[Mapbender-commits] r3700 - in branches/print_dev: . http/classes http/classes/phpmailer-1.72 http/classes/phpmailer-1.72/docs http/classes/phpmailer-1.72/language http/classes/phpmailer-1.72/phpdoc http/classes/phpmailer-1.72/test http/css http/extensions http/extensions/fpdf http/extensions/fpdf/decoders http/extensions/fpdf/font http/extensions/fpdf/font/makefont http/html http/img/button_blue http/include http/javascripts http/php http/print http/print/classes http/sld http/sld/classes lib license owsproxy/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Mar 13 08:02:21 EDT 2009


Author: mschulz
Date: 2009-03-13 08:02:19 -0400 (Fri, 13 Mar 2009)
New Revision: 3700

Modified:
   branches/print_dev/Changes.txt
   branches/print_dev/Readme.txt
   branches/print_dev/http/classes/class.ezpdf.php
   branches/print_dev/http/classes/class_bbox.php
   branches/print_dev/http/classes/class_checkInput.php
   branches/print_dev/http/classes/class_element.php
   branches/print_dev/http/classes/class_kml.php
   branches/print_dev/http/classes/class_kml_ows.php
   branches/print_dev/http/classes/class_kml_parser_ows.php
   branches/print_dev/http/classes/class_layer_monitor.php
   branches/print_dev/http/classes/class_locale.php
   branches/print_dev/http/classes/class_point.php
   branches/print_dev/http/classes/class_wfs.php
   branches/print_dev/http/classes/class_wfsToDb.php
   branches/print_dev/http/classes/class_wfs_1_0.php
   branches/print_dev/http/classes/class_wfs_1_1.php
   branches/print_dev/http/classes/class_wfs_conf.php
   branches/print_dev/http/classes/class_wfs_configuration.php
   branches/print_dev/http/classes/class_wfs_deprecated.php
   branches/print_dev/http/classes/class_wfs_featuretype.php
   branches/print_dev/http/classes/phpmailer-1.72/ChangeLog.txt
   branches/print_dev/http/classes/phpmailer-1.72/class.phpmailer.php
   branches/print_dev/http/classes/phpmailer-1.72/class.smtp.php
   branches/print_dev/http/classes/phpmailer-1.72/docs/extending.html
   branches/print_dev/http/classes/phpmailer-1.72/docs/faq.html
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-br.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-cz.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-de.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-en.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-es.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-fr.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-it.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-nl.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-no.php
   branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-se.php
   branches/print_dev/http/classes/phpmailer-1.72/mail.php
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/allclasses-frame.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/deprecated-list.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/help-doc.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index-all.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/overview-tree.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/packages.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/phpmailer.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/serialized-form.html
   branches/print_dev/http/classes/phpmailer-1.72/phpdoc/stylesheet.css
   branches/print_dev/http/classes/phpmailer-1.72/test/phpmailer_test.php
   branches/print_dev/http/classes/phpmailer-1.72/test/phpunit.php
   branches/print_dev/http/css/admin.css
   branches/print_dev/http/css/admin.screen.css
   branches/print_dev/http/css/admin_service.css
   branches/print_dev/http/css/admin_user.css
   branches/print_dev/http/css/edit_gui.css
   branches/print_dev/http/css/gazetteerSQL_ALB.css
   branches/print_dev/http/css/gazetteerSQL_ALK.css
   branches/print_dev/http/css/gazetteerSQL_Address.css
   branches/print_dev/http/css/mapbender.css
   branches/print_dev/http/css/meetingPoint.css
   branches/print_dev/http/css/metadata.css
   branches/print_dev/http/css/print_div.css
   branches/print_dev/http/css/sldEditor.css
   branches/print_dev/http/css/styler-mod_treefolder.css
   branches/print_dev/http/extensions/DifferenceEngine.php
   branches/print_dev/http/extensions/JSON.php
   branches/print_dev/http/extensions/ext_featureInfoTunnel.php
   branches/print_dev/http/extensions/ext_weldMaps.php
   branches/print_dev/http/extensions/fpdf/decoders/ASCII85Decode.php
   branches/print_dev/http/extensions/fpdf/decoders/LZWDecode.php
   branches/print_dev/http/extensions/fpdf/font/courier.php
   branches/print_dev/http/extensions/fpdf/font/helvetica.php
   branches/print_dev/http/extensions/fpdf/font/helveticab.php
   branches/print_dev/http/extensions/fpdf/font/helveticabi.php
   branches/print_dev/http/extensions/fpdf/font/helveticai.php
   branches/print_dev/http/extensions/fpdf/font/makefont/makefont.php
   branches/print_dev/http/extensions/fpdf/font/symbol.php
   branches/print_dev/http/extensions/fpdf/font/times.php
   branches/print_dev/http/extensions/fpdf/font/timesb.php
   branches/print_dev/http/extensions/fpdf/font/timesbi.php
   branches/print_dev/http/extensions/fpdf/font/timesi.php
   branches/print_dev/http/extensions/fpdf/font/zapfdingbats.php
   branches/print_dev/http/extensions/fpdf/fpdf.php
   branches/print_dev/http/extensions/fpdf/fpdf_tpl.php
   branches/print_dev/http/extensions/fpdf/fpdi.php
   branches/print_dev/http/extensions/fpdf/fpdi_pdf_parser.php
   branches/print_dev/http/extensions/fpdf/license.txt
   branches/print_dev/http/extensions/fpdf/mb_fpdi.php
   branches/print_dev/http/extensions/fpdf/pdf_context.php
   branches/print_dev/http/extensions/fpdf/pdf_parser.php
   branches/print_dev/http/extensions/fpdf/wrapper_functions.php
   branches/print_dev/http/extensions/jquery.form.js
   branches/print_dev/http/html/mod_treefolder.php
   branches/print_dev/http/html/mod_treefolder2.php
   branches/print_dev/http/html/mod_treefolderPlain.php
   branches/print_dev/http/img/button_blue/README.TXT
   branches/print_dev/http/include/gui1_splash.php
   branches/print_dev/http/include/template_splash.php
   branches/print_dev/http/javascripts/geometry.js
   branches/print_dev/http/javascripts/jsTree.js
   branches/print_dev/http/javascripts/mod_addWMS.php
   branches/print_dev/http/javascripts/mod_addWMSfromfilteredList.php
   branches/print_dev/http/javascripts/mod_add_SLD.php
   branches/print_dev/http/javascripts/mod_add_vendorspecific.php
   branches/print_dev/http/javascripts/mod_adminNavigation.js
   branches/print_dev/http/javascripts/mod_exportMapImage.php
   branches/print_dev/http/javascripts/mod_gazetteerSQL_client.php
   branches/print_dev/http/javascripts/mod_highlightPOI.php
   branches/print_dev/http/javascripts/mod_home.php
   branches/print_dev/http/javascripts/mod_initWmc.php
   branches/print_dev/http/javascripts/mod_insertKmlIntoDb.php
   branches/print_dev/http/javascripts/mod_insertLayerPreviewIntoDb.php
   branches/print_dev/http/javascripts/mod_perimeter.php
   branches/print_dev/http/javascripts/mod_poi.php
   branches/print_dev/http/javascripts/mod_reload.php
   branches/print_dev/http/javascripts/mod_renderGML.php
   branches/print_dev/http/javascripts/mod_resize_mapsize.php
   branches/print_dev/http/javascripts/mod_saveLayerPreview.php
   branches/print_dev/http/javascripts/mod_saveWmcKml.php
   branches/print_dev/http/javascripts/mod_savewmc.php
   branches/print_dev/http/javascripts/mod_setPOI2Scale.php
   branches/print_dev/http/javascripts/mod_setTimeout.php
   branches/print_dev/http/javascripts/mod_switchLocale_noreload.php
   branches/print_dev/http/javascripts/mod_tab.js
   branches/print_dev/http/javascripts/mod_wfs_client.html
   branches/print_dev/http/javascripts/requestGeometryConstructor.js
   branches/print_dev/http/javascripts/wfs.php
   branches/print_dev/http/javascripts/wfs_obj.js
   branches/print_dev/http/php/createImageFromText.php
   branches/print_dev/http/php/mod_SelectKeyword.php
   branches/print_dev/http/php/mod_WMSpreferences.php
   branches/print_dev/http/php/mod_addWmsFromFeatureInfo.php
   branches/print_dev/http/php/mod_createJSObjFromXML.php
   branches/print_dev/http/php/mod_deleteWFS.php
   branches/print_dev/http/php/mod_digitize_messages.php
   branches/print_dev/http/php/mod_editApplication_server.php
   branches/print_dev/http/php/mod_editGuiWms.php
   branches/print_dev/http/php/mod_editWMS_Metadata.php
   branches/print_dev/http/php/mod_exportMapImage_server.php
   branches/print_dev/http/php/mod_featuretypeMetadata.php
   branches/print_dev/http/php/mod_gazetteerMetadata.php
   branches/print_dev/http/php/mod_gazetteerMetadata_search.php
   branches/print_dev/http/php/mod_gazetteerSQL_server.php
   branches/print_dev/http/php/mod_layerMetadata.php
   branches/print_dev/http/php/mod_loadCapabilitiesList.php
   branches/print_dev/http/php/mod_loadwmc_server.php
   branches/print_dev/http/php/mod_log.php
   branches/print_dev/http/php/mod_meetingPoint.php
   branches/print_dev/http/php/mod_owsproxy_conf.php
   branches/print_dev/http/php/mod_wfs.php
   branches/print_dev/http/php/mod_wfsSpatialRequest_messages.php
   branches/print_dev/http/php/mod_wfs_gazetteer_server.php
   branches/print_dev/http/php/mod_wfs_result.php
   branches/print_dev/http/php/mod_wfs_server.php
   branches/print_dev/http/print/classes/factoryClasses.php
   branches/print_dev/http/print/classes/mbImageDecorator.php
   branches/print_dev/http/print/classes/mbMapDecorator.php
   branches/print_dev/http/print/classes/mbMeasureDecorator.php
   branches/print_dev/http/print/classes/mbOverviewDecorator.php
   branches/print_dev/http/print/classes/mbParagraphDecorator.php
   branches/print_dev/http/print/classes/mbPdf.php
   branches/print_dev/http/print/classes/mbTemplatePdf.php
   branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php
   branches/print_dev/http/print/classes/mbTextDecorator.php
   branches/print_dev/http/print/mod_printPDF_div.php
   branches/print_dev/http/print/printFactory.php
   branches/print_dev/http/print/printPDF_download.php
   branches/print_dev/http/print/print_functions.php
   branches/print_dev/http/sld/classes/AddOperationModule.php
   branches/print_dev/http/sld/classes/AnchorPoint.php
   branches/print_dev/http/sld/classes/BinaryComparisonOp.php
   branches/print_dev/http/sld/classes/BinaryLogicOp.php
   branches/print_dev/http/sld/classes/ColorMap.php
   branches/print_dev/http/sld/classes/ColorMapEntry.php
   branches/print_dev/http/sld/classes/CssParameter.php
   branches/print_dev/http/sld/classes/DbUtils.php
   branches/print_dev/http/sld/classes/Displacement.php
   branches/print_dev/http/sld/classes/DisplayOperationModule.php
   branches/print_dev/http/sld/classes/ElseFilter.php
   branches/print_dev/http/sld/classes/ExternalGraphic.php
   branches/print_dev/http/sld/classes/FeatureTypeStyle.php
   branches/print_dev/http/sld/classes/Fill.php
   branches/print_dev/http/sld/classes/Filter.php
   branches/print_dev/http/sld/classes/Font.php
   branches/print_dev/http/sld/classes/Graphic.php
   branches/print_dev/http/sld/classes/GraphicFill.php
   branches/print_dev/http/sld/classes/GraphicStroke.php
   branches/print_dev/http/sld/classes/Halo.php
   branches/print_dev/http/sld/classes/LabelPlacement.php
   branches/print_dev/http/sld/classes/LegendGraphic.php
   branches/print_dev/http/sld/classes/LineSymbolizer.php
   branches/print_dev/http/sld/classes/Mark.php
   branches/print_dev/http/sld/classes/NamedLayer.php
   branches/print_dev/http/sld/classes/ParameterValue.php
   branches/print_dev/http/sld/classes/PointPlacement.php
   branches/print_dev/http/sld/classes/PointSymbolizer.php
   branches/print_dev/http/sld/classes/PolygonSymbolizer.php
   branches/print_dev/http/sld/classes/PropertyIsBetween.php
   branches/print_dev/http/sld/classes/PropertyIsLike.php
   branches/print_dev/http/sld/classes/PropertyIsNull.php
   branches/print_dev/http/sld/classes/RasterSymbolizer.php
   branches/print_dev/http/sld/classes/Rule.php
   branches/print_dev/http/sld/classes/Stroke.php
   branches/print_dev/http/sld/classes/StyledLayerDescriptor.php
   branches/print_dev/http/sld/classes/TextSymbolizer.php
   branches/print_dev/http/sld/classes/UnaryLogicOp.php
   branches/print_dev/http/sld/classes/UserStyle.php
   branches/print_dev/http/sld/sld_config.php
   branches/print_dev/http/sld/sld_edit_filter.php
   branches/print_dev/http/sld/sld_filter_parse.php
   branches/print_dev/http/sld/sld_function_getusersld.php
   branches/print_dev/http/sld/sld_function_handler.php
   branches/print_dev/http/sld/sld_main.php
   branches/print_dev/http/sld/sld_parse.php
   branches/print_dev/http/sld/sld_pick_color.php
   branches/print_dev/lib/point.js
   branches/print_dev/lib/style.js
   branches/print_dev/license/license_js.txt
   branches/print_dev/owsproxy/http/index.php
Log:
converted windows to unix line breaks

Modified: branches/print_dev/Changes.txt
===================================================================
--- branches/print_dev/Changes.txt	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/Changes.txt	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,419 +1,419 @@
-The following Link gives a review on the changes in Mapbender you can get in the WIKI
-
-http://www.mapbender.org/index.php/Version_History
-
-------------------------
-
-Changelog 2.4.2
-
-  english
-
-    bug fixes: see http://trac.osgeo.org/mapbender/report/9
-
-    new features
-
-    * set WMS opacity in treeGDE2
-    * Bulgarian translation of the introduction to Mapbender
-    * improved module Add WMS from filtered list: loading a configured WMS from a GUI is now possible
-    * updated Meetingpoint / Treffpunkt: new image, some bugfixes
-    * improved exception handling / log levels (see mapbender.conf#Mapbender_error_logging)
-    * poi (not included in a GUI yet)
-    * JavaScript compression; Mapbender will load faster
-    * dynamic overview - integration in the rc1 an testing gui2
-    * treeGDE2 replaces treeGDE
-    * different configurations of treeGDE2
-    * first draft of an API documentation for JavaScript classes
-    * print temporary objects (lines and polygons) which where drawn with the measure element 
-
-  deutsch
-
-    behobene Fehler: siehe http://trac.osgeo.org/mapbender/report/9
-
-    neue Features
-
-    * Einstellen der Deckkraft (Opacity) einzelner WMSe in der TreeGDE2
-    * Bulgarische Übersetzung der Mapbender-Einführung
-    * Verbesserung des Moduls Add WMS from filtered list: es ist nun möglich, konfigurierte WMSe aus GUIs zu laden
-    * Update des Moduls Meetingpoint / Treffpunkt: neue Bilddatei, diverse Fehler behoben
-    * Verbessertes Logging, auch von JavaScript Fehlern (siehe mapbender.conf#Mapbender_error_logging)
-    * poi (noch in keiner GUI enthalten)
-    * JavaScript Kompression; Mapbender lädt schneller
-    * Dynamisches Overview
-    * TreeGDE2 ersetzt die alte Baumstruktur
-    * verschiedene Konfigurationen der TreeGDE2 in den Standard-GUIs
-    * vorläufige API Dokumentation für JavaScript Klassen
-    * Druck von temporären Objekten (Linien und Polygone), die mit dem "measure" Element erstellt wurden 
-
-
-Changelog 2.4.1
-
-english
-
-
-
-new features
-
-bug fixes
-
-    * 1658777 Export GUI SQL unsorted
-    * 1634035 Wfs geometry name not sorted by position
-    * 1647206 sort order of modules in gui element list
-    * 1635839 JS error: document.form1.newGuiName has no properties
-    * 1589764 wms loading problems when abstract contain linebreak
-    * 1653348 mod_filteredGroup_filteredGui.php
-    * 1653160 Metadata: Undefined variable: wms_id
-    * 3 Online resource incorrect in monitoring module 
-    * 11 wrong sort order in edit_gui_wms
-
-
-database changes
-
-see latest database changes.
-
-deutsch
-
-Changelog Mapbender 2.4.1 rc1
-
-english
-
-    * changes in database architecture: For update have a look in the wiki at dbchanges or Database_Changes_2.4.1. The update sqls you find in the download package in the folder mapbender/resources/db/update/
-    * WFS_gazetteer possibility to handle several wfs_confs and choose from a select-box - thanx to User:Verena Diewald
-    * new treeGDE - thanx to User:Melchior Moos
-    * new element setPOI2Scale mod_setPoi2Scale to open a GUI at a special coordinate and scale - have a look Mod_setPoi2Scale
-    * extended ResizeMapsize functionality - Modul can act automatically or by button click. 3 element vars are added.
-    * new administration functionality OrphanWMS to find information about orphaned WMS and to fix them.
-    * new functionality meetingPoint to generate meeting points and export them as text or via email. The url can be displayed by highlightPOI
-    * pdf-Print now with Din-A2 support
-    * new element highlightPOI (mod_highlightPOI.php) to open a gui and set poi points with text
-    * metadata handling
-    * new admin guis
-    * wfs bug fix for digitize modul
-    * featureinfo tunnel closes empty result windows automatically 
-
-
-deutsch
-
-    * Änderungen in der Datenbankarchitektur: Angaben im Wiki unter dbchanges oder Database_Changes_2.4.1. Die update-sqls befinden sich im Download-Paket im Verzeicnis mapbender/resources/db/update/
-    * WFS_gazetteer Auswahlmöglichkeit zwischen mehreren WFS-Konfigurationenüber eine Auswahlliste - thanx to User:Verena Diewald
-    * treeGDE - neue Baumstruktur - thanx to User:Melchior Moos
-    * Neues Modul add_vendorspecific.
-    * Neues Element setPOI2Scale um eine GUI an einen Punkt in einem bestimmten Maßstab zu öffnen Mod_setPoi2Scale.
-    * Erweiterung des Moduls resizeMapsize. Kartenfenster kann sich automatisch an die Browsergröße anpasssen oder über einen Button. 3 Element vars wurden hinzugefügt.
-    * Neues Administrationselement OrphanWMS, dass informationen über verwaiste WMS liefert und diese löschen kann.
-    * Neues Element meetingPoint um Treffpunkte zu generieren und diese als Text oder via E-Mail zu exportieren. Die URL kann durch highlightPOI angezeigt werden.
-    * pdf-Print nun auch mit Din-A2 Unterstützung (Dank an Frank Härtel und Horst Becker).
-    * Neues Element highlightPOI (mod_highlightPOI.php) ermöglicht es beim Öffnen einer GUI ein oder mehrere Punkte mit Beschriftung zu setzen.
-    * Metadaten handling.
-    * Featureinfotunnel schließt leere Fenster ohne Ergebnis gleich wieder. 
-
-
-Changelog Mapbender 2.4
-
-english
-
-    * bugs in loadWMC are fixed
-    * new module resizeMapsize to resize the Mapsize depending on the size of the browser window
-    * new module monitorCapabilities: periodically checks all WMS and gathers data in the new table mb_monitor (see Database_Changes_2.4)
-    * new module initWMC: starts the client with a wmc.
-    * wms_extent - WMS representing the EXTENTs of the WMS loaded in Mapbender 
-
-
-deutsch
-
-    * Bugs im Modul loadWMC wurden behoben.
-    * Neues Modul resizeMapsize das Modul paßt die Kartengröße in Abhängigkeit von der Größe des Browserfensters dynamisch an.
-    * Neues Modul monitorCapabilities: periodisch werden alle WMSe kontrolliert und alle Daten in der neuen Tabelle mn_monitor erfaßt (siehe auch Database_Changes_2.4).
-    * Neues Modul initWMC: startet den Client mit einem WMS.
-    * wms_extent - WMS, der die Ausdehnungen (Extent) der in Mapbender geladenen WMSe anzeigt. 
-
-
-Changelog 2.4 rc2
-
-english
-
-    * mapbender changed to Subversion (svn), big effort is done in code cleaning
-    * owsproxy is implemented
-    * treeGDE improved, now there is the possibility to handle the layers of a wms with one click (all layer on / all layer off). new element var switchwms
-    * bugs in legend solved
-    * changes in database architecture: new table wfs_featuretype_namespace, new column wms_owsproxy in table wms, new column wms_upload_url in table wms. For update have a look at dbchanges or Database Changes 2.4
-    * perpared statements for PHP > 5.1.x, PostgreSQL > 7.4
-    * new gui_digitize in the installation package. Read more about Digitizing
-    * new gui2 in the installation package with new buttons (button_blue), new tree-style (tree_blue) and more color.
-    * default md5-encryption for the passwords in MySQL and PostgreSQL. Mapbender is doing the md5-encryption.
-    * extended mapbender_setup.php with more information (Thanks to Marko Samson)
-    * new element deleteWFS in GUI admin1
-    * printPDF: highquality print and matching for the overview image
-    * new help: every element in the gui refers to a page in the Mapbender wiki. The link is saved in the table gui_element column e_url and can be changed individual. 
-
-
-deutsch
-
-    * Mapbender wechselt zum Subversion (svn) mit dem damit verbundenen Code cleaning
-    * owsproxy
-    * treeGDE wurde verbessert, es gibt nun die Möglichkeit alle Layer eines WMS durch einen Klick an- bzw. auszustellen.
-    * Bugs in der Legende behoben
-    * Veränderungen in der Datenbankarchitektur: neue Tabelle wfs_featuretype_namespace, neue Spalte wms_owsproxy in Tabelle wms, neue Spalte wms_upload_url in Tabelle wms. Um eine bestehende Datenbank zu aktualisieren, gibt es unter dbchanges weitere Informationen. Database Changes 2.4
-    * Es besteht die Möglichkeit Perpared Statements ab PHP > 5.1.x, PostgreSQL > 7.4 einzusetzen
-    * Neue gui_digitize im Installationsumfang. Mehr unter Digitizing
-    * Neue gui2 im Installationsumfang mit neuen Buttons (button_blue), neuem Style für die Baumstruktur (tree_blue) und mehr Farbe
-    * Standardmäßige md5-Verschlüsselung des Passworts in MySQL und PostgreSQL. Mapbender verschlüsselt nun das Passwort, nicht die Datenbank.
-    * mapbender_setup.php liefert nun mehr Informationen und weist auf Fehler hin (Danke an Marko Samson)
-    * Neues Element deleteWFS in der GUI admin1
-    * printPDF: für den Overview ist nun auch der hochqualitative Druck und das Matching möglich
-    * Hilfebutton: jedes Element der GUI ist direkt mit der Hilfeseite im Mapbender Wiki verlinkt (Eintrag in der Tabelle gui_element Spalte e_url). Dieser Link kann an die jeweilige Umgebung angepaßt werden. 
-
-
-Changelog 2.2.3
-
-english
-
-    * print: now with overview window with position rectangle and scalebar 
-
-    * gui_de and gui1_de are no longer part of the standard installation of mapbender, as it is too much work to handle 4 guis. If you want a german gui, you have to change the tool tip texts. In the next versions we want to handle the language differences with element vars. 
-
-    * WMC handling: includes DisplayWMC, loadWMC, saveWMC and listWMC. 
-
-    * element logout: now with element_var logout_location to define the webside to show after logout 
-
-    * the overview window of the pdf-print is now displayed in highquality, if you use highquality = true in your print-configuration 
-
-    * there has been some rework done at the AddWMS functions. Now the mod_addWMSgeneralFunctions.js offers the functions mod_addWMS_load and mod_addWMS_refresh to the elements addWMSfromfilteredList and addWMSfromList IMPORTANT: JS has to be added as modul in the element-definition 
-
-    * element tabs (mod_tab.php) now with element_var open_tab to decide which tab should be opened at the beginning 
-
-    * print : there where errors in the generation of the legend especially with grouped layers 
-
-    * legend : new element_var checkbox_on_off to decide wether you want to show or hide the on/off checkbox - there where errors in the generation of the legend especially with grouped layers 
-
-    * legend: new element var : stickylegend to decide wether the legend should stick at the mapframe1 
-
-    * connection to GEOS function for mysql users: mapbender.conf / mod_changeEPSG.php / mod_evalArea.php - database parameters where added to the mapbender.conf to enable Mapbender user with mysql-Administration to transform and change the projection 
-
-    * encoding of Mapbender: now UTF-8 or ISO-8859-1 can be choosed as the encoding for the database (have a look in the mapbender.conf CHARSET) 
-
-    * fixed: WFS configuration caused errors with postgresql database 
-
-    * copyright now works with element var for the copyright text: define the JavaScript Variable mod_copyright_text with a text you want as value 
-
-    * fixed: there was an error in class_log, now the printed maprequests should be logged 
-
-    * database changes 
-
-
-deutsch
-
-    * print: nun mit Übersichtsfenster mit Positionsrechteck und Maßstabsleiste (beide Funktionalitäten können in der Konfigurationsdatei des Drucks an- oder ausgestellt werden) 
-
-    * Die Oberflächen gui1_de und gui_de werden nicht mehr weitergeführt, da es zu viel Aufwand darstellt 4 Oberflächen weiterzuführen. Wenn eine deutsche Oberfläche gebraucht wird können die ToolTipTexte auf deutsch angelegt werden. Die Mehrsprachigkeit der einzelnen Elemente soll zukünftig über die Element vars gelöst werden. 
-
-    * WMC-Nutzung: beinhaltet anzeigen (DisplayWMC), laden (loadWMC), speichern (saveWMC) eines WMCs und auflisten aller WMCs (listWMC). 
-
-    * Element logout: verfügt nun über den element_var logout_location, um zu definieren welche Webseite nach dem Logout angezeigt werden soll. 
-
-    * Das Übersichtsfenster des PDF-Drucks wird nun auch hochqualitativ angezeigt bei hochqualitativem Druck. 
-
-    * Die AddWMS Funktionalität wurde überarbeitet. Eine neue Datei mod_addWMSgeneralFunctions.js stellt nun die Funktionen mod_addWMS_load und mod_addWMS_refresh zur Verfügung. Wichtig für die Elemente addWMSfromfilteredList and addWMSfromList das JavaScript mod_addWMSgeneralFunctions.js muß in der Elementdefinition unter Modul angegeben werden. 
-
-    * Element tabs (mod_tab.php) wurde um die element_var open_tab erweitert, um beim Start des Clients einen tab voreingestellt zu öffnen. 
-
-    * print: Fehler in der Legende bei gruppierten Ebenen beseitigt. 
-
-    * legend: Neue element_var: checkbox_on_off zur Steuerung der on/off checkbox. 
-
-    * legend: Neue element_var: stickylegend zur Steuerung des Anzeigefesters der Legende (Positionierung / sticky-Frame). 
-
-    * Bereitstellung der GEOS Funktionen für Mapbender mit mysql-Administrationsdatenbank: mapbender.conf / mod_changeEPSG.php / mod_evalArea.php - Zusätzliche Datenbankparameter für eine PostgresDB neben der mysql-Administrationsdatenbank, zur Transformation von Projektionssystemen und Berechnung von Flächen. 
-
-    * Encoding (Zeichensatz) in Mapbender: es besteht nun die Auswahl zwischen UTF-8 oder ISO-8859-1 als Zeichensatz (die Angabe erfolgt in der mapbender.conf CHARSET) 
-
-    * wfs configuration: WFS Konfiguration erzeugte Fehler mit der PostgreSQL-Datenbank. 
-
-    * copyright: Neue element_var mod_copyright_text, Angabe zum Copyright-Text über die Administrationsoberfläche. 
-
-    * fixed: Fehler in class_log behoben. 
-
-    * Datenbankänderungen 
-
-
-Changelog 2.2.2
-
-english
-
-    * Unfortunately there was a bug left in the PostgreSQL database-module. In the edit gui-menu no templates from other guis were shown so that it was impossible to modify guis. 
-
-To fix this, minor changes in the PostgreSQL database-structure were necessary. If you are updating, please do not use an already existing V. 2.2.1-database and create the database with the SQL-dumps attached to this version instead.
-
-
-
-deutsch
-
-    * Leider war noch ein Fehler im PostgreSQL Datenbank-Modul übersehen worden. Da im Menü Oberflächenelemente editieren die bestehenden GUIs und deren Elemente nicht angezeigt wurden, um sie als Templates zu verwenden, ließen sich die GUIs nicht nach den eigenen Bedürfnissen anpassen. 
-
-Um diesen Fehler zu beheben wurden kleinere Änderungen in der PostgreSQL Datenbank-Struktur vorgenommen. Bitte verwenden Sie daher keine bereits existierende V. 2.2.1-Datenbank falls Sie updaten, sondern benutzen Sie bitte die SQL-Dumps, die dieser Version beigefügt sind.
-
-Changelog 2.2.1
-
-english
-
-We have been a bit quick with the release 2.2 and didn't put the focus on documentation and debugging. But with the help of the users of Mapbender we fixed the bugs and now there is the next Mapbender version for download.
-
-    * There where some bugs when you run Mapbender with PostgreSQL. Hope they are fixed. Have a look at the Installation to find out about how to configure Mapbender (configuration files have been consolidated into ./conf/mapbender.conf) 
-
-    * the name of two columns had to be changed:
-          o mb_log.session changes to mb_log.mb_session (session is a reserved name in postgresql)
-          o gui_element.e_closeTag changed to gui_element.e_closetag (all table- and columnnames are handled in lower case) 
-
-    * Sequences in PostgreSQL: if you use postgresql you have to set sequences for the serial columns so that the next value for the serial is fixed. user mapbender/resources/db/pgsql_serial_set_sequences.sql to set the sequences 
-
-    * changeEPSG and calculating areas at the moment is only possible for user with PostgreSQL/PostGIS database 
-
-
-deutsch
-
-Vielleicht waren wir etwas voreilig mit dem Mapbender Release 2.2 und haben den Fokus nicht auf die Dokumentation und das Debuggig gesetzt. Aber mit Hilfe der User sind viele Fehler aufgezeigt worden und konnten gelöst werden. Hier nun der neue Mapbender 2.2.1. Derzeit gibt es noch keine Dokumentation und auch kein Skript für den automatisierten Update einer bestehenden Mapbender Installation. Die vormals eingesetzen Skripte mapbender_setup.php und validate_db.php können derzeit nicht mehr verwendet werden und wurden aus dem Paket entfernt. Die Skripte müssen erst wieder auf den neuen Release angepaßt werden, damit sie wieder zum Einsatz kommen können.
-
-    * es lagen einige Bugs bei der Verwendung von PostgreSQL als Administrationsdatenbank vor. Diese sind hoffentlich alle beseitigt. In der Installationsanleitung unter 
-
-mapbender.conf findet sich alles wichtige zur Installation (Alles ist nun einfacher. Es muß nur noch die Datei mapbender.conf angepaßt werden)
-
-    * der Name zweier Spalten hat sich geändert:
-          o mb_log.session geändert in mb_log.mb_session (session reserviertes Wort in PostgreSQL)
-          o gui_element.e_closeTag geändert in gui_element.e_closetag (alle Tabellen- und Spaltennamen in Kleinbuchstaben) 
-
-    * Sequences in PostgreSQL: bei der Verwendung von PostgreSQL müssen die Sequenzen der Autowerte nach dem Laden der Daten explizit gesetzt werden. Dazu steht die Datei mapbender/resources/db/pgsql_serial_set_sequences.sql zur Verfügung 
-
-    * changeEPSG und Flächenberechnung steht derzeit nur Benutzern mit einer PostgreSQL-Datenbank zur Verfügung 
-
-
-Changelog 2.2.0
-[edit]
-english
-
-Here you find a list with the changes in Mapbender 2.2.0:
-
-    * The configuration files have been consolidated into one single mapbender.conf
-    * Now Mapbender 2.2.0 is able to work with MySQL- or PostgreSQL-database. Configure the settings in the mapbender.conf.
-    * You can edit the single elements of a GUI with the Mapbender-Administration (table element_vars/ css-files/ var).
-    * WFS
-    * Proxy
-    * PrintPDF. This module enables you to configure the PrintPDF containing an overview, legend, northarrow and your logo.
-    * Click on a Layer refers to the WMS METADATAURL - new column layer_metadataurl.
-    * The legend is displayed by the LEGENDURL.
-    * New Wiki: To edit the new wiki you have to ask for an account at mailto:info at mapbender.org.
-    * ToggleModule to define a function to be active when the gui is opened 
-
-Here you already find a list with the changes in Mapbender 2.2:
-
-    * Mapbender for MySQL or PostgreSQL
-    * You can edit the single elements of a GUI with the Mapbender-Administration (table element_vars/ css-files/ var)
-    * click on a Layer refers to the WMS METADATAURLD - new column layer_metadataurl
-    * the legend is displayed by the LEGENDURL 
-
-
-deutsch
-
-Hier die Änderungen, die mit der Version 2.2 erfolgt sind:
-
-    * Nun ist es möglich Mapbender mit einer MySQL- oder PostgreSQL-Datenbank zu installieren. Konfigurieren Sie die Einstellungen in der Datei mapbender.conf.
-    * Sie können die einzelnen Elemente einer GUI mit der Mapbender-Administration editieren (Tabelle element_vars/ css-files/ var).
-    * WFS
-    * Proxy
-    * PrintPDF. Dieses Modul erlaubt es dem Benutzer den PrintPDF zu konfigurieren und beinhaltet Overview, Legende, Nordpfeil und ein Logo.
-    * Neue Buttons (button_oo) sind in der GUI 'gui' verfügbar.
-    * Ein Klick auf einen Layer referenziert die WMS METADATAURL - neue Spalte layer_metadataurl.
-    * Die Legende wird durch die LEGENDURL dargestellt.
-    * Neues Wiki: Um im neuen Wiki editieren zu können, müssen Sie einen Account beantragen bei CCGIS.
-    * ToggleModule - definiert ein Element, das beim Start der GUI aktiviert sein soll 
-
-Hier aber schonmal die Änderungen, die uns mit der Version 2.2 erwarten:
-
-    * Mapbender für MySQL oder PostgreSQL
-    * Anpassung der einzelnen Elemente einer GUI über die Mapbender-Administration (element_vars)
-    * Metadataurl
-    * Legendurl 
-
-
-Changelog 2.1.0
-
-english
-
-    * communication by email mail.conf
-    * new button myGUIlist in the administration-guis to go back to the list of myGUIs
-    * New table mb_log
-    * New column in table wms wms_getCapabilities_doc
-    * ChangeEpsg_dynamic
-    * Edit gui shows the images of a gui as little pictures (better orientation)
-    * sql to update the mapbender standard guis Update Mapbender
-    * mapbender/http/tools/validate_db.php - php to update the database and add new columns and tables if necessary
-    * New column layer_dataurl in table layer
-    * New columns legendurl and legendurlformat in table layer_style
-    * New table wms_srs
-    * Security update in Edit GUI Elements 
-
-
-deutsch
-
-    * Kommunikation über email mail.conf
-    * Neuer Button myGUIlist für die Administrations-GUIs, um in die Liste von meinenGUIs zurück zu kommen.
-    * Neue Tabelle mb_log
-    * Neue Spalte in der Tabelle wms wms_getCapabilities_doc
-    * ChangeEpsg_dynamic
-    * Die Rubrik 'Oberflächenelemente editieren' zeigt nun kleine Bilder der Oberfläche zur besseren Orientierung.
-    * SQL zur Aktualisierung Ihrer GUIs: siehe Update Mapbender
-    * mapbender/http/tools/validate_db.php - PHP, um die Datenbank zu aktualisieren und wenn nötig neue Spalten und Tabellen hinzuzufügen.
-    * Neue Spalte layer_dataurl in der Tabelle layer hinzugefügt.
-    * Neue Spalten 'legendurl' und 'legendurlformat' in der Tabelle layer_style hinzugefügt.
-    * Neue Tabelle wms_srs 
-
-
-Changelog 2.1.0 rc1
-
-english
-
-    * Print with Mapbender Version 2.1.0 pdf-print is used as standard. You have the possibility to choose A4 or A3 and landscape or portrait. The printframe can be styled to your own design by editing a configuration file.
-    * GUIOwner a new parameter <owner> has been added to the user management. This allows a distinction between reading/using a GUI and being allowed to change it ( edit GUI elements). This feature is necessary as a preliminary step to open Mapbender as a portal with anonymous access which is needed to implement Wikimaps functionality. Additionally this enables setting up a hierarchical administration.
-    * Overview The overview map should be addressed with the module Overview, (<Overview0>, <Overview1>, <Overview2>, ... are deprecated). The module can be parameterized with the field "wms". It contains the index of the WMS which should be displayed in the overview map. (starting at 0).
-    * showCoords_div On button click the coordinate of the mouseposition will be displayed below the target (e.g. mapframe1)
-    * Detailed metadatainformation for a GUI. Also information about the last requests as a link.
-    * Additional default GUIs are added to the Mapbender database.
-    * After installing Mapbender a set of worldwide WMS are already contained in several GUIs.
-    * Copy a GUI copyGUI / rename a GUI RenameGUI.
-    * AddWMS Add a new web map service dynamically by entering the URL to an OGC WMS Capabilities document. Current extent, layers and settings are not affected.
-    * Add WMS from list Dynamically add WMS from a list of all OGC WMS contained in the Mapbender database to the current GUI.
-    * Add WMS from filtered list Dynamically add WMS from a list (filtered by group or gui) to a GUI.
-    * setBackground Define several WMS to be displayed in the background.
-    * setBackground_all You can define one or more WMS to be displayed in the background.
-    * DeleteGUI Delete a selected GUI.
-    * DeleteWMS Delete a selected WMS.
-    * Edit GUI Elements - added: GUI description editable.
-    * Edit GUI WMS - added: show WMS ID.
-    * showCoords_div - shows the coordinate below the target (i.e. mapframe1).
-    * setScaleHint - set scale hints for mapframes.
-    * tabs_vertical - handle iframes with vertical tabs.
-    * WMS_preferences - edit service settings of the loaded WMS, change order, remove wms, change settings. 
-
-
-deutsch
-
-    * Print Ab der Mapbender Version 2.1.0 erfolgt der Standardausdruck von Mapbender als PDF. Hierbei stehen A4 und A3 Druck zur Auswahl sowie Hoch- und Querformat. Der Kartenspiegel kann dabei über eine Konfigurationsdatei an das eigene Design angepaßt werden. Hierbei stehen A4 und A3 Druck zur Auswahl sowie Hoch- und Querformat. 
-
-    * GUIOwner Der neue Parameter <owner> (Besitzer) wurde der Benutzerverwaltung hinzugefügt. Dies erlaubt eine Unterscheidung zwischen lesen/benutzen einer GUI und der Berechtigung die GUI zu ändern ( edit GUI elements). Dieses Feature ist notwendig als Vorbereitung Mapbender als Portal mit anonymem Zugang einzusetzen, was wiederum notwendig ist, um Wikimap-Funktionalität zu implementieren. Zusätzlich ermöglicht diese Einstellung den Aufbau einer hierarchischen Verwaltung.
-    * Overview Die Übersichtskarte sollte mit dem Modul Overview adressiert werden (<Overview0>, <Overview1>, <Overview2>, ... wurden eingestellt). Das Modul kann mit dem Feld "wms" parametriert werden. Es beinhaltet den Index des WMS, der nicht in der Übersichtskarte angezeigt werden sollte (beginnend bei 0).
-    * showCoords_div Bei Aktivierung dieses Buttons werden die Koordinaten der Mausposition unter dem Ziel (target = z.B. mapframe1) angezeigt.
-    * Detaillierte Metadatainformationen für eine GUI. Ebenso Information über die letzte Anfrage als Link.
-    * Zusätzliche Standard-GUIs wurden der Mapbender Datenbank hinzugefügt.
-    * Nach der Installation von Mapbender ist bereits ein Set von weltweiten WMSen in verschiedenen GUIs enthalten.
-    * Kopieren einer GUI copyGUI / Umbenennen einer GUI RenameGUI.
-    * AddWMS Dynamisches Hinzufügen eines neuen Web Map Services durch die Eingabe der URL in ein OGC WMS Capabilities Dokument. Der aktuelle Ausschnitt, Layer und Einstellungen sind davon nicht betroffen.
-    * Add WMS from list Dynamisches Hinzufügen eines WMS von einer Liste von allen OGC WMS, die in der Mapbender Datenbank enthalten sind für die aktuelle GUI.
-    * Add WMS from filtered list Dynamisches Hinzufügen eines WMS von einer Liste (gefiltert für eine Gruppe oder GUI) für eine GUI .
-    * setBackground Definiert einige WMS, die im Hintergrund angezeigt werden.
-    * setBackground_all Definieren Sie hier einen oder mehrere WMS, die im Hintergrund angezeigt werden.
-    * DeleteGUI Löschen einer ausgewählten GUI.
-    * DeleteWMS Löschen eines ausgewählten WMS.
-    * Oberflächenelemente editieren (Edit GUI Elements) - Hinzugefügt: GUI Beschreibung editierbar.
-    * WMS GUI Einstellungen (Edit GUI WMS/ WMS GUI settings) - Hinzugefügt: Anzeige der WMS ID.
-    * showCoords_div - Anzeige der Koordinaten unter dem Ziel (target, z.B. mapframe1).
-    * setScaleHint - Setzen eines Maßstabes für Kartenframes.
-    * tabs_vertical - Handhaben von Iframes mit vertikal Karteireitern.
-    * WMS_preferences - Bearbeiten der Einstellungen eines Dienstes eines geladenen WMS, Änderung der Reihenfolge, Entfernen eines WMS, Änderung der Einstellungen. 
\ No newline at end of file
+The following Link gives a review on the changes in Mapbender you can get in the WIKI
+
+http://www.mapbender.org/index.php/Version_History
+
+------------------------
+
+Changelog 2.4.2
+
+  english
+
+    bug fixes: see http://trac.osgeo.org/mapbender/report/9
+
+    new features
+
+    * set WMS opacity in treeGDE2
+    * Bulgarian translation of the introduction to Mapbender
+    * improved module Add WMS from filtered list: loading a configured WMS from a GUI is now possible
+    * updated Meetingpoint / Treffpunkt: new image, some bugfixes
+    * improved exception handling / log levels (see mapbender.conf#Mapbender_error_logging)
+    * poi (not included in a GUI yet)
+    * JavaScript compression; Mapbender will load faster
+    * dynamic overview - integration in the rc1 an testing gui2
+    * treeGDE2 replaces treeGDE
+    * different configurations of treeGDE2
+    * first draft of an API documentation for JavaScript classes
+    * print temporary objects (lines and polygons) which where drawn with the measure element 
+
+  deutsch
+
+    behobene Fehler: siehe http://trac.osgeo.org/mapbender/report/9
+
+    neue Features
+
+    * Einstellen der Deckkraft (Opacity) einzelner WMSe in der TreeGDE2
+    * Bulgarische �bersetzung der Mapbender-Einf�hrung
+    * Verbesserung des Moduls Add WMS from filtered list: es ist nun m�glich, konfigurierte WMSe aus GUIs zu laden
+    * Update des Moduls Meetingpoint / Treffpunkt: neue Bilddatei, diverse Fehler behoben
+    * Verbessertes Logging, auch von JavaScript Fehlern (siehe mapbender.conf#Mapbender_error_logging)
+    * poi (noch in keiner GUI enthalten)
+    * JavaScript Kompression; Mapbender l�dt schneller
+    * Dynamisches Overview
+    * TreeGDE2 ersetzt die alte Baumstruktur
+    * verschiedene Konfigurationen der TreeGDE2 in den Standard-GUIs
+    * vorl�ufige API Dokumentation f�r JavaScript Klassen
+    * Druck von tempor�ren Objekten (Linien und Polygone), die mit dem "measure" Element erstellt wurden 
+
+
+Changelog 2.4.1
+
+english
+
+
+
+new features
+
+bug fixes
+
+    * 1658777 Export GUI SQL unsorted
+    * 1634035 Wfs geometry name not sorted by position
+    * 1647206 sort order of modules in gui element list
+    * 1635839 JS error: document.form1.newGuiName has no properties
+    * 1589764 wms loading problems when abstract contain linebreak
+    * 1653348 mod_filteredGroup_filteredGui.php
+    * 1653160 Metadata: Undefined variable: wms_id
+    * 3 Online resource incorrect in monitoring module 
+    * 11 wrong sort order in edit_gui_wms
+
+
+database changes
+
+see latest database changes.
+
+deutsch
+
+Changelog Mapbender 2.4.1 rc1
+
+english
+
+    * changes in database architecture: For update have a look in the wiki at dbchanges or Database_Changes_2.4.1. The update sqls you find in the download package in the folder mapbender/resources/db/update/
+    * WFS_gazetteer possibility to handle several wfs_confs and choose from a select-box - thanx to User:Verena Diewald
+    * new treeGDE - thanx to User:Melchior Moos
+    * new element setPOI2Scale mod_setPoi2Scale to open a GUI at a special coordinate and scale - have a look Mod_setPoi2Scale
+    * extended ResizeMapsize functionality - Modul can act automatically or by button click. 3 element vars are added.
+    * new administration functionality OrphanWMS to find information about orphaned WMS and to fix them.
+    * new functionality meetingPoint to generate meeting points and export them as text or via email. The url can be displayed by highlightPOI
+    * pdf-Print now with Din-A2 support
+    * new element highlightPOI (mod_highlightPOI.php) to open a gui and set poi points with text
+    * metadata handling
+    * new admin guis
+    * wfs bug fix for digitize modul
+    * featureinfo tunnel closes empty result windows automatically 
+
+
+deutsch
+
+    * �nderungen in der Datenbankarchitektur: Angaben im Wiki unter dbchanges oder Database_Changes_2.4.1. Die update-sqls befinden sich im Download-Paket im Verzeicnis mapbender/resources/db/update/
+    * WFS_gazetteer Auswahlm�glichkeit zwischen mehreren WFS-Konfigurationen�ber eine Auswahlliste - thanx to User:Verena Diewald
+    * treeGDE - neue Baumstruktur - thanx to User:Melchior Moos
+    * Neues Modul add_vendorspecific.
+    * Neues Element setPOI2Scale um eine GUI an einen Punkt in einem bestimmten Ma�stab zu �ffnen Mod_setPoi2Scale.
+    * Erweiterung des Moduls resizeMapsize. Kartenfenster kann sich automatisch an die Browsergr��e anpasssen oder �ber einen Button. 3 Element vars wurden hinzugef�gt.
+    * Neues Administrationselement OrphanWMS, dass informationen �ber verwaiste WMS liefert und diese l�schen kann.
+    * Neues Element meetingPoint um Treffpunkte zu generieren und diese als Text oder via E-Mail zu exportieren. Die URL kann durch highlightPOI angezeigt werden.
+    * pdf-Print nun auch mit Din-A2 Unterst�tzung (Dank an Frank H�rtel und Horst Becker).
+    * Neues Element highlightPOI (mod_highlightPOI.php) erm�glicht es beim �ffnen einer GUI ein oder mehrere Punkte mit Beschriftung zu setzen.
+    * Metadaten handling.
+    * Featureinfotunnel schlie�t leere Fenster ohne Ergebnis gleich wieder. 
+
+
+Changelog Mapbender 2.4
+
+english
+
+    * bugs in loadWMC are fixed
+    * new module resizeMapsize to resize the Mapsize depending on the size of the browser window
+    * new module monitorCapabilities: periodically checks all WMS and gathers data in the new table mb_monitor (see Database_Changes_2.4)
+    * new module initWMC: starts the client with a wmc.
+    * wms_extent - WMS representing the EXTENTs of the WMS loaded in Mapbender 
+
+
+deutsch
+
+    * Bugs im Modul loadWMC wurden behoben.
+    * Neues Modul resizeMapsize das Modul pa�t die Kartengr��e in Abh�ngigkeit von der Gr��e des Browserfensters dynamisch an.
+    * Neues Modul monitorCapabilities: periodisch werden alle WMSe kontrolliert und alle Daten in der neuen Tabelle mn_monitor erfa�t (siehe auch Database_Changes_2.4).
+    * Neues Modul initWMC: startet den Client mit einem WMS.
+    * wms_extent - WMS, der die Ausdehnungen (Extent) der in Mapbender geladenen WMSe anzeigt. 
+
+
+Changelog 2.4 rc2
+
+english
+
+    * mapbender changed to Subversion (svn), big effort is done in code cleaning
+    * owsproxy is implemented
+    * treeGDE improved, now there is the possibility to handle the layers of a wms with one click (all layer on / all layer off). new element var switchwms
+    * bugs in legend solved
+    * changes in database architecture: new table wfs_featuretype_namespace, new column wms_owsproxy in table wms, new column wms_upload_url in table wms. For update have a look at dbchanges or Database Changes 2.4
+    * perpared statements for PHP > 5.1.x, PostgreSQL > 7.4
+    * new gui_digitize in the installation package. Read more about Digitizing
+    * new gui2 in the installation package with new buttons (button_blue), new tree-style (tree_blue) and more color.
+    * default md5-encryption for the passwords in MySQL and PostgreSQL. Mapbender is doing the md5-encryption.
+    * extended mapbender_setup.php with more information (Thanks to Marko Samson)
+    * new element deleteWFS in GUI admin1
+    * printPDF: highquality print and matching for the overview image
+    * new help: every element in the gui refers to a page in the Mapbender wiki. The link is saved in the table gui_element column e_url and can be changed individual. 
+
+
+deutsch
+
+    * Mapbender wechselt zum Subversion (svn) mit dem damit verbundenen Code cleaning
+    * owsproxy
+    * treeGDE wurde verbessert, es gibt nun die M�glichkeit alle Layer eines WMS durch einen Klick an- bzw. auszustellen.
+    * Bugs in der Legende behoben
+    * Ver�nderungen in der Datenbankarchitektur: neue Tabelle wfs_featuretype_namespace, neue Spalte wms_owsproxy in Tabelle wms, neue Spalte wms_upload_url in Tabelle wms. Um eine bestehende Datenbank zu aktualisieren, gibt es unter dbchanges weitere Informationen. Database Changes 2.4
+    * Es besteht die M�glichkeit Perpared Statements ab PHP > 5.1.x, PostgreSQL > 7.4 einzusetzen
+    * Neue gui_digitize im Installationsumfang. Mehr unter Digitizing
+    * Neue gui2 im Installationsumfang mit neuen Buttons (button_blue), neuem Style f�r die Baumstruktur (tree_blue) und mehr Farbe
+    * Standardm��ige md5-Verschl�sselung des Passworts in MySQL und PostgreSQL. Mapbender verschl�sselt nun das Passwort, nicht die Datenbank.
+    * mapbender_setup.php liefert nun mehr Informationen und weist auf Fehler hin (Danke an Marko Samson)
+    * Neues Element deleteWFS in der GUI admin1
+    * printPDF: f�r den Overview ist nun auch der hochqualitative Druck und das Matching m�glich
+    * Hilfebutton: jedes Element der GUI ist direkt mit der Hilfeseite im Mapbender Wiki verlinkt (Eintrag in der Tabelle gui_element Spalte e_url). Dieser Link kann an die jeweilige Umgebung angepa�t werden. 
+
+
+Changelog 2.2.3
+
+english
+
+    * print: now with overview window with position rectangle and scalebar 
+
+    * gui_de and gui1_de are no longer part of the standard installation of mapbender, as it is too much work to handle 4 guis. If you want a german gui, you have to change the tool tip texts. In the next versions we want to handle the language differences with element vars. 
+
+    * WMC handling: includes DisplayWMC, loadWMC, saveWMC and listWMC. 
+
+    * element logout: now with element_var logout_location to define the webside to show after logout 
+
+    * the overview window of the pdf-print is now displayed in highquality, if you use highquality = true in your print-configuration 
+
+    * there has been some rework done at the AddWMS functions. Now the mod_addWMSgeneralFunctions.js offers the functions mod_addWMS_load and mod_addWMS_refresh to the elements addWMSfromfilteredList and addWMSfromList IMPORTANT: JS has to be added as modul in the element-definition 
+
+    * element tabs (mod_tab.php) now with element_var open_tab to decide which tab should be opened at the beginning 
+
+    * print : there where errors in the generation of the legend especially with grouped layers 
+
+    * legend : new element_var checkbox_on_off to decide wether you want to show or hide the on/off checkbox - there where errors in the generation of the legend especially with grouped layers 
+
+    * legend: new element var : stickylegend to decide wether the legend should stick at the mapframe1 
+
+    * connection to GEOS function for mysql users: mapbender.conf / mod_changeEPSG.php / mod_evalArea.php - database parameters where added to the mapbender.conf to enable Mapbender user with mysql-Administration to transform and change the projection 
+
+    * encoding of Mapbender: now UTF-8 or ISO-8859-1 can be choosed as the encoding for the database (have a look in the mapbender.conf CHARSET) 
+
+    * fixed: WFS configuration caused errors with postgresql database 
+
+    * copyright now works with element var for the copyright text: define the JavaScript Variable mod_copyright_text with a text you want as value 
+
+    * fixed: there was an error in class_log, now the printed maprequests should be logged 
+
+    * database changes 
+
+
+deutsch
+
+    * print: nun mit �bersichtsfenster mit Positionsrechteck und Ma�stabsleiste (beide Funktionalit�ten k�nnen in der Konfigurationsdatei des Drucks an- oder ausgestellt werden) 
+
+    * Die Oberfl�chen gui1_de und gui_de werden nicht mehr weitergef�hrt, da es zu viel Aufwand darstellt 4 Oberfl�chen weiterzuf�hren. Wenn eine deutsche Oberfl�che gebraucht wird k�nnen die ToolTipTexte auf deutsch angelegt werden. Die Mehrsprachigkeit der einzelnen Elemente soll zuk�nftig �ber die Element vars gel�st werden. 
+
+    * WMC-Nutzung: beinhaltet anzeigen (DisplayWMC), laden (loadWMC), speichern (saveWMC) eines WMCs und auflisten aller WMCs (listWMC). 
+
+    * Element logout: verf�gt nun �ber den element_var logout_location, um zu definieren welche Webseite nach dem Logout angezeigt werden soll. 
+
+    * Das �bersichtsfenster des PDF-Drucks wird nun auch hochqualitativ angezeigt bei hochqualitativem Druck. 
+
+    * Die AddWMS Funktionalit�t wurde �berarbeitet. Eine neue Datei mod_addWMSgeneralFunctions.js stellt nun die Funktionen mod_addWMS_load und mod_addWMS_refresh zur Verf�gung. Wichtig f�r die Elemente addWMSfromfilteredList and addWMSfromList das JavaScript mod_addWMSgeneralFunctions.js mu� in der Elementdefinition unter Modul angegeben werden. 
+
+    * Element tabs (mod_tab.php) wurde um die element_var open_tab erweitert, um beim Start des Clients einen tab voreingestellt zu �ffnen. 
+
+    * print: Fehler in der Legende bei gruppierten Ebenen beseitigt. 
+
+    * legend: Neue element_var: checkbox_on_off zur Steuerung der on/off checkbox. 
+
+    * legend: Neue element_var: stickylegend zur Steuerung des Anzeigefesters der Legende (Positionierung / sticky-Frame). 
+
+    * Bereitstellung der GEOS Funktionen f�r Mapbender mit mysql-Administrationsdatenbank: mapbender.conf / mod_changeEPSG.php / mod_evalArea.php - Zus�tzliche Datenbankparameter f�r eine PostgresDB neben der mysql-Administrationsdatenbank, zur Transformation von Projektionssystemen und Berechnung von Fl�chen. 
+
+    * Encoding (Zeichensatz) in Mapbender: es besteht nun die Auswahl zwischen UTF-8 oder ISO-8859-1 als Zeichensatz (die Angabe erfolgt in der mapbender.conf CHARSET) 
+
+    * wfs configuration: WFS Konfiguration erzeugte Fehler mit der PostgreSQL-Datenbank. 
+
+    * copyright: Neue element_var mod_copyright_text, Angabe zum Copyright-Text �ber die Administrationsoberfl�che. 
+
+    * fixed: Fehler in class_log behoben. 
+
+    * Datenbank�nderungen 
+
+
+Changelog 2.2.2
+
+english
+
+    * Unfortunately there was a bug left in the PostgreSQL database-module. In the edit gui-menu no templates from other guis were shown so that it was impossible to modify guis. 
+
+To fix this, minor changes in the PostgreSQL database-structure were necessary. If you are updating, please do not use an already existing V. 2.2.1-database and create the database with the SQL-dumps attached to this version instead.
+
+
+
+deutsch
+
+    * Leider war noch ein Fehler im PostgreSQL Datenbank-Modul �bersehen worden. Da im Men� Oberfl�chenelemente editieren die bestehenden GUIs und deren Elemente nicht angezeigt wurden, um sie als Templates zu verwenden, lie�en sich die GUIs nicht nach den eigenen Bed�rfnissen anpassen. 
+
+Um diesen Fehler zu beheben wurden kleinere �nderungen in der PostgreSQL Datenbank-Struktur vorgenommen. Bitte verwenden Sie daher keine bereits existierende V. 2.2.1-Datenbank falls Sie updaten, sondern benutzen Sie bitte die SQL-Dumps, die dieser Version beigef�gt sind.
+
+Changelog 2.2.1
+
+english
+
+We have been a bit quick with the release 2.2 and didn't put the focus on documentation and debugging. But with the help of the users of Mapbender we fixed the bugs and now there is the next Mapbender version for download.
+
+    * There where some bugs when you run Mapbender with PostgreSQL. Hope they are fixed. Have a look at the Installation to find out about how to configure Mapbender (configuration files have been consolidated into ./conf/mapbender.conf) 
+
+    * the name of two columns had to be changed:
+          o mb_log.session changes to mb_log.mb_session (session is a reserved name in postgresql)
+          o gui_element.e_closeTag changed to gui_element.e_closetag (all table- and columnnames are handled in lower case) 
+
+    * Sequences in PostgreSQL: if you use postgresql you have to set sequences for the serial columns so that the next value for the serial is fixed. user mapbender/resources/db/pgsql_serial_set_sequences.sql to set the sequences 
+
+    * changeEPSG and calculating areas at the moment is only possible for user with PostgreSQL/PostGIS database 
+
+
+deutsch
+
+Vielleicht waren wir etwas voreilig mit dem Mapbender Release 2.2 und haben den Fokus nicht auf die Dokumentation und das Debuggig gesetzt. Aber mit Hilfe der User sind viele Fehler aufgezeigt worden und konnten gel�st werden. Hier nun der neue Mapbender 2.2.1. Derzeit gibt es noch keine Dokumentation und auch kein Skript f�r den automatisierten Update einer bestehenden Mapbender Installation. Die vormals eingesetzen Skripte mapbender_setup.php und validate_db.php k�nnen derzeit nicht mehr verwendet werden und wurden aus dem Paket entfernt. Die Skripte m�ssen erst wieder auf den neuen Release angepa�t werden, damit sie wieder zum Einsatz kommen k�nnen.
+
+    * es lagen einige Bugs bei der Verwendung von PostgreSQL als Administrationsdatenbank vor. Diese sind hoffentlich alle beseitigt. In der Installationsanleitung unter 
+
+mapbender.conf findet sich alles wichtige zur Installation (Alles ist nun einfacher. Es mu� nur noch die Datei mapbender.conf angepa�t werden)
+
+    * der Name zweier Spalten hat sich ge�ndert:
+          o mb_log.session ge�ndert in mb_log.mb_session (session reserviertes Wort in PostgreSQL)
+          o gui_element.e_closeTag ge�ndert in gui_element.e_closetag (alle Tabellen- und Spaltennamen in Kleinbuchstaben) 
+
+    * Sequences in PostgreSQL: bei der Verwendung von PostgreSQL m�ssen die Sequenzen der Autowerte nach dem Laden der Daten explizit gesetzt werden. Dazu steht die Datei mapbender/resources/db/pgsql_serial_set_sequences.sql zur Verf�gung 
+
+    * changeEPSG und Fl�chenberechnung steht derzeit nur Benutzern mit einer PostgreSQL-Datenbank zur Verf�gung 
+
+
+Changelog 2.2.0
+[edit]
+english
+
+Here you find a list with the changes in Mapbender 2.2.0:
+
+    * The configuration files have been consolidated into one single mapbender.conf
+    * Now Mapbender 2.2.0 is able to work with MySQL- or PostgreSQL-database. Configure the settings in the mapbender.conf.
+    * You can edit the single elements of a GUI with the Mapbender-Administration (table element_vars/ css-files/ var).
+    * WFS
+    * Proxy
+    * PrintPDF. This module enables you to configure the PrintPDF containing an overview, legend, northarrow and your logo.
+    * Click on a Layer refers to the WMS METADATAURL - new column layer_metadataurl.
+    * The legend is displayed by the LEGENDURL.
+    * New Wiki: To edit the new wiki you have to ask for an account at mailto:info at mapbender.org.
+    * ToggleModule to define a function to be active when the gui is opened 
+
+Here you already find a list with the changes in Mapbender 2.2:
+
+    * Mapbender for MySQL or PostgreSQL
+    * You can edit the single elements of a GUI with the Mapbender-Administration (table element_vars/ css-files/ var)
+    * click on a Layer refers to the WMS METADATAURLD - new column layer_metadataurl
+    * the legend is displayed by the LEGENDURL 
+
+
+deutsch
+
+Hier die �nderungen, die mit der Version 2.2 erfolgt sind:
+
+    * Nun ist es m�glich Mapbender mit einer MySQL- oder PostgreSQL-Datenbank zu installieren. Konfigurieren Sie die Einstellungen in der Datei mapbender.conf.
+    * Sie k�nnen die einzelnen Elemente einer GUI mit der Mapbender-Administration editieren (Tabelle element_vars/ css-files/ var).
+    * WFS
+    * Proxy
+    * PrintPDF. Dieses Modul erlaubt es dem Benutzer den PrintPDF zu konfigurieren und beinhaltet Overview, Legende, Nordpfeil und ein Logo.
+    * Neue Buttons (button_oo) sind in der GUI 'gui' verf�gbar.
+    * Ein Klick auf einen Layer referenziert die WMS METADATAURL - neue Spalte layer_metadataurl.
+    * Die Legende wird durch die LEGENDURL dargestellt.
+    * Neues Wiki: Um im neuen Wiki editieren zu k�nnen, m�ssen Sie einen Account beantragen bei CCGIS.
+    * ToggleModule - definiert ein Element, das beim Start der GUI aktiviert sein soll 
+
+Hier aber schonmal die �nderungen, die uns mit der Version 2.2 erwarten:
+
+    * Mapbender f�r MySQL oder PostgreSQL
+    * Anpassung der einzelnen Elemente einer GUI �ber die Mapbender-Administration (element_vars)
+    * Metadataurl
+    * Legendurl 
+
+
+Changelog 2.1.0
+
+english
+
+    * communication by email mail.conf
+    * new button myGUIlist in the administration-guis to go back to the list of myGUIs
+    * New table mb_log
+    * New column in table wms wms_getCapabilities_doc
+    * ChangeEpsg_dynamic
+    * Edit gui shows the images of a gui as little pictures (better orientation)
+    * sql to update the mapbender standard guis Update Mapbender
+    * mapbender/http/tools/validate_db.php - php to update the database and add new columns and tables if necessary
+    * New column layer_dataurl in table layer
+    * New columns legendurl and legendurlformat in table layer_style
+    * New table wms_srs
+    * Security update in Edit GUI Elements 
+
+
+deutsch
+
+    * Kommunikation �ber email mail.conf
+    * Neuer Button myGUIlist f�r die Administrations-GUIs, um in die Liste von meinenGUIs zur�ck zu kommen.
+    * Neue Tabelle mb_log
+    * Neue Spalte in der Tabelle wms wms_getCapabilities_doc
+    * ChangeEpsg_dynamic
+    * Die Rubrik 'Oberfl�chenelemente editieren' zeigt nun kleine Bilder der Oberfl�che zur besseren Orientierung.
+    * SQL zur Aktualisierung Ihrer GUIs: siehe Update Mapbender
+    * mapbender/http/tools/validate_db.php - PHP, um die Datenbank zu aktualisieren und wenn n�tig neue Spalten und Tabellen hinzuzuf�gen.
+    * Neue Spalte layer_dataurl in der Tabelle layer hinzugef�gt.
+    * Neue Spalten 'legendurl' und 'legendurlformat' in der Tabelle layer_style hinzugef�gt.
+    * Neue Tabelle wms_srs 
+
+
+Changelog 2.1.0 rc1
+
+english
+
+    * Print with Mapbender Version 2.1.0 pdf-print is used as standard. You have the possibility to choose A4 or A3 and landscape or portrait. The printframe can be styled to your own design by editing a configuration file.
+    * GUIOwner a new parameter <owner> has been added to the user management. This allows a distinction between reading/using a GUI and being allowed to change it ( edit GUI elements). This feature is necessary as a preliminary step to open Mapbender as a portal with anonymous access which is needed to implement Wikimaps functionality. Additionally this enables setting up a hierarchical administration.
+    * Overview The overview map should be addressed with the module Overview, (<Overview0>, <Overview1>, <Overview2>, ... are deprecated). The module can be parameterized with the field "wms". It contains the index of the WMS which should be displayed in the overview map. (starting at 0).
+    * showCoords_div On button click the coordinate of the mouseposition will be displayed below the target (e.g. mapframe1)
+    * Detailed metadatainformation for a GUI. Also information about the last requests as a link.
+    * Additional default GUIs are added to the Mapbender database.
+    * After installing Mapbender a set of worldwide WMS are already contained in several GUIs.
+    * Copy a GUI copyGUI / rename a GUI RenameGUI.
+    * AddWMS Add a new web map service dynamically by entering the URL to an OGC WMS Capabilities document. Current extent, layers and settings are not affected.
+    * Add WMS from list Dynamically add WMS from a list of all OGC WMS contained in the Mapbender database to the current GUI.
+    * Add WMS from filtered list Dynamically add WMS from a list (filtered by group or gui) to a GUI.
+    * setBackground Define several WMS to be displayed in the background.
+    * setBackground_all You can define one or more WMS to be displayed in the background.
+    * DeleteGUI Delete a selected GUI.
+    * DeleteWMS Delete a selected WMS.
+    * Edit GUI Elements - added: GUI description editable.
+    * Edit GUI WMS - added: show WMS ID.
+    * showCoords_div - shows the coordinate below the target (i.e. mapframe1).
+    * setScaleHint - set scale hints for mapframes.
+    * tabs_vertical - handle iframes with vertical tabs.
+    * WMS_preferences - edit service settings of the loaded WMS, change order, remove wms, change settings. 
+
+
+deutsch
+
+    * Print Ab der Mapbender Version 2.1.0 erfolgt der Standardausdruck von Mapbender als PDF. Hierbei stehen A4 und A3 Druck zur Auswahl sowie Hoch- und Querformat. Der Kartenspiegel kann dabei �ber eine Konfigurationsdatei an das eigene Design angepa�t werden. Hierbei stehen A4 und A3 Druck zur Auswahl sowie Hoch- und Querformat. 
+
+    * GUIOwner Der neue Parameter <owner> (Besitzer) wurde der Benutzerverwaltung hinzugef�gt. Dies erlaubt eine Unterscheidung zwischen lesen/benutzen einer GUI und der Berechtigung die GUI zu �ndern ( edit GUI elements). Dieses Feature ist notwendig als Vorbereitung Mapbender als Portal mit anonymem Zugang einzusetzen, was wiederum notwendig ist, um Wikimap-Funktionalit�t zu implementieren. Zus�tzlich erm�glicht diese Einstellung den Aufbau einer hierarchischen Verwaltung.
+    * Overview Die �bersichtskarte sollte mit dem Modul Overview adressiert werden (<Overview0>, <Overview1>, <Overview2>, ... wurden eingestellt). Das Modul kann mit dem Feld "wms" parametriert werden. Es beinhaltet den Index des WMS, der nicht in der �bersichtskarte angezeigt werden sollte (beginnend bei 0).
+    * showCoords_div Bei Aktivierung dieses Buttons werden die Koordinaten der Mausposition unter dem Ziel (target = z.B. mapframe1) angezeigt.
+    * Detaillierte Metadatainformationen f�r eine GUI. Ebenso Information �ber die letzte Anfrage als Link.
+    * Zus�tzliche Standard-GUIs wurden der Mapbender Datenbank hinzugef�gt.
+    * Nach der Installation von Mapbender ist bereits ein Set von weltweiten WMSen in verschiedenen GUIs enthalten.
+    * Kopieren einer GUI copyGUI / Umbenennen einer GUI RenameGUI.
+    * AddWMS Dynamisches Hinzuf�gen eines neuen Web Map Services durch die Eingabe der URL in ein OGC WMS Capabilities Dokument. Der aktuelle Ausschnitt, Layer und Einstellungen sind davon nicht betroffen.
+    * Add WMS from list Dynamisches Hinzuf�gen eines WMS von einer Liste von allen OGC WMS, die in der Mapbender Datenbank enthalten sind f�r die aktuelle GUI.
+    * Add WMS from filtered list Dynamisches Hinzuf�gen eines WMS von einer Liste (gefiltert f�r eine Gruppe oder GUI) f�r eine GUI .
+    * setBackground Definiert einige WMS, die im Hintergrund angezeigt werden.
+    * setBackground_all Definieren Sie hier einen oder mehrere WMS, die im Hintergrund angezeigt werden.
+    * DeleteGUI L�schen einer ausgew�hlten GUI.
+    * DeleteWMS L�schen eines ausgew�hlten WMS.
+    * Oberfl�chenelemente editieren (Edit GUI Elements) - Hinzugef�gt: GUI Beschreibung editierbar.
+    * WMS GUI Einstellungen (Edit GUI WMS/ WMS GUI settings) - Hinzugef�gt: Anzeige der WMS ID.
+    * showCoords_div - Anzeige der Koordinaten unter dem Ziel (target, z.B. mapframe1).
+    * setScaleHint - Setzen eines Ma�stabes f�r Kartenframes.
+    * tabs_vertical - Handhaben von Iframes mit vertikal Karteireitern.
+    * WMS_preferences - Bearbeiten der Einstellungen eines Dienstes eines geladenen WMS, �nderung der Reihenfolge, Entfernen eines WMS, �nderung der Einstellungen. 
\ No newline at end of file

Modified: branches/print_dev/Readme.txt
===================================================================
--- branches/print_dev/Readme.txt	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/Readme.txt	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,8 +1,8 @@
-Read more about Mapbender in the Wiki
-
-http://www.mapbender.org
-
-Every Mapbender User is invited to let the Mapbender Wiki grow.
-If you want an account to edit any of these Wiki pages please write an email to info at mapbender.org and request for an ID and password. 
-You need a valid email address to be able to edit this Wiki. 
-
+Read more about Mapbender in the Wiki
+
+http://www.mapbender.org
+
+Every Mapbender User is invited to let the Mapbender Wiki grow.
+If you want an account to edit any of these Wiki pages please write an email to info at mapbender.org and request for an ID and password. 
+You need a valid email address to be able to edit this Wiki. 
+

Modified: branches/print_dev/http/classes/class.ezpdf.php
===================================================================
--- branches/print_dev/http/classes/class.ezpdf.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class.ezpdf.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,1555 +1,1555 @@
-<?php
-
-include_once(dirname(__FILE__).'/class.pdf.php');
-
-class Cezpdf extends Cpdf {
-//==============================================================================
-// this class will take the basic interaction facilities of the Cpdf class
-// and make more useful functions so that the user does not have to 
-// know all the ins and outs of pdf presentation to produce something pretty.
-//
-// IMPORTANT NOTE
-// there is no warranty, implied or otherwise with this software.
-// 
-// version 009 (versioning is linked to class.pdf.php)
-//
-// released under a public domain licence.
-//
-// Wayne Munro, R&OS Ltd, http://www.ros.co.nz/pdf
-//==============================================================================
-
-var $ez=array('fontSize'=>10); // used for storing most of the page configuration parameters
-var $y; // this is the current vertical positon on the page of the writing point, very important
-var $ezPages=array(); // keep an array of the ids of the pages, making it easy to go back and add page numbers etc.
-var $ezPageCount=0;
-
-// ------------------------------------------------------------------------------
-
-function Cezpdf($paper='a4',$orientation='portrait'){
-	// Assuming that people don't want to specify the paper size using the absolute coordinates
-	// allow a couple of options:
-	// orientation can be 'portrait' or 'landscape'
-	// or, to actually set the coordinates, then pass an array in as the first parameter.
-	// the defaults are as shown.
-	// 
-	// -------------------------
-	// 2002-07-24 - Nicola Asuni (info at tecnick.com):
-	// Added new page formats (45 standard ISO paper formats and 4 american common formats)
-	// paper cordinates are calculated in this way: (inches * 72) where 1 inch = 2.54 cm
-	// 
-	// Now you may also pass a 2 values array containing the page width and height in centimeters
-	// -------------------------
-
-	if (!is_array($paper)){
-		switch (strtoupper($paper)){
-			case '4A0': {$size = array(0,0,4767.87,6740.79); break;}
-			case '2A0': {$size = array(0,0,3370.39,4767.87); break;}
-			case 'A0': {$size = array(0,0,2383.94,3370.39); break;}
-			case 'A1': {$size = array(0,0,1683.78,2383.94); break;}
-			case 'A2': {$size = array(0,0,1190.55,1683.78); break;}
-			case 'A3': {$size = array(0,0,841.89,1190.55); break;}
-			case 'A4': default: {$size = array(0,0,595.28,841.89); break;}
-			case 'A5': {$size = array(0,0,419.53,595.28); break;}
-			case 'A6': {$size = array(0,0,297.64,419.53); break;}
-			case 'A7': {$size = array(0,0,209.76,297.64); break;}
-			case 'A8': {$size = array(0,0,147.40,209.76); break;}
-			case 'A9': {$size = array(0,0,104.88,147.40); break;}
-			case 'A10': {$size = array(0,0,73.70,104.88); break;}
-			case 'B0': {$size = array(0,0,2834.65,4008.19); break;}
-			case 'B1': {$size = array(0,0,2004.09,2834.65); break;}
-			case 'B2': {$size = array(0,0,1417.32,2004.09); break;}
-			case 'B3': {$size = array(0,0,1000.63,1417.32); break;}
-			case 'B4': {$size = array(0,0,708.66,1000.63); break;}
-			case 'B5': {$size = array(0,0,498.90,708.66); break;}
-			case 'B6': {$size = array(0,0,354.33,498.90); break;}
-			case 'B7': {$size = array(0,0,249.45,354.33); break;}
-			case 'B8': {$size = array(0,0,175.75,249.45); break;}
-			case 'B9': {$size = array(0,0,124.72,175.75); break;}
-			case 'B10': {$size = array(0,0,87.87,124.72); break;}
-			case 'C0': {$size = array(0,0,2599.37,3676.54); break;}
-			case 'C1': {$size = array(0,0,1836.85,2599.37); break;}
-			case 'C2': {$size = array(0,0,1298.27,1836.85); break;}
-			case 'C3': {$size = array(0,0,918.43,1298.27); break;}
-			case 'C4': {$size = array(0,0,649.13,918.43); break;}
-			case 'C5': {$size = array(0,0,459.21,649.13); break;}
-			case 'C6': {$size = array(0,0,323.15,459.21); break;}
-			case 'C7': {$size = array(0,0,229.61,323.15); break;}
-			case 'C8': {$size = array(0,0,161.57,229.61); break;}
-			case 'C9': {$size = array(0,0,113.39,161.57); break;}
-			case 'C10': {$size = array(0,0,79.37,113.39); break;}
-			case 'RA0': {$size = array(0,0,2437.80,3458.27); break;}
-			case 'RA1': {$size = array(0,0,1729.13,2437.80); break;}
-			case 'RA2': {$size = array(0,0,1218.90,1729.13); break;}
-			case 'RA3': {$size = array(0,0,864.57,1218.90); break;}
-			case 'RA4': {$size = array(0,0,609.45,864.57); break;}
-			case 'SRA0': {$size = array(0,0,2551.18,3628.35); break;}
-			case 'SRA1': {$size = array(0,0,1814.17,2551.18); break;}
-			case 'SRA2': {$size = array(0,0,1275.59,1814.17); break;}
-			case 'SRA3': {$size = array(0,0,907.09,1275.59); break;}
-			case 'SRA4': {$size = array(0,0,637.80,907.09); break;}
-			case 'LETTER': {$size = array(0,0,612.00,792.00); break;}
-			case 'LEGAL': {$size = array(0,0,612.00,1008.00); break;}
-			case 'EXECUTIVE': {$size = array(0,0,521.86,756.00); break;}
-			case 'FOLIO': {$size = array(0,0,612.00,936.00); break;}
-		}
-		switch (strtolower($orientation)){
-			case 'landscape':
-				$a=$size[3];
-				$size[3]=$size[2];
-				$size[2]=$a;
-				break;
-		}
-	} else {
-		if (count($paper)>2) {
-			// then an array was sent it to set the size
-			$size = $paper;
-		}
-		else { //size in centimeters has been passed
-			$size[0] = 0;
-			$size[1] = 0;
-			$size[2] = ( $paper[0] / 2.54 ) * 72;
-			$size[3] = ( $paper[1] / 2.54 ) * 72;
-		}
-	}
-	$this->Cpdf($size);
-	$this->ez['pageWidth']=$size[2];
-	$this->ez['pageHeight']=$size[3];
-	
-	// also set the margins to some reasonable defaults
-	$this->ez['topMargin']=30;
-	$this->ez['bottomMargin']=30;
-	$this->ez['leftMargin']=30;
-	$this->ez['rightMargin']=30;
-	
-	// set the current writing position to the top of the first page
-	$this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
-	// and get the ID of the page that was created during the instancing process.
-	$this->ezPages[1]=$this->getFirstPageId();
-	$this->ezPageCount=1;
-}
-
-// ------------------------------------------------------------------------------
-// 2002-07-24: Nicola Asuni (info at tecnick.com)
-// Set Margins in centimeters
-function ezSetCmMargins($top,$bottom,$left,$right){
-	$top = ( $top / 2.54 ) * 72;
-	$bottom = ( $bottom / 2.54 ) * 72;
-	$left = ( $left / 2.54 ) * 72;
-	$right = ( $right / 2.54 ) * 72;
-	$this->ezSetMargins($top,$bottom,$left,$right);
-}
-// ------------------------------------------------------------------------------
-
-
-function ezColumnsStart($options=array()){
-  // start from the current y-position, make the set number of columne
-  if (isset($this->ez['columns']) && $this->ez['columns']==1){
-    // if we are already in a column mode then just return.
-    return;
-  }
-  $def=array('gap'=>10,'num'=>2);
-  foreach($def as $k=>$v){
-    if (!isset($options[$k])){
-      $options[$k]=$v;
-    }
-  }
-  // setup the columns
-  $this->ez['columns']=array('on'=>1,'colNum'=>1);
-
-  // store the current margins
-  $this->ez['columns']['margins']=array(
-     $this->ez['leftMargin']
-    ,$this->ez['rightMargin']
-    ,$this->ez['topMargin']
-    ,$this->ez['bottomMargin']
-  );
-  // and store the settings for the columns
-  $this->ez['columns']['options']=$options;
-  // then reset the margins to suit the new columns
-  // safe enough to assume the first column here, but start from the current y-position
-  $this->ez['topMargin']=$this->ez['pageHeight']-$this->y;
-  $width=($this->ez['pageWidth']-$this->ez['leftMargin']-$this->ez['rightMargin']-($options['num']-1)*$options['gap'])/$options['num'];
-  $this->ez['columns']['width']=$width;
-  $this->ez['rightMargin']=$this->ez['pageWidth']-$this->ez['leftMargin']-$width;
-  
-}
-// ------------------------------------------------------------------------------
-function ezColumnsStop(){
-  if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
-    $this->ez['columns']['on']=0;
-    $this->ez['leftMargin']=$this->ez['columns']['margins'][0];
-    $this->ez['rightMargin']=$this->ez['columns']['margins'][1];
-    $this->ez['topMargin']=$this->ez['columns']['margins'][2];
-    $this->ez['bottomMargin']=$this->ez['columns']['margins'][3];
-  }
-}
-// ------------------------------------------------------------------------------
-function ezInsertMode($status=1,$pageNum=1,$pos='before'){
-  // puts the document into insert mode. new pages are inserted until this is re-called with status=0
-  // by default pages wil be inserted at the start of the document
-  switch($status){
-    case '1':
-      if (isset($this->ezPages[$pageNum])){
-        $this->ez['insertMode']=1;
-        $this->ez['insertOptions']=array('id'=>$this->ezPages[$pageNum],'pos'=>$pos);
-      }
-      break;
-    case '0':
-      $this->ez['insertMode']=0;
-      break;
-  }
-}
-// ------------------------------------------------------------------------------
-
-function ezNewPage(){
-  $pageRequired=1;
-  if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
-    // check if this is just going to a new column
-    // increment the column number
-//echo 'HERE<br>';
-    $this->ez['columns']['colNum']++;
-//echo $this->ez['columns']['colNum'].'<br>';
-    if ($this->ez['columns']['colNum'] <= $this->ez['columns']['options']['num']){
-      // then just reset to the top of the next column
-      $pageRequired=0;
-    } else {
-      $this->ez['columns']['colNum']=1;
-      $this->ez['topMargin']=$this->ez['columns']['margins'][2];
-    }
-
-    $width = $this->ez['columns']['width'];
-    $this->ez['leftMargin']=$this->ez['columns']['margins'][0]+($this->ez['columns']['colNum']-1)*($this->ez['columns']['options']['gap']+$width);
-    $this->ez['rightMargin']=$this->ez['pageWidth']-$this->ez['leftMargin']-$width;
-  }
-//echo 'left='.$this->ez['leftMargin'].'   right='.$this->ez['rightMargin'].'<br>';
-
-  if ($pageRequired){
-    // make a new page, setting the writing point back to the top
-    $this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
-    // make the new page with a call to the basic class.
-    $this->ezPageCount++;
-    if (isset($this->ez['insertMode']) && $this->ez['insertMode']==1){
-      $id = $this->ezPages[$this->ezPageCount] = $this->newPage(1,$this->ez['insertOptions']['id'],$this->ez['insertOptions']['pos']);
-      // then manipulate the insert options so that inserted pages follow each other
-      $this->ez['insertOptions']['id']=$id;
-      $this->ez['insertOptions']['pos']='after';
-    } else {
-      $this->ezPages[$this->ezPageCount] = $this->newPage();
-    }
-  } else {
-    $this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-function ezSetMargins($top,$bottom,$left,$right){
-  // sets the margins to new values
-  $this->ez['topMargin']=$top;
-  $this->ez['bottomMargin']=$bottom;
-  $this->ez['leftMargin']=$left;
-  $this->ez['rightMargin']=$right;
-  // check to see if this means that the current writing position is outside the 
-  // writable area
-  if ($this->y > $this->ez['pageHeight']-$top){
-    // then move y down
-    $this->y = $this->ez['pageHeight']-$top;
-  }
-  if ( $this->y < $bottom){
-    // then make a new page
-    $this->ezNewPage();
-  }
-}  
-
-// ------------------------------------------------------------------------------
-
-function ezGetCurrentPageNumber(){
-  // return the strict numbering (1,2,3,4..) number of the current page
-  return $this->ezPageCount;
-}
-
-// ------------------------------------------------------------------------------
-
-function ezStartPageNumbers($x,$y,$size,$pos='left',$pattern='{PAGENUM} of {TOTALPAGENUM}',$num=''){
-  // put page numbers on the pages from here.
-  // place then on the 'pos' side of the coordinates (x,y).
-  // pos can be 'left' or 'right'
-  // use the given 'pattern' for display, where (PAGENUM} and {TOTALPAGENUM} are replaced
-  // as required.
-  // if $num is set, then make the first page this number, the number of total pages will
-  // be adjusted to account for this.
-  // Adjust this function so that each time you 'start' page numbers then you effectively start a different batch
-  // return the number of the batch, so that they can be stopped in a different order if required.
-  if (!$pos || !strlen($pos)){
-    $pos='left';
-  }
-  if (!$pattern || !strlen($pattern)){
-    $pattern='{PAGENUM} of {TOTALPAGENUM}';
-  }
-  if (!isset($this->ez['pageNumbering'])){
-    $this->ez['pageNumbering']=array();
-  }
-  $i = count($this->ez['pageNumbering']);
-  $this->ez['pageNumbering'][$i][$this->ezPageCount]=array('x'=>$x,'y'=>$y,'pos'=>$pos,'pattern'=>$pattern,'num'=>$num,'size'=>$size);
-  return $i;
-}
-
-// ------------------------------------------------------------------------------
-
-function ezWhatPageNumber($pageNum,$i=0){
-  // given a particular generic page number (ie, document numbered sequentially from beginning),
-  // return the page number under a particular page numbering scheme ($i)
-  $num=0;
-  $start=1;
-  $startNum=1;
-  if (!isset($this->ez['pageNumbering']))
-  {
-    $this->addMessage('WARNING: page numbering called for and wasn\'t started with ezStartPageNumbers');
-    return 0;
-  }
-  foreach($this->ez['pageNumbering'][$i] as $k=>$v){
-    if ($k<=$pageNum){
-      if (is_array($v)){
-        // start block
-        if (strlen($v['num'])){
-          // a start was specified
-          $start=$v['num'];
-          $startNum=$k;
-          $num=$pageNum-$startNum+$start;
-        }
-      } else {
-        // stop block
-        $num=0;
-      }
-    }
-  }
-  return $num;
-}
-
-// ------------------------------------------------------------------------------
-
-function ezStopPageNumbers($stopTotal=0,$next=0,$i=0){
-  // if stopTotal=1 then the totalling of pages for this number will stop too
-  // if $next=1, then do this page, but not the next, else do not do this page either
-  // if $i is set, then stop that particular pagenumbering sequence.
-  if (!isset($this->ez['pageNumbering'])){
-    $this->ez['pageNumbering']=array();
-  }
-  if ($next && isset($this->ez['pageNumbering'][$i][$this->ezPageCount]) && is_array($this->ez['pageNumbering'][$i][$this->ezPageCount])){
-    // then this has only just been started, this will over-write the start, and nothing will appear
-    // add a special command to the start block, telling it to stop as well
-    if ($stopTotal){
-      $this->ez['pageNumbering'][$i][$this->ezPageCount]['stoptn']=1;
-    } else {
-      $this->ez['pageNumbering'][$i][$this->ezPageCount]['stopn']=1;
-    }
-  } else {
-    if ($stopTotal){
-      $this->ez['pageNumbering'][$i][$this->ezPageCount]='stopt';
-    } else {
-      $this->ez['pageNumbering'][$i][$this->ezPageCount]='stop';
-    }
-    if ($next){
-      $this->ez['pageNumbering'][$i][$this->ezPageCount].='n';
-    }
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-function ezPRVTpageNumberSearch($lbl,&$tmp){
-  foreach($tmp as $i=>$v){
-    if (is_array($v)){
-      if (isset($v[$lbl])){
-        return $i;
-      }
-    } else {
-      if ($v==$lbl){
-        return $i;
-      }
-    }
-  }
-  return 0;
-}
-
-// ------------------------------------------------------------------------------
-
-function ezPRVTaddPageNumbers(){
-  // this will go through the pageNumbering array and add the page numbers are required
-  if (isset($this->ez['pageNumbering'])){
-    $totalPages1 = $this->ezPageCount;
-    $tmp1=$this->ez['pageNumbering'];
-    $status=0;
-    foreach($tmp1 as $i=>$tmp){
-      // do each of the page numbering systems
-      // firstly, find the total pages for this one
-      $k = $this->ezPRVTpageNumberSearch('stopt',$tmp);
-      if ($k && $k>0){
-        $totalPages = $k-1;
-      } else {
-        $l = $this->ezPRVTpageNumberSearch('stoptn',$tmp);
-        if ($l && $l>0){
-          $totalPages = $l;
-        } else {
-          $totalPages = $totalPages1;
-        }
-      }
-      foreach ($this->ezPages as $pageNum=>$id){
-        if (isset($tmp[$pageNum])){
-          if (is_array($tmp[$pageNum])){
-            // then this must be starting page numbers
-            $status=1;
-            $info = $tmp[$pageNum];
-            $info['dnum']=$info['num']-$pageNum;
-            // also check for the special case of the numbering stopping and starting on the same page
-            if (isset($info['stopn']) || isset($info['stoptn']) ){
-              $status=2;
-            }
-          } else if ($tmp[$pageNum]=='stop' || $tmp[$pageNum]=='stopt'){
-            // then we are stopping page numbers
-            $status=0;
-          } else if ($status==1 && ($tmp[$pageNum]=='stoptn' || $tmp[$pageNum]=='stopn')){
-            // then we are stopping page numbers
-            $status=2;
-          }
-        }
-        if ($status){
-          // then add the page numbering to this page
-          if (strlen($info['num'])){
-            $num=$pageNum+$info['dnum'];
-          } else {
-            $num=$pageNum;
-          }
-          $total = $totalPages+$num-$pageNum;
-          $pat = str_replace('{PAGENUM}',$num,$info['pattern']);
-          $pat = str_replace('{TOTALPAGENUM}',$total,$pat);
-          $this->reopenObject($id);
-          switch($info['pos']){
-            case 'right':
-              $this->addText($info['x'],$info['y'],$info['size'],$pat);
-              break;
-            default:
-              $w=$this->getTextWidth($info['size'],$pat);
-              $this->addText($info['x']-$w,$info['y'],$info['size'],$pat);
-              break;
-          }
-          $this->closeObject();
-        }
-        if ($status==2){
-          $status=0;
-        }
-      }
-    }
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-function ezPRVTcleanUp(){
-  $this->ezPRVTaddPageNumbers();
-}
-
-// ------------------------------------------------------------------------------
-
-function ezStream($options=''){
-  $this->ezPRVTcleanUp();
-  $this->stream($options);
-}
-
-// ------------------------------------------------------------------------------
-
-function ezOutput($options=0){
-  $this->ezPRVTcleanUp();
-  return $this->output($options);
-}
-
-// ------------------------------------------------------------------------------
-
-function ezSetY($y){
-  // used to change the vertical position of the writing point.
-  $this->y = $y;
-  if ( $this->y < $this->ez['bottomMargin']){
-    // then make a new page
-    $this->ezNewPage();
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-function ezSetDy($dy,$mod=''){
-  // used to change the vertical position of the writing point.
-  // changes up by a positive increment, so enter a negative number to go
-  // down the page
-  // if $mod is set to 'makeSpace' and a new page is forced, then the pointed will be moved 
-  // down on the new page, this will allow space to be reserved for graphics etc.
-  $this->y += $dy;
-  if ( $this->y < $this->ez['bottomMargin']){
-    // then make a new page
-    $this->ezNewPage();
-    if ($mod=='makeSpace'){
-      $this->y += $dy;
-    }
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-function ezPrvtTableDrawLines($pos,$gap,$x0,$x1,$y0,$y1,$y2,$col,$inner,$outer,$opt=1){
-  $x0=1000;
-  $x1=0;
-  $this->setStrokeColor($col[0],$col[1],$col[2]);
-  $cnt=0;
-  $n = count($pos);
-  foreach($pos as $x){
-    $cnt++;
-    if ($cnt==1 || $cnt==$n){
-      $this->setLineStyle($outer);
-    } else {
-      $this->setLineStyle($inner);
-    }
-    $this->line($x-$gap/2,$y0,$x-$gap/2,$y2);
-    if ($x>$x1){ $x1=$x; };
-    if ($x<$x0){ $x0=$x; };
-  }
-  $this->setLineStyle($outer);
-  $this->line($x0-$gap/2-$outer/2,$y0,$x1-$gap/2+$outer/2,$y0);
-  // only do the second line if it is different to the first, AND each row does not have
-  // a line on it.
-  if ($y0!=$y1 && $opt<2){
-    $this->line($x0-$gap/2,$y1,$x1-$gap/2,$y1);
-  }
-  $this->line($x0-$gap/2-$outer/2,$y2,$x1-$gap/2+$outer/2,$y2);
-}
-
-// ------------------------------------------------------------------------------
-
-function ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$gap,$size,&$y,$optionsAll=array()){
-  // uses ezText to add the text, and returns the height taken by the largest heading
-  // this page will move the headings to a new page if they will not fit completely on this one
-  // transaction support will be used to implement this
-
-  if (isset($optionsAll['cols'])){
-    $options = $optionsAll['cols'];
-  } else {
-    $options = array();
-  }
-  
-  $mx=0;
-  $startPage = $this->ezPageCount;
-  $secondGo=0;
-
-  // $y is the position at which the top of the table should start, so the base
-  // of the first text, is $y-$height-$gap-$decender, but ezText starts by dropping $height
-  
-  // the return from this function is the total cell height, including gaps, and $y is adjusted
-  // to be the postion of the bottom line
-  
-  // begin the transaction
-  $this->transaction('start');
-  $ok=0;
-//  $y-=$gap-$decender;
-  $y-=$gap;
-  while ($ok==0){
-    foreach($cols as $colName=>$colHeading){
-      $this->ezSetY($y);
-      if (isset($options[$colName]) && isset($options[$colName]['justification'])){
-        $justification = $options[$colName]['justification'];
-      } else {
-        $justification = 'left';
-      }
-      $this->ezText($colHeading,$size,array('aleft'=> $pos[$colName],'aright'=>($maxWidth[$colName]+$pos[$colName]),'justification'=>$justification));
-      $dy = $y-$this->y;
-      if ($dy>$mx){
-        $mx=$dy;
-      }
-    }
-    $y = $y - $mx - $gap + $decender;
-//    $y -= $mx-$gap+$decender;
-    
-    // now, if this has moved to a new page, then abort the transaction, move to a new page, and put it there
-    // do not check on the second time around, to avoid an infinite loop
-    if ($this->ezPageCount != $startPage && $secondGo==0){
-      $this->transaction('rewind');
-      $this->ezNewPage();
-      $y = $this->y - $gap-$decender;
-      $ok=0;
-      $secondGo=1;
-//      $y = $store_y;
-      $mx=0;
-
-    } else {
-      $this->transaction('commit');
-      $ok=1;
-    }
-  }
-
-  return $mx+$gap*2-$decender;
-}
-
-// ------------------------------------------------------------------------------
-
-function ezPrvtGetTextWidth($size,$text){
-  // will calculate the maximum width, taking into account that the text may be broken
-  // by line breaks.
-  $mx=0;
-  $lines = explode("\n",$text);
-  foreach ($lines as $line){
-    $w = $this->getTextWidth($size,$line);
-    if ($w>$mx){
-      $mx=$w;
-    }
-  }
-  return $mx;
-}
-
-// ------------------------------------------------------------------------------
-
-function ezTable(&$data,$cols='',$title='',$options=''){
-  // add a table of information to the pdf document
-  // $data is a two dimensional array
-  // $cols (optional) is an associative array, the keys are the names of the columns from $data
-  // to be presented (and in that order), the values are the titles to be given to the columns
-  // $title (optional) is the title to be put on the top of the table
-  //
-  // $options is an associative array which can contain:
-  // 'showLines'=> 0,1,2, default is 1 (show outside and top lines only), 2=> lines on each row
-  // 'showHeadings' => 0 or 1
-  // 'shaded'=> 0,1,2,3 default is 1 (1->alternate lines are shaded, 0->no shading, 2-> both shaded, second uses shadeCol2)
-  // 'shadeCol' => (r,g,b) array, defining the colour of the shading, default is (0.8,0.8,0.8)
-  // 'shadeCol2' => (r,g,b) array, defining the colour of the shading of the other blocks, default is (0.7,0.7,0.7)
-  // 'fontSize' => 10
-  // 'textCol' => (r,g,b) array, text colour
-  // 'titleFontSize' => 12
-  // 'rowGap' => 2 , the space added at the top and bottom of each row, between the text and the lines
-  // 'colGap' => 5 , the space on the left and right sides of each cell
-  // 'lineCol' => (r,g,b) array, defining the colour of the lines, default, black.
-  // 'xPos' => 'left','right','center','centre',or coordinate, reference coordinate in the x-direction
-  // 'xOrientation' => 'left','right','center','centre', position of the table w.r.t 'xPos' 
-  // 'width'=> <number> which will specify the width of the table, if it turns out to not be this
-  //    wide, then it will stretch the table to fit, if it is wider then each cell will be made
-  //    proportionalty smaller, and the content may have to wrap.
-  // 'maxWidth'=> <number> similar to 'width', but will only make table smaller than it wants to be
-  // 'options' => array(<colname>=>array('justification'=>'left','width'=>100,'link'=>linkDataName),<colname>=>....)
-  //             allow the setting of other paramaters for the individual columns
-  // 'minRowSpace'=> the minimum space between the bottom of each row and the bottom margin, in which a new row will be started
-  //                  if it is less, then a new page would be started, default=-100
-  // 'innerLineThickness'=>1
-  // 'outerLineThickness'=>1
-  // 'splitRows'=>0, 0 or 1, whether or not to allow the rows to be split across page boundaries
-  // 'protectRows'=>number, the number of rows to hold with the heading on page, ie, if there less than this number of
-  //                rows on the page, then move the whole lot onto the next page, default=1
-  //
-  // note that the user will have had to make a font selection already or this will not 
-  // produce a valid pdf file.
-  
-  if (!is_array($data)){
-    return;
-  }
-  
-  if (!is_array($cols)){
-    // take the columns from the first row of the data set
-    reset($data);
-    list($k,$v)=each($data);
-    if (!is_array($v)){
-      return;
-    }
-    $cols=array();
-    foreach($v as $k1=>$v1){
-      $cols[$k1]=$k1;
-    }
-  }
-  
-  if (!is_array($options)){
-    $options=array();
-  }
-
-  $defaults = array(
-    'shaded'=>1,'showLines'=>1,'shadeCol'=>array(0.8,0.8,0.8),'shadeCol2'=>array(0.7,0.7,0.7),'fontSize'=>10,'titleFontSize'=>12
-    ,'titleGap'=>5,'lineCol'=>array(0,0,0),'gap'=>5,'xPos'=>'centre','xOrientation'=>'centre'
-    ,'showHeadings'=>1,'textCol'=>array(0,0,0),'width'=>0,'maxWidth'=>0,'cols'=>array(),'minRowSpace'=>-100,'rowGap'=>2,'colGap'=>5
-    ,'innerLineThickness'=>1,'outerLineThickness'=>1,'splitRows'=>0,'protectRows'=>1
-    );
-
-  foreach($defaults as $key=>$value){
-    if (is_array($value)){
-      if (!isset($options[$key]) || !is_array($options[$key])){
-        $options[$key]=$value;
-      }
-    } else {
-      if (!isset($options[$key])){
-        $options[$key]=$value;
-      }
-    }
-  }
-  $options['gap']=2*$options['colGap'];
-  
-  $middle = ($this->ez['pageWidth']-$this->ez['rightMargin'])/2+($this->ez['leftMargin'])/2;
-  // figure out the maximum widths of the text within each column
-  $maxWidth=array();
-  foreach($cols as $colName=>$colHeading){
-    $maxWidth[$colName]=0;
-  }
-  // find the maximum cell widths based on the data
-  foreach($data as $row){
-    foreach($cols as $colName=>$colHeading){
-      $w = $this->ezPrvtGetTextWidth($options['fontSize'],(string)$row[$colName])*1.01;
-      if ($w > $maxWidth[$colName]){
-        $maxWidth[$colName]=$w;
-      }
-    }
-  }
-  // and the maximum widths to fit in the headings
-  foreach($cols as $colName=>$colTitle){
-    $w = $this->ezPrvtGetTextWidth($options['fontSize'],(string)$colTitle)*1.01;
-    if ($w > $maxWidth[$colName]){
-      $maxWidth[$colName]=$w;
-    }
-  }
-  
-  // calculate the start positions of each of the columns
-  $pos=array();
-  $x=0;
-  $t=$x;
-  $adjustmentWidth=0;
-  $setWidth=0;
-  foreach($maxWidth as $colName => $w){
-    $pos[$colName]=$t;
-    // if the column width has been specified then set that here, also total the
-    // width avaliable for adjustment
-    if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['width']) && $options['cols'][$colName]['width']>0){
-      $t=$t+$options['cols'][$colName]['width'];
-      $maxWidth[$colName] = $options['cols'][$colName]['width']-$options['gap'];
-      $setWidth += $options['cols'][$colName]['width'];
-    } else {
-      $t=$t+$w+$options['gap'];
-      $adjustmentWidth += $w;
-      $setWidth += $options['gap'];
-    }
-  }
-  $pos['_end_']=$t;
-
-  // if maxWidth is specified, and the table is too wide, and the width has not been set,
-  // then set the width.
-  if ($options['width']==0 && $options['maxWidth'] && ($t-$x)>$options['maxWidth']){
-    // then need to make this one smaller
-    $options['width']=$options['maxWidth'];
-  }
-
-  if ($options['width'] && $adjustmentWidth>0 && $setWidth<$options['width']){
-    // first find the current widths of the columns involved in this mystery
-    $cols0 = array();
-    $cols1 = array();
-    $xq=0;
-    $presentWidth=0;
-    $last='';
-    foreach($pos as $colName=>$p){
-      if (!isset($options['cols'][$last]) || !isset($options['cols'][$last]['width']) || $options['cols'][$last]['width']<=0){
-        if (strlen($last)){
-          $cols0[$last]=$p-$xq -$options['gap'];
-          $presentWidth += ($p-$xq - $options['gap']);
-        }
-      } else {
-        $cols1[$last]=$p-$xq;
-      }
-      $last=$colName;
-      $xq=$p;
-    }
-    // $cols0 contains the widths of all the columns which are not set
-    $neededWidth = $options['width']-$setWidth;
-    // if needed width is negative then add it equally to each column, else get more tricky
-    if ($presentWidth<$neededWidth){
-      foreach($cols0 as $colName=>$w){
-        $cols0[$colName]+= ($neededWidth-$presentWidth)/count($cols0);
-      }
-    } else {
-    
-      $cnt=0;
-      while ($presentWidth>$neededWidth && $cnt<100){
-        $cnt++; // insurance policy
-        // find the widest columns, and the next to widest width
-        $aWidest = array();
-        $nWidest=0;
-        $widest=0;
-        foreach($cols0 as $colName=>$w){
-          if ($w>$widest){
-            $aWidest=array($colName);
-            $nWidest = $widest;
-            $widest=$w;
-          } else if ($w==$widest){
-            $aWidest[]=$colName;
-          }
-        }
-        // then figure out what the width of the widest columns would have to be to take up all the slack
-        $newWidestWidth = $widest - ($presentWidth-$neededWidth)/count($aWidest);
-        if ($newWidestWidth > $nWidest){
-          // then there is space to set them to this
-          foreach($aWidest as $colName){
-            $cols0[$colName] = $newWidestWidth;
-          }
-          $presentWidth=$neededWidth;
-        } else {
-          // there is not space, reduce the size of the widest ones down to the next size down, and we
-          // will go round again
-          foreach($aWidest as $colName){
-            $cols0[$colName] = $nWidest;
-          }
-          $presentWidth=$presentWidth-($widest-$nWidest)*count($aWidest);
-        }
-      }
-    }
-    // $cols0 now contains the new widths of the constrained columns.
-    // now need to update the $pos and $maxWidth arrays
-    $xq=0;
-    foreach($pos as $colName=>$p){
-      $pos[$colName]=$xq;
-      if (!isset($options['cols'][$colName]) || !isset($options['cols'][$colName]['width']) || $options['cols'][$colName]['width']<=0){
-        if (isset($cols0[$colName])){
-          $xq += $cols0[$colName] + $options['gap'];
-          $maxWidth[$colName]=$cols0[$colName];
-        }
-      } else {
-        if (isset($cols1[$colName])){
-          $xq += $cols1[$colName];
-        }
-      }
-    }
-
-    $t=$x+$options['width'];
-    $pos['_end_']=$t;
-  }
-
-  // now adjust the table to the correct location across the page
-  switch ($options['xPos']){
-    case 'left':
-      $xref = $this->ez['leftMargin'];
-      break;
-    case 'right':
-      $xref = $this->ez['pageWidth'] - $this->ez['rightMargin'];
-      break;
-    case 'centre':
-    case 'center':
-      $xref = $middle;
-      break;
-    default:
-      $xref = $options['xPos'];
-      break;
-  }
-  switch ($options['xOrientation']){
-    case 'left':
-      $dx = $xref-$t;
-      break;
-    case 'right':
-      $dx = $xref;
-      break;
-    case 'centre':
-    case 'center':
-      $dx = $xref-$t/2;
-      break;
-  }
-
-
-  foreach($pos as $k=>$v){
-    $pos[$k]=$v+$dx;
-  }
-  $x0=$x+$dx;
-  $x1=$t+$dx;
-
-  $baseLeftMargin = $this->ez['leftMargin'];
-  $basePos = $pos;
-  $baseX0 = $x0;
-  $baseX1 = $x1;
-  
-  // ok, just about ready to make me a table
-  $this->setColor($options['textCol'][0],$options['textCol'][1],$options['textCol'][2]);
-  $this->setStrokeColor($options['shadeCol'][0],$options['shadeCol'][1],$options['shadeCol'][2]);
-
-  $middle = ($x1+$x0)/2;
-
-  // start a transaction which will be used to regress the table, if there are not enough rows protected
-  if ($options['protectRows']>0){
-    $this->transaction('start');
-    $movedOnce=0;
-  }
-  $abortTable = 1;
-  while ($abortTable){
-  $abortTable=0;
-
-  $dm = $this->ez['leftMargin']-$baseLeftMargin;
-  foreach($basePos as $k=>$v){
-    $pos[$k]=$v+$dm;
-  }
-  $x0=$baseX0+$dm;
-  $x1=$baseX1+$dm;
-  $middle = ($x1+$x0)/2;
-
-
-  // if the title is set, then do that
-  if (strlen($title)){
-    $w = $this->getTextWidth($options['titleFontSize'],$title);
-    $this->y -= $this->getFontHeight($options['titleFontSize']);
-    if ($this->y < $this->ez['bottomMargin']){
-      $this->ezNewPage();
-        // margins may have changed on the newpage
-        $dm = $this->ez['leftMargin']-$baseLeftMargin;
-        foreach($basePos as $k=>$v){
-          $pos[$k]=$v+$dm;
-        }
-        $x0=$baseX0+$dm;
-        $x1=$baseX1+$dm;
-        $middle = ($x1+$x0)/2;
-      $this->y -= $this->getFontHeight($options['titleFontSize']);
-    }
-    $this->addText($middle-$w/2,$this->y,$options['titleFontSize'],$title);
-    $this->y -= $options['titleGap'];
-  }
-
-        // margins may have changed on the newpage
-        $dm = $this->ez['leftMargin']-$baseLeftMargin;
-        foreach($basePos as $k=>$v){
-          $pos[$k]=$v+$dm;
-        }
-        $x0=$baseX0+$dm;
-        $x1=$baseX1+$dm;
-  
-  $y=$this->y; // to simplify the code a bit
-  
-  // make the table
-  $height = $this->getFontHeight($options['fontSize']);
-  $decender = $this->getFontDecender($options['fontSize']);
-
-  
-  
-  $y0=$y+$decender;
-  $dy=0;
-  if ($options['showHeadings']){
-    // this function will move the start of the table to a new page if it does not fit on this one
-    $headingHeight = $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
-    $y0 = $y+$headingHeight;
-    $y1 = $y;
-
-
-    $dm = $this->ez['leftMargin']-$baseLeftMargin;
-    foreach($basePos as $k=>$v){
-      $pos[$k]=$v+$dm;
-    }
-    $x0=$baseX0+$dm;
-    $x1=$baseX1+$dm;
-
-  } else {
-    $y1 = $y0;
-  }
-  $firstLine=1;
-
-  
-  // open an object here so that the text can be put in over the shading
-  if ($options['shaded']){
-    $this->saveState();
-    $textObjectId = $this->openObject();
-    $this->closeObject();
-    $this->addObject($textObjectId);
-    $this->reopenObject($textObjectId);
-  }
-  
-  $cnt=0;
-  $newPage=0;
-  foreach($data as $row){
-    $cnt++;
-    // the transaction support will be used to prevent rows being split
-    if ($options['splitRows']==0){
-      $pageStart = $this->ezPageCount;
-      if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
-        $columnStart = $this->ez['columns']['colNum'];
-      }
-      $this->transaction('start');
-      $row_orig = $row;
-      $y_orig = $y;
-      $y0_orig = $y0;
-      $y1_orig = $y1;
-    }
-    $ok=0;
-    $secondTurn=0;
-    while(!$abortTable && $ok == 0){
-
-    $mx=0;
-    $newRow=1;
-    while(!$abortTable && ($newPage || $newRow)){
-      
-      $y-=$height;
-      if ($newPage || $y<$this->ez['bottomMargin'] || (isset($options['minRowSpace']) && $y<($this->ez['bottomMargin']+$options['minRowSpace'])) ){
-        // check that enough rows are with the heading
-        if ($options['protectRows']>0 && $movedOnce==0 && $cnt<=$options['protectRows']){
-          // then we need to move the whole table onto the next page
-          $movedOnce = 1;
-          $abortTable = 1;
-        }
-      
-        $y2=$y-$mx+2*$height+$decender-$newRow*$height;
-        if ($options['showLines']){
-          if (!$options['showHeadings']){
-            $y0=$y1;
-          }
-          $this->ezPrvtTableDrawLines($pos,$options['gap'],$x0,$x1,$y0,$y1,$y2,$options['lineCol'],$options['innerLineThickness'],$options['outerLineThickness'],$options['showLines']);
-        }
-        if ($options['shaded']){
-          $this->closeObject();
-          $this->restoreState();
-        }
-        $this->ezNewPage();
-        // and the margins may have changed, this is due to the possibility of the columns being turned on
-        // as the columns are managed by manipulating the margins
-
-        $dm = $this->ez['leftMargin']-$baseLeftMargin;
-        foreach($basePos as $k=>$v){
-          $pos[$k]=$v+$dm;
-        }
-//        $x0=$x0+$dm;
-//        $x1=$x1+$dm;
-        $x0=$baseX0+$dm;
-        $x1=$baseX1+$dm;
-  
-        if ($options['shaded']){
-          $this->saveState();
-          $textObjectId = $this->openObject();
-          $this->closeObject();
-          $this->addObject($textObjectId);
-          $this->reopenObject($textObjectId);
-        }
-        $this->setColor($options['textCol'][0],$options['textCol'][1],$options['textCol'][2],1);
-        $y = $this->ez['pageHeight']-$this->ez['topMargin'];
-        $y0=$y+$decender;
-        $mx=0;
-        if ($options['showHeadings']){
-          $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
-          $y1=$y;
-        } else {
-          $y1=$y0;
-        }
-        $firstLine=1;
-        $y -= $height;
-      }
-      $newRow=0;
-      // write the actual data
-      // if these cells need to be split over a page, then $newPage will be set, and the remaining
-      // text will be placed in $leftOvers
-      $newPage=0;
-      $leftOvers=array();
-
-      foreach($cols as $colName=>$colTitle){
-        $this->ezSetY($y+$height);
-        $colNewPage=0;
-        if (isset($row[$colName])){
-          if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['link']) && strlen($options['cols'][$colName]['link'])){
-            
-            $lines = explode("\n",$row[$colName]);
-            if (isset($row[$options['cols'][$colName]['link']]) && strlen($row[$options['cols'][$colName]['link']])){
-              foreach($lines as $k=>$v){
-                $lines[$k]='<c:alink:'.$row[$options['cols'][$colName]['link']].'>'.$v.'</c:alink>';
-              }
-            }
-          } else {
-            $lines = explode("\n",$row[$colName]);
-          }
-        } else {
-          $lines = array();
-        }
-        $this->y -= $options['rowGap'];
-        foreach ($lines as $line){
-          $line = $this->ezProcessText($line);
-          $start=1;
-
-          while (strlen($line) || $start){
-            $start=0;
-            if (!$colNewPage){
-              $this->y=$this->y-$height;
-            }
-            if ($this->y < $this->ez['bottomMargin']){
-  //            $this->ezNewPage();
-              $newPage=1;  // whether a new page is required for any of the columns
-              $colNewPage=1; // whether a new page is required for this column
-            }
-            if ($colNewPage){
-              if (isset($leftOvers[$colName])){
-                $leftOvers[$colName].="\n".$line;
-              } else {
-                $leftOvers[$colName] = $line;
-              }
-              $line='';
-            } else {
-              if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['justification']) ){
-                $just = $options['cols'][$colName]['justification'];
-              } else {
-                $just='left';
-              }
-
-              $line=$this->addTextWrap($pos[$colName],$this->y,$maxWidth[$colName],$options['fontSize'],$line,$just);
-            }
-          }
-        }
-  
-        $dy=$y+$height-$this->y+$options['rowGap'];
-        if ($dy-$height*$newPage>$mx){
-          $mx=$dy-$height*$newPage;
-        }
-      }
-      // set $row to $leftOvers so that they will be processed onto the new page
-      $row = $leftOvers;
-      // now add the shading underneath
-      if ($options['shaded'] && $cnt%2==0){
-        $this->closeObject();
-        $this->setColor($options['shadeCol'][0],$options['shadeCol'][1],$options['shadeCol'][2],1);
-        $this->filledRectangle($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
-        $this->reopenObject($textObjectId);
-      }
-
-      if ($options['shaded']==2 && $cnt%2==1){
-        $this->closeObject();
-        $this->setColor($options['shadeCol2'][0],$options['shadeCol2'][1],$options['shadeCol2'][2],1);
-        $this->filledRectangle($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
-        $this->reopenObject($textObjectId);
-      }
-
-      if ($options['showLines']>1){
-        // then draw a line on the top of each block
-//        $this->closeObject();
-        $this->saveState();
-        $this->setStrokeColor($options['lineCol'][0],$options['lineCol'][1],$options['lineCol'][2],1);
-//        $this->line($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
-        if ($firstLine){
-          $this->setLineStyle($options['outerLineThickness']);
-          $firstLine=0;
-        } else {
-          $this->setLineStyle($options['innerLineThickness']);
-        }
-        $this->line($x0-$options['gap']/2,$y+$decender+$height,$x1-$options['gap']/2,$y+$decender+$height);
-        $this->restoreState();
-//        $this->reopenObject($textObjectId);
-      }
-    } // end of while 
-    $y=$y-$mx+$height;
-    
-    // checking row split over pages
-    if ($options['splitRows']==0){
-      if ( ( ($this->ezPageCount != $pageStart) || (isset($this->ez['columns']) && $this->ez['columns']['on']==1 && $columnStart != $this->ez['columns']['colNum'] ))  && $secondTurn==0){
-        // then we need to go back and try that again !
-        $newPage=1;
-        $secondTurn=1;
-        $this->transaction('rewind');
-        $row = $row_orig;
-        $y = $y_orig;
-        $y0 = $y0_orig;
-        $y1 = $y1_orig;
-        $ok=0;
-
-        $dm = $this->ez['leftMargin']-$baseLeftMargin;
-        foreach($basePos as $k=>$v){
-          $pos[$k]=$v+$dm;
-        }
-        $x0=$baseX0+$dm;
-        $x1=$baseX1+$dm;
-
-      } else {
-        $this->transaction('commit');
-        $ok=1;
-      }
-    } else {
-      $ok=1;  // don't go round the loop if splitting rows is allowed
-    }
-    
-    }  // end of while to check for row splitting
-    if ($abortTable){
-      if ($ok==0){
-        $this->transaction('abort');
-      }
-      // only the outer transaction should be operational
-      $this->transaction('rewind');
-      $this->ezNewPage();
-      break;
-    }
-    
-  } // end of foreach ($data as $row)
-  
-  } // end of while ($abortTable)
-
-  // table has been put on the page, the rows guarded as required, commit.
-  $this->transaction('commit');
-
-  $y2=$y+$decender;
-  if ($options['showLines']){
-    if (!$options['showHeadings']){
-      $y0=$y1;
-    }
-    $this->ezPrvtTableDrawLines($pos,$options['gap'],$x0,$x1,$y0,$y1,$y2,$options['lineCol'],$options['innerLineThickness'],$options['outerLineThickness'],$options['showLines']);
-  }
-
-  // close the object for drawing the text on top
-  if ($options['shaded']){
-    $this->closeObject();
-    $this->restoreState();
-  }
-  
-  $this->y=$y;
-  return $y;
-}
-
-// ------------------------------------------------------------------------------
-function ezProcessText($text){
-  // this function will intially be used to implement underlining support, but could be used for a range of other
-  // purposes
-  $search = array('<u>','<U>','</u>','</U>');
-  $replace = array('<c:uline>','<c:uline>','</c:uline>','</c:uline>');
-  return str_replace($search,$replace,$text);
-}
-
-// ------------------------------------------------------------------------------
-
-function ezText($text,$size=0,$options=array(),$test=0){
-  // this will add a string of text to the document, starting at the current drawing
-  // position.
-  // it will wrap to keep within the margins, including optional offsets from the left
-  // and the right, if $size is not specified, then it will be the last one used, or
-  // the default value (12 I think).
-  // the text will go to the start of the next line when a return code "\n" is found.
-  // possible options are:
-  // 'left'=> number, gap to leave from the left margin
-  // 'right'=> number, gap to leave from the right margin
-  // 'aleft'=> number, absolute left position (overrides 'left')
-  // 'aright'=> number, absolute right position (overrides 'right')
-  // 'justification' => 'left','right','center','centre','full'
-
-  // only set one of the next two items (leading overrides spacing)
-  // 'leading' => number, defines the total height taken by the line, independent of the font height.
-  // 'spacing' => a real number, though usually set to one of 1, 1.5, 2 (line spacing as used in word processing)
-  
-  // if $test is set then this should just check if the text is going to flow onto a new page or not, returning true or false
-  
-  // apply the filtering which will make the underlining function.
-  $text = $this->ezProcessText($text);
-  
-  $newPage=false;
-  $store_y = $this->y;
-  
-  if (is_array($options) && isset($options['aleft'])){
-    $left=$options['aleft'];
-  } else {
-    $left = $this->ez['leftMargin'] + ((is_array($options) && isset($options['left']))?$options['left']:0);
-  }
-  if (is_array($options) && isset($options['aright'])){
-    $right=$options['aright'];
-  } else {
-    $right = $this->ez['pageWidth'] - $this->ez['rightMargin'] - ((is_array($options) && isset($options['right']))?$options['right']:0);
-  }
-  if ($size<=0){
-    $size = $this->ez['fontSize'];
-  } else {
-    $this->ez['fontSize']=$size;
-  }
-  
-  if (is_array($options) && isset($options['justification'])){
-    $just = $options['justification'];
-  } else {
-    $just = 'left';
-  }
-  
-  // modifications to give leading and spacing based on those given by Craig Heydenburg 1/1/02
-  if (is_array($options) && isset($options['leading'])) { ## use leading instead of spacing
-    $height = $options['leading'];
-	} else if (is_array($options) && isset($options['spacing'])) {
-    $height = $this->getFontHeight($size) * $options['spacing'];
-	} else {
-		$height = $this->getFontHeight($size);
-	}
-
-  
-  $lines = explode("\n",$text);
-  foreach ($lines as $line){
-    $start=1;
-    while (strlen($line) || $start){
-      $start=0;
-      $this->y=$this->y-$height;
-      if ($this->y < $this->ez['bottomMargin']){
-        if ($test){
-          $newPage=true;
-        } else {
-          $this->ezNewPage();
-          // and then re-calc the left and right, in case they have changed due to columns
-        }
-      }
-      if (is_array($options) && isset($options['aleft'])){
-        $left=$options['aleft'];
-      } else {
-        $left = $this->ez['leftMargin'] + ((is_array($options) && isset($options['left']))?$options['left']:0);
-      }
-      if (is_array($options) && isset($options['aright'])){
-        $right=$options['aright'];
-      } else {
-        $right = $this->ez['pageWidth'] - $this->ez['rightMargin'] - ((is_array($options) && isset($options['right']))?$options['right']:0);
-      }
-      $line=$this->addTextWrap($left,$this->y,$right-$left,$size,$line,$just,0,$test);
-    }
-  }
-
-  if ($test){
-    $this->y=$store_y;
-    return $newPage;
-  } else {
-    return $this->y;
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-function ezImage($image,$pad = 5,$width = 0,$resize = 'full',$just = 'center',$border = ''){
-	//beta ezimage function
-	if (stristr($image,'://'))//copy to temp file
-	{
-		$fp = @fopen($image,"rb");
-		while(!feof($fp))
-   		{
-      			$cont.= fread($fp,1024);
-   		}
-   		fclose($fp);
-		$image = tempnam ("/tmp", "php-pdf");
-		$fp2 = @fopen($image,"w");
-   		fwrite($fp2,$cont);
-  		fclose($fp2);
-		$temp = true;
-	}
-
-	if (!(file_exists($image))) return false; //return immediately if image file does not exist
-	$imageInfo = getimagesize($image);
-	switch ($imageInfo[2]){
-		case 2:
-			$type = "jpeg";
-			break;
-		case 3:
-			$type = "png";
-			break;
-		default:
-			return false; //return if file is not jpg or png
-	}
-	if ($width == 0) $width = $imageInfo[0]; //set width
-	$ratio = $imageInfo[0]/$imageInfo[1];
-
-	//get maximum width of image
-	if (isset($this->ez['columns']) && $this->ez['columns']['on'] == 1)
-	{
-		$bigwidth = $this->ez['columns']['width'] - ($pad * 2);
-	}
-	else
-	{
-		$bigwidth = $this->ez['pageWidth'] - ($pad * 2);
-	}
-	//fix width if larger than maximum or if $resize=full
-	if ($resize == 'full' || $resize == 'width' || $width > $bigwidth)
-	{
-		$width = $bigwidth;
-
-	}
-
-	$height = ($width/$ratio); //set height
-
-	//fix size if runs off page
-	if ($height > ($this->y - $this->ez['bottomMargin'] - ($pad * 2)))
-	{
-		if ($resize != 'full')
-		{
-			$this->ezNewPage();
-		}
-		else
-		{
-			$height = ($this->y - $this->ez['bottomMargin'] - ($pad * 2)); //shrink height
-			$width = ($height*$ratio); //fix width
-		}
-	}
-
-	//fix x-offset if image smaller than bigwidth
-	if ($width < $bigwidth)
-	{
-		//center if justification=center
-		if ($just == 'center')
-		{
-			$offset = ($bigwidth - $width) / 2;
-		}
-		//move to right if justification=right
-		if ($just == 'right')
-		{
-			$offset = ($bigwidth - $width);
-		}
-		//leave at left if justification=left
-		if ($just == 'left')
-		{
-			$offset = 0;
-		}
-	}
-
-
-	//call appropriate function
-	if ($type == "jpeg"){
-		$this->addJpegFromFile($image,$this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width);
-	}
-
-	if ($type == "png"){
-		$this->addPngFromFile($image,$this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width);
-	}
-	//draw border
-	if ($border != '')
-	{
-	if (!(isset($border['color'])))
-	{
-		$border['color']['red'] = .5;
-		$border['color']['blue'] = .5;
-		$border['color']['green'] = .5;
-	}
-	if (!(isset($border['width']))) $border['width'] = 1;
-	if (!(isset($border['cap']))) $border['cap'] = 'round';
-	if (!(isset($border['join']))) $border['join'] = 'round';
-	
-
-	$this->setStrokeColor($border['color']['red'],$border['color']['green'],$border['color']['blue']);
-	$this->setLineStyle($border['width'],$border['cap'],$border['join']);
-	$this->rectangle($this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width,$height);
-
-	}
-	// move y below image
-	$this->y = $this->y - $pad - $height;
-	//remove tempfile for remote images
-	if ($temp == true) unlink($image);
-
-}
-// ------------------------------------------------------------------------------
-
-// note that templating code is still considered developmental - have not really figured
-// out a good way of doing this yet.
-function loadTemplate($templateFile){
-  // this function will load the requested template ($file includes full or relative pathname)
-  // the code for the template will be modified to make it name safe, and then stored in 
-  // an array for later use
-  // The id of the template will be returned for the user to operate on it later
-  if (!file_exists($templateFile)){
-    return -1;
-  }
-
-  $code = implode('',file($templateFile));
-  if (!strlen($code)){
-    return;
-  }
-
-  $code = trim($code);
-  if (substr($code,0,5)=='<?php'){
-    $code = substr($code,5);
-  }
-  if (substr($code,-2)=='?>'){
-    $code = substr($code,0,strlen($code)-2);
-  }
-  if (isset($this->ez['numTemplates'])){
-    $newNum = $this->ez['numTemplates'];
-    $this->ez['numTemplates']++;
-  } else {
-    $newNum=0;
-    $this->ez['numTemplates']=1;
-    $this->ez['templates']=array();
-  }
-
-  $this->ez['templates'][$newNum]['code']=$code;
-
-  return $newNum;
-}
-
-// ------------------------------------------------------------------------------
-
-function execTemplate($id,$data=array(),$options=array()){
-  // execute the given template on the current document.
-  if (!isset($this->ez['templates'][$id])){
-    return;
-  }
-  eval($this->ez['templates'][$id]['code']);
-}
-
-// ------------------------------------------------------------------------------
-function ilink($info){
-  $this->alink($info,1);
-}
-
-function alink($info,$internal=0){
-  // a callback function to support the formation of clickable links within the document
-  $lineFactor=0.05; // the thickness of the line as a proportion of the height. also the drop of the line.
-  switch($info['status']){
-    case 'start':
-    case 'sol':
-      // the beginning of the link
-      // this should contain the URl for the link as the 'p' entry, and will also contain the value of 'nCallback'
-      if (!isset($this->ez['links'])){
-        $this->ez['links']=array();
-      }
-      $i = $info['nCallback'];
-      $this->ez['links'][$i] = array('x'=>$info['x'],'y'=>$info['y'],'angle'=>$info['angle'],'decender'=>$info['decender'],'height'=>$info['height'],'url'=>$info['p']);
-      if ($internal==0){
-        $this->saveState();
-        $this->setColor(0,0,1);
-        $this->setStrokeColor(0,0,1);
-        $thick = $info['height']*$lineFactor;
-        $this->setLineStyle($thick);
-      }
-      break;
-    case 'end':
-    case 'eol':
-      // the end of the link
-      // assume that it is the most recent opening which has closed
-      $i = $info['nCallback'];
-      $start = $this->ez['links'][$i];
-      // add underlining
-      if ($internal){
-        $this->addInternalLink($start['url'],$start['x'],$start['y']+$start['decender'],$info['x'],$start['y']+$start['decender']+$start['height']);
-      } else {
-        $a = deg2rad((float)$start['angle']-90.0);
-        $drop = $start['height']*$lineFactor*1.5;
-        $dropx = cos($a)*$drop;
-        $dropy = -sin($a)*$drop;
-        $this->line($start['x']-$dropx,$start['y']-$dropy,$info['x']-$dropx,$info['y']-$dropy);
-        $this->addLink($start['url'],$start['x'],$start['y']+$start['decender'],$info['x'],$start['y']+$start['decender']+$start['height']);
-        $this->restoreState();
-      }
-      break;
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-function uline($info){
-  // a callback function to support underlining
-  $lineFactor=0.05; // the thickness of the line as a proportion of the height. also the drop of the line.
-  switch($info['status']){
-    case 'start':
-    case 'sol':
-    
-      // the beginning of the underline zone
-      if (!isset($this->ez['links'])){
-        $this->ez['links']=array();
-      }
-      $i = $info['nCallback'];
-      $this->ez['links'][$i] = array('x'=>$info['x'],'y'=>$info['y'],'angle'=>$info['angle'],'decender'=>$info['decender'],'height'=>$info['height']);
-      $this->saveState();
-      $thick = $info['height']*$lineFactor;
-      $this->setLineStyle($thick);
-      break;
-    case 'end':
-    case 'eol':
-      // the end of the link
-      // assume that it is the most recent opening which has closed
-      $i = $info['nCallback'];
-      $start = $this->ez['links'][$i];
-      // add underlining
-      $a = deg2rad((float)$start['angle']-90.0);
-      $drop = $start['height']*$lineFactor*1.5;
-      $dropx = cos($a)*$drop;
-      $dropy = -sin($a)*$drop;
-      $this->line($start['x']-$dropx,$start['y']-$dropy,$info['x']-$dropx,$info['y']-$dropy);
-      $this->restoreState();
-      break;
-  }
-}
-
-// ------------------------------------------------------------------------------
-
-}
+<?php
+
+include_once(dirname(__FILE__).'/class.pdf.php');
+
+class Cezpdf extends Cpdf {
+//==============================================================================
+// this class will take the basic interaction facilities of the Cpdf class
+// and make more useful functions so that the user does not have to 
+// know all the ins and outs of pdf presentation to produce something pretty.
+//
+// IMPORTANT NOTE
+// there is no warranty, implied or otherwise with this software.
+// 
+// version 009 (versioning is linked to class.pdf.php)
+//
+// released under a public domain licence.
+//
+// Wayne Munro, R&OS Ltd, http://www.ros.co.nz/pdf
+//==============================================================================
+
+var $ez=array('fontSize'=>10); // used for storing most of the page configuration parameters
+var $y; // this is the current vertical positon on the page of the writing point, very important
+var $ezPages=array(); // keep an array of the ids of the pages, making it easy to go back and add page numbers etc.
+var $ezPageCount=0;
+
+// ------------------------------------------------------------------------------
+
+function Cezpdf($paper='a4',$orientation='portrait'){
+	// Assuming that people don't want to specify the paper size using the absolute coordinates
+	// allow a couple of options:
+	// orientation can be 'portrait' or 'landscape'
+	// or, to actually set the coordinates, then pass an array in as the first parameter.
+	// the defaults are as shown.
+	// 
+	// -------------------------
+	// 2002-07-24 - Nicola Asuni (info at tecnick.com):
+	// Added new page formats (45 standard ISO paper formats and 4 american common formats)
+	// paper cordinates are calculated in this way: (inches * 72) where 1 inch = 2.54 cm
+	// 
+	// Now you may also pass a 2 values array containing the page width and height in centimeters
+	// -------------------------
+
+	if (!is_array($paper)){
+		switch (strtoupper($paper)){
+			case '4A0': {$size = array(0,0,4767.87,6740.79); break;}
+			case '2A0': {$size = array(0,0,3370.39,4767.87); break;}
+			case 'A0': {$size = array(0,0,2383.94,3370.39); break;}
+			case 'A1': {$size = array(0,0,1683.78,2383.94); break;}
+			case 'A2': {$size = array(0,0,1190.55,1683.78); break;}
+			case 'A3': {$size = array(0,0,841.89,1190.55); break;}
+			case 'A4': default: {$size = array(0,0,595.28,841.89); break;}
+			case 'A5': {$size = array(0,0,419.53,595.28); break;}
+			case 'A6': {$size = array(0,0,297.64,419.53); break;}
+			case 'A7': {$size = array(0,0,209.76,297.64); break;}
+			case 'A8': {$size = array(0,0,147.40,209.76); break;}
+			case 'A9': {$size = array(0,0,104.88,147.40); break;}
+			case 'A10': {$size = array(0,0,73.70,104.88); break;}
+			case 'B0': {$size = array(0,0,2834.65,4008.19); break;}
+			case 'B1': {$size = array(0,0,2004.09,2834.65); break;}
+			case 'B2': {$size = array(0,0,1417.32,2004.09); break;}
+			case 'B3': {$size = array(0,0,1000.63,1417.32); break;}
+			case 'B4': {$size = array(0,0,708.66,1000.63); break;}
+			case 'B5': {$size = array(0,0,498.90,708.66); break;}
+			case 'B6': {$size = array(0,0,354.33,498.90); break;}
+			case 'B7': {$size = array(0,0,249.45,354.33); break;}
+			case 'B8': {$size = array(0,0,175.75,249.45); break;}
+			case 'B9': {$size = array(0,0,124.72,175.75); break;}
+			case 'B10': {$size = array(0,0,87.87,124.72); break;}
+			case 'C0': {$size = array(0,0,2599.37,3676.54); break;}
+			case 'C1': {$size = array(0,0,1836.85,2599.37); break;}
+			case 'C2': {$size = array(0,0,1298.27,1836.85); break;}
+			case 'C3': {$size = array(0,0,918.43,1298.27); break;}
+			case 'C4': {$size = array(0,0,649.13,918.43); break;}
+			case 'C5': {$size = array(0,0,459.21,649.13); break;}
+			case 'C6': {$size = array(0,0,323.15,459.21); break;}
+			case 'C7': {$size = array(0,0,229.61,323.15); break;}
+			case 'C8': {$size = array(0,0,161.57,229.61); break;}
+			case 'C9': {$size = array(0,0,113.39,161.57); break;}
+			case 'C10': {$size = array(0,0,79.37,113.39); break;}
+			case 'RA0': {$size = array(0,0,2437.80,3458.27); break;}
+			case 'RA1': {$size = array(0,0,1729.13,2437.80); break;}
+			case 'RA2': {$size = array(0,0,1218.90,1729.13); break;}
+			case 'RA3': {$size = array(0,0,864.57,1218.90); break;}
+			case 'RA4': {$size = array(0,0,609.45,864.57); break;}
+			case 'SRA0': {$size = array(0,0,2551.18,3628.35); break;}
+			case 'SRA1': {$size = array(0,0,1814.17,2551.18); break;}
+			case 'SRA2': {$size = array(0,0,1275.59,1814.17); break;}
+			case 'SRA3': {$size = array(0,0,907.09,1275.59); break;}
+			case 'SRA4': {$size = array(0,0,637.80,907.09); break;}
+			case 'LETTER': {$size = array(0,0,612.00,792.00); break;}
+			case 'LEGAL': {$size = array(0,0,612.00,1008.00); break;}
+			case 'EXECUTIVE': {$size = array(0,0,521.86,756.00); break;}
+			case 'FOLIO': {$size = array(0,0,612.00,936.00); break;}
+		}
+		switch (strtolower($orientation)){
+			case 'landscape':
+				$a=$size[3];
+				$size[3]=$size[2];
+				$size[2]=$a;
+				break;
+		}
+	} else {
+		if (count($paper)>2) {
+			// then an array was sent it to set the size
+			$size = $paper;
+		}
+		else { //size in centimeters has been passed
+			$size[0] = 0;
+			$size[1] = 0;
+			$size[2] = ( $paper[0] / 2.54 ) * 72;
+			$size[3] = ( $paper[1] / 2.54 ) * 72;
+		}
+	}
+	$this->Cpdf($size);
+	$this->ez['pageWidth']=$size[2];
+	$this->ez['pageHeight']=$size[3];
+	
+	// also set the margins to some reasonable defaults
+	$this->ez['topMargin']=30;
+	$this->ez['bottomMargin']=30;
+	$this->ez['leftMargin']=30;
+	$this->ez['rightMargin']=30;
+	
+	// set the current writing position to the top of the first page
+	$this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
+	// and get the ID of the page that was created during the instancing process.
+	$this->ezPages[1]=$this->getFirstPageId();
+	$this->ezPageCount=1;
+}
+
+// ------------------------------------------------------------------------------
+// 2002-07-24: Nicola Asuni (info at tecnick.com)
+// Set Margins in centimeters
+function ezSetCmMargins($top,$bottom,$left,$right){
+	$top = ( $top / 2.54 ) * 72;
+	$bottom = ( $bottom / 2.54 ) * 72;
+	$left = ( $left / 2.54 ) * 72;
+	$right = ( $right / 2.54 ) * 72;
+	$this->ezSetMargins($top,$bottom,$left,$right);
+}
+// ------------------------------------------------------------------------------
+
+
+function ezColumnsStart($options=array()){
+  // start from the current y-position, make the set number of columne
+  if (isset($this->ez['columns']) && $this->ez['columns']==1){
+    // if we are already in a column mode then just return.
+    return;
+  }
+  $def=array('gap'=>10,'num'=>2);
+  foreach($def as $k=>$v){
+    if (!isset($options[$k])){
+      $options[$k]=$v;
+    }
+  }
+  // setup the columns
+  $this->ez['columns']=array('on'=>1,'colNum'=>1);
+
+  // store the current margins
+  $this->ez['columns']['margins']=array(
+     $this->ez['leftMargin']
+    ,$this->ez['rightMargin']
+    ,$this->ez['topMargin']
+    ,$this->ez['bottomMargin']
+  );
+  // and store the settings for the columns
+  $this->ez['columns']['options']=$options;
+  // then reset the margins to suit the new columns
+  // safe enough to assume the first column here, but start from the current y-position
+  $this->ez['topMargin']=$this->ez['pageHeight']-$this->y;
+  $width=($this->ez['pageWidth']-$this->ez['leftMargin']-$this->ez['rightMargin']-($options['num']-1)*$options['gap'])/$options['num'];
+  $this->ez['columns']['width']=$width;
+  $this->ez['rightMargin']=$this->ez['pageWidth']-$this->ez['leftMargin']-$width;
+  
+}
+// ------------------------------------------------------------------------------
+function ezColumnsStop(){
+  if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
+    $this->ez['columns']['on']=0;
+    $this->ez['leftMargin']=$this->ez['columns']['margins'][0];
+    $this->ez['rightMargin']=$this->ez['columns']['margins'][1];
+    $this->ez['topMargin']=$this->ez['columns']['margins'][2];
+    $this->ez['bottomMargin']=$this->ez['columns']['margins'][3];
+  }
+}
+// ------------------------------------------------------------------------------
+function ezInsertMode($status=1,$pageNum=1,$pos='before'){
+  // puts the document into insert mode. new pages are inserted until this is re-called with status=0
+  // by default pages wil be inserted at the start of the document
+  switch($status){
+    case '1':
+      if (isset($this->ezPages[$pageNum])){
+        $this->ez['insertMode']=1;
+        $this->ez['insertOptions']=array('id'=>$this->ezPages[$pageNum],'pos'=>$pos);
+      }
+      break;
+    case '0':
+      $this->ez['insertMode']=0;
+      break;
+  }
+}
+// ------------------------------------------------------------------------------
+
+function ezNewPage(){
+  $pageRequired=1;
+  if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
+    // check if this is just going to a new column
+    // increment the column number
+//echo 'HERE<br>';
+    $this->ez['columns']['colNum']++;
+//echo $this->ez['columns']['colNum'].'<br>';
+    if ($this->ez['columns']['colNum'] <= $this->ez['columns']['options']['num']){
+      // then just reset to the top of the next column
+      $pageRequired=0;
+    } else {
+      $this->ez['columns']['colNum']=1;
+      $this->ez['topMargin']=$this->ez['columns']['margins'][2];
+    }
+
+    $width = $this->ez['columns']['width'];
+    $this->ez['leftMargin']=$this->ez['columns']['margins'][0]+($this->ez['columns']['colNum']-1)*($this->ez['columns']['options']['gap']+$width);
+    $this->ez['rightMargin']=$this->ez['pageWidth']-$this->ez['leftMargin']-$width;
+  }
+//echo 'left='.$this->ez['leftMargin'].'   right='.$this->ez['rightMargin'].'<br>';
+
+  if ($pageRequired){
+    // make a new page, setting the writing point back to the top
+    $this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
+    // make the new page with a call to the basic class.
+    $this->ezPageCount++;
+    if (isset($this->ez['insertMode']) && $this->ez['insertMode']==1){
+      $id = $this->ezPages[$this->ezPageCount] = $this->newPage(1,$this->ez['insertOptions']['id'],$this->ez['insertOptions']['pos']);
+      // then manipulate the insert options so that inserted pages follow each other
+      $this->ez['insertOptions']['id']=$id;
+      $this->ez['insertOptions']['pos']='after';
+    } else {
+      $this->ezPages[$this->ezPageCount] = $this->newPage();
+    }
+  } else {
+    $this->y = $this->ez['pageHeight']-$this->ez['topMargin'];
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+function ezSetMargins($top,$bottom,$left,$right){
+  // sets the margins to new values
+  $this->ez['topMargin']=$top;
+  $this->ez['bottomMargin']=$bottom;
+  $this->ez['leftMargin']=$left;
+  $this->ez['rightMargin']=$right;
+  // check to see if this means that the current writing position is outside the 
+  // writable area
+  if ($this->y > $this->ez['pageHeight']-$top){
+    // then move y down
+    $this->y = $this->ez['pageHeight']-$top;
+  }
+  if ( $this->y < $bottom){
+    // then make a new page
+    $this->ezNewPage();
+  }
+}  
+
+// ------------------------------------------------------------------------------
+
+function ezGetCurrentPageNumber(){
+  // return the strict numbering (1,2,3,4..) number of the current page
+  return $this->ezPageCount;
+}
+
+// ------------------------------------------------------------------------------
+
+function ezStartPageNumbers($x,$y,$size,$pos='left',$pattern='{PAGENUM} of {TOTALPAGENUM}',$num=''){
+  // put page numbers on the pages from here.
+  // place then on the 'pos' side of the coordinates (x,y).
+  // pos can be 'left' or 'right'
+  // use the given 'pattern' for display, where (PAGENUM} and {TOTALPAGENUM} are replaced
+  // as required.
+  // if $num is set, then make the first page this number, the number of total pages will
+  // be adjusted to account for this.
+  // Adjust this function so that each time you 'start' page numbers then you effectively start a different batch
+  // return the number of the batch, so that they can be stopped in a different order if required.
+  if (!$pos || !strlen($pos)){
+    $pos='left';
+  }
+  if (!$pattern || !strlen($pattern)){
+    $pattern='{PAGENUM} of {TOTALPAGENUM}';
+  }
+  if (!isset($this->ez['pageNumbering'])){
+    $this->ez['pageNumbering']=array();
+  }
+  $i = count($this->ez['pageNumbering']);
+  $this->ez['pageNumbering'][$i][$this->ezPageCount]=array('x'=>$x,'y'=>$y,'pos'=>$pos,'pattern'=>$pattern,'num'=>$num,'size'=>$size);
+  return $i;
+}
+
+// ------------------------------------------------------------------------------
+
+function ezWhatPageNumber($pageNum,$i=0){
+  // given a particular generic page number (ie, document numbered sequentially from beginning),
+  // return the page number under a particular page numbering scheme ($i)
+  $num=0;
+  $start=1;
+  $startNum=1;
+  if (!isset($this->ez['pageNumbering']))
+  {
+    $this->addMessage('WARNING: page numbering called for and wasn\'t started with ezStartPageNumbers');
+    return 0;
+  }
+  foreach($this->ez['pageNumbering'][$i] as $k=>$v){
+    if ($k<=$pageNum){
+      if (is_array($v)){
+        // start block
+        if (strlen($v['num'])){
+          // a start was specified
+          $start=$v['num'];
+          $startNum=$k;
+          $num=$pageNum-$startNum+$start;
+        }
+      } else {
+        // stop block
+        $num=0;
+      }
+    }
+  }
+  return $num;
+}
+
+// ------------------------------------------------------------------------------
+
+function ezStopPageNumbers($stopTotal=0,$next=0,$i=0){
+  // if stopTotal=1 then the totalling of pages for this number will stop too
+  // if $next=1, then do this page, but not the next, else do not do this page either
+  // if $i is set, then stop that particular pagenumbering sequence.
+  if (!isset($this->ez['pageNumbering'])){
+    $this->ez['pageNumbering']=array();
+  }
+  if ($next && isset($this->ez['pageNumbering'][$i][$this->ezPageCount]) && is_array($this->ez['pageNumbering'][$i][$this->ezPageCount])){
+    // then this has only just been started, this will over-write the start, and nothing will appear
+    // add a special command to the start block, telling it to stop as well
+    if ($stopTotal){
+      $this->ez['pageNumbering'][$i][$this->ezPageCount]['stoptn']=1;
+    } else {
+      $this->ez['pageNumbering'][$i][$this->ezPageCount]['stopn']=1;
+    }
+  } else {
+    if ($stopTotal){
+      $this->ez['pageNumbering'][$i][$this->ezPageCount]='stopt';
+    } else {
+      $this->ez['pageNumbering'][$i][$this->ezPageCount]='stop';
+    }
+    if ($next){
+      $this->ez['pageNumbering'][$i][$this->ezPageCount].='n';
+    }
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+function ezPRVTpageNumberSearch($lbl,&$tmp){
+  foreach($tmp as $i=>$v){
+    if (is_array($v)){
+      if (isset($v[$lbl])){
+        return $i;
+      }
+    } else {
+      if ($v==$lbl){
+        return $i;
+      }
+    }
+  }
+  return 0;
+}
+
+// ------------------------------------------------------------------------------
+
+function ezPRVTaddPageNumbers(){
+  // this will go through the pageNumbering array and add the page numbers are required
+  if (isset($this->ez['pageNumbering'])){
+    $totalPages1 = $this->ezPageCount;
+    $tmp1=$this->ez['pageNumbering'];
+    $status=0;
+    foreach($tmp1 as $i=>$tmp){
+      // do each of the page numbering systems
+      // firstly, find the total pages for this one
+      $k = $this->ezPRVTpageNumberSearch('stopt',$tmp);
+      if ($k && $k>0){
+        $totalPages = $k-1;
+      } else {
+        $l = $this->ezPRVTpageNumberSearch('stoptn',$tmp);
+        if ($l && $l>0){
+          $totalPages = $l;
+        } else {
+          $totalPages = $totalPages1;
+        }
+      }
+      foreach ($this->ezPages as $pageNum=>$id){
+        if (isset($tmp[$pageNum])){
+          if (is_array($tmp[$pageNum])){
+            // then this must be starting page numbers
+            $status=1;
+            $info = $tmp[$pageNum];
+            $info['dnum']=$info['num']-$pageNum;
+            // also check for the special case of the numbering stopping and starting on the same page
+            if (isset($info['stopn']) || isset($info['stoptn']) ){
+              $status=2;
+            }
+          } else if ($tmp[$pageNum]=='stop' || $tmp[$pageNum]=='stopt'){
+            // then we are stopping page numbers
+            $status=0;
+          } else if ($status==1 && ($tmp[$pageNum]=='stoptn' || $tmp[$pageNum]=='stopn')){
+            // then we are stopping page numbers
+            $status=2;
+          }
+        }
+        if ($status){
+          // then add the page numbering to this page
+          if (strlen($info['num'])){
+            $num=$pageNum+$info['dnum'];
+          } else {
+            $num=$pageNum;
+          }
+          $total = $totalPages+$num-$pageNum;
+          $pat = str_replace('{PAGENUM}',$num,$info['pattern']);
+          $pat = str_replace('{TOTALPAGENUM}',$total,$pat);
+          $this->reopenObject($id);
+          switch($info['pos']){
+            case 'right':
+              $this->addText($info['x'],$info['y'],$info['size'],$pat);
+              break;
+            default:
+              $w=$this->getTextWidth($info['size'],$pat);
+              $this->addText($info['x']-$w,$info['y'],$info['size'],$pat);
+              break;
+          }
+          $this->closeObject();
+        }
+        if ($status==2){
+          $status=0;
+        }
+      }
+    }
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+function ezPRVTcleanUp(){
+  $this->ezPRVTaddPageNumbers();
+}
+
+// ------------------------------------------------------------------------------
+
+function ezStream($options=''){
+  $this->ezPRVTcleanUp();
+  $this->stream($options);
+}
+
+// ------------------------------------------------------------------------------
+
+function ezOutput($options=0){
+  $this->ezPRVTcleanUp();
+  return $this->output($options);
+}
+
+// ------------------------------------------------------------------------------
+
+function ezSetY($y){
+  // used to change the vertical position of the writing point.
+  $this->y = $y;
+  if ( $this->y < $this->ez['bottomMargin']){
+    // then make a new page
+    $this->ezNewPage();
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+function ezSetDy($dy,$mod=''){
+  // used to change the vertical position of the writing point.
+  // changes up by a positive increment, so enter a negative number to go
+  // down the page
+  // if $mod is set to 'makeSpace' and a new page is forced, then the pointed will be moved 
+  // down on the new page, this will allow space to be reserved for graphics etc.
+  $this->y += $dy;
+  if ( $this->y < $this->ez['bottomMargin']){
+    // then make a new page
+    $this->ezNewPage();
+    if ($mod=='makeSpace'){
+      $this->y += $dy;
+    }
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+function ezPrvtTableDrawLines($pos,$gap,$x0,$x1,$y0,$y1,$y2,$col,$inner,$outer,$opt=1){
+  $x0=1000;
+  $x1=0;
+  $this->setStrokeColor($col[0],$col[1],$col[2]);
+  $cnt=0;
+  $n = count($pos);
+  foreach($pos as $x){
+    $cnt++;
+    if ($cnt==1 || $cnt==$n){
+      $this->setLineStyle($outer);
+    } else {
+      $this->setLineStyle($inner);
+    }
+    $this->line($x-$gap/2,$y0,$x-$gap/2,$y2);
+    if ($x>$x1){ $x1=$x; };
+    if ($x<$x0){ $x0=$x; };
+  }
+  $this->setLineStyle($outer);
+  $this->line($x0-$gap/2-$outer/2,$y0,$x1-$gap/2+$outer/2,$y0);
+  // only do the second line if it is different to the first, AND each row does not have
+  // a line on it.
+  if ($y0!=$y1 && $opt<2){
+    $this->line($x0-$gap/2,$y1,$x1-$gap/2,$y1);
+  }
+  $this->line($x0-$gap/2-$outer/2,$y2,$x1-$gap/2+$outer/2,$y2);
+}
+
+// ------------------------------------------------------------------------------
+
+function ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$gap,$size,&$y,$optionsAll=array()){
+  // uses ezText to add the text, and returns the height taken by the largest heading
+  // this page will move the headings to a new page if they will not fit completely on this one
+  // transaction support will be used to implement this
+
+  if (isset($optionsAll['cols'])){
+    $options = $optionsAll['cols'];
+  } else {
+    $options = array();
+  }
+  
+  $mx=0;
+  $startPage = $this->ezPageCount;
+  $secondGo=0;
+
+  // $y is the position at which the top of the table should start, so the base
+  // of the first text, is $y-$height-$gap-$decender, but ezText starts by dropping $height
+  
+  // the return from this function is the total cell height, including gaps, and $y is adjusted
+  // to be the postion of the bottom line
+  
+  // begin the transaction
+  $this->transaction('start');
+  $ok=0;
+//  $y-=$gap-$decender;
+  $y-=$gap;
+  while ($ok==0){
+    foreach($cols as $colName=>$colHeading){
+      $this->ezSetY($y);
+      if (isset($options[$colName]) && isset($options[$colName]['justification'])){
+        $justification = $options[$colName]['justification'];
+      } else {
+        $justification = 'left';
+      }
+      $this->ezText($colHeading,$size,array('aleft'=> $pos[$colName],'aright'=>($maxWidth[$colName]+$pos[$colName]),'justification'=>$justification));
+      $dy = $y-$this->y;
+      if ($dy>$mx){
+        $mx=$dy;
+      }
+    }
+    $y = $y - $mx - $gap + $decender;
+//    $y -= $mx-$gap+$decender;
+    
+    // now, if this has moved to a new page, then abort the transaction, move to a new page, and put it there
+    // do not check on the second time around, to avoid an infinite loop
+    if ($this->ezPageCount != $startPage && $secondGo==0){
+      $this->transaction('rewind');
+      $this->ezNewPage();
+      $y = $this->y - $gap-$decender;
+      $ok=0;
+      $secondGo=1;
+//      $y = $store_y;
+      $mx=0;
+
+    } else {
+      $this->transaction('commit');
+      $ok=1;
+    }
+  }
+
+  return $mx+$gap*2-$decender;
+}
+
+// ------------------------------------------------------------------------------
+
+function ezPrvtGetTextWidth($size,$text){
+  // will calculate the maximum width, taking into account that the text may be broken
+  // by line breaks.
+  $mx=0;
+  $lines = explode("\n",$text);
+  foreach ($lines as $line){
+    $w = $this->getTextWidth($size,$line);
+    if ($w>$mx){
+      $mx=$w;
+    }
+  }
+  return $mx;
+}
+
+// ------------------------------------------------------------------------------
+
+function ezTable(&$data,$cols='',$title='',$options=''){
+  // add a table of information to the pdf document
+  // $data is a two dimensional array
+  // $cols (optional) is an associative array, the keys are the names of the columns from $data
+  // to be presented (and in that order), the values are the titles to be given to the columns
+  // $title (optional) is the title to be put on the top of the table
+  //
+  // $options is an associative array which can contain:
+  // 'showLines'=> 0,1,2, default is 1 (show outside and top lines only), 2=> lines on each row
+  // 'showHeadings' => 0 or 1
+  // 'shaded'=> 0,1,2,3 default is 1 (1->alternate lines are shaded, 0->no shading, 2-> both shaded, second uses shadeCol2)
+  // 'shadeCol' => (r,g,b) array, defining the colour of the shading, default is (0.8,0.8,0.8)
+  // 'shadeCol2' => (r,g,b) array, defining the colour of the shading of the other blocks, default is (0.7,0.7,0.7)
+  // 'fontSize' => 10
+  // 'textCol' => (r,g,b) array, text colour
+  // 'titleFontSize' => 12
+  // 'rowGap' => 2 , the space added at the top and bottom of each row, between the text and the lines
+  // 'colGap' => 5 , the space on the left and right sides of each cell
+  // 'lineCol' => (r,g,b) array, defining the colour of the lines, default, black.
+  // 'xPos' => 'left','right','center','centre',or coordinate, reference coordinate in the x-direction
+  // 'xOrientation' => 'left','right','center','centre', position of the table w.r.t 'xPos' 
+  // 'width'=> <number> which will specify the width of the table, if it turns out to not be this
+  //    wide, then it will stretch the table to fit, if it is wider then each cell will be made
+  //    proportionalty smaller, and the content may have to wrap.
+  // 'maxWidth'=> <number> similar to 'width', but will only make table smaller than it wants to be
+  // 'options' => array(<colname>=>array('justification'=>'left','width'=>100,'link'=>linkDataName),<colname>=>....)
+  //             allow the setting of other paramaters for the individual columns
+  // 'minRowSpace'=> the minimum space between the bottom of each row and the bottom margin, in which a new row will be started
+  //                  if it is less, then a new page would be started, default=-100
+  // 'innerLineThickness'=>1
+  // 'outerLineThickness'=>1
+  // 'splitRows'=>0, 0 or 1, whether or not to allow the rows to be split across page boundaries
+  // 'protectRows'=>number, the number of rows to hold with the heading on page, ie, if there less than this number of
+  //                rows on the page, then move the whole lot onto the next page, default=1
+  //
+  // note that the user will have had to make a font selection already or this will not 
+  // produce a valid pdf file.
+  
+  if (!is_array($data)){
+    return;
+  }
+  
+  if (!is_array($cols)){
+    // take the columns from the first row of the data set
+    reset($data);
+    list($k,$v)=each($data);
+    if (!is_array($v)){
+      return;
+    }
+    $cols=array();
+    foreach($v as $k1=>$v1){
+      $cols[$k1]=$k1;
+    }
+  }
+  
+  if (!is_array($options)){
+    $options=array();
+  }
+
+  $defaults = array(
+    'shaded'=>1,'showLines'=>1,'shadeCol'=>array(0.8,0.8,0.8),'shadeCol2'=>array(0.7,0.7,0.7),'fontSize'=>10,'titleFontSize'=>12
+    ,'titleGap'=>5,'lineCol'=>array(0,0,0),'gap'=>5,'xPos'=>'centre','xOrientation'=>'centre'
+    ,'showHeadings'=>1,'textCol'=>array(0,0,0),'width'=>0,'maxWidth'=>0,'cols'=>array(),'minRowSpace'=>-100,'rowGap'=>2,'colGap'=>5
+    ,'innerLineThickness'=>1,'outerLineThickness'=>1,'splitRows'=>0,'protectRows'=>1
+    );
+
+  foreach($defaults as $key=>$value){
+    if (is_array($value)){
+      if (!isset($options[$key]) || !is_array($options[$key])){
+        $options[$key]=$value;
+      }
+    } else {
+      if (!isset($options[$key])){
+        $options[$key]=$value;
+      }
+    }
+  }
+  $options['gap']=2*$options['colGap'];
+  
+  $middle = ($this->ez['pageWidth']-$this->ez['rightMargin'])/2+($this->ez['leftMargin'])/2;
+  // figure out the maximum widths of the text within each column
+  $maxWidth=array();
+  foreach($cols as $colName=>$colHeading){
+    $maxWidth[$colName]=0;
+  }
+  // find the maximum cell widths based on the data
+  foreach($data as $row){
+    foreach($cols as $colName=>$colHeading){
+      $w = $this->ezPrvtGetTextWidth($options['fontSize'],(string)$row[$colName])*1.01;
+      if ($w > $maxWidth[$colName]){
+        $maxWidth[$colName]=$w;
+      }
+    }
+  }
+  // and the maximum widths to fit in the headings
+  foreach($cols as $colName=>$colTitle){
+    $w = $this->ezPrvtGetTextWidth($options['fontSize'],(string)$colTitle)*1.01;
+    if ($w > $maxWidth[$colName]){
+      $maxWidth[$colName]=$w;
+    }
+  }
+  
+  // calculate the start positions of each of the columns
+  $pos=array();
+  $x=0;
+  $t=$x;
+  $adjustmentWidth=0;
+  $setWidth=0;
+  foreach($maxWidth as $colName => $w){
+    $pos[$colName]=$t;
+    // if the column width has been specified then set that here, also total the
+    // width avaliable for adjustment
+    if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['width']) && $options['cols'][$colName]['width']>0){
+      $t=$t+$options['cols'][$colName]['width'];
+      $maxWidth[$colName] = $options['cols'][$colName]['width']-$options['gap'];
+      $setWidth += $options['cols'][$colName]['width'];
+    } else {
+      $t=$t+$w+$options['gap'];
+      $adjustmentWidth += $w;
+      $setWidth += $options['gap'];
+    }
+  }
+  $pos['_end_']=$t;
+
+  // if maxWidth is specified, and the table is too wide, and the width has not been set,
+  // then set the width.
+  if ($options['width']==0 && $options['maxWidth'] && ($t-$x)>$options['maxWidth']){
+    // then need to make this one smaller
+    $options['width']=$options['maxWidth'];
+  }
+
+  if ($options['width'] && $adjustmentWidth>0 && $setWidth<$options['width']){
+    // first find the current widths of the columns involved in this mystery
+    $cols0 = array();
+    $cols1 = array();
+    $xq=0;
+    $presentWidth=0;
+    $last='';
+    foreach($pos as $colName=>$p){
+      if (!isset($options['cols'][$last]) || !isset($options['cols'][$last]['width']) || $options['cols'][$last]['width']<=0){
+        if (strlen($last)){
+          $cols0[$last]=$p-$xq -$options['gap'];
+          $presentWidth += ($p-$xq - $options['gap']);
+        }
+      } else {
+        $cols1[$last]=$p-$xq;
+      }
+      $last=$colName;
+      $xq=$p;
+    }
+    // $cols0 contains the widths of all the columns which are not set
+    $neededWidth = $options['width']-$setWidth;
+    // if needed width is negative then add it equally to each column, else get more tricky
+    if ($presentWidth<$neededWidth){
+      foreach($cols0 as $colName=>$w){
+        $cols0[$colName]+= ($neededWidth-$presentWidth)/count($cols0);
+      }
+    } else {
+    
+      $cnt=0;
+      while ($presentWidth>$neededWidth && $cnt<100){
+        $cnt++; // insurance policy
+        // find the widest columns, and the next to widest width
+        $aWidest = array();
+        $nWidest=0;
+        $widest=0;
+        foreach($cols0 as $colName=>$w){
+          if ($w>$widest){
+            $aWidest=array($colName);
+            $nWidest = $widest;
+            $widest=$w;
+          } else if ($w==$widest){
+            $aWidest[]=$colName;
+          }
+        }
+        // then figure out what the width of the widest columns would have to be to take up all the slack
+        $newWidestWidth = $widest - ($presentWidth-$neededWidth)/count($aWidest);
+        if ($newWidestWidth > $nWidest){
+          // then there is space to set them to this
+          foreach($aWidest as $colName){
+            $cols0[$colName] = $newWidestWidth;
+          }
+          $presentWidth=$neededWidth;
+        } else {
+          // there is not space, reduce the size of the widest ones down to the next size down, and we
+          // will go round again
+          foreach($aWidest as $colName){
+            $cols0[$colName] = $nWidest;
+          }
+          $presentWidth=$presentWidth-($widest-$nWidest)*count($aWidest);
+        }
+      }
+    }
+    // $cols0 now contains the new widths of the constrained columns.
+    // now need to update the $pos and $maxWidth arrays
+    $xq=0;
+    foreach($pos as $colName=>$p){
+      $pos[$colName]=$xq;
+      if (!isset($options['cols'][$colName]) || !isset($options['cols'][$colName]['width']) || $options['cols'][$colName]['width']<=0){
+        if (isset($cols0[$colName])){
+          $xq += $cols0[$colName] + $options['gap'];
+          $maxWidth[$colName]=$cols0[$colName];
+        }
+      } else {
+        if (isset($cols1[$colName])){
+          $xq += $cols1[$colName];
+        }
+      }
+    }
+
+    $t=$x+$options['width'];
+    $pos['_end_']=$t;
+  }
+
+  // now adjust the table to the correct location across the page
+  switch ($options['xPos']){
+    case 'left':
+      $xref = $this->ez['leftMargin'];
+      break;
+    case 'right':
+      $xref = $this->ez['pageWidth'] - $this->ez['rightMargin'];
+      break;
+    case 'centre':
+    case 'center':
+      $xref = $middle;
+      break;
+    default:
+      $xref = $options['xPos'];
+      break;
+  }
+  switch ($options['xOrientation']){
+    case 'left':
+      $dx = $xref-$t;
+      break;
+    case 'right':
+      $dx = $xref;
+      break;
+    case 'centre':
+    case 'center':
+      $dx = $xref-$t/2;
+      break;
+  }
+
+
+  foreach($pos as $k=>$v){
+    $pos[$k]=$v+$dx;
+  }
+  $x0=$x+$dx;
+  $x1=$t+$dx;
+
+  $baseLeftMargin = $this->ez['leftMargin'];
+  $basePos = $pos;
+  $baseX0 = $x0;
+  $baseX1 = $x1;
+  
+  // ok, just about ready to make me a table
+  $this->setColor($options['textCol'][0],$options['textCol'][1],$options['textCol'][2]);
+  $this->setStrokeColor($options['shadeCol'][0],$options['shadeCol'][1],$options['shadeCol'][2]);
+
+  $middle = ($x1+$x0)/2;
+
+  // start a transaction which will be used to regress the table, if there are not enough rows protected
+  if ($options['protectRows']>0){
+    $this->transaction('start');
+    $movedOnce=0;
+  }
+  $abortTable = 1;
+  while ($abortTable){
+  $abortTable=0;
+
+  $dm = $this->ez['leftMargin']-$baseLeftMargin;
+  foreach($basePos as $k=>$v){
+    $pos[$k]=$v+$dm;
+  }
+  $x0=$baseX0+$dm;
+  $x1=$baseX1+$dm;
+  $middle = ($x1+$x0)/2;
+
+
+  // if the title is set, then do that
+  if (strlen($title)){
+    $w = $this->getTextWidth($options['titleFontSize'],$title);
+    $this->y -= $this->getFontHeight($options['titleFontSize']);
+    if ($this->y < $this->ez['bottomMargin']){
+      $this->ezNewPage();
+        // margins may have changed on the newpage
+        $dm = $this->ez['leftMargin']-$baseLeftMargin;
+        foreach($basePos as $k=>$v){
+          $pos[$k]=$v+$dm;
+        }
+        $x0=$baseX0+$dm;
+        $x1=$baseX1+$dm;
+        $middle = ($x1+$x0)/2;
+      $this->y -= $this->getFontHeight($options['titleFontSize']);
+    }
+    $this->addText($middle-$w/2,$this->y,$options['titleFontSize'],$title);
+    $this->y -= $options['titleGap'];
+  }
+
+        // margins may have changed on the newpage
+        $dm = $this->ez['leftMargin']-$baseLeftMargin;
+        foreach($basePos as $k=>$v){
+          $pos[$k]=$v+$dm;
+        }
+        $x0=$baseX0+$dm;
+        $x1=$baseX1+$dm;
+  
+  $y=$this->y; // to simplify the code a bit
+  
+  // make the table
+  $height = $this->getFontHeight($options['fontSize']);
+  $decender = $this->getFontDecender($options['fontSize']);
+
+  
+  
+  $y0=$y+$decender;
+  $dy=0;
+  if ($options['showHeadings']){
+    // this function will move the start of the table to a new page if it does not fit on this one
+    $headingHeight = $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
+    $y0 = $y+$headingHeight;
+    $y1 = $y;
+
+
+    $dm = $this->ez['leftMargin']-$baseLeftMargin;
+    foreach($basePos as $k=>$v){
+      $pos[$k]=$v+$dm;
+    }
+    $x0=$baseX0+$dm;
+    $x1=$baseX1+$dm;
+
+  } else {
+    $y1 = $y0;
+  }
+  $firstLine=1;
+
+  
+  // open an object here so that the text can be put in over the shading
+  if ($options['shaded']){
+    $this->saveState();
+    $textObjectId = $this->openObject();
+    $this->closeObject();
+    $this->addObject($textObjectId);
+    $this->reopenObject($textObjectId);
+  }
+  
+  $cnt=0;
+  $newPage=0;
+  foreach($data as $row){
+    $cnt++;
+    // the transaction support will be used to prevent rows being split
+    if ($options['splitRows']==0){
+      $pageStart = $this->ezPageCount;
+      if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
+        $columnStart = $this->ez['columns']['colNum'];
+      }
+      $this->transaction('start');
+      $row_orig = $row;
+      $y_orig = $y;
+      $y0_orig = $y0;
+      $y1_orig = $y1;
+    }
+    $ok=0;
+    $secondTurn=0;
+    while(!$abortTable && $ok == 0){
+
+    $mx=0;
+    $newRow=1;
+    while(!$abortTable && ($newPage || $newRow)){
+      
+      $y-=$height;
+      if ($newPage || $y<$this->ez['bottomMargin'] || (isset($options['minRowSpace']) && $y<($this->ez['bottomMargin']+$options['minRowSpace'])) ){
+        // check that enough rows are with the heading
+        if ($options['protectRows']>0 && $movedOnce==0 && $cnt<=$options['protectRows']){
+          // then we need to move the whole table onto the next page
+          $movedOnce = 1;
+          $abortTable = 1;
+        }
+      
+        $y2=$y-$mx+2*$height+$decender-$newRow*$height;
+        if ($options['showLines']){
+          if (!$options['showHeadings']){
+            $y0=$y1;
+          }
+          $this->ezPrvtTableDrawLines($pos,$options['gap'],$x0,$x1,$y0,$y1,$y2,$options['lineCol'],$options['innerLineThickness'],$options['outerLineThickness'],$options['showLines']);
+        }
+        if ($options['shaded']){
+          $this->closeObject();
+          $this->restoreState();
+        }
+        $this->ezNewPage();
+        // and the margins may have changed, this is due to the possibility of the columns being turned on
+        // as the columns are managed by manipulating the margins
+
+        $dm = $this->ez['leftMargin']-$baseLeftMargin;
+        foreach($basePos as $k=>$v){
+          $pos[$k]=$v+$dm;
+        }
+//        $x0=$x0+$dm;
+//        $x1=$x1+$dm;
+        $x0=$baseX0+$dm;
+        $x1=$baseX1+$dm;
+  
+        if ($options['shaded']){
+          $this->saveState();
+          $textObjectId = $this->openObject();
+          $this->closeObject();
+          $this->addObject($textObjectId);
+          $this->reopenObject($textObjectId);
+        }
+        $this->setColor($options['textCol'][0],$options['textCol'][1],$options['textCol'][2],1);
+        $y = $this->ez['pageHeight']-$this->ez['topMargin'];
+        $y0=$y+$decender;
+        $mx=0;
+        if ($options['showHeadings']){
+          $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
+          $y1=$y;
+        } else {
+          $y1=$y0;
+        }
+        $firstLine=1;
+        $y -= $height;
+      }
+      $newRow=0;
+      // write the actual data
+      // if these cells need to be split over a page, then $newPage will be set, and the remaining
+      // text will be placed in $leftOvers
+      $newPage=0;
+      $leftOvers=array();
+
+      foreach($cols as $colName=>$colTitle){
+        $this->ezSetY($y+$height);
+        $colNewPage=0;
+        if (isset($row[$colName])){
+          if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['link']) && strlen($options['cols'][$colName]['link'])){
+            
+            $lines = explode("\n",$row[$colName]);
+            if (isset($row[$options['cols'][$colName]['link']]) && strlen($row[$options['cols'][$colName]['link']])){
+              foreach($lines as $k=>$v){
+                $lines[$k]='<c:alink:'.$row[$options['cols'][$colName]['link']].'>'.$v.'</c:alink>';
+              }
+            }
+          } else {
+            $lines = explode("\n",$row[$colName]);
+          }
+        } else {
+          $lines = array();
+        }
+        $this->y -= $options['rowGap'];
+        foreach ($lines as $line){
+          $line = $this->ezProcessText($line);
+          $start=1;
+
+          while (strlen($line) || $start){
+            $start=0;
+            if (!$colNewPage){
+              $this->y=$this->y-$height;
+            }
+            if ($this->y < $this->ez['bottomMargin']){
+  //            $this->ezNewPage();
+              $newPage=1;  // whether a new page is required for any of the columns
+              $colNewPage=1; // whether a new page is required for this column
+            }
+            if ($colNewPage){
+              if (isset($leftOvers[$colName])){
+                $leftOvers[$colName].="\n".$line;
+              } else {
+                $leftOvers[$colName] = $line;
+              }
+              $line='';
+            } else {
+              if (isset($options['cols'][$colName]) && isset($options['cols'][$colName]['justification']) ){
+                $just = $options['cols'][$colName]['justification'];
+              } else {
+                $just='left';
+              }
+
+              $line=$this->addTextWrap($pos[$colName],$this->y,$maxWidth[$colName],$options['fontSize'],$line,$just);
+            }
+          }
+        }
+  
+        $dy=$y+$height-$this->y+$options['rowGap'];
+        if ($dy-$height*$newPage>$mx){
+          $mx=$dy-$height*$newPage;
+        }
+      }
+      // set $row to $leftOvers so that they will be processed onto the new page
+      $row = $leftOvers;
+      // now add the shading underneath
+      if ($options['shaded'] && $cnt%2==0){
+        $this->closeObject();
+        $this->setColor($options['shadeCol'][0],$options['shadeCol'][1],$options['shadeCol'][2],1);
+        $this->filledRectangle($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
+        $this->reopenObject($textObjectId);
+      }
+
+      if ($options['shaded']==2 && $cnt%2==1){
+        $this->closeObject();
+        $this->setColor($options['shadeCol2'][0],$options['shadeCol2'][1],$options['shadeCol2'][2],1);
+        $this->filledRectangle($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
+        $this->reopenObject($textObjectId);
+      }
+
+      if ($options['showLines']>1){
+        // then draw a line on the top of each block
+//        $this->closeObject();
+        $this->saveState();
+        $this->setStrokeColor($options['lineCol'][0],$options['lineCol'][1],$options['lineCol'][2],1);
+//        $this->line($x0-$options['gap']/2,$y+$decender+$height-$mx,$x1-$x0,$mx);
+        if ($firstLine){
+          $this->setLineStyle($options['outerLineThickness']);
+          $firstLine=0;
+        } else {
+          $this->setLineStyle($options['innerLineThickness']);
+        }
+        $this->line($x0-$options['gap']/2,$y+$decender+$height,$x1-$options['gap']/2,$y+$decender+$height);
+        $this->restoreState();
+//        $this->reopenObject($textObjectId);
+      }
+    } // end of while 
+    $y=$y-$mx+$height;
+    
+    // checking row split over pages
+    if ($options['splitRows']==0){
+      if ( ( ($this->ezPageCount != $pageStart) || (isset($this->ez['columns']) && $this->ez['columns']['on']==1 && $columnStart != $this->ez['columns']['colNum'] ))  && $secondTurn==0){
+        // then we need to go back and try that again !
+        $newPage=1;
+        $secondTurn=1;
+        $this->transaction('rewind');
+        $row = $row_orig;
+        $y = $y_orig;
+        $y0 = $y0_orig;
+        $y1 = $y1_orig;
+        $ok=0;
+
+        $dm = $this->ez['leftMargin']-$baseLeftMargin;
+        foreach($basePos as $k=>$v){
+          $pos[$k]=$v+$dm;
+        }
+        $x0=$baseX0+$dm;
+        $x1=$baseX1+$dm;
+
+      } else {
+        $this->transaction('commit');
+        $ok=1;
+      }
+    } else {
+      $ok=1;  // don't go round the loop if splitting rows is allowed
+    }
+    
+    }  // end of while to check for row splitting
+    if ($abortTable){
+      if ($ok==0){
+        $this->transaction('abort');
+      }
+      // only the outer transaction should be operational
+      $this->transaction('rewind');
+      $this->ezNewPage();
+      break;
+    }
+    
+  } // end of foreach ($data as $row)
+  
+  } // end of while ($abortTable)
+
+  // table has been put on the page, the rows guarded as required, commit.
+  $this->transaction('commit');
+
+  $y2=$y+$decender;
+  if ($options['showLines']){
+    if (!$options['showHeadings']){
+      $y0=$y1;
+    }
+    $this->ezPrvtTableDrawLines($pos,$options['gap'],$x0,$x1,$y0,$y1,$y2,$options['lineCol'],$options['innerLineThickness'],$options['outerLineThickness'],$options['showLines']);
+  }
+
+  // close the object for drawing the text on top
+  if ($options['shaded']){
+    $this->closeObject();
+    $this->restoreState();
+  }
+  
+  $this->y=$y;
+  return $y;
+}
+
+// ------------------------------------------------------------------------------
+function ezProcessText($text){
+  // this function will intially be used to implement underlining support, but could be used for a range of other
+  // purposes
+  $search = array('<u>','<U>','</u>','</U>');
+  $replace = array('<c:uline>','<c:uline>','</c:uline>','</c:uline>');
+  return str_replace($search,$replace,$text);
+}
+
+// ------------------------------------------------------------------------------
+
+function ezText($text,$size=0,$options=array(),$test=0){
+  // this will add a string of text to the document, starting at the current drawing
+  // position.
+  // it will wrap to keep within the margins, including optional offsets from the left
+  // and the right, if $size is not specified, then it will be the last one used, or
+  // the default value (12 I think).
+  // the text will go to the start of the next line when a return code "\n" is found.
+  // possible options are:
+  // 'left'=> number, gap to leave from the left margin
+  // 'right'=> number, gap to leave from the right margin
+  // 'aleft'=> number, absolute left position (overrides 'left')
+  // 'aright'=> number, absolute right position (overrides 'right')
+  // 'justification' => 'left','right','center','centre','full'
+
+  // only set one of the next two items (leading overrides spacing)
+  // 'leading' => number, defines the total height taken by the line, independent of the font height.
+  // 'spacing' => a real number, though usually set to one of 1, 1.5, 2 (line spacing as used in word processing)
+  
+  // if $test is set then this should just check if the text is going to flow onto a new page or not, returning true or false
+  
+  // apply the filtering which will make the underlining function.
+  $text = $this->ezProcessText($text);
+  
+  $newPage=false;
+  $store_y = $this->y;
+  
+  if (is_array($options) && isset($options['aleft'])){
+    $left=$options['aleft'];
+  } else {
+    $left = $this->ez['leftMargin'] + ((is_array($options) && isset($options['left']))?$options['left']:0);
+  }
+  if (is_array($options) && isset($options['aright'])){
+    $right=$options['aright'];
+  } else {
+    $right = $this->ez['pageWidth'] - $this->ez['rightMargin'] - ((is_array($options) && isset($options['right']))?$options['right']:0);
+  }
+  if ($size<=0){
+    $size = $this->ez['fontSize'];
+  } else {
+    $this->ez['fontSize']=$size;
+  }
+  
+  if (is_array($options) && isset($options['justification'])){
+    $just = $options['justification'];
+  } else {
+    $just = 'left';
+  }
+  
+  // modifications to give leading and spacing based on those given by Craig Heydenburg 1/1/02
+  if (is_array($options) && isset($options['leading'])) { ## use leading instead of spacing
+    $height = $options['leading'];
+	} else if (is_array($options) && isset($options['spacing'])) {
+    $height = $this->getFontHeight($size) * $options['spacing'];
+	} else {
+		$height = $this->getFontHeight($size);
+	}
+
+  
+  $lines = explode("\n",$text);
+  foreach ($lines as $line){
+    $start=1;
+    while (strlen($line) || $start){
+      $start=0;
+      $this->y=$this->y-$height;
+      if ($this->y < $this->ez['bottomMargin']){
+        if ($test){
+          $newPage=true;
+        } else {
+          $this->ezNewPage();
+          // and then re-calc the left and right, in case they have changed due to columns
+        }
+      }
+      if (is_array($options) && isset($options['aleft'])){
+        $left=$options['aleft'];
+      } else {
+        $left = $this->ez['leftMargin'] + ((is_array($options) && isset($options['left']))?$options['left']:0);
+      }
+      if (is_array($options) && isset($options['aright'])){
+        $right=$options['aright'];
+      } else {
+        $right = $this->ez['pageWidth'] - $this->ez['rightMargin'] - ((is_array($options) && isset($options['right']))?$options['right']:0);
+      }
+      $line=$this->addTextWrap($left,$this->y,$right-$left,$size,$line,$just,0,$test);
+    }
+  }
+
+  if ($test){
+    $this->y=$store_y;
+    return $newPage;
+  } else {
+    return $this->y;
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+function ezImage($image,$pad = 5,$width = 0,$resize = 'full',$just = 'center',$border = ''){
+	//beta ezimage function
+	if (stristr($image,'://'))//copy to temp file
+	{
+		$fp = @fopen($image,"rb");
+		while(!feof($fp))
+   		{
+      			$cont.= fread($fp,1024);
+   		}
+   		fclose($fp);
+		$image = tempnam ("/tmp", "php-pdf");
+		$fp2 = @fopen($image,"w");
+   		fwrite($fp2,$cont);
+  		fclose($fp2);
+		$temp = true;
+	}
+
+	if (!(file_exists($image))) return false; //return immediately if image file does not exist
+	$imageInfo = getimagesize($image);
+	switch ($imageInfo[2]){
+		case 2:
+			$type = "jpeg";
+			break;
+		case 3:
+			$type = "png";
+			break;
+		default:
+			return false; //return if file is not jpg or png
+	}
+	if ($width == 0) $width = $imageInfo[0]; //set width
+	$ratio = $imageInfo[0]/$imageInfo[1];
+
+	//get maximum width of image
+	if (isset($this->ez['columns']) && $this->ez['columns']['on'] == 1)
+	{
+		$bigwidth = $this->ez['columns']['width'] - ($pad * 2);
+	}
+	else
+	{
+		$bigwidth = $this->ez['pageWidth'] - ($pad * 2);
+	}
+	//fix width if larger than maximum or if $resize=full
+	if ($resize == 'full' || $resize == 'width' || $width > $bigwidth)
+	{
+		$width = $bigwidth;
+
+	}
+
+	$height = ($width/$ratio); //set height
+
+	//fix size if runs off page
+	if ($height > ($this->y - $this->ez['bottomMargin'] - ($pad * 2)))
+	{
+		if ($resize != 'full')
+		{
+			$this->ezNewPage();
+		}
+		else
+		{
+			$height = ($this->y - $this->ez['bottomMargin'] - ($pad * 2)); //shrink height
+			$width = ($height*$ratio); //fix width
+		}
+	}
+
+	//fix x-offset if image smaller than bigwidth
+	if ($width < $bigwidth)
+	{
+		//center if justification=center
+		if ($just == 'center')
+		{
+			$offset = ($bigwidth - $width) / 2;
+		}
+		//move to right if justification=right
+		if ($just == 'right')
+		{
+			$offset = ($bigwidth - $width);
+		}
+		//leave at left if justification=left
+		if ($just == 'left')
+		{
+			$offset = 0;
+		}
+	}
+
+
+	//call appropriate function
+	if ($type == "jpeg"){
+		$this->addJpegFromFile($image,$this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width);
+	}
+
+	if ($type == "png"){
+		$this->addPngFromFile($image,$this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width);
+	}
+	//draw border
+	if ($border != '')
+	{
+	if (!(isset($border['color'])))
+	{
+		$border['color']['red'] = .5;
+		$border['color']['blue'] = .5;
+		$border['color']['green'] = .5;
+	}
+	if (!(isset($border['width']))) $border['width'] = 1;
+	if (!(isset($border['cap']))) $border['cap'] = 'round';
+	if (!(isset($border['join']))) $border['join'] = 'round';
+	
+
+	$this->setStrokeColor($border['color']['red'],$border['color']['green'],$border['color']['blue']);
+	$this->setLineStyle($border['width'],$border['cap'],$border['join']);
+	$this->rectangle($this->ez['leftMargin'] + $pad + $offset, $this->y + $this->getFontHeight($this->ez['fontSize']) - $pad - $height,$width,$height);
+
+	}
+	// move y below image
+	$this->y = $this->y - $pad - $height;
+	//remove tempfile for remote images
+	if ($temp == true) unlink($image);
+
+}
+// ------------------------------------------------------------------------------
+
+// note that templating code is still considered developmental - have not really figured
+// out a good way of doing this yet.
+function loadTemplate($templateFile){
+  // this function will load the requested template ($file includes full or relative pathname)
+  // the code for the template will be modified to make it name safe, and then stored in 
+  // an array for later use
+  // The id of the template will be returned for the user to operate on it later
+  if (!file_exists($templateFile)){
+    return -1;
+  }
+
+  $code = implode('',file($templateFile));
+  if (!strlen($code)){
+    return;
+  }
+
+  $code = trim($code);
+  if (substr($code,0,5)=='<?php'){
+    $code = substr($code,5);
+  }
+  if (substr($code,-2)=='?>'){
+    $code = substr($code,0,strlen($code)-2);
+  }
+  if (isset($this->ez['numTemplates'])){
+    $newNum = $this->ez['numTemplates'];
+    $this->ez['numTemplates']++;
+  } else {
+    $newNum=0;
+    $this->ez['numTemplates']=1;
+    $this->ez['templates']=array();
+  }
+
+  $this->ez['templates'][$newNum]['code']=$code;
+
+  return $newNum;
+}
+
+// ------------------------------------------------------------------------------
+
+function execTemplate($id,$data=array(),$options=array()){
+  // execute the given template on the current document.
+  if (!isset($this->ez['templates'][$id])){
+    return;
+  }
+  eval($this->ez['templates'][$id]['code']);
+}
+
+// ------------------------------------------------------------------------------
+function ilink($info){
+  $this->alink($info,1);
+}
+
+function alink($info,$internal=0){
+  // a callback function to support the formation of clickable links within the document
+  $lineFactor=0.05; // the thickness of the line as a proportion of the height. also the drop of the line.
+  switch($info['status']){
+    case 'start':
+    case 'sol':
+      // the beginning of the link
+      // this should contain the URl for the link as the 'p' entry, and will also contain the value of 'nCallback'
+      if (!isset($this->ez['links'])){
+        $this->ez['links']=array();
+      }
+      $i = $info['nCallback'];
+      $this->ez['links'][$i] = array('x'=>$info['x'],'y'=>$info['y'],'angle'=>$info['angle'],'decender'=>$info['decender'],'height'=>$info['height'],'url'=>$info['p']);
+      if ($internal==0){
+        $this->saveState();
+        $this->setColor(0,0,1);
+        $this->setStrokeColor(0,0,1);
+        $thick = $info['height']*$lineFactor;
+        $this->setLineStyle($thick);
+      }
+      break;
+    case 'end':
+    case 'eol':
+      // the end of the link
+      // assume that it is the most recent opening which has closed
+      $i = $info['nCallback'];
+      $start = $this->ez['links'][$i];
+      // add underlining
+      if ($internal){
+        $this->addInternalLink($start['url'],$start['x'],$start['y']+$start['decender'],$info['x'],$start['y']+$start['decender']+$start['height']);
+      } else {
+        $a = deg2rad((float)$start['angle']-90.0);
+        $drop = $start['height']*$lineFactor*1.5;
+        $dropx = cos($a)*$drop;
+        $dropy = -sin($a)*$drop;
+        $this->line($start['x']-$dropx,$start['y']-$dropy,$info['x']-$dropx,$info['y']-$dropy);
+        $this->addLink($start['url'],$start['x'],$start['y']+$start['decender'],$info['x'],$start['y']+$start['decender']+$start['height']);
+        $this->restoreState();
+      }
+      break;
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+function uline($info){
+  // a callback function to support underlining
+  $lineFactor=0.05; // the thickness of the line as a proportion of the height. also the drop of the line.
+  switch($info['status']){
+    case 'start':
+    case 'sol':
+    
+      // the beginning of the underline zone
+      if (!isset($this->ez['links'])){
+        $this->ez['links']=array();
+      }
+      $i = $info['nCallback'];
+      $this->ez['links'][$i] = array('x'=>$info['x'],'y'=>$info['y'],'angle'=>$info['angle'],'decender'=>$info['decender'],'height'=>$info['height']);
+      $this->saveState();
+      $thick = $info['height']*$lineFactor;
+      $this->setLineStyle($thick);
+      break;
+    case 'end':
+    case 'eol':
+      // the end of the link
+      // assume that it is the most recent opening which has closed
+      $i = $info['nCallback'];
+      $start = $this->ez['links'][$i];
+      // add underlining
+      $a = deg2rad((float)$start['angle']-90.0);
+      $drop = $start['height']*$lineFactor*1.5;
+      $dropx = cos($a)*$drop;
+      $dropy = -sin($a)*$drop;
+      $this->line($start['x']-$dropx,$start['y']-$dropy,$info['x']-$dropx,$info['y']-$dropy);
+      $this->restoreState();
+      break;
+  }
+}
+
+// ------------------------------------------------------------------------------
+
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_bbox.php
===================================================================
--- branches/print_dev/http/classes/class_bbox.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_bbox.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,171 +1,171 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_point.php");
-
-/**
- * A bounding box consisting of an lower left and an upper right point, and an EPSG.
- */
-class Mapbender_bbox {
-	var $min;
-	var $max;
-	var $epsg;
-	
-	/**
-	 * @constructor
-	 */
-	function __construct() {
-		if (func_num_args() == 5) {
-			$param0 = func_get_arg(0);
-			$param1 = func_get_arg(1);
-			$param2 = func_get_arg(2);
-			$param3 = func_get_arg(3);
-			$param4 = func_get_arg(4);
-		}
-		else if (func_num_args() == 3) {
-			$param0 = func_get_arg(0);
-			$param1 = func_get_arg(1);
-			$param2 = func_get_arg(2);
-		}
-		else {
-			return;
-		}
-		
-		// params are point, point, epsg
-		if (is_a($param0, "Mapbender_point") && is_a($param1, "Mapbender_point") && !$param3 && !$param4) {
-			$e = new mb_notice("Mapbender_bbox: constructor: point1, point2, epsg");
-			$min = $param0; // is a Mapbender_point
-			$max = $param1; // is a Mapbender_point
-			$epsg = $param2; // is an EPSG code like "EPSG:4326"
-			
-			if ($min->isWestOf($max) && $min->isSouthOf($max)) {
-				if ($min->epsg == $max->epsg && $min->epsg == $epsg) {
-					$this->min = $min;
-					$this->max = $max;
-					$this->epsg = $epsg;
-				}
-				else {
-					$e = new mb_exception("Mapbender_bbox: constructor: EPSG mismatch!");
-				}
-			}
-			else {
-				$e = new mb_exception("Mapbender_bbox: constructor: min (".$this->min.") is not southwest of max (".$this->max.")!");
-			}
-		}
-		// params are x1, y1, x2, xy, epsg
-		else {
-			$e = new mb_notice("Mapbender_bbox: constructor: x1, y1, x2, y2, epsg");
-			$min = new Mapbender_point($param0, $param1, $param4);
-			$max = new Mapbender_point($param2, $param3, $param4);
-			$epsg = $param4; // is an EPSG code like "EPSG:4326"
-			
-			if ($min->isWestOf($max) && $min->isSouthOf($max)) {
-				if ($min->epsg == $max->epsg && $min->epsg == $epsg) {
-					$this->min = $min;
-					$this->max = $max;
-					$this->epsg = $epsg;
-				}
-				else {
-					$e = new mb_exception("Mapbender_bbox: constructor: EPSG mismatch!");
-				}
-			}
-			else {
-				$e = new mb_exception("Mapbender_bbox: constructor: min (".$this->min.") is not southwest of max (".$this->max.")!");
-			}
-			
-		}
-	}
-	
-	/**
-	 * Computes a new bounding box, bbox1 UNION bbox2
-	 */
-	static function union ($bboxArray) {
-		if (count($bboxArray) == 1) {
-			return array_pop($bboxArray);
-		}
-		elseif (count($bboxArray) >= 2) {
-			
-			$bbox1 = array_pop($bboxArray);
-			$bbox2 = Mapbender_bbox::union($bboxArray);
-
-			if (!($bbox1 != null && $bbox1->isValid()) && !($bbox2 != null && $bbox2->isValid())) {
-				$e = new mb_exception("Mapbender_bbox: union: both parameters invalid!");
-				return null;
-			}
-			elseif (!($bbox1 != null && $bbox1->isValid()) && ($bbox2 != null && $bbox2->isValid())) {
-				$e = new mb_exception("Mapbender_bbox: union: first parameter invalid!");
-				return $bbox2;
-			}
-			elseif (($bbox1 != null && $bbox1->isValid()) && !($bbox2 != null && $bbox2->isValid())) {
-				$e = new mb_exception("Mapbender_bbox: union: second parameter invalid!");
-				return $bbox1;
-			}
-			else {
-				if ($bbox1->epsg == $bbox2->epsg) {
-					$e = new mb_notice("Mapbender_bbox: union: bbox1 is: " . $bbox1);
-					$e = new mb_notice("Mapbender_bbox: union: bbox2 is: " . $bbox2);
-					$e = new mb_notice("Mapbender_bbox: union: merging bbox1 and bbox2...");
-					return new Mapbender_bbox(Mapbender_point::min($bbox1->min, $bbox2->min), Mapbender_point::max($bbox1->max, $bbox2->max), $bbox1->epsg);
-				}
-				else {
-					$e = new mb_exception("Mapbender_bbox: cannot process union with different EPSG codes");
-				}
-			}
-		}
-		else {
-			$e = new mb_exception("Mapbender_bbox: Invalid parameter (Not an array)!");
-		}
-		return null;
-	}
-	
-	/**
-	 * transforms this bbox in another EPSG
-	 * @param toEpsg transform the bbox to this EPSG code, example: "EPSG:4326" 
-	 */
-	function transform($toEpsg) {
-		if ($this->isValid()) {
-			$this->epsg = $toEpsg;
-			$this->min->transform($toEpsg);
-			$this->max->transform($toEpsg);
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * checks if lower left and upper right coordinate are set, as well as EPSG
-	 */
-	function isValid() {
-		if ($this->min != null && $this->max != null && $this->epsg != null) {
-			return true;
-		}
-		$e = new mb_exception("Mapbender_bbox: this is not a valid bbox!");
-		return false;
-	}
-	
-	function toHtml () {
-		return (string) $this->min->toHtml() . " | " . $this->max->toHtml(); 
-	}
-	
-	function __toString() {
-		return (string) "[" . $this->min . $this->max . " " . $this->epsg . "]"; 
-	}
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/class_point.php");
+
+/**
+ * A bounding box consisting of an lower left and an upper right point, and an EPSG.
+ */
+class Mapbender_bbox {
+	var $min;
+	var $max;
+	var $epsg;
+	
+	/**
+	 * @constructor
+	 */
+	function __construct() {
+		if (func_num_args() == 5) {
+			$param0 = func_get_arg(0);
+			$param1 = func_get_arg(1);
+			$param2 = func_get_arg(2);
+			$param3 = func_get_arg(3);
+			$param4 = func_get_arg(4);
+		}
+		else if (func_num_args() == 3) {
+			$param0 = func_get_arg(0);
+			$param1 = func_get_arg(1);
+			$param2 = func_get_arg(2);
+		}
+		else {
+			return;
+		}
+		
+		// params are point, point, epsg
+		if (is_a($param0, "Mapbender_point") && is_a($param1, "Mapbender_point") && !$param3 && !$param4) {
+			$e = new mb_notice("Mapbender_bbox: constructor: point1, point2, epsg");
+			$min = $param0; // is a Mapbender_point
+			$max = $param1; // is a Mapbender_point
+			$epsg = $param2; // is an EPSG code like "EPSG:4326"
+			
+			if ($min->isWestOf($max) && $min->isSouthOf($max)) {
+				if ($min->epsg == $max->epsg && $min->epsg == $epsg) {
+					$this->min = $min;
+					$this->max = $max;
+					$this->epsg = $epsg;
+				}
+				else {
+					$e = new mb_exception("Mapbender_bbox: constructor: EPSG mismatch!");
+				}
+			}
+			else {
+				$e = new mb_exception("Mapbender_bbox: constructor: min (".$this->min.") is not southwest of max (".$this->max.")!");
+			}
+		}
+		// params are x1, y1, x2, xy, epsg
+		else {
+			$e = new mb_notice("Mapbender_bbox: constructor: x1, y1, x2, y2, epsg");
+			$min = new Mapbender_point($param0, $param1, $param4);
+			$max = new Mapbender_point($param2, $param3, $param4);
+			$epsg = $param4; // is an EPSG code like "EPSG:4326"
+			
+			if ($min->isWestOf($max) && $min->isSouthOf($max)) {
+				if ($min->epsg == $max->epsg && $min->epsg == $epsg) {
+					$this->min = $min;
+					$this->max = $max;
+					$this->epsg = $epsg;
+				}
+				else {
+					$e = new mb_exception("Mapbender_bbox: constructor: EPSG mismatch!");
+				}
+			}
+			else {
+				$e = new mb_exception("Mapbender_bbox: constructor: min (".$this->min.") is not southwest of max (".$this->max.")!");
+			}
+			
+		}
+	}
+	
+	/**
+	 * Computes a new bounding box, bbox1 UNION bbox2
+	 */
+	static function union ($bboxArray) {
+		if (count($bboxArray) == 1) {
+			return array_pop($bboxArray);
+		}
+		elseif (count($bboxArray) >= 2) {
+			
+			$bbox1 = array_pop($bboxArray);
+			$bbox2 = Mapbender_bbox::union($bboxArray);
+
+			if (!($bbox1 != null && $bbox1->isValid()) && !($bbox2 != null && $bbox2->isValid())) {
+				$e = new mb_exception("Mapbender_bbox: union: both parameters invalid!");
+				return null;
+			}
+			elseif (!($bbox1 != null && $bbox1->isValid()) && ($bbox2 != null && $bbox2->isValid())) {
+				$e = new mb_exception("Mapbender_bbox: union: first parameter invalid!");
+				return $bbox2;
+			}
+			elseif (($bbox1 != null && $bbox1->isValid()) && !($bbox2 != null && $bbox2->isValid())) {
+				$e = new mb_exception("Mapbender_bbox: union: second parameter invalid!");
+				return $bbox1;
+			}
+			else {
+				if ($bbox1->epsg == $bbox2->epsg) {
+					$e = new mb_notice("Mapbender_bbox: union: bbox1 is: " . $bbox1);
+					$e = new mb_notice("Mapbender_bbox: union: bbox2 is: " . $bbox2);
+					$e = new mb_notice("Mapbender_bbox: union: merging bbox1 and bbox2...");
+					return new Mapbender_bbox(Mapbender_point::min($bbox1->min, $bbox2->min), Mapbender_point::max($bbox1->max, $bbox2->max), $bbox1->epsg);
+				}
+				else {
+					$e = new mb_exception("Mapbender_bbox: cannot process union with different EPSG codes");
+				}
+			}
+		}
+		else {
+			$e = new mb_exception("Mapbender_bbox: Invalid parameter (Not an array)!");
+		}
+		return null;
+	}
+	
+	/**
+	 * transforms this bbox in another EPSG
+	 * @param toEpsg transform the bbox to this EPSG code, example: "EPSG:4326" 
+	 */
+	function transform($toEpsg) {
+		if ($this->isValid()) {
+			$this->epsg = $toEpsg;
+			$this->min->transform($toEpsg);
+			$this->max->transform($toEpsg);
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * checks if lower left and upper right coordinate are set, as well as EPSG
+	 */
+	function isValid() {
+		if ($this->min != null && $this->max != null && $this->epsg != null) {
+			return true;
+		}
+		$e = new mb_exception("Mapbender_bbox: this is not a valid bbox!");
+		return false;
+	}
+	
+	function toHtml () {
+		return (string) $this->min->toHtml() . " | " . $this->max->toHtml(); 
+	}
+	
+	function __toString() {
+		return (string) "[" . $this->min . $this->max . " " . $this->epsg . "]"; 
+	}
+}
+?>

Modified: branches/print_dev/http/classes/class_checkInput.php
===================================================================
--- branches/print_dev/http/classes/class_checkInput.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_checkInput.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,56 +1,56 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_checkInput
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-class checkInput{
-	var $v;
-	function checkInput($q,$v,$t){
-		if(is_array($v) == false){
-			$v = array($v);
-		}
-		if(is_array($t) == false){
-			$t = array($t);
-		}
-		if(count($v) != count($t)){
-			$e = new mb_exception("array params and array types have a different count  in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$q);
-		}
-		if(PREPAREDSTATEMENTS == true && SYS_DBTYPE == "pgsql"){
-			$this->v = $v;
-		}
-		else{
-			for($i=0; $i<count($v); $i++){
-				if($t[$i] == 's'){
-					$v[$i] = db_escape_string($v[$i]);
-				}
-				else if($t[$i] == 'i'){
-					if(preg_match("/w/",$v[$i])){
-						$e = new mb_exception($_SERVER['SCRIPT_FILENAME'].": Unable to parse integer in: ".$q." with: param ".$i.",".$v[i]);
-						die("wrong data type in sql:".$q);
-					}					
-				}
-				else if($t[$i] == 'd'){
-					
-				}	
-			}
-			$this->v = $v;
-		}		
-	}	
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_checkInput
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+class checkInput{
+	var $v;
+	function checkInput($q,$v,$t){
+		if(is_array($v) == false){
+			$v = array($v);
+		}
+		if(is_array($t) == false){
+			$t = array($t);
+		}
+		if(count($v) != count($t)){
+			$e = new mb_exception("array params and array types have a different count  in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$q);
+		}
+		if(PREPAREDSTATEMENTS == true && SYS_DBTYPE == "pgsql"){
+			$this->v = $v;
+		}
+		else{
+			for($i=0; $i<count($v); $i++){
+				if($t[$i] == 's'){
+					$v[$i] = db_escape_string($v[$i]);
+				}
+				else if($t[$i] == 'i'){
+					if(preg_match("/w/",$v[$i])){
+						$e = new mb_exception($_SERVER['SCRIPT_FILENAME'].": Unable to parse integer in: ".$q." with: param ".$i.",".$v[i]);
+						die("wrong data type in sql:".$q);
+					}					
+				}
+				else if($t[$i] == 'd'){
+					
+				}	
+			}
+			$this->v = $v;
+		}		
+	}	
+}
+?>

Modified: branches/print_dev/http/classes/class_element.php
===================================================================
--- branches/print_dev/http/classes/class_element.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_element.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,260 +1,260 @@
-<?php
-# $Id: class_bbox.php 1965 2008-01-15 08:24:29Z christoph $
-# http://www.mapbender.org/index.php/
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-define("ELEMENT_PATTERN", "/sessionID/");
-
-class Element {
-	
-	var $guiId;
-	var $id;
-	var $pos;
-	var $isPublic;
-	var $comment;
-	var $title;
-	var $element;
-	var $src;
-	var $attributes;
-	var $left;
-	var $top;
-	var $width;
-	var $height;
-	var $zIndex;
-	var $moreStyles;
-	var $content;
-	var $closeTag;
-	var $jsFile;
-	var $mbMod;
-	var $target;
-	var $requires;
-	var $helpUrl;
-	var $isBodyAndUsesSplashScreen = false;
-	
-	public function __contruct() {
-		
-	}
-	
-	public function select ($id, $applicationId) {
-		$sql = "SELECT fkey_gui_id, e_id, e_pos, e_public, e_comment, e_public, ".
-				"gettext($1, e_title) as e_title, e_element, e_src, e_attributes, " .
-				"e_left, e_top, e_width, e_height, e_z_index, e_more_styles, " .
-				"e_content, e_closetag, e_js_file, e_mb_mod, e_target, " .
-				"e_requires, e_url FROM gui_element WHERE e_id = $2 AND " .
-				"fkey_gui_id = $3 LIMIT 1";
-		$v = array ($_SESSION["mb_lang"], $id, $applicationId);
-		$t = array ("s", "s", "s");
-		$res = db_prep_query($sql, $v, $t);
-		$row = db_fetch_array($res);
-		if ($row) {
-			$this->guiId = $applicationId;
-			$this->id = $row["e_id"];
-			$this->pos = $row["e_pos"];
-			$this->isPublic = $row["e_public"];
-			$this->comment = $row["e_comment"];
-			$this->title = $row["e_title"];
-			$this->element = $row["e_element"];
-			$this->src = $row["e_src"];
-			$this->attributes = $row["e_attributes"];
-			$this->left = $row["e_left"];
-			$this->top = $row["e_top"];
-			$this->width = $row["e_width"];
-			$this->height = $row["e_height"];
-			$this->zIndex = $row["e_z_index"];
-			$this->moreStyles = $row["e_more_styles"];
-			$this->content = $row["e_content"];
-			$this->closeTag = $row["e_closetag"];
-			$this->jsFile = $row["e_js_file"];
-			$this->mbMod = $row["e_mb_mod"];
-			$this->target = $row["e_target"];
-			$this->requires = $row["e_requires"];
-			$this->helpUrl = $row["e_url"];
-			return true;
-		}
-		return false;		
-	}
-	
-	public function __toString () {
-		return $this->toHtml();
-	}
-	
-	public function getJavaScriptModules () {
-		$jsArray = array();
-		if ($this->mbMod != "") {
-			$moduleArray = explode(",", $this->mbMod);
-			for ($i = 0; $i < count($moduleArray); $i++) {
-				$currentFile = dirname(__FILE__) . "/../javascripts/" . trim($moduleArray[$i]);
-				if (file_exists($currentFile)) {
-					array_push($jsArray, $currentFile);
-				}
-				else {
-					$e = new mb_exception("Javascript module not found: " . $currentFile);
-				}
-			}
-		}
-		return $jsArray;
-	}
-	
-	public function toHtmlArray () {
-		if ($this->isPublic) {
-			return array($this->getHtmlOpenTag(), $this->getHtmlContent(), $this->getHtmlCloseTag());	
-		}
-		return array("", "", "");
-	}
-	
-	public function toHtml () {
-		if ($this->isPublic) {
-			return implode("", $this->toHtmlArray());
-		}
-		return "";
-	}
-
-	private function getHtmlOpenTag () {
-		$openTag = "";
-	
-		if ($this->id) {
-			// tag name
-			$openTag .= "<" . $this->element . " ";
-			
-			// id and name
-			$openTag .= "id='" . $this->id . "' name='" . $this->id . "' ";
-			
-			// attributes
-			if ($this->attributes) {
-				$openTag .= stripslashes($this->replaceSessionStringByUrlParameters($this->attributes)) . " ";
-			}
-			
-			// title
-			if ($this->title) {
-				$openTag .= "title='" . $this->title . "' ";
-			}
-			
-			// src
-			if ($this->src) {
-   				$openTag .= "src = '" . $this->replaceSessionStringByUrlParameters($this->src);
-
-				// for iframes which are not "loadData", 
-				// add additional parameters
-				if ($this->closeTag == "iframe" && $this->id != "loadData") {
-					if(mb_strpos($this->src, "?")) {
-						$openTag .= "&";
-					}
-					else {
-	      				$openTag .= "?";
-      				}
-	      			$openTag .= "e_id_css=" . $this->id . "&" .
-	      					 "e_id= " . $this->id . "&" .
-	      					 "e_target=" . $this->target . "&" .
-	      					 $this->getUrlParameters();
-				}
-   				$openTag .= "' ";
-			}
-			
-			// style
-			$openTag .= " style = '";
-			if ($this->top != "" && $this->left != "") {
-				$openTag .= "position:absolute;" .
-						 "left:" . $this->left . ";" .
-						 "top:" . $this->top . ";";
-			}
-			if ($this->width != "" && $this->height != "") {
-				$openTag .= "width:" . $this->width . ";" .
-						 "height:" . $this->height . ";";
-			}
-			if ($this->zIndex) {
-		    	$openTag .= "z-index:" . $this->zIndex . ";";
-			}
-			if ($this->moreStyles) {
-		    	$openTag .= $this->moreStyles;
-			}
-			$openTag .= "'>";
-
-			if ($this->element == "body") {
-				$e_id = "body";
-				$gui_id = $this->guiId;
-				include(dirname(__FILE__)."/../include/dyn_php.php");
-				
-				$splashScreen = "";
-				
-				if ($use_load_message) {
-					$this->isBodyAndUsesSplashScreen = true;
-					if (isset($htmlWhileLoading) && $htmlWhileLoading != '') {
-						$splashScreen .= $htmlWhileLoading; 
-					} elseif (isset($includeWhileLoading) && $includeWhileLoading != '' && file_exists(dirname(__FILE__)."/".$includeWhileLoading)) { 
-						ob_start();
-						include(dirname(__FILE__)."/".$includeWhileLoading);
-						$splashScreen .= ob_get_contents();
-						ob_end_clean();
-					}
-					else {
-						$splashScreen .= "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
-							"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
-							MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
-							"loading application '" . $this->guiId . "'";
-					}
-				}	
-				$openTag .= "<p id='loading_mapbender' " .
-								"style='margin:0px;padding:0px;width:100%;height:100%;'>" . 
-								$splashScreen . "</p>" . 
-								"<p id='complete_mapbender' " .
-								"style='display:none'>";
-				unset ($e_id, $gui_id);
-			}
-		}
-		return $openTag;
-	}
-	
-	private function getHtmlContent () {
-		$htmlContent = "";
-		if ($this->content != "") {
-			$htmlContent .= stripslashes($this->content);
-		}
-		return $htmlContent;
-	}
-	
-	private function getHtmlCloseTag () {
-		if ($this->element == "body" && $this->isBodyAndUsesSplashScreen) {
-			return "</p></body>";
-		}
-		if ($this->closeTag != "") {
-			return "</" . $this->closeTag . ">";
-		}
-		return "";
-	}
-	
-	private function getUrlParameters () {
-		$urlParameters = SID;
-		if (isset($this->guiId)) {
-			$urlParameters .= "&guiID=" . $this->guiId;
-		}
-		if (isset($this->id)) {
-			$urlParameters .= "&elementID=" . $this->id;
-		}
-		return $urlParameters;
-	}
-	
-	private function replaceSessionStringByUrlParameters ($string) {
-		$urlParameters = $this->getUrlParameters();
-		return preg_replace(ELEMENT_PATTERN, $urlParameters, $string);
-	}
-	
-}
-
-
+<?php
+# $Id: class_bbox.php 1965 2008-01-15 08:24:29Z christoph $
+# http://www.mapbender.org/index.php/
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+define("ELEMENT_PATTERN", "/sessionID/");
+
+class Element {
+	
+	var $guiId;
+	var $id;
+	var $pos;
+	var $isPublic;
+	var $comment;
+	var $title;
+	var $element;
+	var $src;
+	var $attributes;
+	var $left;
+	var $top;
+	var $width;
+	var $height;
+	var $zIndex;
+	var $moreStyles;
+	var $content;
+	var $closeTag;
+	var $jsFile;
+	var $mbMod;
+	var $target;
+	var $requires;
+	var $helpUrl;
+	var $isBodyAndUsesSplashScreen = false;
+	
+	public function __contruct() {
+		
+	}
+	
+	public function select ($id, $applicationId) {
+		$sql = "SELECT fkey_gui_id, e_id, e_pos, e_public, e_comment, e_public, ".
+				"gettext($1, e_title) as e_title, e_element, e_src, e_attributes, " .
+				"e_left, e_top, e_width, e_height, e_z_index, e_more_styles, " .
+				"e_content, e_closetag, e_js_file, e_mb_mod, e_target, " .
+				"e_requires, e_url FROM gui_element WHERE e_id = $2 AND " .
+				"fkey_gui_id = $3 LIMIT 1";
+		$v = array ($_SESSION["mb_lang"], $id, $applicationId);
+		$t = array ("s", "s", "s");
+		$res = db_prep_query($sql, $v, $t);
+		$row = db_fetch_array($res);
+		if ($row) {
+			$this->guiId = $applicationId;
+			$this->id = $row["e_id"];
+			$this->pos = $row["e_pos"];
+			$this->isPublic = $row["e_public"];
+			$this->comment = $row["e_comment"];
+			$this->title = $row["e_title"];
+			$this->element = $row["e_element"];
+			$this->src = $row["e_src"];
+			$this->attributes = $row["e_attributes"];
+			$this->left = $row["e_left"];
+			$this->top = $row["e_top"];
+			$this->width = $row["e_width"];
+			$this->height = $row["e_height"];
+			$this->zIndex = $row["e_z_index"];
+			$this->moreStyles = $row["e_more_styles"];
+			$this->content = $row["e_content"];
+			$this->closeTag = $row["e_closetag"];
+			$this->jsFile = $row["e_js_file"];
+			$this->mbMod = $row["e_mb_mod"];
+			$this->target = $row["e_target"];
+			$this->requires = $row["e_requires"];
+			$this->helpUrl = $row["e_url"];
+			return true;
+		}
+		return false;		
+	}
+	
+	public function __toString () {
+		return $this->toHtml();
+	}
+	
+	public function getJavaScriptModules () {
+		$jsArray = array();
+		if ($this->mbMod != "") {
+			$moduleArray = explode(",", $this->mbMod);
+			for ($i = 0; $i < count($moduleArray); $i++) {
+				$currentFile = dirname(__FILE__) . "/../javascripts/" . trim($moduleArray[$i]);
+				if (file_exists($currentFile)) {
+					array_push($jsArray, $currentFile);
+				}
+				else {
+					$e = new mb_exception("Javascript module not found: " . $currentFile);
+				}
+			}
+		}
+		return $jsArray;
+	}
+	
+	public function toHtmlArray () {
+		if ($this->isPublic) {
+			return array($this->getHtmlOpenTag(), $this->getHtmlContent(), $this->getHtmlCloseTag());	
+		}
+		return array("", "", "");
+	}
+	
+	public function toHtml () {
+		if ($this->isPublic) {
+			return implode("", $this->toHtmlArray());
+		}
+		return "";
+	}
+
+	private function getHtmlOpenTag () {
+		$openTag = "";
+	
+		if ($this->id) {
+			// tag name
+			$openTag .= "<" . $this->element . " ";
+			
+			// id and name
+			$openTag .= "id='" . $this->id . "' name='" . $this->id . "' ";
+			
+			// attributes
+			if ($this->attributes) {
+				$openTag .= stripslashes($this->replaceSessionStringByUrlParameters($this->attributes)) . " ";
+			}
+			
+			// title
+			if ($this->title) {
+				$openTag .= "title='" . $this->title . "' ";
+			}
+			
+			// src
+			if ($this->src) {
+   				$openTag .= "src = '" . $this->replaceSessionStringByUrlParameters($this->src);
+
+				// for iframes which are not "loadData", 
+				// add additional parameters
+				if ($this->closeTag == "iframe" && $this->id != "loadData") {
+					if(mb_strpos($this->src, "?")) {
+						$openTag .= "&";
+					}
+					else {
+	      				$openTag .= "?";
+      				}
+	      			$openTag .= "e_id_css=" . $this->id . "&" .
+	      					 "e_id= " . $this->id . "&" .
+	      					 "e_target=" . $this->target . "&" .
+	      					 $this->getUrlParameters();
+				}
+   				$openTag .= "' ";
+			}
+			
+			// style
+			$openTag .= " style = '";
+			if ($this->top != "" && $this->left != "") {
+				$openTag .= "position:absolute;" .
+						 "left:" . $this->left . ";" .
+						 "top:" . $this->top . ";";
+			}
+			if ($this->width != "" && $this->height != "") {
+				$openTag .= "width:" . $this->width . ";" .
+						 "height:" . $this->height . ";";
+			}
+			if ($this->zIndex) {
+		    	$openTag .= "z-index:" . $this->zIndex . ";";
+			}
+			if ($this->moreStyles) {
+		    	$openTag .= $this->moreStyles;
+			}
+			$openTag .= "'>";
+
+			if ($this->element == "body") {
+				$e_id = "body";
+				$gui_id = $this->guiId;
+				include(dirname(__FILE__)."/../include/dyn_php.php");
+				
+				$splashScreen = "";
+				
+				if ($use_load_message) {
+					$this->isBodyAndUsesSplashScreen = true;
+					if (isset($htmlWhileLoading) && $htmlWhileLoading != '') {
+						$splashScreen .= $htmlWhileLoading; 
+					} elseif (isset($includeWhileLoading) && $includeWhileLoading != '' && file_exists(dirname(__FILE__)."/".$includeWhileLoading)) { 
+						ob_start();
+						include(dirname(__FILE__)."/".$includeWhileLoading);
+						$splashScreen .= ob_get_contents();
+						ob_end_clean();
+					}
+					else {
+						$splashScreen .= "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
+							"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
+							MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
+							"loading application '" . $this->guiId . "'";
+					}
+				}	
+				$openTag .= "<p id='loading_mapbender' " .
+								"style='margin:0px;padding:0px;width:100%;height:100%;'>" . 
+								$splashScreen . "</p>" . 
+								"<p id='complete_mapbender' " .
+								"style='display:none'>";
+				unset ($e_id, $gui_id);
+			}
+		}
+		return $openTag;
+	}
+	
+	private function getHtmlContent () {
+		$htmlContent = "";
+		if ($this->content != "") {
+			$htmlContent .= stripslashes($this->content);
+		}
+		return $htmlContent;
+	}
+	
+	private function getHtmlCloseTag () {
+		if ($this->element == "body" && $this->isBodyAndUsesSplashScreen) {
+			return "</p></body>";
+		}
+		if ($this->closeTag != "") {
+			return "</" . $this->closeTag . ">";
+		}
+		return "";
+	}
+	
+	private function getUrlParameters () {
+		$urlParameters = SID;
+		if (isset($this->guiId)) {
+			$urlParameters .= "&guiID=" . $this->guiId;
+		}
+		if (isset($this->id)) {
+			$urlParameters .= "&elementID=" . $this->id;
+		}
+		return $urlParameters;
+	}
+	
+	private function replaceSessionStringByUrlParameters ($string) {
+		$urlParameters = $this->getUrlParameters();
+		return preg_replace(ELEMENT_PATTERN, $urlParameters, $string);
+	}
+	
+}
+
+
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_kml.php
===================================================================
--- branches/print_dev/http/classes/class_kml.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_kml.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,176 +1,176 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_wmc.php
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-class kml {
-
-		var $kml_id;
-		var $lookAt_range = 5000;
-		var $lookAt_heading = 0;
-		var $lookAt_tilt = 0;
-		var $description;
-		var $title;
-		var $icon;
-		var $x;
-		var $y;
-		var $kml;
-					
-	function kml($title, $description, $x, $y, $icon) {
-  		$this->kml_id = md5(microtime());
-  		$this->x = $x;
-  		$this->y = $y;
-  		$this->icon = $icon;
-  		$this->title = $title;
-  		$this->description = $description;
-	} 
-
-	function setLookAt($range, $heading) {
-		$this->lookAt_range = $range;
-		$this->lookAt_heading = $heading;
-	}
-	
-	function createObjFromKML($kml_doc) {
-		$section = null;
-		$values = null;
-		$tags = null;
-
-		$data = $kml_doc;
-		
-		if(!$data){
-			echo "document empty.";
-			return false;
-		}
-		
-		$this->kml = $data;
-
-		$parser = xml_parser_create(CHARSET);
-		xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
-		xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
-		xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
-		xml_parse_into_struct($parser,$data,$values,$tags);
-		xml_parser_free($parser);
-		
-		$cnt_format = 0;
-		$parent = array();
-		$myParent = array();
-		$cnt_layer = -1;
-		$layer_style = array();
-		$cnt_styles = -1;
-		
-		foreach ($values as $element) {
-			if(mb_strtoupper($element[tag]) == "KML" && $element[type] == "open"){
-				$section = "kml";
-			}
-			if ($section == "kml" && mb_strtoupper($element[tag]) == "PLACEMARK" && $element[type] == "open") {
-				$section = "placemark";
-			}
-			if ($section == "placemark" && mb_strtoupper($element[tag]) == "DESCRIPTION" && $element[type] == "complete") {
-				$this->description = $element[value];
-			}
-			if ($section == "placemark" && mb_strtoupper($element[tag]) == "NAME" && $element[type] == "complete") {
-				$this->title = $element[value];
-			}
-			if ($section == "placemark" && mb_strtoupper($element[tag]) == "LOOKAT" && $element[type] == "open") {
-				$section = "lookat";
-			}
-			if ($section == "lookat") {
-				
-				if (mb_strtoupper($element[tag]) == "RANGE" && $element[type] == "complete") {
-					$this->lookAt_range = $element[value]; 
-				}
-				if (mb_strtoupper($element[tag]) == "HEADING" && $element[type] == "complete") {
-					$this->lookAt_heading = $element[value]; 
-				}
-				if (mb_strtoupper($element[tag]) == "TILT" && $element[type] == "complete") {
-					$this->lookAt_tilt = $element[value]; 
-				}
-			}
-			if (mb_strtoupper($element[tag]) == "STYLE" && $element[type] == "open") {
-				$section = "style";
-			}
-			if ($section == "style" && mb_strtoupper($element[tag]) == "ICONSTYLE" && $element[type] == "open") {
-				$section = "iconstyle";
-			}
-			if ($section == "iconstyle" && mb_strtoupper($element[tag]) == "ICON" && $element[type] == "open") {
-				$section = "icon";
-			}
-			if ($section == "icon" && mb_strtoupper($element[tag]) == "HREF" && $element[type] == "complete") {
-				$this->icon = $element[value];
-			}
-			if (mb_strtoupper($element[tag]) == "POINT" && $element[type] == "open") {
-				$section = "point";
-			}
-			if ($section == "point" && mb_strtoupper($element[tag]) == "COORDINATES" && $element[type] == "complete") {
-				$array = explode(",", $element[value]);
-				$this->x = $array[0];
-				$this->y = $array[1];
-			}
-		}
-		return true;
-	}
-
-	function createObjFromDB($kml_id) {
-		$this->kml_id = $kml_id;
-
-		$sql = "SELECT kml FROM mb_meetingpoint WHERE mb_meetingpoint_id = $1";
-		$v = array($kml_id);
-		$t = array('s');
-		$res = db_prep_query($sql, $v, $t);
-		$row = db_fetch_array($res);
-		return $this->createObjFromKML($row['kml']);
-	}
-
-	function createKMLFromObj(){
-		$kml = "";
-		$kml .= "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>\n";
-		$kml .= "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n";
-		$kml .= "<Placemark>\n";
-		$kml .= "\t<description>" . $this->description . "</description>\n";
-		$kml .= "\t<name>" . $this->title . "</name>\n";
-		$kml .= "\t<LookAt>\n";
-		$kml .= "\t\t<longitude>" . $this->x . "</longitude>\n";
-		$kml .= "\t\t<latitude>" . $this->y . "</latitude>\n";
-		$kml .= "\t\t<range>" . $this->lookAt_range . "</range>\n";
-		$kml .= "\t\t<tilt>" . $this->lookAt_tilt . "</tilt>\n";
-		$kml .= "\t\t<heading>" . $this->lookAt_heading . "</heading>\n";
-		$kml .= "\t</LookAt>\n";
-		$kml .= "\t<visibility>0</visibility>\n";
-		$kml .= "\t<Style>\n";
-		$kml .= "\t\t<IconStyle>\n";
-		$kml .= "\t\t\t<Icon>\n";
-		$kml .= "\t\t\t\t<href>" . $this->icon . "</href>\n";
-		$kml .= "\t\t\t</Icon>\n";
-		$kml .= "\t\t</IconStyle>\n";
-		$kml .= "\t</Style>\n";
-		$kml .= "\t<Point>\n";
-		$kml .= "\t\t<extrude>1</extrude>\n";
-		$kml .= "\t\t<coordinates>" . $this->x . "," . $this->y . "</coordinates>\n";
-		$kml .= "\t</Point>\n";
-		$kml .= "</Placemark>\n";
-		$kml .= "</kml>";
-		
-		$this->kml = $kml;
-		
-		return $kml;
-	}
-
-} 
-// end class
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_wmc.php
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+class kml {
+
+		var $kml_id;
+		var $lookAt_range = 5000;
+		var $lookAt_heading = 0;
+		var $lookAt_tilt = 0;
+		var $description;
+		var $title;
+		var $icon;
+		var $x;
+		var $y;
+		var $kml;
+					
+	function kml($title, $description, $x, $y, $icon) {
+  		$this->kml_id = md5(microtime());
+  		$this->x = $x;
+  		$this->y = $y;
+  		$this->icon = $icon;
+  		$this->title = $title;
+  		$this->description = $description;
+	} 
+
+	function setLookAt($range, $heading) {
+		$this->lookAt_range = $range;
+		$this->lookAt_heading = $heading;
+	}
+	
+	function createObjFromKML($kml_doc) {
+		$section = null;
+		$values = null;
+		$tags = null;
+
+		$data = $kml_doc;
+		
+		if(!$data){
+			echo "document empty.";
+			return false;
+		}
+		
+		$this->kml = $data;
+
+		$parser = xml_parser_create(CHARSET);
+		xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
+		xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
+		xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
+		xml_parse_into_struct($parser,$data,$values,$tags);
+		xml_parser_free($parser);
+		
+		$cnt_format = 0;
+		$parent = array();
+		$myParent = array();
+		$cnt_layer = -1;
+		$layer_style = array();
+		$cnt_styles = -1;
+		
+		foreach ($values as $element) {
+			if(mb_strtoupper($element[tag]) == "KML" && $element[type] == "open"){
+				$section = "kml";
+			}
+			if ($section == "kml" && mb_strtoupper($element[tag]) == "PLACEMARK" && $element[type] == "open") {
+				$section = "placemark";
+			}
+			if ($section == "placemark" && mb_strtoupper($element[tag]) == "DESCRIPTION" && $element[type] == "complete") {
+				$this->description = $element[value];
+			}
+			if ($section == "placemark" && mb_strtoupper($element[tag]) == "NAME" && $element[type] == "complete") {
+				$this->title = $element[value];
+			}
+			if ($section == "placemark" && mb_strtoupper($element[tag]) == "LOOKAT" && $element[type] == "open") {
+				$section = "lookat";
+			}
+			if ($section == "lookat") {
+				
+				if (mb_strtoupper($element[tag]) == "RANGE" && $element[type] == "complete") {
+					$this->lookAt_range = $element[value]; 
+				}
+				if (mb_strtoupper($element[tag]) == "HEADING" && $element[type] == "complete") {
+					$this->lookAt_heading = $element[value]; 
+				}
+				if (mb_strtoupper($element[tag]) == "TILT" && $element[type] == "complete") {
+					$this->lookAt_tilt = $element[value]; 
+				}
+			}
+			if (mb_strtoupper($element[tag]) == "STYLE" && $element[type] == "open") {
+				$section = "style";
+			}
+			if ($section == "style" && mb_strtoupper($element[tag]) == "ICONSTYLE" && $element[type] == "open") {
+				$section = "iconstyle";
+			}
+			if ($section == "iconstyle" && mb_strtoupper($element[tag]) == "ICON" && $element[type] == "open") {
+				$section = "icon";
+			}
+			if ($section == "icon" && mb_strtoupper($element[tag]) == "HREF" && $element[type] == "complete") {
+				$this->icon = $element[value];
+			}
+			if (mb_strtoupper($element[tag]) == "POINT" && $element[type] == "open") {
+				$section = "point";
+			}
+			if ($section == "point" && mb_strtoupper($element[tag]) == "COORDINATES" && $element[type] == "complete") {
+				$array = explode(",", $element[value]);
+				$this->x = $array[0];
+				$this->y = $array[1];
+			}
+		}
+		return true;
+	}
+
+	function createObjFromDB($kml_id) {
+		$this->kml_id = $kml_id;
+
+		$sql = "SELECT kml FROM mb_meetingpoint WHERE mb_meetingpoint_id = $1";
+		$v = array($kml_id);
+		$t = array('s');
+		$res = db_prep_query($sql, $v, $t);
+		$row = db_fetch_array($res);
+		return $this->createObjFromKML($row['kml']);
+	}
+
+	function createKMLFromObj(){
+		$kml = "";
+		$kml .= "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>\n";
+		$kml .= "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n";
+		$kml .= "<Placemark>\n";
+		$kml .= "\t<description>" . $this->description . "</description>\n";
+		$kml .= "\t<name>" . $this->title . "</name>\n";
+		$kml .= "\t<LookAt>\n";
+		$kml .= "\t\t<longitude>" . $this->x . "</longitude>\n";
+		$kml .= "\t\t<latitude>" . $this->y . "</latitude>\n";
+		$kml .= "\t\t<range>" . $this->lookAt_range . "</range>\n";
+		$kml .= "\t\t<tilt>" . $this->lookAt_tilt . "</tilt>\n";
+		$kml .= "\t\t<heading>" . $this->lookAt_heading . "</heading>\n";
+		$kml .= "\t</LookAt>\n";
+		$kml .= "\t<visibility>0</visibility>\n";
+		$kml .= "\t<Style>\n";
+		$kml .= "\t\t<IconStyle>\n";
+		$kml .= "\t\t\t<Icon>\n";
+		$kml .= "\t\t\t\t<href>" . $this->icon . "</href>\n";
+		$kml .= "\t\t\t</Icon>\n";
+		$kml .= "\t\t</IconStyle>\n";
+		$kml .= "\t</Style>\n";
+		$kml .= "\t<Point>\n";
+		$kml .= "\t\t<extrude>1</extrude>\n";
+		$kml .= "\t\t<coordinates>" . $this->x . "," . $this->y . "</coordinates>\n";
+		$kml .= "\t</Point>\n";
+		$kml .= "</Placemark>\n";
+		$kml .= "</kml>";
+		
+		$this->kml = $kml;
+		
+		return $kml;
+	}
+
+} 
+// end class
+?>

Modified: branches/print_dev/http/classes/class_kml_ows.php
===================================================================
--- branches/print_dev/http/classes/class_kml_ows.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_kml_ows.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,626 +1,626 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_wmc.php
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_point.php");
-
-require_once(dirname(__FILE__)."/../classes/class_kml_geometry.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_placemark.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_parser_ows.php");;
-
-/**
- * Allows parsing a KML file, extracting the placemarks.
- * 
- * @package KML
- */
-class KML {
-
-	//
-	//
-	// ------------------------------- public -----------------------------------------------
-	//
-	//
-
-	/**
-	 * The constructor function, currently empty.
-	 */				
-	public function __construct() {
-	} 
-
-	public function toSingleLineStringKml() {
-		//KML 2.2 output
-		$doc = new DOMDocument("1.0", CHARSET);
-		$doc->preserveWhiteSpace = false;
-	
-		// attach kml and Document tag
-		$e_kml = $doc->createElementNS("http://earth.google.com/kml/2.2", "kml");
-		$e_document = $doc->createElement("Document");
-		$e_kml->appendChild($e_document);
-		$doc->appendChild($e_kml);
-	
-		// attach placemarks
-		$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
-
-		$lineStyleNode = $doc->createElement("Style");
-		$lineStyleNode->setAttribute("id", "linestyleExample");
-		$lineStyleColorNode = $doc->createElement("color", "7f0000ff");
-		$lineStyleWidthNode = $doc->createElement("width", 4);
-		$lineStyleNode->appendChild($lineStyleColorNode);
-		$lineStyleNode->appendChild($lineStyleWidthNode);
-		$e_document->appendChild($lineStyleNode);
-		
-		//
-		// line segments first
-		//
-		$coordinates = "";
-
-		for ($i = 0; $i < count($this->placemarkArray); $i++) {
-			$currentPlacemark = $this->placemarkArray[$i];
-			$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
-
-			switch ($currentPlacemark->getGeometryType()) {
-				case "KMLLine" :
-					$coordinatesArray = $currentPlacemark->getGeometry()->getPointArray();
-					for ($j = 0; $j < count($coordinatesArray); $j++) {
-						if (!($j == 0 && $i == 0)) {
-							$coordinates .= " ";
-						}
-						$coordinates .= $coordinatesArray[$j]["x"] . "," . $coordinatesArray[$j]["y"] . "," . $coordinatesArray[$j]["z"];
-						
-					}
-					break;
-			}
-		}
-		// create a placemark tag with a geometry and add it to the document
-		$e_coordinates = $doc->createElement("coordinates", $coordinates);
-		$e_geometry = $doc->createElement("LineString");
-		$e_geometry->appendChild($e_coordinates);
-		$e_placemark = $doc->createElement("Placemark");
-		$e_placemark->appendChild($e_geometry);
-		$e_pl_name = $doc->createElement("name", "Route");
-		$e_placemark->appendChild($e_pl_name);
-		$e_pl_style = $doc->createElement("styleUrl", "#linestyleExample");
-		$e_placemark->appendChild($e_pl_style);
-		$e_document->appendChild($e_placemark);
-		
-/*		
-		//
-		// now pois
-		//
-		// attach placemarks
-		$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
-		for ($i = 0; $i < count($this->placemarkArray); $i++) {
-			$currentPlacemark = $this->placemarkArray[$i];
-
-			$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
-			
-			$pl_instructions = $currentPlacemark->getProperty("instruction");
-			$pl_name_array = array();
-			$pl_name = false;
-			$pl_description = false;
-			if ($pl_instructions != null) {
-				$pl_name_array = explode("|", $pl_instructions);
-			}
-
-			switch ($currentPlacemark->getGeometryType()) {
-				case "KMLPoint" :
-					if (count($pl_name_array) > 2) {
-						$pl_name = $pl_name_array[0];
-						$pl_description = $pl_name_array[1];
-					}
-					$e_geometry = $doc->createElement("Point");
-					$point = $currentPlacemark->getGeometry()->getPoint();
-					$coordinates = $point["x"] . "," . $point["y"];
-					$e_coordinates = $doc->createElement("coordinates", $coordinates);
-					$e_geometry->appendChild($e_coordinates);
-					break;
-
-			}
-			// create a placemark tag with a geometry and add it to the document
-			if ($e_geometry) {
-				$e_placemark = $doc->createElement("Placemark");
-				$e_placemark->appendChild($e_geometry);
-				if ($pl_name) {
-					$e_pl_name = $doc->createElement("name", $pl_name);
-					$e_placemark->appendChild($e_pl_name);
-				}
-				if ($pl_description) {
-					$e_pl_description = $doc->createElement("description", $pl_description);
-					$e_placemark->appendChild($e_pl_description);
-				}
-				$e_document->appendChild($e_placemark);
-			}
-		}
-*/
-		return $doc->saveXML();
-	}
-	
-	/**
-	 * @return string the KML document.
-	 */
-	public function __toString() {
-		
-	
-		if (!$this->kml) {
-			//KML 2.2 output
-			$doc = new DOMDocument("1.0", CHARSET);
-			$doc->preserveWhiteSpace = false;
-	
-			// attach kml and Document tag
-			$e_kml = $doc->createElementNS("http://earth.google.com/kml/2.2", "kml");
-			$e_document = $doc->createElement("Document");
-			$e_kml->appendChild($e_document);
-			$doc->appendChild($e_kml);
-	
-			// attach placemarks
-			$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
-			for ($i = 0; $i < count($this->placemarkArray); $i++) {
-				$currentPlacemark = $this->placemarkArray[$i];
-
-				$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
-				
-				$pl_instructions = $currentPlacemark->getProperty("instruction");
-				$pl_name_array = array();
-				$pl_name = false;
-				$pl_description = false;
-				if ($pl_instructions != null) {
-					$pl_name_array = explode("|", $pl_instructions);
-				}
-
-				switch ($currentPlacemark->getGeometryType()) {
-					case "KMLPoint" :
-						if (count($pl_name_array) > 2) {
-							$pl_name = $pl_name_array[0];
-							$pl_description = $pl_name_array[1];
-						}
-						$e_geometry = $doc->createElement("Point");
-						$point = $currentPlacemark->getGeometry()->getPoint();
-						$coordinates = $point["x"] . "," . $point["y"];
-						$e_coordinates = $doc->createElement("coordinates", $coordinates);
-						$e_geometry->appendChild($e_coordinates);
-						break;
-					
-/* TODO:Polygons
-					case "KMLPolygon" :
-						$e_geometry = $doc->createElement("Polygon");
-						$e_outer = $doc->createElement("OuterBoundaryIs");
-						$e_outer_lr = $doc->createElement("LinearRing");
-						$outer_coordinates = ""; // TODO: get coords from placemark
-						$e_outer_coordinates = $doc->createElement("Coordinates", $outer_coordinates);
-						
-						$e_outer_lr->appendChild($e_outer_coordinates);
-						$e_outer->appendChild($e_outer_lr);
-						
-						for ($j = 0; $j < $currentPlacemark; $j++) {
-							
-						}
-						
-						$e_geometry->appendChild($e_coordinates);
-					outerBoundaryIs"}->{"LinearRing"}->{"coordinates
-					
-						break;
-*/					
-					case "KMLLine" :
-						if (count($pl_name_array) > 2) {
-							$pl_description = $pl_name_array[1];
-						}
-						$e_geometry = $doc->createElement("LineString");
-						$coordinatesArray = $currentPlacemark->getGeometry()->getPointArray();
-						$coordinates = "";
-						for ($j = 0; $j < count($coordinatesArray); $j++) {
-							if ($j > 0) {
-								$coordinates .= " ";
-							}
-							$coordinates .= $coordinatesArray[$j]["x"] . "," . $coordinatesArray[$j]["y"] . "," . $coordinatesArray[$j]["z"];
-							
-						}
-						$e_coordinates = $doc->createElement("coordinates", $coordinates);
-						$e_geometry->appendChild($e_coordinates);
-						break;
-
-/*	TODO: Multigeometries				
-					case "KMLMultiGeometry" :
-						break;
-*/
-				}
-				// create a placemark tag with a geometry and add it to the document
-				if ($e_geometry) {
-					$e_placemark = $doc->createElement("Placemark");
-					$e_placemark->appendChild($e_geometry);
-					if ($pl_name) {
-						$e_pl_name = $doc->createElement("name", $pl_name);
-						$e_placemark->appendChild($e_pl_name);
-					}
-					if ($pl_description) {
-						$e_pl_description = $doc->createElement("description", $pl_description);
-						$e_placemark->appendChild($e_pl_description);
-					}
-					$e_document->appendChild($e_placemark);
-				}
-			}
-			$this->kml = $doc->saveXML();
-		}
-		return $this->kml;
-	}
-	
-	/**
-	 * @return string the ID of this KML.
-	 */
-	public function getId () {
-		return $this->id;
-	}
-	
-	/**
-	 * parses an incoming KML, creates the object, 
-	 * stores the kml in the object and in the database.
-	 * 
-	 * @param  string  a KML document.
-	 * @return boolean true if the parsing succeded, else false.
-	 */
-	public function parseKml ($kml) {
-		$this->kml = $kml;
-
-		if (!$this->storeInDb()) {
-			return false;
-		}
-
-		$parser = new KmlOwsParser();
-		$parser->parseKML($kml, $this->id);
-		$this->placemarkArray = $parser->placemarkArray; 
-
-		return true;
-	}
-	
-	/**
-	 * parses an incoming GeoJSON, creates the object, 
-	 * stores the kml in the object and in the database.
-	 * 
-	 * @param string a geoJSON.
-	 * @return boolean true if the parsing succeded, else false.
-	 */
-	public function parseGeoJSON ($geoJSON) {
-		$this->kml = "";
-
-		if (!$this->storeInDb()) {
-			return false;
-		}
-
-		$parser = new KmlOwsParser();
-		$parser->parseGeoJSON($geoJSON, $this->id);
-		$e = new mb_notice("parsing finished...#placemarks: " . count($this->placemarkArray) . " (" . count($parser->placemarkArray) . ")");
-		$this->placemarkArray = $parser->placemarkArray; 
-
-//		print_r($this);
-		
-//		$this->kml = $this->__toString();
-
-//		$this->updateInDb($this->kml, $this->id);
-		return true;
-	}
-	
-	/**
-	 * @return string the geoJSON representation of the KML.
-	 */
-	public function toGeoJSON() {
-		$str = "";
-		$numberOfPlacemarks = count($this->placemarkArray);
-		if ($numberOfPlacemarks > 0) {
-			$str .= "{\"type\": \"FeatureCollection\", \"features\": [";
-			for ($i=0; $i < $numberOfPlacemarks; $i++) {
-				if ($i > 0) {
-					$str .= ",";
-				}	
-				$str .= $this->placemarkArray[$i]->toGeoJSON();
-			}
-			$str .= "]}";
-		}
-		else {
-			$e = new mb_exception("KML: toGeoJSON: this placemarkArray is empty!");
-		}
-		return $str;
-	}
-
-	private function updateInDb($kmlDoc, $kmlId) {
-		$sql = "UPDATE gui_kml SET kml_doc = $1 WHERE kml_id = $2";
-		$v = array($kmlDoc, $kmlId);
-		$t = array("s", "i");
-		$result = db_prep_query($sql, $v, $t);
-		if (!$result) {
-			$e = new mb_exception("class_kml: kml update failed! " . db_error());
-			return false;
-		}
-	}
-
-	public function updateKml ($kmlId, $placemarkId, $geoJSON) {
-		$kmlFromDb = $this->getKmlDocumentFromDB($kmlId);
-		 
-		if ($kmlFromDb !== NULL) {
-			// load the KML from the database in the DOM object
-			$kmlDoc_DOM = new DOMDocument("1.0");
-			$kmlDoc_DOM->encoding = CHARSET;
-			$kmlDoc_DOM->preserveWhiteSpace = false;
-			$kmlDoc_DOM->loadXML($kmlFromDb); 
-
-			//load the geoJSON
-			$json = new Mapbender_JSON();
-			$geoObj = $json->decode($geoJSON);
-
-			// construct an array that holds all metadata of the placemark
-			$metadataObj = $geoObj->properties;
-			
-			// construct an array that holds all geometries of the placemark
-			$geometryObj = $geoObj->geometry;
-			$geometryType = $geometryObj->type;
-			if ($geometryType == "GeometryCollection") {
-				$geometryArray = $geometryObj->geometries;
-			}
-			else if ($geometryType == "Point" || $geometryType == "LineString" || $geometryType == "Polygon") {
-				$geometryArray = array($geometryObj);
-			}
-			else {
-				$e = new mb_exception("class_kml: Invalid geometry type " . $geometryType);
-				return false;
-			}
-
-			//
-			// apply the changes
-			//
-			
-			$currentPlacemarkArray = $kmlDoc_DOM->getElementsByTagName("Placemark");
-			$currentPlacemark = $currentPlacemarkArray->item($placemarkId);
-
-			if ($currentPlacemark) {
-				$metadataUpdateSuccessful = $this->updateMetadata($currentPlacemark, $metadataObj);
-				$geometryUpdateSuccessful = $this->updateGeometries($currentPlacemark, $geometryArray);
-			}
-			else {
-				$e = new mb_exception("class_kml.php: updateKml: placemark " . $placemarkId . " not found in KML " . $kmlId . ".");
-				return false;
-			}
-
-			if ($metadataUpdateSuccessful && $geometryUpdateSuccessful) {
-				$updatedKml = $kmlDoc_DOM->saveXML();
-
-				$this->updateInDb($updatedKml, $kmlId);
-			}
-			else {
-				if (!$metadataUpdateSuccessful) {
-					$e = new mb_exception("class_kml: Updating the metadata failed, no database update.");
-				}
-				if (!$geometryUpdateSuccessful) {
-					$e = new mb_exception("class_kml: Updating the geometries failed, no database update.");
-				}
-				return false;
-			}
-		}
-		else {
-			$e = new mb_exception("class_kml: No KML found in database, no database update. " . db_error());
-			return false;
-		}
-		return true;
-	}
-
-	//
-	//
-	// ------------------------------- private -----------------------------------------------
-	//
-	//
-		
-	/**
-	 * Store this KML in the database, and sets the ID.
-	 * 
-	 * @return boolean true, if the KML could be stored in the database; else false.
-	 */
-	private function storeInDb () {
-		if ($_SESSION["mb_user_id"] && $_SESSION["mb_user_gui"]) {
-			$con = db_connect(DBSERVER,OWNER,PW);
-			db_select_db(DB,$con);
-	
-			$sql  = "INSERT INTO gui_kml ";
-			$sql .= "(fkey_mb_user_id, fkey_gui_id, kml_doc, kml_name, kml_description, kml_timestamp) ";
-			$sql .= "VALUES ";
-			$sql .= "($1, $2, $3, $4, $5, $6)";
-			$v = array ($_SESSION["mb_user_id"], $_SESSION["mb_user_gui"], $this->kml, "name", "description", time());
-			$t = array ("i", "s", "s", "s", "s", "s");
-			$res = db_prep_query($sql, $v, $t);
-			if (!$res) {
-				$e = new mb_exception("class_kml.php: storeInDb: failed to store KML in database: " . db_error());
-				return false;
-			}
-	
-			$this->id = db_insert_id($con, "gui_kml", "kml_id");
-			return true;
-		}
-		else {
-			// should be false, but code in caller has to be changed first.
-			return true;
-		}
-	}
-
-	/**
-	 * @param  integer  the ID of the KML.
-	 * @return string   the KML document with the given ID.
-	 */
-	public function getKmlDocumentFromDB ($kmlId) {
-		$con = db_connect(DBSERVER,OWNER,PW);
-		db_select_db(DB,$con);
-		//get KML from database (check if user is allowed to access)
-
-# for now, do not restrict access 
-#		$sql = "SELECT kml_doc FROM gui_kml WHERE kml_id = $1 AND fkey_mb_user_id = $2 AND fkey_gui_id = $3 LIMIT 1";
-#		$v = array($kmlId, $_SESSION["mb_user_id"], $_SESSION["mb_user_gui"]);
-#		$t = array("i", "i", "s");
-
-		$sql = "SELECT kml_doc FROM gui_kml WHERE kml_id = $1 LIMIT 1";
-		$v = array($kmlId);
-		$t = array("i");
-
-		$result = db_prep_query($sql, $v, $t);
-		$row = db_fetch_array($result);
-		if ($row) {
-			return $row["kml_doc"];
-		}
-		else {
-			$e = new mb_exception("class_kml.php: getKMLDocumentFromDB: no KML found for ID " . $kmlId);
-		}
-		return "";
-	}
-
-	/**
-	 * @param  string the tag name.
-	 * @return string the tag name without its namespace.
-	 */
-	private function sepNameSpace($s){
-		$c = mb_strpos($s, ":"); 
-		if ($c > 0) {
-			$s = mb_substr($s, $c+1);
-		}
-		return $s;
-	}
-
-	private function updateGeometries($currentPlacemark, $geometryArray) {
-		$cnt = 0; 
-		$childNodes = $currentPlacemark->childNodes;
-
-		foreach ($childNodes as $childNode) {
-			$name = $childNode->nodeName;
-			if ( in_array($name, array("Point","LineString","Polygon"))) {
-				$returnValue = $this->updateGeometry($childNode, $geometryArray[$cnt]);
-				if (!$returnValue) {
-					return false;
-				}
-				$cnt ++;
-			}
-			else if ($name == "MultiGeometry") {
-				return $this->updateGeometries($childNode, $geometryArray);
-			}
-		}
-		return true;
-	}
-	
-	private function updateGeometry ($currentNode, $geometry) {
-		$json = new Mapbender_JSON();
-		$currentNode_SimpleXML = simplexml_import_dom($currentNode);
-
-		$currentTypeXml = mb_strtoupper($currentNode->nodeName);
-		$currentTypeGeoJson = mb_strtoupper($geometry->type);  
-
-		if ($currentTypeGeoJson != $currentTypeXml) {
-			$e = new mb_exception("class_kml: geometry type mismatch: geoJSON: " . $currentTypeGeoJson . "; XML: " . $currentTypeXml);
-			return false;
-		}
-		if ($currentTypeXml == "POLYGON") {
-			// GML 3
-			$gmlNode = $currentNode_SimpleXML->{"exterior"}->{"LinearRing"}->{"posList"};
-			$kmlNode = $currentNode_SimpleXML->{"outerBoundaryIs"}->{"LinearRing"}->{"coordinates"};
-			if ($gmlNode && $gmlNode->asXML()) {
-				$currentNode_SimpleXML->{"exterior"}->{"LinearRing"}->{"posList"} = preg_replace("/,/", " ", preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates)));
-			}
-			// KML 2.2
-			else if ($kmlNode && $kmlNode->asXML()) {
-				$currentNode_SimpleXML->{"outerBoundaryIs"}->{"LinearRing"}->{"coordinates"} = preg_replace("/\],/", " ", preg_replace("/\][^,]|\[/", "", $json->encode($geometry->coordinates)));
-			}
-		}
-		elseif ($currentTypeXml == "POINT") {
-			$gmlNode = $currentNode_SimpleXML->{"pos"};
-			$kmlNode = $currentNode_SimpleXML->{"coordinates"};
-
-			// GML 3
-			if ($gmlNode && $gmlNode->asXML()) {
-				$currentNode_SimpleXML->{"pos"} = preg_replace("/,/", " ", preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates)));
-			}
-			// KML 2.2
-			else if ($kmlNode && $kmlNode->asXML()) {
-				$currentNode_SimpleXML->{"coordinates"} = preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates));
-			}
-		}
-		elseif ($currentTypeXml == "LINESTRING") {
-			$gmlNode = $currentNode_SimpleXML->{"posList"};
-			$kmlNode = $currentNode_SimpleXML->{"coordinates"};
-
-			// GML 3
-			if ($gmlNode && $gmlNode->asXML()) {
-				$currentNode_SimpleXML->{"posList"} = preg_replace("/,/", " ", preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates)));
-			}
-			// KML 2.2
-			else if ($kmlNode && $kmlNode->asXML()) {
-				$currentNode_SimpleXML->{"coordinates"} = preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates));
-			}
-		}
-		return true;
-	}
-
-	private function updateMetadata($currentPlacemark, $metadataObj) {
-		$metadataExistsAndUpdateSucceeded = true;
-		
-		$currentPlacemark_SimpleXML = simplexml_import_dom($currentPlacemark);
-		$extendedDataNode = $currentPlacemark_SimpleXML->{"ExtendedData"};
-		if ($extendedDataNode) {
-			$metadataExistsAndUpdateSucceeded = false;
-
-			// Either, data is within a SCHEMADATA tag...
-			$simpleDataNodes = $extendedDataNode->{"SchemaData"}->{"SimpleData"};
-			if ($simpleDataNodes) {
-				foreach ($simpleDataNodes as $simpleDataNode) {
-					$tmp = dom_import_simplexml($simpleDataNode);					
-					$name = $tmp->getAttribute("name");
-					// if there is a metadata entry, update it
-					if (isset($metadataObj->$name)) {
-						$tmp->nodeValue = $metadataObj->$name;
-					}										
-				}
-
-				$metadataExistsAndUpdateSucceeded = true;
-			}
-
-			// ...or within a DATA tag
-			$dataNodes = $extendedDataNode->{"Data"};
-			if ($dataNodes && !$metadataExistsAndUpdateSucceeded) {
-				foreach ($dataNodes as $dataNode) {
-					$tmp = dom_import_simplexml($dataNode);
-					$name = $tmp->getAttribute("name");
-					// if there is a metadata entry, update it
-					if (isset($metadataObj->$name)) {
-						$tmp->nodeValue = $metadataObj->$name;
-					}										
-				}
-				$metadataExistsAndUpdateSucceeded = true;
-			}
-		}
-		return $metadataExistsAndUpdateSucceeded;
-	}
-
-	/**
-	 * The KML document.
-	 */
-	private $kml;
-	
-	/**
-	 * The ID of this KML in the database.
-	 */
-	private $id;
-	
-	/**
-	 * An array of {@link KMLPlacemark}
-	 */
-	private $placemarkArray = array();
-} 
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_wmc.php
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_point.php");
+
+require_once(dirname(__FILE__)."/../classes/class_kml_geometry.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_placemark.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_parser_ows.php");;
+
+/**
+ * Allows parsing a KML file, extracting the placemarks.
+ * 
+ * @package KML
+ */
+class KML {
+
+	//
+	//
+	// ------------------------------- public -----------------------------------------------
+	//
+	//
+
+	/**
+	 * The constructor function, currently empty.
+	 */				
+	public function __construct() {
+	} 
+
+	public function toSingleLineStringKml() {
+		//KML 2.2 output
+		$doc = new DOMDocument("1.0", CHARSET);
+		$doc->preserveWhiteSpace = false;
+	
+		// attach kml and Document tag
+		$e_kml = $doc->createElementNS("http://earth.google.com/kml/2.2", "kml");
+		$e_document = $doc->createElement("Document");
+		$e_kml->appendChild($e_document);
+		$doc->appendChild($e_kml);
+	
+		// attach placemarks
+		$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
+
+		$lineStyleNode = $doc->createElement("Style");
+		$lineStyleNode->setAttribute("id", "linestyleExample");
+		$lineStyleColorNode = $doc->createElement("color", "7f0000ff");
+		$lineStyleWidthNode = $doc->createElement("width", 4);
+		$lineStyleNode->appendChild($lineStyleColorNode);
+		$lineStyleNode->appendChild($lineStyleWidthNode);
+		$e_document->appendChild($lineStyleNode);
+		
+		//
+		// line segments first
+		//
+		$coordinates = "";
+
+		for ($i = 0; $i < count($this->placemarkArray); $i++) {
+			$currentPlacemark = $this->placemarkArray[$i];
+			$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
+
+			switch ($currentPlacemark->getGeometryType()) {
+				case "KMLLine" :
+					$coordinatesArray = $currentPlacemark->getGeometry()->getPointArray();
+					for ($j = 0; $j < count($coordinatesArray); $j++) {
+						if (!($j == 0 && $i == 0)) {
+							$coordinates .= " ";
+						}
+						$coordinates .= $coordinatesArray[$j]["x"] . "," . $coordinatesArray[$j]["y"] . "," . $coordinatesArray[$j]["z"];
+						
+					}
+					break;
+			}
+		}
+		// create a placemark tag with a geometry and add it to the document
+		$e_coordinates = $doc->createElement("coordinates", $coordinates);
+		$e_geometry = $doc->createElement("LineString");
+		$e_geometry->appendChild($e_coordinates);
+		$e_placemark = $doc->createElement("Placemark");
+		$e_placemark->appendChild($e_geometry);
+		$e_pl_name = $doc->createElement("name", "Route");
+		$e_placemark->appendChild($e_pl_name);
+		$e_pl_style = $doc->createElement("styleUrl", "#linestyleExample");
+		$e_placemark->appendChild($e_pl_style);
+		$e_document->appendChild($e_placemark);
+		
+/*		
+		//
+		// now pois
+		//
+		// attach placemarks
+		$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
+		for ($i = 0; $i < count($this->placemarkArray); $i++) {
+			$currentPlacemark = $this->placemarkArray[$i];
+
+			$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
+			
+			$pl_instructions = $currentPlacemark->getProperty("instruction");
+			$pl_name_array = array();
+			$pl_name = false;
+			$pl_description = false;
+			if ($pl_instructions != null) {
+				$pl_name_array = explode("|", $pl_instructions);
+			}
+
+			switch ($currentPlacemark->getGeometryType()) {
+				case "KMLPoint" :
+					if (count($pl_name_array) > 2) {
+						$pl_name = $pl_name_array[0];
+						$pl_description = $pl_name_array[1];
+					}
+					$e_geometry = $doc->createElement("Point");
+					$point = $currentPlacemark->getGeometry()->getPoint();
+					$coordinates = $point["x"] . "," . $point["y"];
+					$e_coordinates = $doc->createElement("coordinates", $coordinates);
+					$e_geometry->appendChild($e_coordinates);
+					break;
+
+			}
+			// create a placemark tag with a geometry and add it to the document
+			if ($e_geometry) {
+				$e_placemark = $doc->createElement("Placemark");
+				$e_placemark->appendChild($e_geometry);
+				if ($pl_name) {
+					$e_pl_name = $doc->createElement("name", $pl_name);
+					$e_placemark->appendChild($e_pl_name);
+				}
+				if ($pl_description) {
+					$e_pl_description = $doc->createElement("description", $pl_description);
+					$e_placemark->appendChild($e_pl_description);
+				}
+				$e_document->appendChild($e_placemark);
+			}
+		}
+*/
+		return $doc->saveXML();
+	}
+	
+	/**
+	 * @return string the KML document.
+	 */
+	public function __toString() {
+		
+	
+		if (!$this->kml) {
+			//KML 2.2 output
+			$doc = new DOMDocument("1.0", CHARSET);
+			$doc->preserveWhiteSpace = false;
+	
+			// attach kml and Document tag
+			$e_kml = $doc->createElementNS("http://earth.google.com/kml/2.2", "kml");
+			$e_document = $doc->createElement("Document");
+			$e_kml->appendChild($e_document);
+			$doc->appendChild($e_kml);
+	
+			// attach placemarks
+			$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
+			for ($i = 0; $i < count($this->placemarkArray); $i++) {
+				$currentPlacemark = $this->placemarkArray[$i];
+
+				$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
+				
+				$pl_instructions = $currentPlacemark->getProperty("instruction");
+				$pl_name_array = array();
+				$pl_name = false;
+				$pl_description = false;
+				if ($pl_instructions != null) {
+					$pl_name_array = explode("|", $pl_instructions);
+				}
+
+				switch ($currentPlacemark->getGeometryType()) {
+					case "KMLPoint" :
+						if (count($pl_name_array) > 2) {
+							$pl_name = $pl_name_array[0];
+							$pl_description = $pl_name_array[1];
+						}
+						$e_geometry = $doc->createElement("Point");
+						$point = $currentPlacemark->getGeometry()->getPoint();
+						$coordinates = $point["x"] . "," . $point["y"];
+						$e_coordinates = $doc->createElement("coordinates", $coordinates);
+						$e_geometry->appendChild($e_coordinates);
+						break;
+					
+/* TODO:Polygons
+					case "KMLPolygon" :
+						$e_geometry = $doc->createElement("Polygon");
+						$e_outer = $doc->createElement("OuterBoundaryIs");
+						$e_outer_lr = $doc->createElement("LinearRing");
+						$outer_coordinates = ""; // TODO: get coords from placemark
+						$e_outer_coordinates = $doc->createElement("Coordinates", $outer_coordinates);
+						
+						$e_outer_lr->appendChild($e_outer_coordinates);
+						$e_outer->appendChild($e_outer_lr);
+						
+						for ($j = 0; $j < $currentPlacemark; $j++) {
+							
+						}
+						
+						$e_geometry->appendChild($e_coordinates);
+					outerBoundaryIs"}->{"LinearRing"}->{"coordinates
+					
+						break;
+*/					
+					case "KMLLine" :
+						if (count($pl_name_array) > 2) {
+							$pl_description = $pl_name_array[1];
+						}
+						$e_geometry = $doc->createElement("LineString");
+						$coordinatesArray = $currentPlacemark->getGeometry()->getPointArray();
+						$coordinates = "";
+						for ($j = 0; $j < count($coordinatesArray); $j++) {
+							if ($j > 0) {
+								$coordinates .= " ";
+							}
+							$coordinates .= $coordinatesArray[$j]["x"] . "," . $coordinatesArray[$j]["y"] . "," . $coordinatesArray[$j]["z"];
+							
+						}
+						$e_coordinates = $doc->createElement("coordinates", $coordinates);
+						$e_geometry->appendChild($e_coordinates);
+						break;
+
+/*	TODO: Multigeometries				
+					case "KMLMultiGeometry" :
+						break;
+*/
+				}
+				// create a placemark tag with a geometry and add it to the document
+				if ($e_geometry) {
+					$e_placemark = $doc->createElement("Placemark");
+					$e_placemark->appendChild($e_geometry);
+					if ($pl_name) {
+						$e_pl_name = $doc->createElement("name", $pl_name);
+						$e_placemark->appendChild($e_pl_name);
+					}
+					if ($pl_description) {
+						$e_pl_description = $doc->createElement("description", $pl_description);
+						$e_placemark->appendChild($e_pl_description);
+					}
+					$e_document->appendChild($e_placemark);
+				}
+			}
+			$this->kml = $doc->saveXML();
+		}
+		return $this->kml;
+	}
+	
+	/**
+	 * @return string the ID of this KML.
+	 */
+	public function getId () {
+		return $this->id;
+	}
+	
+	/**
+	 * parses an incoming KML, creates the object, 
+	 * stores the kml in the object and in the database.
+	 * 
+	 * @param  string  a KML document.
+	 * @return boolean true if the parsing succeded, else false.
+	 */
+	public function parseKml ($kml) {
+		$this->kml = $kml;
+
+		if (!$this->storeInDb()) {
+			return false;
+		}
+
+		$parser = new KmlOwsParser();
+		$parser->parseKML($kml, $this->id);
+		$this->placemarkArray = $parser->placemarkArray; 
+
+		return true;
+	}
+	
+	/**
+	 * parses an incoming GeoJSON, creates the object, 
+	 * stores the kml in the object and in the database.
+	 * 
+	 * @param string a geoJSON.
+	 * @return boolean true if the parsing succeded, else false.
+	 */
+	public function parseGeoJSON ($geoJSON) {
+		$this->kml = "";
+
+		if (!$this->storeInDb()) {
+			return false;
+		}
+
+		$parser = new KmlOwsParser();
+		$parser->parseGeoJSON($geoJSON, $this->id);
+		$e = new mb_notice("parsing finished...#placemarks: " . count($this->placemarkArray) . " (" . count($parser->placemarkArray) . ")");
+		$this->placemarkArray = $parser->placemarkArray; 
+
+//		print_r($this);
+		
+//		$this->kml = $this->__toString();
+
+//		$this->updateInDb($this->kml, $this->id);
+		return true;
+	}
+	
+	/**
+	 * @return string the geoJSON representation of the KML.
+	 */
+	public function toGeoJSON() {
+		$str = "";
+		$numberOfPlacemarks = count($this->placemarkArray);
+		if ($numberOfPlacemarks > 0) {
+			$str .= "{\"type\": \"FeatureCollection\", \"features\": [";
+			for ($i=0; $i < $numberOfPlacemarks; $i++) {
+				if ($i > 0) {
+					$str .= ",";
+				}	
+				$str .= $this->placemarkArray[$i]->toGeoJSON();
+			}
+			$str .= "]}";
+		}
+		else {
+			$e = new mb_exception("KML: toGeoJSON: this placemarkArray is empty!");
+		}
+		return $str;
+	}
+
+	private function updateInDb($kmlDoc, $kmlId) {
+		$sql = "UPDATE gui_kml SET kml_doc = $1 WHERE kml_id = $2";
+		$v = array($kmlDoc, $kmlId);
+		$t = array("s", "i");
+		$result = db_prep_query($sql, $v, $t);
+		if (!$result) {
+			$e = new mb_exception("class_kml: kml update failed! " . db_error());
+			return false;
+		}
+	}
+
+	public function updateKml ($kmlId, $placemarkId, $geoJSON) {
+		$kmlFromDb = $this->getKmlDocumentFromDB($kmlId);
+		 
+		if ($kmlFromDb !== NULL) {
+			// load the KML from the database in the DOM object
+			$kmlDoc_DOM = new DOMDocument("1.0");
+			$kmlDoc_DOM->encoding = CHARSET;
+			$kmlDoc_DOM->preserveWhiteSpace = false;
+			$kmlDoc_DOM->loadXML($kmlFromDb); 
+
+			//load the geoJSON
+			$json = new Mapbender_JSON();
+			$geoObj = $json->decode($geoJSON);
+
+			// construct an array that holds all metadata of the placemark
+			$metadataObj = $geoObj->properties;
+			
+			// construct an array that holds all geometries of the placemark
+			$geometryObj = $geoObj->geometry;
+			$geometryType = $geometryObj->type;
+			if ($geometryType == "GeometryCollection") {
+				$geometryArray = $geometryObj->geometries;
+			}
+			else if ($geometryType == "Point" || $geometryType == "LineString" || $geometryType == "Polygon") {
+				$geometryArray = array($geometryObj);
+			}
+			else {
+				$e = new mb_exception("class_kml: Invalid geometry type " . $geometryType);
+				return false;
+			}
+
+			//
+			// apply the changes
+			//
+			
+			$currentPlacemarkArray = $kmlDoc_DOM->getElementsByTagName("Placemark");
+			$currentPlacemark = $currentPlacemarkArray->item($placemarkId);
+
+			if ($currentPlacemark) {
+				$metadataUpdateSuccessful = $this->updateMetadata($currentPlacemark, $metadataObj);
+				$geometryUpdateSuccessful = $this->updateGeometries($currentPlacemark, $geometryArray);
+			}
+			else {
+				$e = new mb_exception("class_kml.php: updateKml: placemark " . $placemarkId . " not found in KML " . $kmlId . ".");
+				return false;
+			}
+
+			if ($metadataUpdateSuccessful && $geometryUpdateSuccessful) {
+				$updatedKml = $kmlDoc_DOM->saveXML();
+
+				$this->updateInDb($updatedKml, $kmlId);
+			}
+			else {
+				if (!$metadataUpdateSuccessful) {
+					$e = new mb_exception("class_kml: Updating the metadata failed, no database update.");
+				}
+				if (!$geometryUpdateSuccessful) {
+					$e = new mb_exception("class_kml: Updating the geometries failed, no database update.");
+				}
+				return false;
+			}
+		}
+		else {
+			$e = new mb_exception("class_kml: No KML found in database, no database update. " . db_error());
+			return false;
+		}
+		return true;
+	}
+
+	//
+	//
+	// ------------------------------- private -----------------------------------------------
+	//
+	//
+		
+	/**
+	 * Store this KML in the database, and sets the ID.
+	 * 
+	 * @return boolean true, if the KML could be stored in the database; else false.
+	 */
+	private function storeInDb () {
+		if ($_SESSION["mb_user_id"] && $_SESSION["mb_user_gui"]) {
+			$con = db_connect(DBSERVER,OWNER,PW);
+			db_select_db(DB,$con);
+	
+			$sql  = "INSERT INTO gui_kml ";
+			$sql .= "(fkey_mb_user_id, fkey_gui_id, kml_doc, kml_name, kml_description, kml_timestamp) ";
+			$sql .= "VALUES ";
+			$sql .= "($1, $2, $3, $4, $5, $6)";
+			$v = array ($_SESSION["mb_user_id"], $_SESSION["mb_user_gui"], $this->kml, "name", "description", time());
+			$t = array ("i", "s", "s", "s", "s", "s");
+			$res = db_prep_query($sql, $v, $t);
+			if (!$res) {
+				$e = new mb_exception("class_kml.php: storeInDb: failed to store KML in database: " . db_error());
+				return false;
+			}
+	
+			$this->id = db_insert_id($con, "gui_kml", "kml_id");
+			return true;
+		}
+		else {
+			// should be false, but code in caller has to be changed first.
+			return true;
+		}
+	}
+
+	/**
+	 * @param  integer  the ID of the KML.
+	 * @return string   the KML document with the given ID.
+	 */
+	public function getKmlDocumentFromDB ($kmlId) {
+		$con = db_connect(DBSERVER,OWNER,PW);
+		db_select_db(DB,$con);
+		//get KML from database (check if user is allowed to access)
+
+# for now, do not restrict access 
+#		$sql = "SELECT kml_doc FROM gui_kml WHERE kml_id = $1 AND fkey_mb_user_id = $2 AND fkey_gui_id = $3 LIMIT 1";
+#		$v = array($kmlId, $_SESSION["mb_user_id"], $_SESSION["mb_user_gui"]);
+#		$t = array("i", "i", "s");
+
+		$sql = "SELECT kml_doc FROM gui_kml WHERE kml_id = $1 LIMIT 1";
+		$v = array($kmlId);
+		$t = array("i");
+
+		$result = db_prep_query($sql, $v, $t);
+		$row = db_fetch_array($result);
+		if ($row) {
+			return $row["kml_doc"];
+		}
+		else {
+			$e = new mb_exception("class_kml.php: getKMLDocumentFromDB: no KML found for ID " . $kmlId);
+		}
+		return "";
+	}
+
+	/**
+	 * @param  string the tag name.
+	 * @return string the tag name without its namespace.
+	 */
+	private function sepNameSpace($s){
+		$c = mb_strpos($s, ":"); 
+		if ($c > 0) {
+			$s = mb_substr($s, $c+1);
+		}
+		return $s;
+	}
+
+	private function updateGeometries($currentPlacemark, $geometryArray) {
+		$cnt = 0; 
+		$childNodes = $currentPlacemark->childNodes;
+
+		foreach ($childNodes as $childNode) {
+			$name = $childNode->nodeName;
+			if ( in_array($name, array("Point","LineString","Polygon"))) {
+				$returnValue = $this->updateGeometry($childNode, $geometryArray[$cnt]);
+				if (!$returnValue) {
+					return false;
+				}
+				$cnt ++;
+			}
+			else if ($name == "MultiGeometry") {
+				return $this->updateGeometries($childNode, $geometryArray);
+			}
+		}
+		return true;
+	}
+	
+	private function updateGeometry ($currentNode, $geometry) {
+		$json = new Mapbender_JSON();
+		$currentNode_SimpleXML = simplexml_import_dom($currentNode);
+
+		$currentTypeXml = mb_strtoupper($currentNode->nodeName);
+		$currentTypeGeoJson = mb_strtoupper($geometry->type);  
+
+		if ($currentTypeGeoJson != $currentTypeXml) {
+			$e = new mb_exception("class_kml: geometry type mismatch: geoJSON: " . $currentTypeGeoJson . "; XML: " . $currentTypeXml);
+			return false;
+		}
+		if ($currentTypeXml == "POLYGON") {
+			// GML 3
+			$gmlNode = $currentNode_SimpleXML->{"exterior"}->{"LinearRing"}->{"posList"};
+			$kmlNode = $currentNode_SimpleXML->{"outerBoundaryIs"}->{"LinearRing"}->{"coordinates"};
+			if ($gmlNode && $gmlNode->asXML()) {
+				$currentNode_SimpleXML->{"exterior"}->{"LinearRing"}->{"posList"} = preg_replace("/,/", " ", preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates)));
+			}
+			// KML 2.2
+			else if ($kmlNode && $kmlNode->asXML()) {
+				$currentNode_SimpleXML->{"outerBoundaryIs"}->{"LinearRing"}->{"coordinates"} = preg_replace("/\],/", " ", preg_replace("/\][^,]|\[/", "", $json->encode($geometry->coordinates)));
+			}
+		}
+		elseif ($currentTypeXml == "POINT") {
+			$gmlNode = $currentNode_SimpleXML->{"pos"};
+			$kmlNode = $currentNode_SimpleXML->{"coordinates"};
+
+			// GML 3
+			if ($gmlNode && $gmlNode->asXML()) {
+				$currentNode_SimpleXML->{"pos"} = preg_replace("/,/", " ", preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates)));
+			}
+			// KML 2.2
+			else if ($kmlNode && $kmlNode->asXML()) {
+				$currentNode_SimpleXML->{"coordinates"} = preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates));
+			}
+		}
+		elseif ($currentTypeXml == "LINESTRING") {
+			$gmlNode = $currentNode_SimpleXML->{"posList"};
+			$kmlNode = $currentNode_SimpleXML->{"coordinates"};
+
+			// GML 3
+			if ($gmlNode && $gmlNode->asXML()) {
+				$currentNode_SimpleXML->{"posList"} = preg_replace("/,/", " ", preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates)));
+			}
+			// KML 2.2
+			else if ($kmlNode && $kmlNode->asXML()) {
+				$currentNode_SimpleXML->{"coordinates"} = preg_replace("/\[|\]/", "", $json->encode($geometry->coordinates));
+			}
+		}
+		return true;
+	}
+
+	private function updateMetadata($currentPlacemark, $metadataObj) {
+		$metadataExistsAndUpdateSucceeded = true;
+		
+		$currentPlacemark_SimpleXML = simplexml_import_dom($currentPlacemark);
+		$extendedDataNode = $currentPlacemark_SimpleXML->{"ExtendedData"};
+		if ($extendedDataNode) {
+			$metadataExistsAndUpdateSucceeded = false;
+
+			// Either, data is within a SCHEMADATA tag...
+			$simpleDataNodes = $extendedDataNode->{"SchemaData"}->{"SimpleData"};
+			if ($simpleDataNodes) {
+				foreach ($simpleDataNodes as $simpleDataNode) {
+					$tmp = dom_import_simplexml($simpleDataNode);					
+					$name = $tmp->getAttribute("name");
+					// if there is a metadata entry, update it
+					if (isset($metadataObj->$name)) {
+						$tmp->nodeValue = $metadataObj->$name;
+					}										
+				}
+
+				$metadataExistsAndUpdateSucceeded = true;
+			}
+
+			// ...or within a DATA tag
+			$dataNodes = $extendedDataNode->{"Data"};
+			if ($dataNodes && !$metadataExistsAndUpdateSucceeded) {
+				foreach ($dataNodes as $dataNode) {
+					$tmp = dom_import_simplexml($dataNode);
+					$name = $tmp->getAttribute("name");
+					// if there is a metadata entry, update it
+					if (isset($metadataObj->$name)) {
+						$tmp->nodeValue = $metadataObj->$name;
+					}										
+				}
+				$metadataExistsAndUpdateSucceeded = true;
+			}
+		}
+		return $metadataExistsAndUpdateSucceeded;
+	}
+
+	/**
+	 * The KML document.
+	 */
+	private $kml;
+	
+	/**
+	 * The ID of this KML in the database.
+	 */
+	private $id;
+	
+	/**
+	 * An array of {@link KMLPlacemark}
+	 */
+	private $placemarkArray = array();
+} 
+?>

Modified: branches/print_dev/http/classes/class_kml_parser_ows.php
===================================================================
--- branches/print_dev/http/classes/class_kml_parser_ows.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_kml_parser_ows.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,313 +1,313 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_wmc.php
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_point.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_polygon.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_linearring.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_line.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_point.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_multigeometry.php");
-require_once(dirname(__FILE__)."/../classes/class_kml_placemark.php");
-
-/**
- * @package KML
- */
- class KmlOwsParser {
-	var $placemarkArray = array();
-	
-	public function __construct() {
-	}
-	
-	public function parseGeoJSON ($geoJSON, $kmlId) {
-		
-//		$e = new mb_notice("GEOJSON: " . $geoJSON);
-		$json = new Mapbender_JSON();
-		$geometryFromGeoJSON = $json->decode($geoJSON);
-		$id = 0;
-		
-		if (gettype($geometryFromGeoJSON) == "object" && $geometryFromGeoJSON->type == "FeatureCollection") {
-			if ($geometryFromGeoJSON->crs->type == "EPSG" && $geometryFromGeoJSON->crs->properties->code) {
-				$epsg = $geometryFromGeoJSON->crs->properties->code;	
-			}
-			// create Placemarks
-			for ($i = 0; $i < count($geometryFromGeoJSON->features); $i++) {
-				$e = new mb_notice("parsing plm #" . $i . "...length of placemarkArray: " . count($this->placemarkArray));
-				$feature = $geometryFromGeoJSON->features[$i];
-				if (gettype($feature) == "object" && $feature->type == "Feature") {
-					if ($feature->geometry->crs->type == "EPSG") {
-						$epsg = $feature->geometry->crs->properties->code;	
-					}
-					if (!$epsg) {
-						$e = new mb_notice("EPSG is not set! Aborting...(" . $epsg . ")");
-					}
-					$geometry = $feature->geometry;
-					
-					$currentGeometry = false;
-					//TODO: missing Polygon and MultiGeometry
-					switch ($geometry->type) {
-						case "LineString" :
-							$coordinateList = "";
-							for ($j = 0; $j < count($geometry->coordinates); $j++) {
-								if ($j > 0) {
-									$coordinateList .= " ";
-								}
-								$coordinateList .= implode(",", $geometry->coordinates[$j]);
-							}
-							$currentGeometry = new KMLLine($coordinateList, $epsg);
-							break;
-						case "Point" :
-							$coordinateList = implode(",", $geometry->coordinates);
-							$currentGeometry = new KMLPoint($coordinateList, $epsg);
-							break;
-					}
-					
-					if ($currentGeometry) {
-						$currentPlacemark = new KMLPlacemark($currentGeometry);
-
-						if (gettype($feature->properties) == "object") {
-							
-							foreach ($feature->properties as $key => $value) {
-								$currentPlacemark->setProperty($key, $value);
-							}
-							$currentPlacemark->setProperty("Mapbender:kml", true);
-							$currentPlacemark->setProperty("Mapbender:name", "unknown");
-							$currentPlacemark->setProperty("Mapbender:id", $kmlId);
-							$currentPlacemark->setProperty("Mapbender:placemarkId", $id);
-							$e = new mb_notice("adding to placemarkArray (current length: " . count($this->placemarkArray) . ")");
-							array_push($this->placemarkArray, $currentPlacemark);
-							$e = new mb_notice("added...new length: " . count($this->placemarkArray));
-							$id ++;
-						}
-					}
-				}
-			}
-		}
-		return true;
-	}
-		
-	public function parseKML ($kml, $kmlId) {
-		$doc = new DOMDocument("1.0");
-		$doc->preserveWhiteSpace = false;
-		$doc->loadXML($kml);
-
-		/*
-		 * Get geometry information only, store it in placemarkArray
-		 */
-		$placemarkTagArray = $doc->getElementsByTagName("Placemark");
-		
-		if (count($placemarkTagArray) > 0) {
-			$id = 0;
-			
-			foreach ($placemarkTagArray as $node) {
-	
-				$geometryArray = $this->getGeometryArrayFromPlacemarkOrMultigeometryNode($node);
-				$metadataArray = $this->getMetadataFromPlacemarkNode($node);
-				
-				/*
-				 * For a placemark, the geometryArray should only contain 1 geometry!
-				 */
-				for ($i=0; $i < count($geometryArray); $i++) {
-					$currentPlacemark = new KMLPlacemark($geometryArray[$i]);
-					
-					foreach ($metadataArray as $key => $value) {
-						$currentPlacemark->setProperty($key, $value);
-					}
-					$currentPlacemark->setProperty("Mapbender:kml", true);
-					$currentPlacemark->setProperty("Mapbender:name", "unknown");
-					$currentPlacemark->setProperty("Mapbender:id", $kmlId);
-					$currentPlacemark->setProperty("Mapbender:placemarkId", $id);
-					array_push($this->placemarkArray, $currentPlacemark);
-				}
-				$id ++;		    
-			}
-		}
-		else {
-			$e = new mb_exception("class_kml.php: KMLOWSParser: No placemarks found in KML.");
-			return false;
-		}
-		return true;
-	}
-
-	/**
-	 * Returns an associative array, containing metadata
-	 */
-	private function getMetadataFromPlacemarkNode ($node) {
-	    $children = $node->childNodes;
-	    
-	    $metadataArray = array();
-	    
-		// search "ExtendedData" tag
-		foreach ($children as $child) {
-			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "EXTENDEDDATA") {  
-				$extendedDataNode = $child;
-				$extDataChildren = $extendedDataNode->childNodes; 
-				
-				// search "Data" or "SchemaData" tag
-				foreach ($extDataChildren as $extDataChild) {
-					if (mb_strtoupper($this->sepNameSpace($extDataChild->nodeName)) == "SCHEMADATA") {
-						$simpleDataNode = $extDataChild->firstChild;
-						while ($simpleDataNode !== NULL) {
-							if (mb_strtoupper($this->sepNameSpace($simpleDataNode->nodeName)) == "SIMPLEDATA") {
-								$name = $simpleDataNode->getAttribute("name");
-								$value = $simpleDataNode->nodeValue;
-								$metadataArray[$name] = $value;
-							}
-							$simpleDataNode = $simpleDataNode->nextSibling;
-						}
-					}
-					if (mb_strtoupper($this->sepNameSpace($extDataChild->nodeName)) == "DATA") {
-						$dataNode = $extDataChild;
-						$name = $dataNode->getAttribute("name");
-						$metadataArray[$name] = $dataNode->nodeValue;
-					}
-				}
-			}
-		}
-		return $metadataArray;		
-	}
-	
-	/**
-	 * Given a "Point" node, this function returns the geometry (KMLPoint)
-	 * from within the node.
-	 */
-	private function getGeometryFromPointNode ($node) {
-		$coordinatesNode = $this->getCoordinatesNode($node);
-		$geomString = $coordinatesNode->nodeValue;
-		return new KMLPoint($geomString, 4326);
-	}
-	
-	/**
-	 * Given a "LineString" node, this function returns the geometry (KMLLine)
-	 * from within the node.
-	 */
-	private function getGeometryFromLinestringNode ($node) {
-		$coordinatesNode = $this->getCoordinatesNode($node);
-		$geomString = $coordinatesNode->nodeValue;
-		return new KMLLine($geomString, 4326);
-	}
-	
-	/**
-	 * Given a "Polygon" node, this function returns the geometry (KMLPolygon)
-	 * from within the node.
-	 */
-	private function getGeometryFromPolygonNode ($node) {
-		$polygon = null;
-
-	    $children = $node->childNodes;
-	    
-		// create new KMLPolygon
-		foreach ($children as $child) {
-			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "EXTERIOR" || 
-				mb_strtoupper($this->sepNameSpace($child->nodeName)) == "OUTERBOUNDARYIS") {
-				// create a new Linear Ring
-				$outerBoundary = $this->getGeometryFromLinearRingNode($child);
-				$polygon = new KMLPolygon($outerBoundary);
-			}
-		}
-		
-		if ($polygon !== null) {
-			// append inner boundaries to KMLPolygon
-			foreach ($children as $child) {
-				if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "INTERIOR" || 
-					mb_strtoupper($this->sepNameSpace($child->nodeName)) == "INNERBOUNDARYIS") {
-					// create a new Linear Ring
-					$innerBoundary = $this->getGeometryFromLinearRingNode($child);
-					$polygon->appendInnerBoundary($innerBoundary);
-				}
-			}
-		}
-		return $polygon;
-	}
-	
-	/**
-	 * Given a "OuterBoundaryIs" or "InnerBoundaryIs" node, this function 
-	 * returns the geometry (KMLLinearRing) within the child node named "linearring"
-	 */
-	private function getGeometryFromLinearRingNode ($node) {
-	    $children = $node->childNodes;
-		foreach($children as $child) {
-			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "LINEARRING") {
-				$coordinatesNode = $this->getCoordinatesNode($child);
-				$geomString = $coordinatesNode->nodeValue;
-				return new KMLLinearRing($geomString);
-			}
-		}
-		return null;
-	}
-	
-	/**
-	 * Checks if the child nodes of a given KML node contains any geometries and
-	 * returns an array of geometries (KMLPoint, KMLPolygon, KMLLinestring and KMLMultigeometry)
-	 */
-	private function getGeometryArrayFromPlacemarkOrMultigeometryNode ($node) {
-	    $geometryArray = array();
-	    
-	    $children = $node->childNodes;
-		foreach($children as $child) {
-			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POINT") {
-				array_push($geometryArray, $this->getGeometryFromPointNode($child));
-			}
-			elseif (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POLYGON") {
-				array_push($geometryArray, $this->getGeometryFromPolygonNode($child));
-			}
-			elseif (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "LINESTRING") {
-				array_push($geometryArray, $this->getGeometryFromLinestringNode($child));
-			}
-			elseif (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "MULTIGEOMETRY") {
-				$geometryArray = $this->getGeometryArrayFromPlacemarkOrMultigeometryNode($child);
-				$multigeometry = new KMLMultiGeometry();
-				
-				for ($i=0; $i < count($geometryArray); $i++) {
-					$multigeometry->append($geometryArray[$i]);	
-				}
-				array_push($geometryArray, $multigeometry);
-			}
-		}
-		return $geometryArray;
-	}
-
-	/**
-	 * Returns the child node with node name "coordinates" of a given KML node.
-	 * If no node is found, null is returned.
-	 */
-	private function getCoordinatesNode ($node) {
-	    $children = $node->childNodes;
-		foreach($children as $child) {
-			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POSLIST" || 
-				mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POS" || 
-				mb_strtoupper($this->sepNameSpace($child->nodeName)) == "COORDINATES") {
-				return $child;
-			}
-		}
-		return null;
-	}
-
-	private function sepNameSpace($s){
-		$c = mb_strpos($s,":"); 
-		if($c>0){
-			return mb_substr($s,$c+1);
-		}
-		else{
-			return $s;
-		}		
-	}
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_wmc.php
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_point.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_polygon.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_linearring.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_line.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_point.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_multigeometry.php");
+require_once(dirname(__FILE__)."/../classes/class_kml_placemark.php");
+
+/**
+ * @package KML
+ */
+ class KmlOwsParser {
+	var $placemarkArray = array();
+	
+	public function __construct() {
+	}
+	
+	public function parseGeoJSON ($geoJSON, $kmlId) {
+		
+//		$e = new mb_notice("GEOJSON: " . $geoJSON);
+		$json = new Mapbender_JSON();
+		$geometryFromGeoJSON = $json->decode($geoJSON);
+		$id = 0;
+		
+		if (gettype($geometryFromGeoJSON) == "object" && $geometryFromGeoJSON->type == "FeatureCollection") {
+			if ($geometryFromGeoJSON->crs->type == "EPSG" && $geometryFromGeoJSON->crs->properties->code) {
+				$epsg = $geometryFromGeoJSON->crs->properties->code;	
+			}
+			// create Placemarks
+			for ($i = 0; $i < count($geometryFromGeoJSON->features); $i++) {
+				$e = new mb_notice("parsing plm #" . $i . "...length of placemarkArray: " . count($this->placemarkArray));
+				$feature = $geometryFromGeoJSON->features[$i];
+				if (gettype($feature) == "object" && $feature->type == "Feature") {
+					if ($feature->geometry->crs->type == "EPSG") {
+						$epsg = $feature->geometry->crs->properties->code;	
+					}
+					if (!$epsg) {
+						$e = new mb_notice("EPSG is not set! Aborting...(" . $epsg . ")");
+					}
+					$geometry = $feature->geometry;
+					
+					$currentGeometry = false;
+					//TODO: missing Polygon and MultiGeometry
+					switch ($geometry->type) {
+						case "LineString" :
+							$coordinateList = "";
+							for ($j = 0; $j < count($geometry->coordinates); $j++) {
+								if ($j > 0) {
+									$coordinateList .= " ";
+								}
+								$coordinateList .= implode(",", $geometry->coordinates[$j]);
+							}
+							$currentGeometry = new KMLLine($coordinateList, $epsg);
+							break;
+						case "Point" :
+							$coordinateList = implode(",", $geometry->coordinates);
+							$currentGeometry = new KMLPoint($coordinateList, $epsg);
+							break;
+					}
+					
+					if ($currentGeometry) {
+						$currentPlacemark = new KMLPlacemark($currentGeometry);
+
+						if (gettype($feature->properties) == "object") {
+							
+							foreach ($feature->properties as $key => $value) {
+								$currentPlacemark->setProperty($key, $value);
+							}
+							$currentPlacemark->setProperty("Mapbender:kml", true);
+							$currentPlacemark->setProperty("Mapbender:name", "unknown");
+							$currentPlacemark->setProperty("Mapbender:id", $kmlId);
+							$currentPlacemark->setProperty("Mapbender:placemarkId", $id);
+							$e = new mb_notice("adding to placemarkArray (current length: " . count($this->placemarkArray) . ")");
+							array_push($this->placemarkArray, $currentPlacemark);
+							$e = new mb_notice("added...new length: " . count($this->placemarkArray));
+							$id ++;
+						}
+					}
+				}
+			}
+		}
+		return true;
+	}
+		
+	public function parseKML ($kml, $kmlId) {
+		$doc = new DOMDocument("1.0");
+		$doc->preserveWhiteSpace = false;
+		$doc->loadXML($kml);
+
+		/*
+		 * Get geometry information only, store it in placemarkArray
+		 */
+		$placemarkTagArray = $doc->getElementsByTagName("Placemark");
+		
+		if (count($placemarkTagArray) > 0) {
+			$id = 0;
+			
+			foreach ($placemarkTagArray as $node) {
+	
+				$geometryArray = $this->getGeometryArrayFromPlacemarkOrMultigeometryNode($node);
+				$metadataArray = $this->getMetadataFromPlacemarkNode($node);
+				
+				/*
+				 * For a placemark, the geometryArray should only contain 1 geometry!
+				 */
+				for ($i=0; $i < count($geometryArray); $i++) {
+					$currentPlacemark = new KMLPlacemark($geometryArray[$i]);
+					
+					foreach ($metadataArray as $key => $value) {
+						$currentPlacemark->setProperty($key, $value);
+					}
+					$currentPlacemark->setProperty("Mapbender:kml", true);
+					$currentPlacemark->setProperty("Mapbender:name", "unknown");
+					$currentPlacemark->setProperty("Mapbender:id", $kmlId);
+					$currentPlacemark->setProperty("Mapbender:placemarkId", $id);
+					array_push($this->placemarkArray, $currentPlacemark);
+				}
+				$id ++;		    
+			}
+		}
+		else {
+			$e = new mb_exception("class_kml.php: KMLOWSParser: No placemarks found in KML.");
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Returns an associative array, containing metadata
+	 */
+	private function getMetadataFromPlacemarkNode ($node) {
+	    $children = $node->childNodes;
+	    
+	    $metadataArray = array();
+	    
+		// search "ExtendedData" tag
+		foreach ($children as $child) {
+			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "EXTENDEDDATA") {  
+				$extendedDataNode = $child;
+				$extDataChildren = $extendedDataNode->childNodes; 
+				
+				// search "Data" or "SchemaData" tag
+				foreach ($extDataChildren as $extDataChild) {
+					if (mb_strtoupper($this->sepNameSpace($extDataChild->nodeName)) == "SCHEMADATA") {
+						$simpleDataNode = $extDataChild->firstChild;
+						while ($simpleDataNode !== NULL) {
+							if (mb_strtoupper($this->sepNameSpace($simpleDataNode->nodeName)) == "SIMPLEDATA") {
+								$name = $simpleDataNode->getAttribute("name");
+								$value = $simpleDataNode->nodeValue;
+								$metadataArray[$name] = $value;
+							}
+							$simpleDataNode = $simpleDataNode->nextSibling;
+						}
+					}
+					if (mb_strtoupper($this->sepNameSpace($extDataChild->nodeName)) == "DATA") {
+						$dataNode = $extDataChild;
+						$name = $dataNode->getAttribute("name");
+						$metadataArray[$name] = $dataNode->nodeValue;
+					}
+				}
+			}
+		}
+		return $metadataArray;		
+	}
+	
+	/**
+	 * Given a "Point" node, this function returns the geometry (KMLPoint)
+	 * from within the node.
+	 */
+	private function getGeometryFromPointNode ($node) {
+		$coordinatesNode = $this->getCoordinatesNode($node);
+		$geomString = $coordinatesNode->nodeValue;
+		return new KMLPoint($geomString, 4326);
+	}
+	
+	/**
+	 * Given a "LineString" node, this function returns the geometry (KMLLine)
+	 * from within the node.
+	 */
+	private function getGeometryFromLinestringNode ($node) {
+		$coordinatesNode = $this->getCoordinatesNode($node);
+		$geomString = $coordinatesNode->nodeValue;
+		return new KMLLine($geomString, 4326);
+	}
+	
+	/**
+	 * Given a "Polygon" node, this function returns the geometry (KMLPolygon)
+	 * from within the node.
+	 */
+	private function getGeometryFromPolygonNode ($node) {
+		$polygon = null;
+
+	    $children = $node->childNodes;
+	    
+		// create new KMLPolygon
+		foreach ($children as $child) {
+			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "EXTERIOR" || 
+				mb_strtoupper($this->sepNameSpace($child->nodeName)) == "OUTERBOUNDARYIS") {
+				// create a new Linear Ring
+				$outerBoundary = $this->getGeometryFromLinearRingNode($child);
+				$polygon = new KMLPolygon($outerBoundary);
+			}
+		}
+		
+		if ($polygon !== null) {
+			// append inner boundaries to KMLPolygon
+			foreach ($children as $child) {
+				if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "INTERIOR" || 
+					mb_strtoupper($this->sepNameSpace($child->nodeName)) == "INNERBOUNDARYIS") {
+					// create a new Linear Ring
+					$innerBoundary = $this->getGeometryFromLinearRingNode($child);
+					$polygon->appendInnerBoundary($innerBoundary);
+				}
+			}
+		}
+		return $polygon;
+	}
+	
+	/**
+	 * Given a "OuterBoundaryIs" or "InnerBoundaryIs" node, this function 
+	 * returns the geometry (KMLLinearRing) within the child node named "linearring"
+	 */
+	private function getGeometryFromLinearRingNode ($node) {
+	    $children = $node->childNodes;
+		foreach($children as $child) {
+			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "LINEARRING") {
+				$coordinatesNode = $this->getCoordinatesNode($child);
+				$geomString = $coordinatesNode->nodeValue;
+				return new KMLLinearRing($geomString);
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * Checks if the child nodes of a given KML node contains any geometries and
+	 * returns an array of geometries (KMLPoint, KMLPolygon, KMLLinestring and KMLMultigeometry)
+	 */
+	private function getGeometryArrayFromPlacemarkOrMultigeometryNode ($node) {
+	    $geometryArray = array();
+	    
+	    $children = $node->childNodes;
+		foreach($children as $child) {
+			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POINT") {
+				array_push($geometryArray, $this->getGeometryFromPointNode($child));
+			}
+			elseif (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POLYGON") {
+				array_push($geometryArray, $this->getGeometryFromPolygonNode($child));
+			}
+			elseif (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "LINESTRING") {
+				array_push($geometryArray, $this->getGeometryFromLinestringNode($child));
+			}
+			elseif (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "MULTIGEOMETRY") {
+				$geometryArray = $this->getGeometryArrayFromPlacemarkOrMultigeometryNode($child);
+				$multigeometry = new KMLMultiGeometry();
+				
+				for ($i=0; $i < count($geometryArray); $i++) {
+					$multigeometry->append($geometryArray[$i]);	
+				}
+				array_push($geometryArray, $multigeometry);
+			}
+		}
+		return $geometryArray;
+	}
+
+	/**
+	 * Returns the child node with node name "coordinates" of a given KML node.
+	 * If no node is found, null is returned.
+	 */
+	private function getCoordinatesNode ($node) {
+	    $children = $node->childNodes;
+		foreach($children as $child) {
+			if (mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POSLIST" || 
+				mb_strtoupper($this->sepNameSpace($child->nodeName)) == "POS" || 
+				mb_strtoupper($this->sepNameSpace($child->nodeName)) == "COORDINATES") {
+				return $child;
+			}
+		}
+		return null;
+	}
+
+	private function sepNameSpace($s){
+		$c = mb_strpos($s,":"); 
+		if($c>0){
+			return mb_substr($s,$c+1);
+		}
+		else{
+			return $s;
+		}		
+	}
+}
+?>

Modified: branches/print_dev/http/classes/class_layer_monitor.php
===================================================================
--- branches/print_dev/http/classes/class_layer_monitor.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_layer_monitor.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,57 +1,57 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-class Layer_load_count {
-
-	function __construct () {
-	}
-	
-	/**
-	 * increments the load count in table "layer_load_count" for
-	 * each layer in the WMC document by one. 
-	 */
-	function increment($layer_id) {
-
-		//check if an entry exists for the current layer id
-		$sql = "SELECT load_count FROM layer_load_count WHERE fkey_layer_id = $1";
-		$v = array($layer_id);
-		$t = array('i');
-		$res = db_prep_query($sql, $v, $t);
-		$row = db_fetch_array($res);
-
-		//if yes, increment the load counter
-		if ($row) {
-			$currentCount = $row["load_count"];
-			$sql = "UPDATE layer_load_count SET load_count = $1 WHERE fkey_layer_id = $2";
-			$v = array(intval($currentCount + 1), $layer_id);
-			$t = array('i', 'i');
-			$res = db_prep_query($sql, $v, $t);
-		}
-		//if no, insert a new row with current layer id and load_count = 1
-		else {
-			$sql = "INSERT INTO layer_load_count (fkey_layer_id, load_count) VALUES ($1, 1)";
-			$v = array($layer_id);
-			$t = array('i');
-			$res = db_prep_query($sql, $v, $t);
-		}
-	}
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+class Layer_load_count {
+
+	function __construct () {
+	}
+	
+	/**
+	 * increments the load count in table "layer_load_count" for
+	 * each layer in the WMC document by one. 
+	 */
+	function increment($layer_id) {
+
+		//check if an entry exists for the current layer id
+		$sql = "SELECT load_count FROM layer_load_count WHERE fkey_layer_id = $1";
+		$v = array($layer_id);
+		$t = array('i');
+		$res = db_prep_query($sql, $v, $t);
+		$row = db_fetch_array($res);
+
+		//if yes, increment the load counter
+		if ($row) {
+			$currentCount = $row["load_count"];
+			$sql = "UPDATE layer_load_count SET load_count = $1 WHERE fkey_layer_id = $2";
+			$v = array(intval($currentCount + 1), $layer_id);
+			$t = array('i', 'i');
+			$res = db_prep_query($sql, $v, $t);
+		}
+		//if no, insert a new row with current layer id and load_count = 1
+		else {
+			$sql = "INSERT INTO layer_load_count (fkey_layer_id, load_count) VALUES ($1, 1)";
+			$v = array($layer_id);
+			$t = array('i');
+			$res = db_prep_query($sql, $v, $t);
+		}
+	}
+}
+?>

Modified: branches/print_dev/http/classes/class_locale.php
===================================================================
--- branches/print_dev/http/classes/class_locale.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_locale.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,259 +1,259 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_locale.php
-# 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
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-/**
- * sets the locale, depending on various settings:
- * 1) a language ID passed to the constructor
- * 2) the browser settings $_SERVER["HTTP_ACCEPT_LANGUAGE"]
- * 3) a default language ID
- *
- */
-class Mb_locale {
-	var $knownLanguages = null;
-	var $systemLocales = null;
-	var $browserLanguages = null;
-	var $os = null;
-	var $name = null;
-	var $defaultLanguage = "en";
-	var $status = "No locale set.";
-
-	function Mb_locale($languageId) {
-		if (!$languageId) {
-			$languageId = LANGUAGE;
-		}
-		$e = new Mb_notice("class_locale: setting locale to " . $languageId);
-		if (USE_I18N) {
-			if (!$this->setCurrentLocale($languageId)) {
-				$e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
-			}
-		}
-		else {
-			$this->setCurrentLocale($this->defaultLanguage);
-		}
-	}
-
-    /**
-	 * Get the current locale, evaluating GET/POST variables, browser languages
-     * and a default locale (in that preference)
-	 *
-	 * @returns current locale
-	 */
-	function setCurrentLocale($languageId) {
-
-		// try to set the locale to $languageId
-		if ($this->checkAndSetLocale($languageId)) {
-			return true;
-		}
-		else {
-			$e = new Mb_notice("class_locale: no input parameter specified.");
-		}
-
-		// determine the browser setting and try to set locale according to that
-		if ($this->browserLanguage == null) {
-			$this->setBrowserLanguages();
-		}
-		foreach ($this->browserLanguages as $lang) {
-			$e = new Mb_notice("trying browser setting " . $lang);
-			if ($this->checkAndSetLocale($lang)) {
-				return true;
-			}
-		}
-
-		// set to default language
-		$e = new Mb_notice("trying default language " . $this->defaultLanguage);
-		return $this->checkAndSetLocale($this->defaultLanguage);
-	}
-
-	/**
-	 * checks if a locale is available; if yes, it is set via setlocale
-	 *
-	 * @returns true if the the locale is set successfully; otherwise false
-	 */
-	function checkAndSetLocale($languageId) {
-		if ($this->os == null) {
-			$this->os = $this->guessHostOS();
-		}
-		
-		if (!USE_I18N || ($this->os != null && isset($languageId))) {
-			if ($this->isKnownLanguage($languageId)) {
-		
-				if ($this->systemLocales == null) {
-					$this->setSystemLocales();
-				}
-		
-				$locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];
-				$selectedLocale = setlocale(LC_MESSAGES, $locale);
-
-				if ($selectedLocale) {
-					$this->name = $selectedLocale;
-					$_SESSION["mb_lang"] = $languageId;
-					$_SESSION["mb_locale"] = $this->name;
-					$e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
-
-					// from http://de3.php.net/manual/de/function.gettext.php
-					$path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
-					$enc = bind_textdomain_codeset("Mapbender", "UTF-8");
-					$dom = textdomain("Mapbender");
-					return true;
-				}
-			}
-		}
-		$e = new Mb_notice("locale " . $locale . " not found.");
-		return false;
-	}
-
-	/**
-	* Guess the operating system which on which this code is running
-	* multiple methods are tested for reliably guessing the os
-	*
-	* @private
-	* @returns string with os name
-	*/
-	function guessHostOS(){
-		if (strncasecmp(php_uname(), 'Windows', 7) == 0) {
-			return 'windows';
-		}
-		else if (strncasecmp(php_uname(), 'Linux', 5) == 0) {
-			return 'linux';
-		}
-		else if (strncasecmp(php_uname(), 'OpenBSD', 7) == 0) {
-			return 'bsd';
-		}
-		else if (strncasecmp(php_uname(), 'FreeBSD', 7) == 0) {
-			return 'bsd';
-		}
-		new mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
-		return null;
-	}
-
-        /**
-         * checks if a language is supported
-         *
-         * @returns true if the language is supported; otherwise false
-         */
-        function isKnownLanguage($languageId) {
-                if ($this->knownLocales == null) {
-                        $this->setKnownLanguages();
-                }
-                if (array_key_exists($languageId, $this->knownLanguages)) {
-                        return true;
-                }
-                else {
-                        $e = new Mb_notice("language " . $languageId . " not supported.");
-                }
-                return false;
-        }
-
-
-
-        /**
-         * determines the available Locales on this system
-         */
-        function setSystemLocales() {
-			$this->systemLocales['pt_PT'] = array(
-				'linux' => 'pt_PT.utf8',
-				'windows' => 'Portuguese_Portugal.1252',
-				'bsd' => 'pt_PT',
-				'posix' => 'pt_PT'
-			);
-			$this->systemLocales['fr_FR'] = array(
-				'linux' => 'fr_FR.utf8',
-				'windows' => 'French_France.1252',
-				'bsd' => 'fr_FR',
-				'posix' => 'fr_FR'
-			);
-			$this->systemLocales['es_ES'] = array(
-				'linux' => 'es_ES.utf8',
-				'windows' => 'Spanish_Spain.1252',
-				'bsd' => 'es_ES',
-				'posix' => 'es_ES'
-			);
-			$this->systemLocales['it_IT'] = array(
-				'linux' => 'it_IT.utf8',
-				'windows' => 'Italian_Italy.1252',
-				'bsd' => 'it_IT',
-				'posix' => 'it_IT'
-			);
-			$this->systemLocales['de_DE'] = array(
-				'linux' => 'de_DE.utf8',
-				'windows' => 'German_Germany.1252',
-				'bsd' => 'de_DE',
-				'posix' => 'de_DE'
-			);
-			$this->systemLocales['en_US'] = array(
-				'linux' => 'en_US.utf8',
-				'windows' => 'English_United States.1252',
-				'bsd' => 'en_US',
-				'posix' => 'en_US'
-			);
-			$this->systemLocales['bg_BG'] = array(
-				'linux' => 'bg_BG.utf8',
-				'windows' => 'Bulgarian_Bulgaria.1251',
-				'bsd' => 'bg_BG',
-				'posix' => 'bg_BG'
-			);
-			$this->systemLocales['el_GR'] = array(
-				'linux' => 'el_GR.utf8',
-				'windows' => 'Greek_Greece.1253',
-				'bsd' => 'el_GR',
-				'posix' => 'el_GR'
-			);
-        }
-
-        /**
-         * set the known languages
-         */
-        function setKnownLanguages() {
-                $this->knownLanguages = array(
-						'en_US' => 'en_US',
-						'en' => 'en_US',
-						'de_DE' => 'de_DE',
-						'de' => 'de_DE',
-						'bg_BG' => 'bg_BG',
-						'bg' => 'bg_BG',
-						'es_ES' => 'es_ES',
-						'es' => 'es_ES',
-						'nl_NL' => 'nl_NL',
-						'nl' => 'nl_NL',
-						'fr_FR' => 'fr_FR',
-						'fr' => 'fr_FR',
-						'el_GR' => 'el_GR',
-						'gr' => 'el_GR',
-						'it_IT' => 'it_IT',
-						'it' => 'it_IT');
-        }
-
-        /**
-         * sets the languages accepted by the client browser
-         */
-        function setBrowserLanguages () {
-                $this->browserLanguages = array();
-
-            $bLangs = split(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
-            foreach ($bLangs as $lang) {
-                        if (strpos($lang, ';') === false)
-                                array_push($this->browserLanguages, $lang);
-                        else
-                                array_push($this->browserLanguages, substr($lang, 0, strpos($lang, ';')));
-            }
-        }
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_locale.php
+# 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
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+/**
+ * sets the locale, depending on various settings:
+ * 1) a language ID passed to the constructor
+ * 2) the browser settings $_SERVER["HTTP_ACCEPT_LANGUAGE"]
+ * 3) a default language ID
+ *
+ */
+class Mb_locale {
+	var $knownLanguages = null;
+	var $systemLocales = null;
+	var $browserLanguages = null;
+	var $os = null;
+	var $name = null;
+	var $defaultLanguage = "en";
+	var $status = "No locale set.";
+
+	function Mb_locale($languageId) {
+		if (!$languageId) {
+			$languageId = LANGUAGE;
+		}
+		$e = new Mb_notice("class_locale: setting locale to " . $languageId);
+		if (USE_I18N) {
+			if (!$this->setCurrentLocale($languageId)) {
+				$e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
+			}
+		}
+		else {
+			$this->setCurrentLocale($this->defaultLanguage);
+		}
+	}
+
+    /**
+	 * Get the current locale, evaluating GET/POST variables, browser languages
+     * and a default locale (in that preference)
+	 *
+	 * @returns current locale
+	 */
+	function setCurrentLocale($languageId) {
+
+		// try to set the locale to $languageId
+		if ($this->checkAndSetLocale($languageId)) {
+			return true;
+		}
+		else {
+			$e = new Mb_notice("class_locale: no input parameter specified.");
+		}
+
+		// determine the browser setting and try to set locale according to that
+		if ($this->browserLanguage == null) {
+			$this->setBrowserLanguages();
+		}
+		foreach ($this->browserLanguages as $lang) {
+			$e = new Mb_notice("trying browser setting " . $lang);
+			if ($this->checkAndSetLocale($lang)) {
+				return true;
+			}
+		}
+
+		// set to default language
+		$e = new Mb_notice("trying default language " . $this->defaultLanguage);
+		return $this->checkAndSetLocale($this->defaultLanguage);
+	}
+
+	/**
+	 * checks if a locale is available; if yes, it is set via setlocale
+	 *
+	 * @returns true if the the locale is set successfully; otherwise false
+	 */
+	function checkAndSetLocale($languageId) {
+		if ($this->os == null) {
+			$this->os = $this->guessHostOS();
+		}
+		
+		if (!USE_I18N || ($this->os != null && isset($languageId))) {
+			if ($this->isKnownLanguage($languageId)) {
+		
+				if ($this->systemLocales == null) {
+					$this->setSystemLocales();
+				}
+		
+				$locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];
+				$selectedLocale = setlocale(LC_MESSAGES, $locale);
+
+				if ($selectedLocale) {
+					$this->name = $selectedLocale;
+					$_SESSION["mb_lang"] = $languageId;
+					$_SESSION["mb_locale"] = $this->name;
+					$e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
+
+					// from http://de3.php.net/manual/de/function.gettext.php
+					$path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
+					$enc = bind_textdomain_codeset("Mapbender", "UTF-8");
+					$dom = textdomain("Mapbender");
+					return true;
+				}
+			}
+		}
+		$e = new Mb_notice("locale " . $locale . " not found.");
+		return false;
+	}
+
+	/**
+	* Guess the operating system which on which this code is running
+	* multiple methods are tested for reliably guessing the os
+	*
+	* @private
+	* @returns string with os name
+	*/
+	function guessHostOS(){
+		if (strncasecmp(php_uname(), 'Windows', 7) == 0) {
+			return 'windows';
+		}
+		else if (strncasecmp(php_uname(), 'Linux', 5) == 0) {
+			return 'linux';
+		}
+		else if (strncasecmp(php_uname(), 'OpenBSD', 7) == 0) {
+			return 'bsd';
+		}
+		else if (strncasecmp(php_uname(), 'FreeBSD', 7) == 0) {
+			return 'bsd';
+		}
+		new mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
+		return null;
+	}
+
+        /**
+         * checks if a language is supported
+         *
+         * @returns true if the language is supported; otherwise false
+         */
+        function isKnownLanguage($languageId) {
+                if ($this->knownLocales == null) {
+                        $this->setKnownLanguages();
+                }
+                if (array_key_exists($languageId, $this->knownLanguages)) {
+                        return true;
+                }
+                else {
+                        $e = new Mb_notice("language " . $languageId . " not supported.");
+                }
+                return false;
+        }
+
+
+
+        /**
+         * determines the available Locales on this system
+         */
+        function setSystemLocales() {
+			$this->systemLocales['pt_PT'] = array(
+				'linux' => 'pt_PT.utf8',
+				'windows' => 'Portuguese_Portugal.1252',
+				'bsd' => 'pt_PT',
+				'posix' => 'pt_PT'
+			);
+			$this->systemLocales['fr_FR'] = array(
+				'linux' => 'fr_FR.utf8',
+				'windows' => 'French_France.1252',
+				'bsd' => 'fr_FR',
+				'posix' => 'fr_FR'
+			);
+			$this->systemLocales['es_ES'] = array(
+				'linux' => 'es_ES.utf8',
+				'windows' => 'Spanish_Spain.1252',
+				'bsd' => 'es_ES',
+				'posix' => 'es_ES'
+			);
+			$this->systemLocales['it_IT'] = array(
+				'linux' => 'it_IT.utf8',
+				'windows' => 'Italian_Italy.1252',
+				'bsd' => 'it_IT',
+				'posix' => 'it_IT'
+			);
+			$this->systemLocales['de_DE'] = array(
+				'linux' => 'de_DE.utf8',
+				'windows' => 'German_Germany.1252',
+				'bsd' => 'de_DE',
+				'posix' => 'de_DE'
+			);
+			$this->systemLocales['en_US'] = array(
+				'linux' => 'en_US.utf8',
+				'windows' => 'English_United States.1252',
+				'bsd' => 'en_US',
+				'posix' => 'en_US'
+			);
+			$this->systemLocales['bg_BG'] = array(
+				'linux' => 'bg_BG.utf8',
+				'windows' => 'Bulgarian_Bulgaria.1251',
+				'bsd' => 'bg_BG',
+				'posix' => 'bg_BG'
+			);
+			$this->systemLocales['el_GR'] = array(
+				'linux' => 'el_GR.utf8',
+				'windows' => 'Greek_Greece.1253',
+				'bsd' => 'el_GR',
+				'posix' => 'el_GR'
+			);
+        }
+
+        /**
+         * set the known languages
+         */
+        function setKnownLanguages() {
+                $this->knownLanguages = array(
+						'en_US' => 'en_US',
+						'en' => 'en_US',
+						'de_DE' => 'de_DE',
+						'de' => 'de_DE',
+						'bg_BG' => 'bg_BG',
+						'bg' => 'bg_BG',
+						'es_ES' => 'es_ES',
+						'es' => 'es_ES',
+						'nl_NL' => 'nl_NL',
+						'nl' => 'nl_NL',
+						'fr_FR' => 'fr_FR',
+						'fr' => 'fr_FR',
+						'el_GR' => 'el_GR',
+						'gr' => 'el_GR',
+						'it_IT' => 'it_IT',
+						'it' => 'it_IT');
+        }
+
+        /**
+         * sets the languages accepted by the client browser
+         */
+        function setBrowserLanguages () {
+                $this->browserLanguages = array();
+
+            $bLangs = split(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
+            foreach ($bLangs as $lang) {
+                        if (strpos($lang, ';') === false)
+                                array_push($this->browserLanguages, $lang);
+                        else
+                                array_push($this->browserLanguages, substr($lang, 0, strpos($lang, ';')));
+            }
+        }
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_point.php
===================================================================
--- branches/print_dev/http/classes/class_point.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_point.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,202 +1,202 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-/**
- * A Mapbender_point is a 2- or 3-dimensional point with an EPSG. 
- */
-class Mapbender_point {
-	var $x;
-	var $y;
-	var $z;
-	var $epsg;
-	
-	/**
-	 * @constructor
-	 */
-	function __construct() {
-		if (func_num_args() == 4) {
-			$x = func_get_arg(0);
-			$y = func_get_arg(1);
-			$z = func_get_arg(2);
-			$epsg = func_get_arg(3);
-		}
-		else if (func_num_args() == 3) {
-			$x = func_get_arg(0);
-			$y = func_get_arg(1);
-			$z = false;
-			$epsg = func_get_arg(2);
-		}
-		else {
-			return;
-		}
-
-		if (!isset($x) || !isset($y) || !isset($epsg)) {
-			$e = new mb_exception("Mapbender_point: constructor: some parameters are not set (set (x: ".$x.", y: ".$y.", z: ".$z.", epsg:".$epsg.")!");
-		}
-		$this->x = $x;
-		$this->y = $y;
-		$this->z = $z;
-		$this->epsg = $epsg;
-	}
-	
-	/**
-	 * computes a new point with the minimal coordinates of this point and $point
-	 */
-	static function min ($point1, $point2) {
-		if ($point1->epsg == $point2->epsg) {
-			if ($point1->isWestOf($point2)) {
-				$minx = $point1->x;
-			}
-			else {
-				$minx = $point2->x;
-			}
-			if ($point1->isSouthOf($point2)) {
-				$miny = $point1->y;
-			}
-			else {
-				$miny = $point2->y;
-			}
-			return new Mapbender_point($minx, $miny, $point1->epsg);
-		}
-		else {
-			$e = new mb_exception("Mapbender_point: cannot process min with different EPSG codes");
-		}
-	}
-	
-	/**
-	 * computes a new point with the maximal coordinates of this point and $point
-	 */
-	static function max ($point1, $point2) {
-		if ($point1->epsg == $point2->epsg) {
-			if ($point1->isWestOf($point2)) {
-				$maxx = $point2->x;
-			}
-			else {
-				$maxx = $point1->x;
-			}
-			if ($point1->isSouthOf($point2)) {
-				$maxy = $point2->y;
-			}
-			else {
-				$maxy = $point1->y;
-			}
-			return new Mapbender_point($maxx, $maxy, $point1->epsg);
-		}
-		else {
-			$e = new mb_exception("Mapbender_point: cannot process min with different EPSG codes");
-		}
-	}
-	
-	function isWestOf($point) {
-		if ($this->x < $point->x) {
-			return true;
-		}
-	}
-
-	function isSouthOf($point) {
-		if ($this->y < $point->y) {
-			return true;
-		}
-	}
-	
-	/**
-	 * Addition
-	 * 
-	 * @param anotherPoint another Mapbender_point
-	 */
-	function plus ($anotherPoint) {
-		return new Mapbender_point($this->x + $anotherPoint->x, $this->y + $anotherPoint->y, $this->epsg);
-	}
-
-	/**
-	 * Subtraction
-	 * 
-	 * @param anotherPoint another Mapbender_point
-	 */
-	function minus ($anotherPoint) {
-		return $this->plus($anotherPoint->times(-1));
-	}
-	
-	/**
-	 * Scalar multiplication
-	 * 
-	 * @param aFloat a floating point number
-	 */
-	function times ($aFloat) {
-		return new Mapbender_point($this->x * $aFloat, $this->y * $aFloat, $this->epsg);
-	}
-
-	/**
-	 * transforms this point to another EPSG
-	 * 
-	 * @param {Integer} toEpsg the coordinates are transformed to this EPSG code.
-	 */
-	function transform($toEpsg) {
-		if(SYS_DBTYPE=='pgsql'){
-			$currentEpsg = preg_replace("/EPSG:/", "", $this->epsg);
-			$targetEpsg = preg_replace("/EPSG:/", "", $toEpsg);
-			$sql = "SELECT X(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as x, ";
-			$sql .= "Y(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as y, ";
-			if (isset($this->z)) {
-				$sql .= "Z(transform(GeometryFromText('POINT(".$this->x." ".$this->y." ".$this->z.")',".$currentEpsg."),".$targetEpsg.")) as z";
-			}
-			$res = db_query($sql);
-			if (isset($this->z)) {
-				$point = new Mapbender_point(db_result($res,0,"x"), db_result($res,0,"y"), db_result($res,0,"z"), $toEpsg);
-			}
-			else {
-				$point = new Mapbender_point(db_result($res,0,"x"), db_result($res,0,"y"), $toEpsg);
-			}
-			$this->x = $point->x;
-			$this->y = $point->y;
-			$this->z = $point->z;
-			$this->epsg = $point->epsg;
-		}
-		else {
-			$e = new mb_exception("transformCoordinates needs PostgreSQL");
-		}
-	}
-	
-	function toHtml () {
-		$str = "";
-
-		$xArray = explode(".", strval($this->x));
-		$str .= $xArray[0] . "°";
-		if ($xArray[1]) {
-			$str .= $xArray[1] . "'";
-		}
-		$str .= " O / ";
-		
-		$yArray = explode(".", strval($this->y));
-		$str .= $yArray[0] . "°";
-		if ($yArray[1]) {
-			$str .= $yArray[1] . "'";
-		}
-		$str .= " N";
-		return $str;
-		
-	}
-	
-	function __toString() {
-		return (string) "(" . $this->x . "," . $this->y . "," . $this->z . "," . $this->epsg . ")";
-	}
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+/**
+ * A Mapbender_point is a 2- or 3-dimensional point with an EPSG. 
+ */
+class Mapbender_point {
+	var $x;
+	var $y;
+	var $z;
+	var $epsg;
+	
+	/**
+	 * @constructor
+	 */
+	function __construct() {
+		if (func_num_args() == 4) {
+			$x = func_get_arg(0);
+			$y = func_get_arg(1);
+			$z = func_get_arg(2);
+			$epsg = func_get_arg(3);
+		}
+		else if (func_num_args() == 3) {
+			$x = func_get_arg(0);
+			$y = func_get_arg(1);
+			$z = false;
+			$epsg = func_get_arg(2);
+		}
+		else {
+			return;
+		}
+
+		if (!isset($x) || !isset($y) || !isset($epsg)) {
+			$e = new mb_exception("Mapbender_point: constructor: some parameters are not set (set (x: ".$x.", y: ".$y.", z: ".$z.", epsg:".$epsg.")!");
+		}
+		$this->x = $x;
+		$this->y = $y;
+		$this->z = $z;
+		$this->epsg = $epsg;
+	}
+	
+	/**
+	 * computes a new point with the minimal coordinates of this point and $point
+	 */
+	static function min ($point1, $point2) {
+		if ($point1->epsg == $point2->epsg) {
+			if ($point1->isWestOf($point2)) {
+				$minx = $point1->x;
+			}
+			else {
+				$minx = $point2->x;
+			}
+			if ($point1->isSouthOf($point2)) {
+				$miny = $point1->y;
+			}
+			else {
+				$miny = $point2->y;
+			}
+			return new Mapbender_point($minx, $miny, $point1->epsg);
+		}
+		else {
+			$e = new mb_exception("Mapbender_point: cannot process min with different EPSG codes");
+		}
+	}
+	
+	/**
+	 * computes a new point with the maximal coordinates of this point and $point
+	 */
+	static function max ($point1, $point2) {
+		if ($point1->epsg == $point2->epsg) {
+			if ($point1->isWestOf($point2)) {
+				$maxx = $point2->x;
+			}
+			else {
+				$maxx = $point1->x;
+			}
+			if ($point1->isSouthOf($point2)) {
+				$maxy = $point2->y;
+			}
+			else {
+				$maxy = $point1->y;
+			}
+			return new Mapbender_point($maxx, $maxy, $point1->epsg);
+		}
+		else {
+			$e = new mb_exception("Mapbender_point: cannot process min with different EPSG codes");
+		}
+	}
+	
+	function isWestOf($point) {
+		if ($this->x < $point->x) {
+			return true;
+		}
+	}
+
+	function isSouthOf($point) {
+		if ($this->y < $point->y) {
+			return true;
+		}
+	}
+	
+	/**
+	 * Addition
+	 * 
+	 * @param anotherPoint another Mapbender_point
+	 */
+	function plus ($anotherPoint) {
+		return new Mapbender_point($this->x + $anotherPoint->x, $this->y + $anotherPoint->y, $this->epsg);
+	}
+
+	/**
+	 * Subtraction
+	 * 
+	 * @param anotherPoint another Mapbender_point
+	 */
+	function minus ($anotherPoint) {
+		return $this->plus($anotherPoint->times(-1));
+	}
+	
+	/**
+	 * Scalar multiplication
+	 * 
+	 * @param aFloat a floating point number
+	 */
+	function times ($aFloat) {
+		return new Mapbender_point($this->x * $aFloat, $this->y * $aFloat, $this->epsg);
+	}
+
+	/**
+	 * transforms this point to another EPSG
+	 * 
+	 * @param {Integer} toEpsg the coordinates are transformed to this EPSG code.
+	 */
+	function transform($toEpsg) {
+		if(SYS_DBTYPE=='pgsql'){
+			$currentEpsg = preg_replace("/EPSG:/", "", $this->epsg);
+			$targetEpsg = preg_replace("/EPSG:/", "", $toEpsg);
+			$sql = "SELECT X(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as x, ";
+			$sql .= "Y(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as y, ";
+			if (isset($this->z)) {
+				$sql .= "Z(transform(GeometryFromText('POINT(".$this->x." ".$this->y." ".$this->z.")',".$currentEpsg."),".$targetEpsg.")) as z";
+			}
+			$res = db_query($sql);
+			if (isset($this->z)) {
+				$point = new Mapbender_point(db_result($res,0,"x"), db_result($res,0,"y"), db_result($res,0,"z"), $toEpsg);
+			}
+			else {
+				$point = new Mapbender_point(db_result($res,0,"x"), db_result($res,0,"y"), $toEpsg);
+			}
+			$this->x = $point->x;
+			$this->y = $point->y;
+			$this->z = $point->z;
+			$this->epsg = $point->epsg;
+		}
+		else {
+			$e = new mb_exception("transformCoordinates needs PostgreSQL");
+		}
+	}
+	
+	function toHtml () {
+		$str = "";
+
+		$xArray = explode(".", strval($this->x));
+		$str .= $xArray[0] . "°";
+		if ($xArray[1]) {
+			$str .= $xArray[1] . "'";
+		}
+		$str .= " O / ";
+		
+		$yArray = explode(".", strval($this->y));
+		$str .= $yArray[0] . "°";
+		if ($yArray[1]) {
+			$str .= $yArray[1] . "'";
+		}
+		$str .= " N";
+		return $str;
+		
+	}
+	
+	function __toString() {
+		return (string) "(" . $this->x . "," . $this->y . "," . $this->z . "," . $this->epsg . ")";
+	}
+}
+?>

Modified: branches/print_dev/http/classes/class_wfs.php
===================================================================
--- branches/print_dev/http/classes/class_wfs.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfs.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 require_once(dirname(__FILE__)."/class_gml.php");
 require_once(dirname(__FILE__)."/class_ows.php");

Modified: branches/print_dev/http/classes/class_wfsToDb.php
===================================================================
--- branches/print_dev/http/classes/class_wfsToDb.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfsToDb.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 require_once(dirname(__FILE__)."/class_wfs.php");
 

Modified: branches/print_dev/http/classes/class_wfs_1_0.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_1_0.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfs_1_0.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 require_once(dirname(__FILE__)."/class_wfs.php");
 

Modified: branches/print_dev/http/classes/class_wfs_1_1.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_1_1.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfs_1_1.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 require_once(dirname(__FILE__)."/class_wfs.php");
 

Modified: branches/print_dev/http/classes/class_wfs_conf.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_conf.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfs_conf.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,383 +1,383 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_wfs_conf.php
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_user.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
-class WfsConf {
-	var $confArray = array();
-
-	/**
-	 * Gets the configuration from the database
-	 */
-	function __construct () {
-
-	}
-	
-	function __toString () {
-		$json = new Mapbender_JSON();
-		return $json->encode($this->confArray);
-	}
-	
-	/**
-	 * Loads WFS conf data from the database
-	 * 
-	 * @return Object WFS conf data.
-	 * @param $idOrIdArray Object May be an integer or an array of integers representing WFS conf IDs.
-	 */
-	public function load ($idOrIdArray) {
-		// Check parameter and set idArray
-		if (isset($idOrIdArray)){
-			
-			// parameter is a number	
-			if (!is_array($idOrIdArray) && is_numeric($idOrIdArray)) {
-				$idOrIdArray = array(intval($idOrIdArray));
-			}
-
-			// parameter is an array of numbers
-			if (is_array($idOrIdArray)) {
-				$idArray = array();
-				for ($i=0; $i < count($idOrIdArray); $i++) {
-					if (!is_numeric($idOrIdArray[$i])) {
-						$e = new mb_exception("Wfs_conf: constructor: wrong parameter: ".$idOrIdArray[$i]." is not a number.");
-						return array();
-					}
-					array_push($idArray, intval($idOrIdArray[$i]));
-				}
-
-				// If a user ID is given, remove the ones the user has no access to
-				if ($_SESSION["mb_user_id"]) {
-					$user = new User($_SESSION["mb_user_id"]);
-					$idArray = array_intersect($idArray, $user->getWfsConfByPermission());
-				}
-
-				return $this->getWfsConfFromDb($idArray);
-			}
-			// parameter is invalid
-			else {
-				$e = new mb_exception("Wfs_conf: constructor: parameter must be number or an array of numbers.");
-				return array();
-			}
-		}
-		else {
-			$e = new mb_exception("Wfs_conf: constructor: parameter is not valid");
-			return null;
-		}
-	}
-	
-
-	// --------------------------- private -----------------------------------
-
-	/**
-	 * Gets the database content for a number of WFS configurations given by their IDs.
-	 * 
-	 * @return Array
-	 * @param $idArray Array an array of integer values representing WFS conf IDs.
-	 */
-	private static function getWfsConfFromDbByArray ($idArray) {
-		$rowArray = array();
-        foreach ($idArray as $id) {
-        		$sql = "SELECT * FROM wfs_conf ";
-                $sql .= "JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
-                $sql .= "WHERE wfs_conf.wfs_conf_id = $1 LIMIT 1";
-        
-                $v = array($id);
-                $t = array("i");
-                $res = db_prep_query($sql, $v, $t);
-                $row = db_fetch_array($res);
-                array_push($rowArray, $row);
-        }
-        return $rowArray;
-	}
-	
-	public static function getGeomColumnNameByConfId ($confId) {
-		$elArray = self::getWfsConfElementFromDb($confId);
-		foreach ($elArray as $element) {
-			if ($element["f_geom"] == "1") {
-				return $element["element_name"];
-			}
-		}
-		return null;
-	}
-	
-	/**
-	 * Gets the database content of a WFS conf element given by a WFS conf ID.
-	 * 
-	 * @return Array
-	 * @param $id Integer the WFS conf ID.
-	 */
-	private static function getWfsConfElementFromDb ($id) {
-		$sql = "SELECT * FROM wfs_conf_element ";
-		$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
-		$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
-		#filtered on client side
-		#$sql .= "AND wfs_conf_element.f_search = 1 ";
-		$sql .= "ORDER BY wfs_conf_element.f_pos";
-		$v = array($id);
-		$t = array('i');
-		$res = db_prep_query($sql, $v, $t);
-	
-		$elementArray = array();
-		while ($row = db_fetch_array($res)) {
-			$currentElement = array("element_name" => $row["element_name"],
-									"element_type" => $row["element_type"],
-									"f_search" => $row["f_search"],
-									"f_style_id" => $row["f_style_id"],
-									"f_toupper" => $row["f_toupper"],
-									"f_label" => $row["f_label"],
-									"f_label_id" => $row["f_label_id"],
-									"f_geom" => $row["f_geom"],
-									"f_show" => $row["f_show"],
-									"f_mandatory" => $row["f_mandatory"],
-									"f_respos" => $row["f_respos"],
-									"f_min_input" => $row["f_min_input"],
-									"f_form_element_html" => $row["f_form_element_html"],
-									"f_auth_varname" => $row["f_auth_varname"],
-									"f_detailpos" => $row["f_detailpos"],
-									"f_operator" => $row["f_operator"],
-									"f_show_detail" => $row["f_show_detail"]
-									);
-			array_push($elementArray, $currentElement);
-		}
-		return $elementArray;
-	}
-
-	/**
-	 * Gets the database content of a WFS feature type given by a WFS ID and a featuretype ID.
-	 * 
-	 * @return Array
-	 * @param $wfsId Integer the WFS ID.
-	 * @param $featuretypeId Integer the WFS featuretype ID.
-	 */
-	private static function getWfsFeatureTypeFromDb($wfsId, $featuretypeId) {
-		$sql = "SELECT * FROM wfs_featuretype WHERE fkey_wfs_id = $1 AND featuretype_id = $2";
-		$v = array($wfsId, $featuretypeId);
-		$t = array("i", "i");
-	
-		$res = db_prep_query($sql, $v, $t);
-
-		$currentRow = array();
-		
-		if($row = db_fetch_array($res)){
-			$currentRow["featuretype_name"] = $row["featuretype_name"];
-			$currentRow["featuretype_srs"] = $row["featuretype_srs"];
-		}
-	
-		return $currentRow;
-	}
-	
-	/**
-	 * get WFS conf data from database
-	 */
-	private function getWfsConfFromDB ($idArray) {
-		
-		// if a user has access to some WFS confs...
-		if (count($idArray) > 0) {
-
-			// get WFS conf data from DB
-			$rowArray = self::getWfsConfFromDbByArray($idArray);
-			
-			for ($i=0; $i < count($rowArray); $i++) {
-	
-				// WFS conf data				
-				$currentRow = array("g_label" => $rowArray[$i]["g_label"], 
-			                        "g_label_id" => $rowArray[$i]["g_label_id"],
-									"g_style" => $rowArray[$i]["g_style"],
-									"g_button" => $rowArray[$i]["g_button"],
-									"g_button_id" => $rowArray[$i]["g_button_id"],
-									"g_buffer" => $rowArray[$i]["g_buffer"],
-									"g_res_style" => $rowArray[$i]["g_res_style"],
-									"g_use_wzgraphics" => $rowArray[$i]["g_use_wzgraphics"],
-									"wfs_id" => $rowArray[$i]["fkey_wfs_id"],
-									"featuretype_id" => $rowArray[$i]["fkey_featuretype_id"],
-									"wfs_getfeature" => $rowArray[$i]["wfs_getfeature"],
-									"wfs_describefeaturetype" => $rowArray[$i]["wfs_describefeaturetype"],
-									"wfs_transaction" => $rowArray[$i]["wfs_transaction"],
-									"element" => $elementArray
-									);
-
-				// get WFS conf element data of current WFS conf
-				$id = $rowArray[$i]["wfs_conf_id"];
-				$currentRow["element"] = self::getWfsConfElementFromDb($id);
-
-				// get WFS featuretype data of current WFS conf
-				$wfsId = $rowArray[$i]["fkey_wfs_id"];
-				$featuretypeId = $rowArray[$i]["fkey_featuretype_id"];
-				$currentRow = array_merge($currentRow , self::getWfsFeatureTypeFromDb($wfsId, $featuretypeId));
-
-				$this->confArray[$id] = $currentRow;
-			}
-			return $this->confArray;
-		}
-		else {
-			$e = new mb_warning("class_wfs_conf.php: getWfsConfFromDB: You don't have access to any WFS confs. Check EDIT WFS.");
-			return array();
-		}
-	}
-	
-}
-
-/**
- * @deprecated
- */
-class wfs_conf{
-	
-	var $wfs_id;
-	var $wfs_name;
-	var $wfs_title;
-	var $wfs_abstract;
-	var $wfs_getcapabilities;
-	var $wfs_describefeaturetype;
-	var $wfs_getfeature;
-	
-	var $features;
-	var $elements;
-	var $namespaces;
-		
-
-	function getallwfs($userid){
-		$this->wfs_id = array();
-		$this->wfs_name = array();
-		$this->wfs_title = array();
-		$this->wfs_abstract = array();
-		
-		global $DBSERVER,$DB,$OWNER,$PW;
-		$con = db_connect($DBSERVER,$OWNER,$PW);
-		db_select_db($DB,$con);
-		if($userid){
-		 	$sql = "SELECT * FROM wfs WHERE wfs_owner = $1";
-			$v = array($userid);
-			$t = array('i');
-			$res = db_prep_query($sql,$v,$t);
-		}
-		else{
-		 	$sql = "SELECT * FROM wfs";
-			$res = db_query($sql);
-		}
-		
-		$cnt = 0;
-		while ($row = db_fetch_array($res)){
-			$this->wfs_version[$cnt] = $row["wfs_version"];
-			$this->wfs_id[$cnt] = $row["wfs_id"];
-			$this->wfs_name[$cnt] = $row["wfs_name"];
-			$this->wfs_title[$cnt] = $row["wfs_title"];
-			$this->wfs_abstract[$cnt] = $row["wfs_abstract"];
-			$this->wfs_getcapabilities[$cnt] = $row["wfs_getcapabilities"];
-			$this->wfs_describefeaturetype[$cnt] = $row["wfs_describefeaturetype"];
-			$this->wfs_getfeature[$cnt] = $row["wfs_getfeature"];
-			$cnt++;
-		}	
-	}
-	function getfeatures($wfsid){
-		$this->features = new features($wfsid);
-	}
-	function getelements($feature){
-		$this->elements = new elements($feature);
-	}
-	function getnamespaces($feature){
-		$this->namespaces = new namespaces($feature);
-	}
-}
-class features extends wfs_conf{
-	
-	var $featuretype_id;
-	var $featuretype_name;
-	var $featuretype_title;
-	var $featuretype_srs;
-	
-	function features($id){		
-		
-		$featuretype_id = array();
-		$featuretype_name = array();
-		$featuretype_title = array();
-		$featuretype_srs = array();
-		
-		global $DBSERVER,$DB,$OWNER,$PW;
-		$con = db_connect($DBSERVER,$OWNER,$PW);
-		db_select_db($DB,$con);
-		$sql = "SELECT * FROM wfs_featuretype WHERE fkey_wfs_id = $1";
-		$v = array($id);
-		$t = array("i");
-		$res = db_prep_query($sql, $v, $t);
-		$cnt = 0;
-		while ($row = db_fetch_array($res)){
-			$this->featuretype_id[$cnt] = $row["featuretype_id"];
-			$this->featuretype_name[$cnt] = $row["featuretype_name"];
-			$this->featuretype_title[$cnt] = $row["featuretype_title"];
-			$this->featuretype_srs[$cnt] = $row["featuretype_srs"];
-			$cnt++;
-		}	
-	}	
-}
-class elements extends wfs_conf{
-	
-	var $element_id;
-	var $element_name;
-	var $element_type;
-	
-	function elements($fid){
-		
-		$element_id = array();
-		$element_name = array();
-		$element_type = array();
-		
-		global $DBSERVER,$DB,$OWNER,$PW;
-		$con = db_connect($DBSERVER,$OWNER,$PW);
-		db_select_db($DB,$con);
-		$sql = "SELECT * FROM wfs_element WHERE fkey_featuretype_id = $1";
-		$v = array($fid);
-		$t = array("s");
-		$res = db_prep_query($sql, $v, $t);
-		$cnt = 0;
-		while ($row = db_fetch_array($res)){
-			$this->element_id[$cnt] = $row["element_id"];
-			$this->element_name[$cnt] = $row["element_name"];
-			$this->element_type[$cnt] = $row["element_type"];
-			$cnt++;
-		}
-	}
-}
-class namespaces extends wfs_conf{
-	
-	var $namespace_name;
-	var $namespace_location;
-	
-	function namespaces($fid){
-		
-		$namespace_name = array();
-		$namespace_location = array();
-		
-		global $DBSERVER,$DB,$OWNER,$PW;
-		$con = db_connect($DBSERVER,$OWNER,$PW);
-		db_select_db($DB,$con);
-		$sql = "SELECT * FROM wfs_featuretype_namespace WHERE fkey_featuretype_id = $1";
-		$v = array($fid);
-		$t = array("s");
-		$res = db_prep_query($sql, $v, $t);
-		$cnt = 0;
-		while ($row = db_fetch_array($res)){
-			$this->namespace_name[$cnt] = $row["namespace"];
-			$this->namespace_location[$cnt] = $row["namespace_location"];
-			$cnt++;
-		}
-	}
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_wfs_conf.php
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_user.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+class WfsConf {
+	var $confArray = array();
+
+	/**
+	 * Gets the configuration from the database
+	 */
+	function __construct () {
+
+	}
+	
+	function __toString () {
+		$json = new Mapbender_JSON();
+		return $json->encode($this->confArray);
+	}
+	
+	/**
+	 * Loads WFS conf data from the database
+	 * 
+	 * @return Object WFS conf data.
+	 * @param $idOrIdArray Object May be an integer or an array of integers representing WFS conf IDs.
+	 */
+	public function load ($idOrIdArray) {
+		// Check parameter and set idArray
+		if (isset($idOrIdArray)){
+			
+			// parameter is a number	
+			if (!is_array($idOrIdArray) && is_numeric($idOrIdArray)) {
+				$idOrIdArray = array(intval($idOrIdArray));
+			}
+
+			// parameter is an array of numbers
+			if (is_array($idOrIdArray)) {
+				$idArray = array();
+				for ($i=0; $i < count($idOrIdArray); $i++) {
+					if (!is_numeric($idOrIdArray[$i])) {
+						$e = new mb_exception("Wfs_conf: constructor: wrong parameter: ".$idOrIdArray[$i]." is not a number.");
+						return array();
+					}
+					array_push($idArray, intval($idOrIdArray[$i]));
+				}
+
+				// If a user ID is given, remove the ones the user has no access to
+				if ($_SESSION["mb_user_id"]) {
+					$user = new User($_SESSION["mb_user_id"]);
+					$idArray = array_intersect($idArray, $user->getWfsConfByPermission());
+				}
+
+				return $this->getWfsConfFromDb($idArray);
+			}
+			// parameter is invalid
+			else {
+				$e = new mb_exception("Wfs_conf: constructor: parameter must be number or an array of numbers.");
+				return array();
+			}
+		}
+		else {
+			$e = new mb_exception("Wfs_conf: constructor: parameter is not valid");
+			return null;
+		}
+	}
+	
+
+	// --------------------------- private -----------------------------------
+
+	/**
+	 * Gets the database content for a number of WFS configurations given by their IDs.
+	 * 
+	 * @return Array
+	 * @param $idArray Array an array of integer values representing WFS conf IDs.
+	 */
+	private static function getWfsConfFromDbByArray ($idArray) {
+		$rowArray = array();
+        foreach ($idArray as $id) {
+        		$sql = "SELECT * FROM wfs_conf ";
+                $sql .= "JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
+                $sql .= "WHERE wfs_conf.wfs_conf_id = $1 LIMIT 1";
+        
+                $v = array($id);
+                $t = array("i");
+                $res = db_prep_query($sql, $v, $t);
+                $row = db_fetch_array($res);
+                array_push($rowArray, $row);
+        }
+        return $rowArray;
+	}
+	
+	public static function getGeomColumnNameByConfId ($confId) {
+		$elArray = self::getWfsConfElementFromDb($confId);
+		foreach ($elArray as $element) {
+			if ($element["f_geom"] == "1") {
+				return $element["element_name"];
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * Gets the database content of a WFS conf element given by a WFS conf ID.
+	 * 
+	 * @return Array
+	 * @param $id Integer the WFS conf ID.
+	 */
+	private static function getWfsConfElementFromDb ($id) {
+		$sql = "SELECT * FROM wfs_conf_element ";
+		$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
+		$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
+		#filtered on client side
+		#$sql .= "AND wfs_conf_element.f_search = 1 ";
+		$sql .= "ORDER BY wfs_conf_element.f_pos";
+		$v = array($id);
+		$t = array('i');
+		$res = db_prep_query($sql, $v, $t);
+	
+		$elementArray = array();
+		while ($row = db_fetch_array($res)) {
+			$currentElement = array("element_name" => $row["element_name"],
+									"element_type" => $row["element_type"],
+									"f_search" => $row["f_search"],
+									"f_style_id" => $row["f_style_id"],
+									"f_toupper" => $row["f_toupper"],
+									"f_label" => $row["f_label"],
+									"f_label_id" => $row["f_label_id"],
+									"f_geom" => $row["f_geom"],
+									"f_show" => $row["f_show"],
+									"f_mandatory" => $row["f_mandatory"],
+									"f_respos" => $row["f_respos"],
+									"f_min_input" => $row["f_min_input"],
+									"f_form_element_html" => $row["f_form_element_html"],
+									"f_auth_varname" => $row["f_auth_varname"],
+									"f_detailpos" => $row["f_detailpos"],
+									"f_operator" => $row["f_operator"],
+									"f_show_detail" => $row["f_show_detail"]
+									);
+			array_push($elementArray, $currentElement);
+		}
+		return $elementArray;
+	}
+
+	/**
+	 * Gets the database content of a WFS feature type given by a WFS ID and a featuretype ID.
+	 * 
+	 * @return Array
+	 * @param $wfsId Integer the WFS ID.
+	 * @param $featuretypeId Integer the WFS featuretype ID.
+	 */
+	private static function getWfsFeatureTypeFromDb($wfsId, $featuretypeId) {
+		$sql = "SELECT * FROM wfs_featuretype WHERE fkey_wfs_id = $1 AND featuretype_id = $2";
+		$v = array($wfsId, $featuretypeId);
+		$t = array("i", "i");
+	
+		$res = db_prep_query($sql, $v, $t);
+
+		$currentRow = array();
+		
+		if($row = db_fetch_array($res)){
+			$currentRow["featuretype_name"] = $row["featuretype_name"];
+			$currentRow["featuretype_srs"] = $row["featuretype_srs"];
+		}
+	
+		return $currentRow;
+	}
+	
+	/**
+	 * get WFS conf data from database
+	 */
+	private function getWfsConfFromDB ($idArray) {
+		
+		// if a user has access to some WFS confs...
+		if (count($idArray) > 0) {
+
+			// get WFS conf data from DB
+			$rowArray = self::getWfsConfFromDbByArray($idArray);
+			
+			for ($i=0; $i < count($rowArray); $i++) {
+	
+				// WFS conf data				
+				$currentRow = array("g_label" => $rowArray[$i]["g_label"], 
+			                        "g_label_id" => $rowArray[$i]["g_label_id"],
+									"g_style" => $rowArray[$i]["g_style"],
+									"g_button" => $rowArray[$i]["g_button"],
+									"g_button_id" => $rowArray[$i]["g_button_id"],
+									"g_buffer" => $rowArray[$i]["g_buffer"],
+									"g_res_style" => $rowArray[$i]["g_res_style"],
+									"g_use_wzgraphics" => $rowArray[$i]["g_use_wzgraphics"],
+									"wfs_id" => $rowArray[$i]["fkey_wfs_id"],
+									"featuretype_id" => $rowArray[$i]["fkey_featuretype_id"],
+									"wfs_getfeature" => $rowArray[$i]["wfs_getfeature"],
+									"wfs_describefeaturetype" => $rowArray[$i]["wfs_describefeaturetype"],
+									"wfs_transaction" => $rowArray[$i]["wfs_transaction"],
+									"element" => $elementArray
+									);
+
+				// get WFS conf element data of current WFS conf
+				$id = $rowArray[$i]["wfs_conf_id"];
+				$currentRow["element"] = self::getWfsConfElementFromDb($id);
+
+				// get WFS featuretype data of current WFS conf
+				$wfsId = $rowArray[$i]["fkey_wfs_id"];
+				$featuretypeId = $rowArray[$i]["fkey_featuretype_id"];
+				$currentRow = array_merge($currentRow , self::getWfsFeatureTypeFromDb($wfsId, $featuretypeId));
+
+				$this->confArray[$id] = $currentRow;
+			}
+			return $this->confArray;
+		}
+		else {
+			$e = new mb_warning("class_wfs_conf.php: getWfsConfFromDB: You don't have access to any WFS confs. Check EDIT WFS.");
+			return array();
+		}
+	}
+	
+}
+
+/**
+ * @deprecated
+ */
+class wfs_conf{
+	
+	var $wfs_id;
+	var $wfs_name;
+	var $wfs_title;
+	var $wfs_abstract;
+	var $wfs_getcapabilities;
+	var $wfs_describefeaturetype;
+	var $wfs_getfeature;
+	
+	var $features;
+	var $elements;
+	var $namespaces;
+		
+
+	function getallwfs($userid){
+		$this->wfs_id = array();
+		$this->wfs_name = array();
+		$this->wfs_title = array();
+		$this->wfs_abstract = array();
+		
+		global $DBSERVER,$DB,$OWNER,$PW;
+		$con = db_connect($DBSERVER,$OWNER,$PW);
+		db_select_db($DB,$con);
+		if($userid){
+		 	$sql = "SELECT * FROM wfs WHERE wfs_owner = $1";
+			$v = array($userid);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+		}
+		else{
+		 	$sql = "SELECT * FROM wfs";
+			$res = db_query($sql);
+		}
+		
+		$cnt = 0;
+		while ($row = db_fetch_array($res)){
+			$this->wfs_version[$cnt] = $row["wfs_version"];
+			$this->wfs_id[$cnt] = $row["wfs_id"];
+			$this->wfs_name[$cnt] = $row["wfs_name"];
+			$this->wfs_title[$cnt] = $row["wfs_title"];
+			$this->wfs_abstract[$cnt] = $row["wfs_abstract"];
+			$this->wfs_getcapabilities[$cnt] = $row["wfs_getcapabilities"];
+			$this->wfs_describefeaturetype[$cnt] = $row["wfs_describefeaturetype"];
+			$this->wfs_getfeature[$cnt] = $row["wfs_getfeature"];
+			$cnt++;
+		}	
+	}
+	function getfeatures($wfsid){
+		$this->features = new features($wfsid);
+	}
+	function getelements($feature){
+		$this->elements = new elements($feature);
+	}
+	function getnamespaces($feature){
+		$this->namespaces = new namespaces($feature);
+	}
+}
+class features extends wfs_conf{
+	
+	var $featuretype_id;
+	var $featuretype_name;
+	var $featuretype_title;
+	var $featuretype_srs;
+	
+	function features($id){		
+		
+		$featuretype_id = array();
+		$featuretype_name = array();
+		$featuretype_title = array();
+		$featuretype_srs = array();
+		
+		global $DBSERVER,$DB,$OWNER,$PW;
+		$con = db_connect($DBSERVER,$OWNER,$PW);
+		db_select_db($DB,$con);
+		$sql = "SELECT * FROM wfs_featuretype WHERE fkey_wfs_id = $1";
+		$v = array($id);
+		$t = array("i");
+		$res = db_prep_query($sql, $v, $t);
+		$cnt = 0;
+		while ($row = db_fetch_array($res)){
+			$this->featuretype_id[$cnt] = $row["featuretype_id"];
+			$this->featuretype_name[$cnt] = $row["featuretype_name"];
+			$this->featuretype_title[$cnt] = $row["featuretype_title"];
+			$this->featuretype_srs[$cnt] = $row["featuretype_srs"];
+			$cnt++;
+		}	
+	}	
+}
+class elements extends wfs_conf{
+	
+	var $element_id;
+	var $element_name;
+	var $element_type;
+	
+	function elements($fid){
+		
+		$element_id = array();
+		$element_name = array();
+		$element_type = array();
+		
+		global $DBSERVER,$DB,$OWNER,$PW;
+		$con = db_connect($DBSERVER,$OWNER,$PW);
+		db_select_db($DB,$con);
+		$sql = "SELECT * FROM wfs_element WHERE fkey_featuretype_id = $1";
+		$v = array($fid);
+		$t = array("s");
+		$res = db_prep_query($sql, $v, $t);
+		$cnt = 0;
+		while ($row = db_fetch_array($res)){
+			$this->element_id[$cnt] = $row["element_id"];
+			$this->element_name[$cnt] = $row["element_name"];
+			$this->element_type[$cnt] = $row["element_type"];
+			$cnt++;
+		}
+	}
+}
+class namespaces extends wfs_conf{
+	
+	var $namespace_name;
+	var $namespace_location;
+	
+	function namespaces($fid){
+		
+		$namespace_name = array();
+		$namespace_location = array();
+		
+		global $DBSERVER,$DB,$OWNER,$PW;
+		$con = db_connect($DBSERVER,$OWNER,$PW);
+		db_select_db($DB,$con);
+		$sql = "SELECT * FROM wfs_featuretype_namespace WHERE fkey_featuretype_id = $1";
+		$v = array($fid);
+		$t = array("s");
+		$res = db_prep_query($sql, $v, $t);
+		$cnt = 0;
+		while ($row = db_fetch_array($res)){
+			$this->namespace_name[$cnt] = $row["namespace"];
+			$this->namespace_location[$cnt] = $row["namespace_location"];
+			$cnt++;
+		}
+	}
+}
+?>

Modified: branches/print_dev/http/classes/class_wfs_configuration.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_configuration.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfs_configuration.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,191 +1,191 @@
-<?php
-# $Id: class_wfs_conf.php 3510 2009-02-03 10:36:01Z christoph $
-# http://www.mapbender.org/index.php/class_wfs_conf.php
-# 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.
-
-require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../classes/class_user.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
-class WfsConfigurationElement {
-	var $name;
-	var $type;
-	var $search;
-	var $styleId;
-	var $toUpper;
-	var $label;
-	var $labelId;
-	var $geom;
-	var $show;
-	var $mandatory;
-	var $respos;
-	var $minInput;
-	var $formElementHtml;
-	var $authVarname;
-	var $detailPos;
-	var $operator;
-	var $showDetail;
-}	
-
-
-class WfsConfiguration {
-	
-	var $id;
-	var $wfsId;
-	var $featureTypeId;
-	var $label; 
-	var $labelId;
-	var $style;
-	var $button;
-	var $buttonId;
-	var $buffer;
-	var $resStyle;
-	var $elementArray = array();
-
-	function __construct () {
-	}
-	
-	public function getGeometryColumnName () {
-		foreach ($this->elementArray as $element) {
-			if ($element->geom) {
-				return $element->name;
-			}
-		}
-		$e = new mb_warning("This WFS conf doesn't have a geometry column.");
-		return null;
-	}
-	
-	/**
-	 * Finds the featuretype element which stores the authentication data.
-	 * 
-	 * @return String 
-	 */
-	public function getAuthElement () {
-		foreach ($this->elementArray as $element) {
-			if (!empty($element->authVarname)) {
-				$validname = preg_match('/^\$_[a-zA-z]+(\[\"[a-zA-Z_]+\"\])?$/', $element->authVarname);
-
-				if ($validname === 1) {
-					return $element;
-				}
-				else {
-					$e = new mb_exception("Found auth element, but variable name is not valid: " . $element->authVarname);
-				}
-			}
-		}
-		return null;
-	}
-
-	/**
-	 * Checks if the user currently logged in is allowed to access
-	 * the WFS configuration
-	 * 
-	 * @return Boolean
-	 */
-	private function accessAllowed () {
-		if ($_SESSION["mb_user_id"]) {
-			$user = new User($_SESSION["mb_user_id"]);
-
-			$allowedWfsConfIds = $user->getWfsConfByPermission();
-
-			$idArray = array_intersect(array($this->id), $allowedWfsConfIds);
-
-			if (count($idArray) === 1) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	/**
-	 * Creates an object from the database.
-	 * Maybe we could have a factory for this later...let's
-	 * keep it simple for now
-	 * 
-	 * @return WfsConfiguration
-	 * @param $id Integer
-	 */
-	public static function createFromDb ($id) {
-		if (!is_numeric($id)) {
-			return null;	
-		}
-		$wfsConf = new WfsConfiguration();
-		$wfsConf->id = intval($id);
-		
-		if (!$wfsConf->accessAllowed()) {
-			return null;
-		}
-		
-		$sql = <<<SQL
-SELECT * FROM wfs_conf JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id 
-WHERE wfs_conf.wfs_conf_id = $1 LIMIT 1
-SQL;
-
-        $v = array($wfsConf->id);
-        $t = array("i");
-        $res = db_prep_query($sql, $v, $t);
-        $row = db_fetch_array($res);
-		
-		$wfsConf->label = $row["g_label"];
-		$wfsConf->labelId = $row["g_label_id"];
-		$wfsConf->style = $row["g_style"];
-		$wfsConf->button = $row["g_button"];
-		$wfsConf->buttonId = $row["g_button_id"];
-		$wfsConf->buffer = $row["g_buffer"];
-		$wfsConf->resStyle = $row["g_res_style"];
-		$wfsConf->wfsId = $row["fkey_wfs_id"];
-		$wfsConf->featureTypeId = $row["fkey_featuretype_id"];
-
-		$sql = <<<SQL
-SELECT * FROM wfs_conf_element JOIN wfs_element 
-ON wfs_conf_element.f_id = wfs_element.element_id 
-WHERE wfs_conf_element.fkey_wfs_conf_id = $1
-SQL;
-		$v = array($wfsConf->id);
-		$t = array('i');
-		$res = db_prep_query($sql, $v, $t);
-	
-		
-		while ($row = db_fetch_array($res)) {
-			$element = new WfsConfigurationElement();
-
-			$element->name = $row["element_name"];
-			$element->type = $row["element_type"];
-			$element->search = $row["f_search"];
-			$element->styleId = $row["f_style_id"];
-			$element->toUpper = $row["f_toupper"];
-			$element->label = $row["f_label"];
-			$element->labelId = $row["f_label_id"];
-			$element->geom = $row["f_geom"];
-			$element->show = $row["f_show"];
-			$element->mandatory = $row["f_mandatory"];
-			$element->respos = $row["f_respos"];
-			$element->minInput = $row["f_min_input"];
-			$element->formElementHtml = $row["f_form_element_html"];
-			$element->authVarname = stripslashes($row["f_auth_varname"]);
-			$element->detailpos = $row["f_detailpos"];
-			$element->operator = $row["f_operator"];
-			$element->showDetail = $row["f_show_detail"];
-
-			array_push($wfsConf->elementArray, $element);
-		}
-		
-		return $wfsConf;
-	}
-}
+<?php
+# $Id: class_wfs_conf.php 3510 2009-02-03 10:36:01Z christoph $
+# http://www.mapbender.org/index.php/class_wfs_conf.php
+# 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.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_user.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+class WfsConfigurationElement {
+	var $name;
+	var $type;
+	var $search;
+	var $styleId;
+	var $toUpper;
+	var $label;
+	var $labelId;
+	var $geom;
+	var $show;
+	var $mandatory;
+	var $respos;
+	var $minInput;
+	var $formElementHtml;
+	var $authVarname;
+	var $detailPos;
+	var $operator;
+	var $showDetail;
+}	
+
+
+class WfsConfiguration {
+	
+	var $id;
+	var $wfsId;
+	var $featureTypeId;
+	var $label; 
+	var $labelId;
+	var $style;
+	var $button;
+	var $buttonId;
+	var $buffer;
+	var $resStyle;
+	var $elementArray = array();
+
+	function __construct () {
+	}
+	
+	public function getGeometryColumnName () {
+		foreach ($this->elementArray as $element) {
+			if ($element->geom) {
+				return $element->name;
+			}
+		}
+		$e = new mb_warning("This WFS conf doesn't have a geometry column.");
+		return null;
+	}
+	
+	/**
+	 * Finds the featuretype element which stores the authentication data.
+	 * 
+	 * @return String 
+	 */
+	public function getAuthElement () {
+		foreach ($this->elementArray as $element) {
+			if (!empty($element->authVarname)) {
+				$validname = preg_match('/^\$_[a-zA-z]+(\[\"[a-zA-Z_]+\"\])?$/', $element->authVarname);
+
+				if ($validname === 1) {
+					return $element;
+				}
+				else {
+					$e = new mb_exception("Found auth element, but variable name is not valid: " . $element->authVarname);
+				}
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Checks if the user currently logged in is allowed to access
+	 * the WFS configuration
+	 * 
+	 * @return Boolean
+	 */
+	private function accessAllowed () {
+		if ($_SESSION["mb_user_id"]) {
+			$user = new User($_SESSION["mb_user_id"]);
+
+			$allowedWfsConfIds = $user->getWfsConfByPermission();
+
+			$idArray = array_intersect(array($this->id), $allowedWfsConfIds);
+
+			if (count($idArray) === 1) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	/**
+	 * Creates an object from the database.
+	 * Maybe we could have a factory for this later...let's
+	 * keep it simple for now
+	 * 
+	 * @return WfsConfiguration
+	 * @param $id Integer
+	 */
+	public static function createFromDb ($id) {
+		if (!is_numeric($id)) {
+			return null;	
+		}
+		$wfsConf = new WfsConfiguration();
+		$wfsConf->id = intval($id);
+		
+		if (!$wfsConf->accessAllowed()) {
+			return null;
+		}
+		
+		$sql = <<<SQL
+SELECT * FROM wfs_conf JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id 
+WHERE wfs_conf.wfs_conf_id = $1 LIMIT 1
+SQL;
+
+        $v = array($wfsConf->id);
+        $t = array("i");
+        $res = db_prep_query($sql, $v, $t);
+        $row = db_fetch_array($res);
+		
+		$wfsConf->label = $row["g_label"];
+		$wfsConf->labelId = $row["g_label_id"];
+		$wfsConf->style = $row["g_style"];
+		$wfsConf->button = $row["g_button"];
+		$wfsConf->buttonId = $row["g_button_id"];
+		$wfsConf->buffer = $row["g_buffer"];
+		$wfsConf->resStyle = $row["g_res_style"];
+		$wfsConf->wfsId = $row["fkey_wfs_id"];
+		$wfsConf->featureTypeId = $row["fkey_featuretype_id"];
+
+		$sql = <<<SQL
+SELECT * FROM wfs_conf_element JOIN wfs_element 
+ON wfs_conf_element.f_id = wfs_element.element_id 
+WHERE wfs_conf_element.fkey_wfs_conf_id = $1
+SQL;
+		$v = array($wfsConf->id);
+		$t = array('i');
+		$res = db_prep_query($sql, $v, $t);
+	
+		
+		while ($row = db_fetch_array($res)) {
+			$element = new WfsConfigurationElement();
+
+			$element->name = $row["element_name"];
+			$element->type = $row["element_type"];
+			$element->search = $row["f_search"];
+			$element->styleId = $row["f_style_id"];
+			$element->toUpper = $row["f_toupper"];
+			$element->label = $row["f_label"];
+			$element->labelId = $row["f_label_id"];
+			$element->geom = $row["f_geom"];
+			$element->show = $row["f_show"];
+			$element->mandatory = $row["f_mandatory"];
+			$element->respos = $row["f_respos"];
+			$element->minInput = $row["f_min_input"];
+			$element->formElementHtml = $row["f_form_element_html"];
+			$element->authVarname = stripslashes($row["f_auth_varname"]);
+			$element->detailpos = $row["f_detailpos"];
+			$element->operator = $row["f_operator"];
+			$element->showDetail = $row["f_show_detail"];
+
+			array_push($wfsConf->elementArray, $element);
+		}
+		
+		return $wfsConf;
+	}
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/classes/class_wfs_deprecated.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_deprecated.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfs_deprecated.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -22,7 +22,7 @@
 */
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 require_once(dirname(__FILE__)."/class_ows.php");
 
@@ -69,7 +69,7 @@
 	$values = null;
 	$tags = null;
 	$admin = new administration();
-	$this->wfs_getcapabilities_doc = $admin->char_encode($data);
+	$this->wfs_getcapabilities_doc = $admin->char_encode($data);
 	$this->wfs_upload_url = $url;
 	
 	# for temporary wfs a id has to be created...
@@ -80,7 +80,7 @@
 	xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
 	xml_parse_into_struct($parser,$this->wfs_getcapabilities_doc,$values,$tags);
 	//xml_parse_into_struct($parser,$data,$values,$tags);
-	
+	
 	xml_parser_free($parser);
 	
 	$section = false;
@@ -206,7 +206,7 @@
 	$this->wfs_featuretype[count($this->wfs_featuretype)] = new featuretype($name,$title,$abstract,$srs,$url,$version);
 }
 */
-/*
+/*
  function stripEndlineAndCarriageReturn($string) {
 	  	return preg_replace("/\n/", "", preg_replace("/\r/", " ", $string));
 	  }

Modified: branches/print_dev/http/classes/class_wfs_featuretype.php
===================================================================
--- branches/print_dev/http/classes/class_wfs_featuretype.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/class_wfs_featuretype.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 require_once(dirname(__FILE__)."/class_wfs.php");
 

Modified: branches/print_dev/http/classes/phpmailer-1.72/ChangeLog.txt
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/ChangeLog.txt	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/ChangeLog.txt	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,179 +1,179 @@
-ChangeLog
-
-Version 1.72 (Wed, May 25 2004)
-* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
-* Received: Removed this method because spam filter programs like 
-SpamAssassin reject this header.
-* Fixed error count bug.
-* SetLanguage default is now "language/".
-* Fixed magic_quotes_runtime bug.
-
-Version 1.71 (Tue, Jul 28 2003)
-* Made several speed enhancements
-* Added German and Italian translation files
-* Fixed HELO/AUTH bugs on keep-alive connects
-* Now provides an error message if language file does not load
-* Fixed attachment EOL bug
-* Updated some unclear documentation
-* Added additional tests and improved others
-
-Version 1.70 (Mon, Jun 20 2003)
-* Added SMTP keep-alive support
-* Added IsError method for error detection
-* Added error message translation support (SetLanguage)
-* Refactored many methods to increase library performance
-* Hello now sends the newer EHLO message before HELO as per RFC 2821
-* Removed the boundary class and replaced it with GetBoundary
-* Removed queue support methods
-* New $Hostname variable
-* New Message-ID header
-* Received header reformat
-* Helo variable default changed to $Hostname
-* Removed extra spaces in Content-Type definition (#667182)
-* Return-Path should be set to Sender when set
-* Adds Q or B encoding to headers when necessary
-* quoted-encoding should now encode NULs \000
-* Fixed encoding of body/AltBody (#553370)
-* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)
-* Multiple bug fixes
-
-Version 1.65 (Fri, Aug 09 2002)
-* Fixed non-visible attachment bug (#585097) for Outlook
-* SMTP connections are now closed after each transaction
-* Fixed SMTP::Expand return value
-* Converted SMTP class documentation to phpDocumentor format
-
-Version 1.62 (Wed, Jun 26 2002)
-* Fixed multi-attach bug
-* Set proper word wrapping
-* Reduced memory use with attachments
-* Added more debugging
-* Changed documentation to phpDocumentor format
-
-Version 1.60 (Sat, Mar 30 2002)
-* Sendmail pipe and address patch (Christian Holtje)
-* Added embedded image and read confirmation support (A. Ognio)
-* Added unit tests
-* Added SMTP timeout support (*nix only)
-* Added possibly temporary PluginDir variable for SMTP class
-* Added LE message line ending variable
-* Refactored boundary and attachment code
-* Eliminated SMTP class warnings
-* Added SendToQueue method for future queuing support
-
-Version 1.54 (Wed, Dec 19 2001)
-* Add some queuing support code
-* Fixed a pesky multi/alt bug
-* Messages are no longer forced to have "To" addresses
-
-Version 1.50 (Thu, Nov 08 2001)
-* Fix extra lines when not using SMTP mailer
-* Set WordWrap variable to int with a zero default
-
-Version 1.47 (Tue, Oct 16 2001)
-* Fixed Received header code format
-* Fixed AltBody order error
-* Fixed alternate port warning
-
-Version 1.45 (Tue, Sep 25 2001)
-* Added enhanced SMTP debug support
-* Added support for multiple ports on SMTP
-* Added Received header for tracing
-* Fixed AddStringAttachment encoding
-* Fixed possible header name quote bug
-* Fixed wordwrap() trim bug
-* Couple other small bug fixes
-
-Version 1.41 (Wed, Aug 22 2001)
-* Fixed AltBody bug w/o attachments
-* Fixed rfc_date() for certain mail servers
-
-Version 1.40 (Sun, Aug 12 2001)
-* Added multipart/alternative support (AltBody)
-* Documentation update
-* Fixed bug in Mercury MTA
-
-Version 1.29 (Fri, Aug 03 2001)
-* Added AddStringAttachment() method
-* Added SMTP authentication support
-
-Version 1.28 (Mon, Jul 30 2001)
-* Fixed a typo in SMTP class
-* Fixed header issue with Imail (win32) SMTP server
-* Made fopen() calls for attachments use "rb" to fix win32 error
-
-Version 1.25 (Mon, Jul 02 2001)
-* Added RFC 822 date fix (Patrice)
-* Added improved error handling by adding a $ErrorInfo variable
-* Removed MailerDebug variable (obsolete with new error handler)
-
-Version 1.20 (Mon, Jun 25 2001)
-* Added quoted-printable encoding (Patrice)
-* Set Version as public and removed PrintVersion()
-* Changed phpdoc to only display public variables and methods
-
-Version 1.19 (Thu, Jun 21 2001)
-* Fixed MS Mail header bug
-* Added fix for Bcc problem with mail(). *Does not work on Win32*
-  (See PHP bug report: http://www.php.net/bugs.php?id=11616)
-* mail() no longer passes a fifth parameter when not needed
-
-Version 1.15 (Fri, Jun 15 2001)
-[Note: these changes contributed by Patrice Fournier]
-* Changed all remaining \n to \r\n
-* Bcc: header no longer writen to message except
-when sent directly to sendmail
-* Added a small message to non-MIME compliant mail reader
-* Added Sender variable to change the Sender email
-used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode
-* Changed boundary setting to a place it will be set only once
-* Removed transfer encoding for whole message when using multipart
-* Message body now uses Encoding in multipart messages
-* Can set encoding and type to attachments 7bit, 8bit
-and binary attachment are sent as is, base64 are encoded
-* Can set Encoding to base64 to send 8 bits body
-through 7 bits servers
-
-Version 1.10 (Tue, Jun 12 2001)
-* Fixed win32 mail header bug (printed out headers in message body)
-
-Version 1.09 (Fri, Jun 08 2001)
-* Changed date header to work with Netscape mail programs
-* Altered phpdoc documentation
-
-Version 1.08 (Tue, Jun 05 2001)
-* Added enhanced error-checking
-* Added phpdoc documentation to source
-
-Version 1.06 (Fri, Jun 01 2001)
-* Added optional name for file attachments
-
-Version 1.05 (Tue, May 29 2001)
-* Code cleanup
-* Eliminated sendmail header warning message
-* Fixed possible SMTP error
-
-Version 1.03 (Thu, May 24 2001)
-* Fixed problem where qmail sends out duplicate messages
-
-Version 1.02 (Wed, May 23 2001)
-* Added multiple recipient and attachment Clear* methods
-* Added Sendmail public variable
-* Fixed problem with loading SMTP library multiple times
-
-Version 0.98 (Tue, May 22 2001)
-* Fixed problem with redundant mail hosts sending out multiple messages
-* Added additional error handler code
-* Added AddCustomHeader() function
-* Added support for Microsoft mail client headers (affects priority)
-* Fixed small bug with Mailer variable
-* Added PrintVersion() function
-
-Version 0.92 (Tue, May 15 2001)
-* Changed file names to class.phpmailer.php and class.smtp.php to match
-  current PHP class trend.
-* Fixed problem where body not being printed when a message is attached
-* Several small bug fixes
-
-Version 0.90 (Tue, April 17 2001)
-* Intial public release
+ChangeLog
+
+Version 1.72 (Wed, May 25 2004)
+* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
+* Received: Removed this method because spam filter programs like 
+SpamAssassin reject this header.
+* Fixed error count bug.
+* SetLanguage default is now "language/".
+* Fixed magic_quotes_runtime bug.
+
+Version 1.71 (Tue, Jul 28 2003)
+* Made several speed enhancements
+* Added German and Italian translation files
+* Fixed HELO/AUTH bugs on keep-alive connects
+* Now provides an error message if language file does not load
+* Fixed attachment EOL bug
+* Updated some unclear documentation
+* Added additional tests and improved others
+
+Version 1.70 (Mon, Jun 20 2003)
+* Added SMTP keep-alive support
+* Added IsError method for error detection
+* Added error message translation support (SetLanguage)
+* Refactored many methods to increase library performance
+* Hello now sends the newer EHLO message before HELO as per RFC 2821
+* Removed the boundary class and replaced it with GetBoundary
+* Removed queue support methods
+* New $Hostname variable
+* New Message-ID header
+* Received header reformat
+* Helo variable default changed to $Hostname
+* Removed extra spaces in Content-Type definition (#667182)
+* Return-Path should be set to Sender when set
+* Adds Q or B encoding to headers when necessary
+* quoted-encoding should now encode NULs \000
+* Fixed encoding of body/AltBody (#553370)
+* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)
+* Multiple bug fixes
+
+Version 1.65 (Fri, Aug 09 2002)
+* Fixed non-visible attachment bug (#585097) for Outlook
+* SMTP connections are now closed after each transaction
+* Fixed SMTP::Expand return value
+* Converted SMTP class documentation to phpDocumentor format
+
+Version 1.62 (Wed, Jun 26 2002)
+* Fixed multi-attach bug
+* Set proper word wrapping
+* Reduced memory use with attachments
+* Added more debugging
+* Changed documentation to phpDocumentor format
+
+Version 1.60 (Sat, Mar 30 2002)
+* Sendmail pipe and address patch (Christian Holtje)
+* Added embedded image and read confirmation support (A. Ognio)
+* Added unit tests
+* Added SMTP timeout support (*nix only)
+* Added possibly temporary PluginDir variable for SMTP class
+* Added LE message line ending variable
+* Refactored boundary and attachment code
+* Eliminated SMTP class warnings
+* Added SendToQueue method for future queuing support
+
+Version 1.54 (Wed, Dec 19 2001)
+* Add some queuing support code
+* Fixed a pesky multi/alt bug
+* Messages are no longer forced to have "To" addresses
+
+Version 1.50 (Thu, Nov 08 2001)
+* Fix extra lines when not using SMTP mailer
+* Set WordWrap variable to int with a zero default
+
+Version 1.47 (Tue, Oct 16 2001)
+* Fixed Received header code format
+* Fixed AltBody order error
+* Fixed alternate port warning
+
+Version 1.45 (Tue, Sep 25 2001)
+* Added enhanced SMTP debug support
+* Added support for multiple ports on SMTP
+* Added Received header for tracing
+* Fixed AddStringAttachment encoding
+* Fixed possible header name quote bug
+* Fixed wordwrap() trim bug
+* Couple other small bug fixes
+
+Version 1.41 (Wed, Aug 22 2001)
+* Fixed AltBody bug w/o attachments
+* Fixed rfc_date() for certain mail servers
+
+Version 1.40 (Sun, Aug 12 2001)
+* Added multipart/alternative support (AltBody)
+* Documentation update
+* Fixed bug in Mercury MTA
+
+Version 1.29 (Fri, Aug 03 2001)
+* Added AddStringAttachment() method
+* Added SMTP authentication support
+
+Version 1.28 (Mon, Jul 30 2001)
+* Fixed a typo in SMTP class
+* Fixed header issue with Imail (win32) SMTP server
+* Made fopen() calls for attachments use "rb" to fix win32 error
+
+Version 1.25 (Mon, Jul 02 2001)
+* Added RFC 822 date fix (Patrice)
+* Added improved error handling by adding a $ErrorInfo variable
+* Removed MailerDebug variable (obsolete with new error handler)
+
+Version 1.20 (Mon, Jun 25 2001)
+* Added quoted-printable encoding (Patrice)
+* Set Version as public and removed PrintVersion()
+* Changed phpdoc to only display public variables and methods
+
+Version 1.19 (Thu, Jun 21 2001)
+* Fixed MS Mail header bug
+* Added fix for Bcc problem with mail(). *Does not work on Win32*
+  (See PHP bug report: http://www.php.net/bugs.php?id=11616)
+* mail() no longer passes a fifth parameter when not needed
+
+Version 1.15 (Fri, Jun 15 2001)
+[Note: these changes contributed by Patrice Fournier]
+* Changed all remaining \n to \r\n
+* Bcc: header no longer writen to message except
+when sent directly to sendmail
+* Added a small message to non-MIME compliant mail reader
+* Added Sender variable to change the Sender email
+used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode
+* Changed boundary setting to a place it will be set only once
+* Removed transfer encoding for whole message when using multipart
+* Message body now uses Encoding in multipart messages
+* Can set encoding and type to attachments 7bit, 8bit
+and binary attachment are sent as is, base64 are encoded
+* Can set Encoding to base64 to send 8 bits body
+through 7 bits servers
+
+Version 1.10 (Tue, Jun 12 2001)
+* Fixed win32 mail header bug (printed out headers in message body)
+
+Version 1.09 (Fri, Jun 08 2001)
+* Changed date header to work with Netscape mail programs
+* Altered phpdoc documentation
+
+Version 1.08 (Tue, Jun 05 2001)
+* Added enhanced error-checking
+* Added phpdoc documentation to source
+
+Version 1.06 (Fri, Jun 01 2001)
+* Added optional name for file attachments
+
+Version 1.05 (Tue, May 29 2001)
+* Code cleanup
+* Eliminated sendmail header warning message
+* Fixed possible SMTP error
+
+Version 1.03 (Thu, May 24 2001)
+* Fixed problem where qmail sends out duplicate messages
+
+Version 1.02 (Wed, May 23 2001)
+* Added multiple recipient and attachment Clear* methods
+* Added Sendmail public variable
+* Fixed problem with loading SMTP library multiple times
+
+Version 0.98 (Tue, May 22 2001)
+* Fixed problem with redundant mail hosts sending out multiple messages
+* Added additional error handler code
+* Added AddCustomHeader() function
+* Added support for Microsoft mail client headers (affects priority)
+* Fixed small bug with Mailer variable
+* Added PrintVersion() function
+
+Version 0.92 (Tue, May 15 2001)
+* Changed file names to class.phpmailer.php and class.smtp.php to match
+  current PHP class trend.
+* Fixed problem where body not being printed when a message is attached
+* Several small bug fixes
+
+Version 0.90 (Tue, April 17 2001)
+* Intial public release

Modified: branches/print_dev/http/classes/phpmailer-1.72/class.phpmailer.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/class.phpmailer.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/class.phpmailer.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,1496 +1,1496 @@
-<?php
-////////////////////////////////////////////////////
-// PHPMailer - PHP email class
-//
-// Class for sending email using either
-// sendmail, PHP mail(), or SMTP.  Methods are
-// based upon the standard AspEmail(tm) classes.
-//
-// Copyright (C) 2001 - 2003  Brent R. Matzelle
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
-
-/**
- * PHPMailer - PHP email transport class
- * @package PHPMailer
- * @author Brent R. Matzelle
- * @copyright 2001 - 2003 Brent R. Matzelle
- */
-class PHPMailer
-{
-    /////////////////////////////////////////////////
-    // PUBLIC VARIABLES
-    /////////////////////////////////////////////////
-
-    /**
-     * Email priority (1 = High, 3 = Normal, 5 = low).
-     * @var int
-     */
-    var $Priority          = 3;
-
-    /**
-     * Sets the CharSet of the message.
-     * @var string
-     */
-    var $CharSet           = "iso-8859-1";
-
-    /**
-     * Sets the Content-type of the message.
-     * @var string
-     */
-    var $ContentType        = "text/plain";
-
-    /**
-     * Sets the Encoding of the message. Options for this are "8bit",
-     * "7bit", "binary", "base64", and "quoted-printable".
-     * @var string
-     */
-    var $Encoding          = "8bit";
-
-    /**
-     * Holds the most recent mailer error message.
-     * @var string
-     */
-    var $ErrorInfo         = "";
-
-    /**
-     * Sets the From email address for the message.
-     * @var string
-     */
-    var $From               = "root at localhost";
-
-    /**
-     * Sets the From name of the message.
-     * @var string
-     */
-    var $FromName           = "Root User";
-
-    /**
-     * Sets the Sender email (Return-Path) of the message.  If not empty,
-     * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
-     * @var string
-     */
-    var $Sender            = "";
-
-    /**
-     * Sets the Subject of the message.
-     * @var string
-     */
-    var $Subject           = "";
-
-    /**
-     * Sets the Body of the message.  This can be either an HTML or text body.
-     * If HTML then run IsHTML(true).
-     * @var string
-     */
-    var $Body               = "";
-
-    /**
-     * Sets the text-only body of the message.  This automatically sets the
-     * email to multipart/alternative.  This body can be read by mail
-     * clients that do not have HTML email capability such as mutt. Clients
-     * that can read HTML will view the normal Body.
-     * @var string
-     */
-    var $AltBody           = "";
-
-    /**
-     * Sets word wrapping on the body of the message to a given number of 
-     * characters.
-     * @var int
-     */
-    var $WordWrap          = 0;
-
-    /**
-     * Method to send mail: ("mail", "sendmail", or "smtp").
-     * @var string
-     */
-    var $Mailer            = "mail";
-
-    /**
-     * Sets the path of the sendmail program.
-     * @var string
-     */
-    var $Sendmail          = "/usr/sbin/sendmail";
-    
-    /**
-     * Path to PHPMailer plugins.  This is now only useful if the SMTP class 
-     * is in a different directory than the PHP include path.  
-     * @var string
-     */
-    var $PluginDir         = "";
-
-    /**
-     *  Holds PHPMailer version.
-     *  @var string
-     */
-    var $Version           = "1.72";
-
-    /**
-     * Sets the email address that a reading confirmation will be sent.
-     * @var string
-     */
-    var $ConfirmReadingTo  = "";
-
-    /**
-     *  Sets the hostname to use in Message-Id and Received headers
-     *  and as default HELO string. If empty, the value returned
-     *  by SERVER_NAME is used or 'localhost.localdomain'.
-     *  @var string
-     */
-    var $Hostname          = "";
-
-    /////////////////////////////////////////////////
-    // SMTP VARIABLES
-    /////////////////////////////////////////////////
-
-    /**
-     *  Sets the SMTP hosts.  All hosts must be separated by a
-     *  semicolon.  You can also specify a different port
-     *  for each host by using this format: [hostname:port]
-     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
-     *  Hosts will be tried in order.
-     *  @var string
-     */
-    var $Host        = "localhost";
-
-    /**
-     *  Sets the default SMTP server port.
-     *  @var int
-     */
-    var $Port        = 25;
-
-    /**
-     *  Sets the SMTP HELO of the message (Default is $Hostname).
-     *  @var string
-     */
-    var $Helo        = "";
-
-    /**
-     *  Sets SMTP authentication. Utilizes the Username and Password variables.
-     *  @var bool
-     */
-    var $SMTPAuth     = false;
-
-    /**
-     *  Sets SMTP username.
-     *  @var string
-     */
-    var $Username     = "";
-
-    /**
-     *  Sets SMTP password.
-     *  @var string
-     */
-    var $Password     = "";
-
-    /**
-     *  Sets the SMTP server timeout in seconds. This function will not 
-     *  work with the win32 version.
-     *  @var int
-     */
-    var $Timeout      = 10;
-
-    /**
-     *  Sets SMTP class debugging on or off.
-     *  @var bool
-     */
-    var $SMTPDebug    = false;
-
-    /**
-     * Prevents the SMTP connection from being closed after each mail 
-     * sending.  If this is set to true then to close the connection 
-     * requires an explicit call to SmtpClose(). 
-     * @var bool
-     */
-    var $SMTPKeepAlive = false;
-
-    /**#@+
-     * @access private
-     */
-    var $smtp            = NULL;
-    var $to              = array();
-    var $cc              = array();
-    var $bcc             = array();
-    var $ReplyTo         = array();
-    var $attachment      = array();
-    var $CustomHeader    = array();
-    var $message_type    = "";
-    var $boundary        = array();
-    var $language        = array();
-    var $error_count     = 0;
-    var $LE              = "\n";
-    /**#@-*/
-    
-    /////////////////////////////////////////////////
-    // VARIABLE METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Sets message type to HTML.  
-     * @param bool $bool
-     * @return void
-     */
-    function IsHTML($bool) {
-        if($bool == true)
-            $this->ContentType = "text/html";
-        else
-            $this->ContentType = "text/plain";
-    }
-
-    /**
-     * Sets Mailer to send message using SMTP.
-     * @return void
-     */
-    function IsSMTP() {
-        $this->Mailer = "smtp";
-    }
-
-    /**
-     * Sets Mailer to send message using PHP mail() function.
-     * @return void
-     */
-    function IsMail() {
-        $this->Mailer = "mail";
-    }
-
-    /**
-     * Sets Mailer to send message using the $Sendmail program.
-     * @return void
-     */
-    function IsSendmail() {
-        $this->Mailer = "sendmail";
-    }
-
-    /**
-     * Sets Mailer to send message using the qmail MTA. 
-     * @return void
-     */
-    function IsQmail() {
-        $this->Sendmail = "/var/qmail/bin/sendmail";
-        $this->Mailer = "sendmail";
-    }
-
-
-    /////////////////////////////////////////////////
-    // RECIPIENT METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds a "To" address.  
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddAddress($address, $name = "") {
-        $cur = count($this->to);
-        $this->to[$cur][0] = trim($address);
-        $this->to[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Cc" address. Note: this function works
-     * with the SMTP mailer on win32, not with the "mail"
-     * mailer.  
-     * @param string $address
-     * @param string $name
-     * @return void
-    */
-    function AddCC($address, $name = "") {
-        $cur = count($this->cc);
-        $this->cc[$cur][0] = trim($address);
-        $this->cc[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Bcc" address. Note: this function works
-     * with the SMTP mailer on win32, not with the "mail"
-     * mailer.  
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddBCC($address, $name = "") {
-        $cur = count($this->bcc);
-        $this->bcc[$cur][0] = trim($address);
-        $this->bcc[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Reply-to" address.  
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddReplyTo($address, $name = "") {
-        $cur = count($this->ReplyTo);
-        $this->ReplyTo[$cur][0] = trim($address);
-        $this->ReplyTo[$cur][1] = $name;
-    }
-
-
-    /////////////////////////////////////////////////
-    // MAIL SENDING METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Creates message and assigns Mailer. If the message is
-     * not sent successfully then it returns false.  Use the ErrorInfo
-     * variable to view description of the error.  
-     * @return bool
-     */
-    function Send() {
-        $header = "";
-        $body = "";
-        $result = true;
-
-        if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
-        {
-            $this->SetError($this->Lang("provide_address"));
-            return false;
-        }
-
-        // Set whether the message is multipart/alternative
-        if(!empty($this->AltBody))
-            $this->ContentType = "multipart/alternative";
-
-        $this->error_count = 0; // reset errors
-        $this->SetMessageType();
-        $header .= $this->CreateHeader();
-        $body = $this->CreateBody();
-
-        if($body == "") { return false; }
-
-        // Choose the mailer
-        switch($this->Mailer)
-        {
-            case "sendmail":
-                $result = $this->SendmailSend($header, $body);
-                break;
-            case "mail":
-                $result = $this->MailSend($header, $body);
-                break;
-            case "smtp":
-                $result = $this->SmtpSend($header, $body);
-                break;
-            default:
-            $this->SetError($this->Mailer . $this->Lang("mailer_not_supported"));
-                $result = false;
-                break;
-        }
-
-        return $result;
-    }
-    
-    /**
-     * Sends mail using the $Sendmail program.  
-     * @access private
-     * @return bool
-     */
-    function SendmailSend($header, $body) {
-        if ($this->Sender != "")
-            $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
-        else
-            $sendmail = sprintf("%s -oi -t", $this->Sendmail);
-
-        if(!@$mail = popen($sendmail, "w"))
-        {
-            $this->SetError($this->Lang("execute") . $this->Sendmail);
-            return false;
-        }
-
-        fputs($mail, $header);
-        fputs($mail, $body);
-        
-        $result = pclose($mail) >> 8 & 0xFF;
-        if($result != 0)
-        {
-            $this->SetError($this->Lang("execute") . $this->Sendmail);
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Sends mail using the PHP mail() function.  
-     * @access private
-     * @return bool
-     */
-    function MailSend($header, $body) {
-        $to = "";
-        for($i = 0; $i < count($this->to); $i++)
-        {
-            if($i != 0) { $to .= ", "; }
-            $to .= $this->to[$i][0];
-        }
-
-        if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
-        {
-            $old_from = ini_get("sendmail_from");
-            ini_set("sendmail_from", $this->Sender);
-            $params = sprintf("-oi -f %s", $this->Sender);
-            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, 
-                        $header, $params);
-        }
-        else
-            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
-
-        if (isset($old_from))
-            ini_set("sendmail_from", $old_from);
-
-        if(!$rt)
-        {
-            $this->SetError($this->Lang("instantiate"));
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Sends mail via SMTP using PhpSMTP (Author:
-     * Chris Ryan).  Returns bool.  Returns false if there is a
-     * bad MAIL FROM, RCPT, or DATA input.
-     * @access private
-     * @return bool
-     */
-    function SmtpSend($header, $body) {
-        include_once($this->PluginDir . "class.smtp.php");
-        $error = "";
-        $bad_rcpt = array();
-
-        if(!$this->SmtpConnect())
-            return false;
-
-        $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
-        if(!$this->smtp->Mail($smtp_from))
-        {
-            $error = $this->Lang("from_failed") . $smtp_from;
-            $this->SetError($error);
-            $this->smtp->Reset();
-            return false;
-        }
-
-        // Attempt to send attach all recipients
-        for($i = 0; $i < count($this->to); $i++)
-        {
-            if(!$this->smtp->Recipient($this->to[$i][0]))
-                $bad_rcpt[] = $this->to[$i][0];
-        }
-        for($i = 0; $i < count($this->cc); $i++)
-        {
-            if(!$this->smtp->Recipient($this->cc[$i][0]))
-                $bad_rcpt[] = $this->cc[$i][0];
-        }
-        for($i = 0; $i < count($this->bcc); $i++)
-        {
-            if(!$this->smtp->Recipient($this->bcc[$i][0]))
-                $bad_rcpt[] = $this->bcc[$i][0];
-        }
-
-        if(count($bad_rcpt) > 0) // Create error message
-        {
-            for($i = 0; $i < count($bad_rcpt); $i++)
-            {
-                if($i != 0) { $error .= ", "; }
-                $error .= $bad_rcpt[$i];
-            }
-            $error = $this->Lang("recipients_failed") . $error;
-            $this->SetError($error);
-            $this->smtp->Reset();
-            return false;
-        }
-
-        if(!$this->smtp->Data($header . $body))
-        {
-            $this->SetError($this->Lang("data_not_accepted"));
-            $this->smtp->Reset();
-            return false;
-        }
-        if($this->SMTPKeepAlive == true)
-            $this->smtp->Reset();
-        else
-            $this->SmtpClose();
-
-        return true;
-    }
-
-    /**
-     * Initiates a connection to an SMTP server.  Returns false if the 
-     * operation failed.
-     * @access private
-     * @return bool
-     */
-    function SmtpConnect() {
-        if($this->smtp == NULL) { $this->smtp = new SMTP(); }
-
-        $this->smtp->do_debug = $this->SMTPDebug;
-        $hosts = explode(";", $this->Host);
-        $index = 0;
-        $connection = ($this->smtp->Connected()); 
-
-        // Retry while there is no connection
-        while($index < count($hosts) && $connection == false)
-        {
-            if(strstr($hosts[$index], ":"))
-                list($host, $port) = explode(":", $hosts[$index]);
-            else
-            {
-                $host = $hosts[$index];
-                $port = $this->Port;
-            }
-
-            if($this->smtp->Connect($host, $port, $this->Timeout))
-            {
-                if ($this->Helo != '')
-                    $this->smtp->Hello($this->Helo);
-                else
-                    $this->smtp->Hello($this->ServerHostname());
-        
-                if($this->SMTPAuth)
-                {
-                    if(!$this->smtp->Authenticate($this->Username, 
-                                                  $this->Password))
-                    {
-                        $this->SetError($this->Lang("authenticate"));
-                        $this->smtp->Reset();
-                        $connection = false;
-                    }
-                }
-                $connection = true;
-            }
-            $index++;
-        }
-        if(!$connection)
-            $this->SetError($this->Lang("connect_host"));
-
-        return $connection;
-    }
-
-    /**
-     * Closes the active SMTP session if one exists.
-     * @return void
-     */
-    function SmtpClose() {
-        if($this->smtp != NULL)
-        {
-            if($this->smtp->Connected())
-            {
-                $this->smtp->Quit();
-                $this->smtp->Close();
-            }
-        }
-    }
-
-    /**
-     * Sets the language for all class error messages.  Returns false 
-     * if it cannot load the language file.  The default language type
-     * is English.
-     * @param string $lang_type Type of language (e.g. Portuguese: "br")
-     * @param string $lang_path Path to the language file directory
-     * @access public
-     * @return bool
-     */
-    function SetLanguage($lang_type, $lang_path = "language/") {
-        if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php'))
-            include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
-        else if(file_exists($lang_path.'phpmailer.lang-en.php'))
-            include($lang_path.'phpmailer.lang-en.php');
-        else
-        {
-            $this->SetError("Could not load language file");
-            return false;
-        }
-        $this->language = $PHPMAILER_LANG;
-    
-        return true;
-    }
-
-    /////////////////////////////////////////////////
-    // MESSAGE CREATION METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Creates recipient headers.  
-     * @access private
-     * @return string
-     */
-    function AddrAppend($type, $addr) {
-        $addr_str = $type . ": ";
-        $addr_str .= $this->AddrFormat($addr[0]);
-        if(count($addr) > 1)
-        {
-            for($i = 1; $i < count($addr); $i++)
-                $addr_str .= ", " . $this->AddrFormat($addr[$i]);
-        }
-        $addr_str .= $this->LE;
-
-        return $addr_str;
-    }
-    
-    /**
-     * Formats an address correctly. 
-     * @access private
-     * @return string
-     */
-    function AddrFormat($addr) {
-        if(empty($addr[1]))
-            $formatted = $addr[0];
-        else
-        {
-            $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . 
-                         $addr[0] . ">";
-        }
-
-        return $formatted;
-    }
-
-    /**
-     * Wraps message for use with mailers that do not
-     * automatically perform wrapping and for quoted-printable.
-     * Original written by philippe.  
-     * @access private
-     * @return string
-     */
-    function WrapText($message, $length, $qp_mode = false) {
-        $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
-
-        $message = $this->FixEOL($message);
-        if (substr($message, -1) == $this->LE)
-            $message = substr($message, 0, -1);
-
-        $line = explode($this->LE, $message);
-        $message = "";
-        for ($i=0 ;$i < count($line); $i++)
-        {
-          $line_part = explode(" ", $line[$i]);
-          $buf = "";
-          for ($e = 0; $e<count($line_part); $e++)
-          {
-              $word = $line_part[$e];
-              if ($qp_mode and (strlen($word) > $length))
-              {
-                $space_left = $length - strlen($buf) - 1;
-                if ($e != 0)
-                {
-                    if ($space_left > 20)
-                    {
-                        $len = $space_left;
-                        if (substr($word, $len - 1, 1) == "=")
-                          $len--;
-                        elseif (substr($word, $len - 2, 1) == "=")
-                          $len -= 2;
-                        $part = substr($word, 0, $len);
-                        $word = substr($word, $len);
-                        $buf .= " " . $part;
-                        $message .= $buf . sprintf("=%s", $this->LE);
-                    }
-                    else
-                    {
-                        $message .= $buf . $soft_break;
-                    }
-                    $buf = "";
-                }
-                while (strlen($word) > 0)
-                {
-                    $len = $length;
-                    if (substr($word, $len - 1, 1) == "=")
-                        $len--;
-                    elseif (substr($word, $len - 2, 1) == "=")
-                        $len -= 2;
-                    $part = substr($word, 0, $len);
-                    $word = substr($word, $len);
-
-                    if (strlen($word) > 0)
-                        $message .= $part . sprintf("=%s", $this->LE);
-                    else
-                        $buf = $part;
-                }
-              }
-              else
-              {
-                $buf_o = $buf;
-                $buf .= ($e == 0) ? $word : (" " . $word); 
-
-                if (strlen($buf) > $length and $buf_o != "")
-                {
-                    $message .= $buf_o . $soft_break;
-                    $buf = $word;
-                }
-              }
-          }
-          $message .= $buf . $this->LE;
-        }
-
-        return $message;
-    }
-    
-    /**
-     * Set the body wrapping.
-     * @access private
-     * @return void
-     */
-    function SetWordWrap() {
-        if($this->WordWrap < 1)
-            return;
-            
-        switch($this->message_type)
-        {
-           case "alt":
-              // fall through
-           case "alt_attachment":
-              $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
-              break;
-           default:
-              $this->Body = $this->WrapText($this->Body, $this->WordWrap);
-              break;
-        }
-    }
-
-    /**
-     * Assembles message header.  
-     * @access private
-     * @return string
-     */
-    function CreateHeader() {
-        $result = "";
-        
-        // Set the boundaries
-        $uniq_id = md5(uniqid(time()));
-        $this->boundary[1] = "b1_" . $uniq_id;
-        $this->boundary[2] = "b2_" . $uniq_id;
-
-        $result .= $this->HeaderLine("Date", $this->RFCDate());
-        if($this->Sender == "")
-            $result .= $this->HeaderLine("Return-Path", trim($this->From));
-        else
-            $result .= $this->HeaderLine("Return-Path", trim($this->Sender));
-        
-        // To be created automatically by mail()
-        if($this->Mailer != "mail")
-        {
-            if(count($this->to) > 0)
-                $result .= $this->AddrAppend("To", $this->to);
-            else if (count($this->cc) == 0)
-                $result .= $this->HeaderLine("To", "undisclosed-recipients:;");
-            if(count($this->cc) > 0)
-                $result .= $this->AddrAppend("Cc", $this->cc);
-        }
-
-        $from = array();
-        $from[0][0] = trim($this->From);
-        $from[0][1] = $this->FromName;
-        $result .= $this->AddrAppend("From", $from); 
-
-        // sendmail and mail() extract Bcc from the header before sending
-        if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0))
-            $result .= $this->AddrAppend("Bcc", $this->bcc);
-
-        if(count($this->ReplyTo) > 0)
-            $result .= $this->AddrAppend("Reply-to", $this->ReplyTo);
-
-        // mail() sets the subject itself
-        if($this->Mailer != "mail")
-            $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject)));
-
-        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
-        $result .= $this->HeaderLine("X-Priority", $this->Priority);
-        $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]");
-        
-        if($this->ConfirmReadingTo != "")
-        {
-            $result .= $this->HeaderLine("Disposition-Notification-To", 
-                       "<" . trim($this->ConfirmReadingTo) . ">");
-        }
-
-        // Add custom headers
-        for($index = 0; $index < count($this->CustomHeader); $index++)
-        {
-            $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), 
-                       $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
-        }
-        $result .= $this->HeaderLine("MIME-Version", "1.0");
-
-        switch($this->message_type)
-        {
-            case "plain":
-                $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
-                $result .= sprintf("Content-Type: %s; charset=\"%s\"",
-                                    $this->ContentType, $this->CharSet);
-                break;
-            case "attachments":
-                // fall through
-            case "alt_attachments":
-                if($this->InlineImageExists())
-                {
-                    $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 
-                                    "multipart/related", $this->LE, $this->LE, 
-                                    $this->boundary[1], $this->LE);
-                }
-                else
-                {
-                    $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
-                    $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
-                }
-                break;
-            case "alt":
-                $result .= $this->HeaderLine("Content-Type", "multipart/alternative;");
-                $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
-                break;
-        }
-
-        if($this->Mailer != "mail")
-            $result .= $this->LE.$this->LE;
-
-        return $result;
-    }
-
-    /**
-     * Assembles the message body.  Returns an empty string on failure.
-     * @access private
-     * @return string
-     */
-    function CreateBody() {
-        $result = "";
-
-        $this->SetWordWrap();
-
-        switch($this->message_type)
-        {
-            case "alt":
-                $result .= $this->GetBoundary($this->boundary[1], "", 
-                                              "text/plain", "");
-                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-                $result .= $this->GetBoundary($this->boundary[1], "", 
-                                              "text/html", "");
-                
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-    
-                $result .= $this->EndBoundary($this->boundary[1]);
-                break;
-            case "plain":
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                break;
-            case "attachments":
-                $result .= $this->GetBoundary($this->boundary[1], "", "", "");
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE;
-     
-                $result .= $this->AttachAll();
-                break;
-            case "alt_attachments":
-                $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
-                $result .= sprintf("Content-Type: %s;%s" .
-                                   "\tboundary=\"%s\"%s",
-                                   "multipart/alternative", $this->LE, 
-                                   $this->boundary[2], $this->LE.$this->LE);
-    
-                // Create text body
-                $result .= $this->GetBoundary($this->boundary[2], "", 
-                                              "text/plain", "") . $this->LE;
-
-                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-    
-                // Create the HTML body
-                $result .= $this->GetBoundary($this->boundary[2], "", 
-                                              "text/html", "") . $this->LE;
-    
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-
-                $result .= $this->EndBoundary($this->boundary[2]);
-                
-                $result .= $this->AttachAll();
-                break;
-        }
-        if($this->IsError())
-            $result = "";
-
-        return $result;
-    }
-
-    /**
-     * Returns the start of a message boundary.
-     * @access private
-     */
-    function GetBoundary($boundary, $charSet, $contentType, $encoding) {
-        $result = "";
-        if($charSet == "") { $charSet = $this->CharSet; }
-        if($contentType == "") { $contentType = $this->ContentType; }
-        if($encoding == "") { $encoding = $this->Encoding; }
-
-        $result .= $this->TextLine("--" . $boundary);
-        $result .= sprintf("Content-Type: %s; charset = \"%s\"", 
-                            $contentType, $charSet);
-        $result .= $this->LE;
-        $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
-        $result .= $this->LE;
-       
-        return $result;
-    }
-    
-    /**
-     * Returns the end of a message boundary.
-     * @access private
-     */
-    function EndBoundary($boundary) {
-        return $this->LE . "--" . $boundary . "--" . $this->LE; 
-    }
-    
-    /**
-     * Sets the message type.
-     * @access private
-     * @return void
-     */
-    function SetMessageType() {
-        if(count($this->attachment) < 1 && strlen($this->AltBody) < 1)
-            $this->message_type = "plain";
-        else
-        {
-            if(count($this->attachment) > 0)
-                $this->message_type = "attachments";
-            if(strlen($this->AltBody) > 0 && count($this->attachment) < 1)
-                $this->message_type = "alt";
-            if(strlen($this->AltBody) > 0 && count($this->attachment) > 0)
-                $this->message_type = "alt_attachments";
-        }
-    }
-
-    /**
-     * Returns a formatted header line.
-     * @access private
-     * @return string
-     */
-    function HeaderLine($name, $value) {
-        return $name . ": " . $value . $this->LE;
-    }
-
-    /**
-     * Returns a formatted mail line.
-     * @access private
-     * @return string
-     */
-    function TextLine($value) {
-        return $value . $this->LE;
-    }
-
-    /////////////////////////////////////////////////
-    // ATTACHMENT METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds an attachment from a path on the filesystem.
-     * Returns false if the file could not be found
-     * or accessed.
-     * @param string $path Path to the attachment.
-     * @param string $name Overrides the attachment name.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.
-     * @return bool
-     */
-    function AddAttachment($path, $name = "", $encoding = "base64", 
-                           $type = "application/octet-stream") {
-        if(!@is_file($path))
-        {
-            $this->SetError($this->Lang("file_access") . $path);
-            return false;
-        }
-
-        $filename = basename($path);
-        if($name == "")
-            $name = $filename;
-
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $path;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $name;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = false; // isStringAttachment
-        $this->attachment[$cur][6] = "attachment";
-        $this->attachment[$cur][7] = 0;
-
-        return true;
-    }
-
-    /**
-     * Attaches all fs, string, and binary attachments to the message.
-     * Returns an empty string on failure.
-     * @access private
-     * @return string
-     */
-    function AttachAll() {
-        // Return text of body
-        $mime = array();
-
-        // Add all attachments
-        for($i = 0; $i < count($this->attachment); $i++)
-        {
-            // Check for string attachment
-            $bString = $this->attachment[$i][5];
-            if ($bString)
-                $string = $this->attachment[$i][0];
-            else
-                $path = $this->attachment[$i][0];
-
-            $filename    = $this->attachment[$i][1];
-            $name        = $this->attachment[$i][2];
-            $encoding    = $this->attachment[$i][3];
-            $type        = $this->attachment[$i][4];
-            $disposition = $this->attachment[$i][6];
-            $cid         = $this->attachment[$i][7];
-            
-            $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
-            $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
-            $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
-
-            if($disposition == "inline")
-                $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
-
-            $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", 
-                              $disposition, $name, $this->LE.$this->LE);
-
-            // Encode as string attachment
-            if($bString)
-            {
-                $mime[] = $this->EncodeString($string, $encoding);
-                if($this->IsError()) { return ""; }
-                $mime[] = $this->LE.$this->LE;
-            }
-            else
-            {
-                $mime[] = $this->EncodeFile($path, $encoding);                
-                if($this->IsError()) { return ""; }
-                $mime[] = $this->LE.$this->LE;
-            }
-        }
-
-        $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
-
-        return join("", $mime);
-    }
-    
-    /**
-     * Encodes attachment in requested format.  Returns an
-     * empty string on failure.
-     * @access private
-     * @return string
-     */
-    function EncodeFile ($path, $encoding = "base64") {
-        if(!@$fd = fopen($path, "rb"))
-        {
-            $this->SetError($this->Lang("file_open") . $path);
-            return "";
-        }
-        $file_buffer = fread($fd, filesize($path));
-        $file_buffer = $this->EncodeString($file_buffer, $encoding);
-        fclose($fd);
-
-        return $file_buffer;
-    }
-
-    /**
-     * Encodes string to requested format. Returns an
-     * empty string on failure.
-     * @access private
-     * @return string
-     */
-    function EncodeString ($str, $encoding = "base64") {
-        $encoded = "";
-        switch(strtolower($encoding)) {
-          case "base64":
-              // chunk_split is found in PHP >= 3.0.6
-              $encoded = chunk_split(base64_encode($str), 76, $this->LE);
-              break;
-          case "7bit":
-          case "8bit":
-              $encoded = $this->FixEOL($str);
-              if (substr($encoded, -(strlen($this->LE))) != $this->LE)
-                $encoded .= $this->LE;
-              break;
-          case "binary":
-              $encoded = $str;
-              break;
-          case "quoted-printable":
-              $encoded = $this->EncodeQP($str);
-              break;
-          default:
-              $this->SetError($this->Lang("encoding") . $encoding);
-              break;
-        }
-        return $encoded;
-    }
-
-    /**
-     * Encode a header string to best of Q, B, quoted or none.  
-     * @access private
-     * @return string
-     */
-    function EncodeHeader ($str, $position = 'text') {
-      $x = 0;
-      
-      switch (strtolower($position)) {
-        case 'phrase':
-          if (!preg_match('/[\200-\377]/', $str)) {
-            // Can't use addslashes as we don't know what value has magic_quotes_sybase.
-            $encoded = addcslashes($str, "\0..\37\177\\\"");
-
-            if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str))
-              return ($encoded);
-            else
-              return ("\"$encoded\"");
-          }
-          $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
-          break;
-        case 'comment':
-          $x = preg_match_all('/[()"]/', $str, $matches);
-          // Fall-through
-        case 'text':
-        default:
-          $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
-          break;
-      }
-
-      if ($x == 0)
-        return ($str);
-
-      $maxlen = 75 - 7 - strlen($this->CharSet);
-      // Try to select the encoding which should produce the shortest output
-      if (strlen($str)/3 < $x) {
-        $encoding = 'B';
-        $encoded = base64_encode($str);
-        $maxlen -= $maxlen % 4;
-        $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
-      } else {
-        $encoding = 'Q';
-        $encoded = $this->EncodeQ($str, $position);
-        $encoded = $this->WrapText($encoded, $maxlen, true);
-        $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
-      }
-
-      $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
-      $encoded = trim(str_replace("\n", $this->LE, $encoded));
-      
-      return $encoded;
-    }
-    
-    /**
-     * Encode string to quoted-printable.  
-     * @access private
-     * @return string
-     */
-    function EncodeQP ($str) {
-        $encoded = $this->FixEOL($str);
-        if (substr($encoded, -(strlen($this->LE))) != $this->LE)
-            $encoded .= $this->LE;
-
-        // Replace every high ascii, control and = characters
-        $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
-                  "'='.sprintf('%02X', ord('\\1'))", $encoded);
-        // Replace every spaces and tabs when it's the last character on a line
-        $encoded = preg_replace("/([\011\040])".$this->LE."/e",
-                  "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
-
-        // Maximum line length of 76 characters before CRLF (74 + space + '=')
-        $encoded = $this->WrapText($encoded, 74, true);
-
-        return $encoded;
-    }
-
-    /**
-     * Encode string to q encoding.  
-     * @access private
-     * @return string
-     */
-    function EncodeQ ($str, $position = "text") {
-        // There should not be any EOL in the string
-        $encoded = preg_replace("[\r\n]", "", $str);
-
-        switch (strtolower($position)) {
-          case "phrase":
-            $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
-            break;
-          case "comment":
-            $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
-          case "text":
-          default:
-            // Replace every high ascii, control =, ? and _ characters
-            $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
-                  "'='.sprintf('%02X', ord('\\1'))", $encoded);
-            break;
-        }
-        
-        // Replace every spaces to _ (more readable than =20)
-        $encoded = str_replace(" ", "_", $encoded);
-
-        return $encoded;
-    }
-
-    /**
-     * Adds a string or binary attachment (non-filesystem) to the list.
-     * This method can be used to attach ascii or binary data,
-     * such as a BLOB record from a database.
-     * @param string $string String attachment data.
-     * @param string $filename Name of the attachment.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.
-     * @return void
-     */
-    function AddStringAttachment($string, $filename, $encoding = "base64", 
-                                 $type = "application/octet-stream") {
-        // Append to $attachment array
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $string;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $filename;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = true; // isString
-        $this->attachment[$cur][6] = "attachment";
-        $this->attachment[$cur][7] = 0;
-    }
-    
-    /**
-     * Adds an embedded attachment.  This can include images, sounds, and 
-     * just about any other document.  Make sure to set the $type to an 
-     * image type.  For JPEG images use "image/jpeg" and for GIF images 
-     * use "image/gif".
-     * @param string $path Path to the attachment.
-     * @param string $cid Content ID of the attachment.  Use this to identify 
-     *        the Id for accessing the image in an HTML form.
-     * @param string $name Overrides the attachment name.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.  
-     * @return bool
-     */
-    function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", 
-                              $type = "application/octet-stream") {
-    
-        if(!@is_file($path))
-        {
-            $this->SetError($this->Lang("file_access") . $path);
-            return false;
-        }
-
-        $filename = basename($path);
-        if($name == "")
-            $name = $filename;
-
-        // Append to $attachment array
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $path;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $name;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = false; // isStringAttachment
-        $this->attachment[$cur][6] = "inline";
-        $this->attachment[$cur][7] = $cid;
-    
-        return true;
-    }
-    
-    /**
-     * Returns true if an inline attachment is present.
-     * @access private
-     * @return bool
-     */
-    function InlineImageExists() {
-        $result = false;
-        for($i = 0; $i < count($this->attachment); $i++)
-        {
-            if($this->attachment[$i][6] == "inline")
-            {
-                $result = true;
-                break;
-            }
-        }
-        
-        return $result;
-    }
-
-    /////////////////////////////////////////////////
-    // MESSAGE RESET METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Clears all recipients assigned in the TO array.  Returns void.
-     * @return void
-     */
-    function ClearAddresses() {
-        $this->to = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the CC array.  Returns void.
-     * @return void
-     */
-    function ClearCCs() {
-        $this->cc = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the BCC array.  Returns void.
-     * @return void
-     */
-    function ClearBCCs() {
-        $this->bcc = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the ReplyTo array.  Returns void.
-     * @return void
-     */
-    function ClearReplyTos() {
-        $this->ReplyTo = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the TO, CC and BCC
-     * array.  Returns void.
-     * @return void
-     */
-    function ClearAllRecipients() {
-        $this->to = array();
-        $this->cc = array();
-        $this->bcc = array();
-    }
-
-    /**
-     * Clears all previously set filesystem, string, and binary
-     * attachments.  Returns void.
-     * @return void
-     */
-    function ClearAttachments() {
-        $this->attachment = array();
-    }
-
-    /**
-     * Clears all custom headers.  Returns void.
-     * @return void
-     */
-    function ClearCustomHeaders() {
-        $this->CustomHeader = array();
-    }
-
-
-    /////////////////////////////////////////////////
-    // MISCELLANEOUS METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds the error message to the error container.
-     * Returns void.
-     * @access private
-     * @return void
-     */
-    function SetError($msg) {
-        $this->error_count++;
-        $this->ErrorInfo = $msg;
-    }
-
-    /**
-     * Returns the proper RFC 822 formatted date. 
-     * @access private
-     * @return string
-     */
-    function RFCDate() {
-        $tz = date("Z");
-        $tzs = ($tz < 0) ? "-" : "+";
-        $tz = abs($tz);
-        $tz = ($tz/3600)*100 + ($tz%3600)/60;
-        $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
-
-        return $result;
-    }
-    
-    /**
-     * Returns the appropriate server variable.  Should work with both 
-     * PHP 4.1.0+ as well as older versions.  Returns an empty string 
-     * if nothing is found.
-     * @access private
-     * @return mixed
-     */
-    function ServerVar($varName) {
-        global $HTTP_SERVER_VARS;
-        global $HTTP_ENV_VARS;
-
-        if(!isset($_SERVER))
-        {
-            $_SERVER = $HTTP_SERVER_VARS;
-            if(!isset($_SERVER["REMOTE_ADDR"]))
-                $_SERVER = $HTTP_ENV_VARS; // must be Apache
-        }
-        
-        if(isset($_SERVER[$varName]))
-            return $_SERVER[$varName];
-        else
-            return "";
-    }
-
-    /**
-     * Returns the server hostname or 'localhost.localdomain' if unknown.
-     * @access private
-     * @return string
-     */
-    function ServerHostname() {
-        if ($this->Hostname != "")
-            $result = $this->Hostname;
-        elseif ($this->ServerVar('SERVER_NAME') != "")
-            $result = $this->ServerVar('SERVER_NAME');
-        else
-            $result = "localhost.localdomain";
-
-        return $result;
-    }
-
-    /**
-     * Returns a message in the appropriate language.
-     * @access private
-     * @return string
-     */
-    function Lang($key) {
-        if(count($this->language) < 1)
-            $this->SetLanguage("en"); // set the default language
-    
-        if(isset($this->language[$key]))
-            return $this->language[$key];
-        else
-            return "Language string failed to load: " . $key;
-    }
-    
-    /**
-     * Returns true if an error occurred.
-     * @return bool
-     */
-    function IsError() {
-        return ($this->error_count > 0);
-    }
-
-    /**
-     * Changes every end of line from CR or LF to CRLF.  
-     * @access private
-     * @return string
-     */
-    function FixEOL($str) {
-        $str = str_replace("\r\n", "\n", $str);
-        $str = str_replace("\r", "\n", $str);
-        $str = str_replace("\n", $this->LE, $str);
-        return $str;
-    }
-
-    /**
-     * Adds a custom header. 
-     * @return void
-     */
-    function AddCustomHeader($custom_header) {
-        $this->CustomHeader[] = explode(":", $custom_header, 2);
-    }
-}
-
-?>
+<?php
+////////////////////////////////////////////////////
+// PHPMailer - PHP email class
+//
+// Class for sending email using either
+// sendmail, PHP mail(), or SMTP.  Methods are
+// based upon the standard AspEmail(tm) classes.
+//
+// Copyright (C) 2001 - 2003  Brent R. Matzelle
+//
+// License: LGPL, see LICENSE
+////////////////////////////////////////////////////
+
+/**
+ * PHPMailer - PHP email transport class
+ * @package PHPMailer
+ * @author Brent R. Matzelle
+ * @copyright 2001 - 2003 Brent R. Matzelle
+ */
+class PHPMailer
+{
+    /////////////////////////////////////////////////
+    // PUBLIC VARIABLES
+    /////////////////////////////////////////////////
+
+    /**
+     * Email priority (1 = High, 3 = Normal, 5 = low).
+     * @var int
+     */
+    var $Priority          = 3;
+
+    /**
+     * Sets the CharSet of the message.
+     * @var string
+     */
+    var $CharSet           = "iso-8859-1";
+
+    /**
+     * Sets the Content-type of the message.
+     * @var string
+     */
+    var $ContentType        = "text/plain";
+
+    /**
+     * Sets the Encoding of the message. Options for this are "8bit",
+     * "7bit", "binary", "base64", and "quoted-printable".
+     * @var string
+     */
+    var $Encoding          = "8bit";
+
+    /**
+     * Holds the most recent mailer error message.
+     * @var string
+     */
+    var $ErrorInfo         = "";
+
+    /**
+     * Sets the From email address for the message.
+     * @var string
+     */
+    var $From               = "root at localhost";
+
+    /**
+     * Sets the From name of the message.
+     * @var string
+     */
+    var $FromName           = "Root User";
+
+    /**
+     * Sets the Sender email (Return-Path) of the message.  If not empty,
+     * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+     * @var string
+     */
+    var $Sender            = "";
+
+    /**
+     * Sets the Subject of the message.
+     * @var string
+     */
+    var $Subject           = "";
+
+    /**
+     * Sets the Body of the message.  This can be either an HTML or text body.
+     * If HTML then run IsHTML(true).
+     * @var string
+     */
+    var $Body               = "";
+
+    /**
+     * Sets the text-only body of the message.  This automatically sets the
+     * email to multipart/alternative.  This body can be read by mail
+     * clients that do not have HTML email capability such as mutt. Clients
+     * that can read HTML will view the normal Body.
+     * @var string
+     */
+    var $AltBody           = "";
+
+    /**
+     * Sets word wrapping on the body of the message to a given number of 
+     * characters.
+     * @var int
+     */
+    var $WordWrap          = 0;
+
+    /**
+     * Method to send mail: ("mail", "sendmail", or "smtp").
+     * @var string
+     */
+    var $Mailer            = "mail";
+
+    /**
+     * Sets the path of the sendmail program.
+     * @var string
+     */
+    var $Sendmail          = "/usr/sbin/sendmail";
+    
+    /**
+     * Path to PHPMailer plugins.  This is now only useful if the SMTP class 
+     * is in a different directory than the PHP include path.  
+     * @var string
+     */
+    var $PluginDir         = "";
+
+    /**
+     *  Holds PHPMailer version.
+     *  @var string
+     */
+    var $Version           = "1.72";
+
+    /**
+     * Sets the email address that a reading confirmation will be sent.
+     * @var string
+     */
+    var $ConfirmReadingTo  = "";
+
+    /**
+     *  Sets the hostname to use in Message-Id and Received headers
+     *  and as default HELO string. If empty, the value returned
+     *  by SERVER_NAME is used or 'localhost.localdomain'.
+     *  @var string
+     */
+    var $Hostname          = "";
+
+    /////////////////////////////////////////////////
+    // SMTP VARIABLES
+    /////////////////////////////////////////////////
+
+    /**
+     *  Sets the SMTP hosts.  All hosts must be separated by a
+     *  semicolon.  You can also specify a different port
+     *  for each host by using this format: [hostname:port]
+     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
+     *  Hosts will be tried in order.
+     *  @var string
+     */
+    var $Host        = "localhost";
+
+    /**
+     *  Sets the default SMTP server port.
+     *  @var int
+     */
+    var $Port        = 25;
+
+    /**
+     *  Sets the SMTP HELO of the message (Default is $Hostname).
+     *  @var string
+     */
+    var $Helo        = "";
+
+    /**
+     *  Sets SMTP authentication. Utilizes the Username and Password variables.
+     *  @var bool
+     */
+    var $SMTPAuth     = false;
+
+    /**
+     *  Sets SMTP username.
+     *  @var string
+     */
+    var $Username     = "";
+
+    /**
+     *  Sets SMTP password.
+     *  @var string
+     */
+    var $Password     = "";
+
+    /**
+     *  Sets the SMTP server timeout in seconds. This function will not 
+     *  work with the win32 version.
+     *  @var int
+     */
+    var $Timeout      = 10;
+
+    /**
+     *  Sets SMTP class debugging on or off.
+     *  @var bool
+     */
+    var $SMTPDebug    = false;
+
+    /**
+     * Prevents the SMTP connection from being closed after each mail 
+     * sending.  If this is set to true then to close the connection 
+     * requires an explicit call to SmtpClose(). 
+     * @var bool
+     */
+    var $SMTPKeepAlive = false;
+
+    /**#@+
+     * @access private
+     */
+    var $smtp            = NULL;
+    var $to              = array();
+    var $cc              = array();
+    var $bcc             = array();
+    var $ReplyTo         = array();
+    var $attachment      = array();
+    var $CustomHeader    = array();
+    var $message_type    = "";
+    var $boundary        = array();
+    var $language        = array();
+    var $error_count     = 0;
+    var $LE              = "\n";
+    /**#@-*/
+    
+    /////////////////////////////////////////////////
+    // VARIABLE METHODS
+    /////////////////////////////////////////////////
+
+    /**
+     * Sets message type to HTML.  
+     * @param bool $bool
+     * @return void
+     */
+    function IsHTML($bool) {
+        if($bool == true)
+            $this->ContentType = "text/html";
+        else
+            $this->ContentType = "text/plain";
+    }
+
+    /**
+     * Sets Mailer to send message using SMTP.
+     * @return void
+     */
+    function IsSMTP() {
+        $this->Mailer = "smtp";
+    }
+
+    /**
+     * Sets Mailer to send message using PHP mail() function.
+     * @return void
+     */
+    function IsMail() {
+        $this->Mailer = "mail";
+    }
+
+    /**
+     * Sets Mailer to send message using the $Sendmail program.
+     * @return void
+     */
+    function IsSendmail() {
+        $this->Mailer = "sendmail";
+    }
+
+    /**
+     * Sets Mailer to send message using the qmail MTA. 
+     * @return void
+     */
+    function IsQmail() {
+        $this->Sendmail = "/var/qmail/bin/sendmail";
+        $this->Mailer = "sendmail";
+    }
+
+
+    /////////////////////////////////////////////////
+    // RECIPIENT METHODS
+    /////////////////////////////////////////////////
+
+    /**
+     * Adds a "To" address.  
+     * @param string $address
+     * @param string $name
+     * @return void
+     */
+    function AddAddress($address, $name = "") {
+        $cur = count($this->to);
+        $this->to[$cur][0] = trim($address);
+        $this->to[$cur][1] = $name;
+    }
+
+    /**
+     * Adds a "Cc" address. Note: this function works
+     * with the SMTP mailer on win32, not with the "mail"
+     * mailer.  
+     * @param string $address
+     * @param string $name
+     * @return void
+    */
+    function AddCC($address, $name = "") {
+        $cur = count($this->cc);
+        $this->cc[$cur][0] = trim($address);
+        $this->cc[$cur][1] = $name;
+    }
+
+    /**
+     * Adds a "Bcc" address. Note: this function works
+     * with the SMTP mailer on win32, not with the "mail"
+     * mailer.  
+     * @param string $address
+     * @param string $name
+     * @return void
+     */
+    function AddBCC($address, $name = "") {
+        $cur = count($this->bcc);
+        $this->bcc[$cur][0] = trim($address);
+        $this->bcc[$cur][1] = $name;
+    }
+
+    /**
+     * Adds a "Reply-to" address.  
+     * @param string $address
+     * @param string $name
+     * @return void
+     */
+    function AddReplyTo($address, $name = "") {
+        $cur = count($this->ReplyTo);
+        $this->ReplyTo[$cur][0] = trim($address);
+        $this->ReplyTo[$cur][1] = $name;
+    }
+
+
+    /////////////////////////////////////////////////
+    // MAIL SENDING METHODS
+    /////////////////////////////////////////////////
+
+    /**
+     * Creates message and assigns Mailer. If the message is
+     * not sent successfully then it returns false.  Use the ErrorInfo
+     * variable to view description of the error.  
+     * @return bool
+     */
+    function Send() {
+        $header = "";
+        $body = "";
+        $result = true;
+
+        if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
+        {
+            $this->SetError($this->Lang("provide_address"));
+            return false;
+        }
+
+        // Set whether the message is multipart/alternative
+        if(!empty($this->AltBody))
+            $this->ContentType = "multipart/alternative";
+
+        $this->error_count = 0; // reset errors
+        $this->SetMessageType();
+        $header .= $this->CreateHeader();
+        $body = $this->CreateBody();
+
+        if($body == "") { return false; }
+
+        // Choose the mailer
+        switch($this->Mailer)
+        {
+            case "sendmail":
+                $result = $this->SendmailSend($header, $body);
+                break;
+            case "mail":
+                $result = $this->MailSend($header, $body);
+                break;
+            case "smtp":
+                $result = $this->SmtpSend($header, $body);
+                break;
+            default:
+            $this->SetError($this->Mailer . $this->Lang("mailer_not_supported"));
+                $result = false;
+                break;
+        }
+
+        return $result;
+    }
+    
+    /**
+     * Sends mail using the $Sendmail program.  
+     * @access private
+     * @return bool
+     */
+    function SendmailSend($header, $body) {
+        if ($this->Sender != "")
+            $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
+        else
+            $sendmail = sprintf("%s -oi -t", $this->Sendmail);
+
+        if(!@$mail = popen($sendmail, "w"))
+        {
+            $this->SetError($this->Lang("execute") . $this->Sendmail);
+            return false;
+        }
+
+        fputs($mail, $header);
+        fputs($mail, $body);
+        
+        $result = pclose($mail) >> 8 & 0xFF;
+        if($result != 0)
+        {
+            $this->SetError($this->Lang("execute") . $this->Sendmail);
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Sends mail using the PHP mail() function.  
+     * @access private
+     * @return bool
+     */
+    function MailSend($header, $body) {
+        $to = "";
+        for($i = 0; $i < count($this->to); $i++)
+        {
+            if($i != 0) { $to .= ", "; }
+            $to .= $this->to[$i][0];
+        }
+
+        if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
+        {
+            $old_from = ini_get("sendmail_from");
+            ini_set("sendmail_from", $this->Sender);
+            $params = sprintf("-oi -f %s", $this->Sender);
+            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, 
+                        $header, $params);
+        }
+        else
+            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
+
+        if (isset($old_from))
+            ini_set("sendmail_from", $old_from);
+
+        if(!$rt)
+        {
+            $this->SetError($this->Lang("instantiate"));
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Sends mail via SMTP using PhpSMTP (Author:
+     * Chris Ryan).  Returns bool.  Returns false if there is a
+     * bad MAIL FROM, RCPT, or DATA input.
+     * @access private
+     * @return bool
+     */
+    function SmtpSend($header, $body) {
+        include_once($this->PluginDir . "class.smtp.php");
+        $error = "";
+        $bad_rcpt = array();
+
+        if(!$this->SmtpConnect())
+            return false;
+
+        $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
+        if(!$this->smtp->Mail($smtp_from))
+        {
+            $error = $this->Lang("from_failed") . $smtp_from;
+            $this->SetError($error);
+            $this->smtp->Reset();
+            return false;
+        }
+
+        // Attempt to send attach all recipients
+        for($i = 0; $i < count($this->to); $i++)
+        {
+            if(!$this->smtp->Recipient($this->to[$i][0]))
+                $bad_rcpt[] = $this->to[$i][0];
+        }
+        for($i = 0; $i < count($this->cc); $i++)
+        {
+            if(!$this->smtp->Recipient($this->cc[$i][0]))
+                $bad_rcpt[] = $this->cc[$i][0];
+        }
+        for($i = 0; $i < count($this->bcc); $i++)
+        {
+            if(!$this->smtp->Recipient($this->bcc[$i][0]))
+                $bad_rcpt[] = $this->bcc[$i][0];
+        }
+
+        if(count($bad_rcpt) > 0) // Create error message
+        {
+            for($i = 0; $i < count($bad_rcpt); $i++)
+            {
+                if($i != 0) { $error .= ", "; }
+                $error .= $bad_rcpt[$i];
+            }
+            $error = $this->Lang("recipients_failed") . $error;
+            $this->SetError($error);
+            $this->smtp->Reset();
+            return false;
+        }
+
+        if(!$this->smtp->Data($header . $body))
+        {
+            $this->SetError($this->Lang("data_not_accepted"));
+            $this->smtp->Reset();
+            return false;
+        }
+        if($this->SMTPKeepAlive == true)
+            $this->smtp->Reset();
+        else
+            $this->SmtpClose();
+
+        return true;
+    }
+
+    /**
+     * Initiates a connection to an SMTP server.  Returns false if the 
+     * operation failed.
+     * @access private
+     * @return bool
+     */
+    function SmtpConnect() {
+        if($this->smtp == NULL) { $this->smtp = new SMTP(); }
+
+        $this->smtp->do_debug = $this->SMTPDebug;
+        $hosts = explode(";", $this->Host);
+        $index = 0;
+        $connection = ($this->smtp->Connected()); 
+
+        // Retry while there is no connection
+        while($index < count($hosts) && $connection == false)
+        {
+            if(strstr($hosts[$index], ":"))
+                list($host, $port) = explode(":", $hosts[$index]);
+            else
+            {
+                $host = $hosts[$index];
+                $port = $this->Port;
+            }
+
+            if($this->smtp->Connect($host, $port, $this->Timeout))
+            {
+                if ($this->Helo != '')
+                    $this->smtp->Hello($this->Helo);
+                else
+                    $this->smtp->Hello($this->ServerHostname());
+        
+                if($this->SMTPAuth)
+                {
+                    if(!$this->smtp->Authenticate($this->Username, 
+                                                  $this->Password))
+                    {
+                        $this->SetError($this->Lang("authenticate"));
+                        $this->smtp->Reset();
+                        $connection = false;
+                    }
+                }
+                $connection = true;
+            }
+            $index++;
+        }
+        if(!$connection)
+            $this->SetError($this->Lang("connect_host"));
+
+        return $connection;
+    }
+
+    /**
+     * Closes the active SMTP session if one exists.
+     * @return void
+     */
+    function SmtpClose() {
+        if($this->smtp != NULL)
+        {
+            if($this->smtp->Connected())
+            {
+                $this->smtp->Quit();
+                $this->smtp->Close();
+            }
+        }
+    }
+
+    /**
+     * Sets the language for all class error messages.  Returns false 
+     * if it cannot load the language file.  The default language type
+     * is English.
+     * @param string $lang_type Type of language (e.g. Portuguese: "br")
+     * @param string $lang_path Path to the language file directory
+     * @access public
+     * @return bool
+     */
+    function SetLanguage($lang_type, $lang_path = "language/") {
+        if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php'))
+            include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
+        else if(file_exists($lang_path.'phpmailer.lang-en.php'))
+            include($lang_path.'phpmailer.lang-en.php');
+        else
+        {
+            $this->SetError("Could not load language file");
+            return false;
+        }
+        $this->language = $PHPMAILER_LANG;
+    
+        return true;
+    }
+
+    /////////////////////////////////////////////////
+    // MESSAGE CREATION METHODS
+    /////////////////////////////////////////////////
+
+    /**
+     * Creates recipient headers.  
+     * @access private
+     * @return string
+     */
+    function AddrAppend($type, $addr) {
+        $addr_str = $type . ": ";
+        $addr_str .= $this->AddrFormat($addr[0]);
+        if(count($addr) > 1)
+        {
+            for($i = 1; $i < count($addr); $i++)
+                $addr_str .= ", " . $this->AddrFormat($addr[$i]);
+        }
+        $addr_str .= $this->LE;
+
+        return $addr_str;
+    }
+    
+    /**
+     * Formats an address correctly. 
+     * @access private
+     * @return string
+     */
+    function AddrFormat($addr) {
+        if(empty($addr[1]))
+            $formatted = $addr[0];
+        else
+        {
+            $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . 
+                         $addr[0] . ">";
+        }
+
+        return $formatted;
+    }
+
+    /**
+     * Wraps message for use with mailers that do not
+     * automatically perform wrapping and for quoted-printable.
+     * Original written by philippe.  
+     * @access private
+     * @return string
+     */
+    function WrapText($message, $length, $qp_mode = false) {
+        $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+
+        $message = $this->FixEOL($message);
+        if (substr($message, -1) == $this->LE)
+            $message = substr($message, 0, -1);
+
+        $line = explode($this->LE, $message);
+        $message = "";
+        for ($i=0 ;$i < count($line); $i++)
+        {
+          $line_part = explode(" ", $line[$i]);
+          $buf = "";
+          for ($e = 0; $e<count($line_part); $e++)
+          {
+              $word = $line_part[$e];
+              if ($qp_mode and (strlen($word) > $length))
+              {
+                $space_left = $length - strlen($buf) - 1;
+                if ($e != 0)
+                {
+                    if ($space_left > 20)
+                    {
+                        $len = $space_left;
+                        if (substr($word, $len - 1, 1) == "=")
+                          $len--;
+                        elseif (substr($word, $len - 2, 1) == "=")
+                          $len -= 2;
+                        $part = substr($word, 0, $len);
+                        $word = substr($word, $len);
+                        $buf .= " " . $part;
+                        $message .= $buf . sprintf("=%s", $this->LE);
+                    }
+                    else
+                    {
+                        $message .= $buf . $soft_break;
+                    }
+                    $buf = "";
+                }
+                while (strlen($word) > 0)
+                {
+                    $len = $length;
+                    if (substr($word, $len - 1, 1) == "=")
+                        $len--;
+                    elseif (substr($word, $len - 2, 1) == "=")
+                        $len -= 2;
+                    $part = substr($word, 0, $len);
+                    $word = substr($word, $len);
+
+                    if (strlen($word) > 0)
+                        $message .= $part . sprintf("=%s", $this->LE);
+                    else
+                        $buf = $part;
+                }
+              }
+              else
+              {
+                $buf_o = $buf;
+                $buf .= ($e == 0) ? $word : (" " . $word); 
+
+                if (strlen($buf) > $length and $buf_o != "")
+                {
+                    $message .= $buf_o . $soft_break;
+                    $buf = $word;
+                }
+              }
+          }
+          $message .= $buf . $this->LE;
+        }
+
+        return $message;
+    }
+    
+    /**
+     * Set the body wrapping.
+     * @access private
+     * @return void
+     */
+    function SetWordWrap() {
+        if($this->WordWrap < 1)
+            return;
+            
+        switch($this->message_type)
+        {
+           case "alt":
+              // fall through
+           case "alt_attachment":
+              $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
+              break;
+           default:
+              $this->Body = $this->WrapText($this->Body, $this->WordWrap);
+              break;
+        }
+    }
+
+    /**
+     * Assembles message header.  
+     * @access private
+     * @return string
+     */
+    function CreateHeader() {
+        $result = "";
+        
+        // Set the boundaries
+        $uniq_id = md5(uniqid(time()));
+        $this->boundary[1] = "b1_" . $uniq_id;
+        $this->boundary[2] = "b2_" . $uniq_id;
+
+        $result .= $this->HeaderLine("Date", $this->RFCDate());
+        if($this->Sender == "")
+            $result .= $this->HeaderLine("Return-Path", trim($this->From));
+        else
+            $result .= $this->HeaderLine("Return-Path", trim($this->Sender));
+        
+        // To be created automatically by mail()
+        if($this->Mailer != "mail")
+        {
+            if(count($this->to) > 0)
+                $result .= $this->AddrAppend("To", $this->to);
+            else if (count($this->cc) == 0)
+                $result .= $this->HeaderLine("To", "undisclosed-recipients:;");
+            if(count($this->cc) > 0)
+                $result .= $this->AddrAppend("Cc", $this->cc);
+        }
+
+        $from = array();
+        $from[0][0] = trim($this->From);
+        $from[0][1] = $this->FromName;
+        $result .= $this->AddrAppend("From", $from); 
+
+        // sendmail and mail() extract Bcc from the header before sending
+        if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0))
+            $result .= $this->AddrAppend("Bcc", $this->bcc);
+
+        if(count($this->ReplyTo) > 0)
+            $result .= $this->AddrAppend("Reply-to", $this->ReplyTo);
+
+        // mail() sets the subject itself
+        if($this->Mailer != "mail")
+            $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject)));
+
+        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+        $result .= $this->HeaderLine("X-Priority", $this->Priority);
+        $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]");
+        
+        if($this->ConfirmReadingTo != "")
+        {
+            $result .= $this->HeaderLine("Disposition-Notification-To", 
+                       "<" . trim($this->ConfirmReadingTo) . ">");
+        }
+
+        // Add custom headers
+        for($index = 0; $index < count($this->CustomHeader); $index++)
+        {
+            $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), 
+                       $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
+        }
+        $result .= $this->HeaderLine("MIME-Version", "1.0");
+
+        switch($this->message_type)
+        {
+            case "plain":
+                $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
+                $result .= sprintf("Content-Type: %s; charset=\"%s\"",
+                                    $this->ContentType, $this->CharSet);
+                break;
+            case "attachments":
+                // fall through
+            case "alt_attachments":
+                if($this->InlineImageExists())
+                {
+                    $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 
+                                    "multipart/related", $this->LE, $this->LE, 
+                                    $this->boundary[1], $this->LE);
+                }
+                else
+                {
+                    $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
+                    $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+                }
+                break;
+            case "alt":
+                $result .= $this->HeaderLine("Content-Type", "multipart/alternative;");
+                $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+                break;
+        }
+
+        if($this->Mailer != "mail")
+            $result .= $this->LE.$this->LE;
+
+        return $result;
+    }
+
+    /**
+     * Assembles the message body.  Returns an empty string on failure.
+     * @access private
+     * @return string
+     */
+    function CreateBody() {
+        $result = "";
+
+        $this->SetWordWrap();
+
+        switch($this->message_type)
+        {
+            case "alt":
+                $result .= $this->GetBoundary($this->boundary[1], "", 
+                                              "text/plain", "");
+                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+                $result .= $this->LE.$this->LE;
+                $result .= $this->GetBoundary($this->boundary[1], "", 
+                                              "text/html", "");
+                
+                $result .= $this->EncodeString($this->Body, $this->Encoding);
+                $result .= $this->LE.$this->LE;
+    
+                $result .= $this->EndBoundary($this->boundary[1]);
+                break;
+            case "plain":
+                $result .= $this->EncodeString($this->Body, $this->Encoding);
+                break;
+            case "attachments":
+                $result .= $this->GetBoundary($this->boundary[1], "", "", "");
+                $result .= $this->EncodeString($this->Body, $this->Encoding);
+                $result .= $this->LE;
+     
+                $result .= $this->AttachAll();
+                break;
+            case "alt_attachments":
+                $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
+                $result .= sprintf("Content-Type: %s;%s" .
+                                   "\tboundary=\"%s\"%s",
+                                   "multipart/alternative", $this->LE, 
+                                   $this->boundary[2], $this->LE.$this->LE);
+    
+                // Create text body
+                $result .= $this->GetBoundary($this->boundary[2], "", 
+                                              "text/plain", "") . $this->LE;
+
+                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+                $result .= $this->LE.$this->LE;
+    
+                // Create the HTML body
+                $result .= $this->GetBoundary($this->boundary[2], "", 
+                                              "text/html", "") . $this->LE;
+    
+                $result .= $this->EncodeString($this->Body, $this->Encoding);
+                $result .= $this->LE.$this->LE;
+
+                $result .= $this->EndBoundary($this->boundary[2]);
+                
+                $result .= $this->AttachAll();
+                break;
+        }
+        if($this->IsError())
+            $result = "";
+
+        return $result;
+    }
+
+    /**
+     * Returns the start of a message boundary.
+     * @access private
+     */
+    function GetBoundary($boundary, $charSet, $contentType, $encoding) {
+        $result = "";
+        if($charSet == "") { $charSet = $this->CharSet; }
+        if($contentType == "") { $contentType = $this->ContentType; }
+        if($encoding == "") { $encoding = $this->Encoding; }
+
+        $result .= $this->TextLine("--" . $boundary);
+        $result .= sprintf("Content-Type: %s; charset = \"%s\"", 
+                            $contentType, $charSet);
+        $result .= $this->LE;
+        $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
+        $result .= $this->LE;
+       
+        return $result;
+    }
+    
+    /**
+     * Returns the end of a message boundary.
+     * @access private
+     */
+    function EndBoundary($boundary) {
+        return $this->LE . "--" . $boundary . "--" . $this->LE; 
+    }
+    
+    /**
+     * Sets the message type.
+     * @access private
+     * @return void
+     */
+    function SetMessageType() {
+        if(count($this->attachment) < 1 && strlen($this->AltBody) < 1)
+            $this->message_type = "plain";
+        else
+        {
+            if(count($this->attachment) > 0)
+                $this->message_type = "attachments";
+            if(strlen($this->AltBody) > 0 && count($this->attachment) < 1)
+                $this->message_type = "alt";
+            if(strlen($this->AltBody) > 0 && count($this->attachment) > 0)
+                $this->message_type = "alt_attachments";
+        }
+    }
+
+    /**
+     * Returns a formatted header line.
+     * @access private
+     * @return string
+     */
+    function HeaderLine($name, $value) {
+        return $name . ": " . $value . $this->LE;
+    }
+
+    /**
+     * Returns a formatted mail line.
+     * @access private
+     * @return string
+     */
+    function TextLine($value) {
+        return $value . $this->LE;
+    }
+
+    /////////////////////////////////////////////////
+    // ATTACHMENT METHODS
+    /////////////////////////////////////////////////
+
+    /**
+     * Adds an attachment from a path on the filesystem.
+     * Returns false if the file could not be found
+     * or accessed.
+     * @param string $path Path to the attachment.
+     * @param string $name Overrides the attachment name.
+     * @param string $encoding File encoding (see $Encoding).
+     * @param string $type File extension (MIME) type.
+     * @return bool
+     */
+    function AddAttachment($path, $name = "", $encoding = "base64", 
+                           $type = "application/octet-stream") {
+        if(!@is_file($path))
+        {
+            $this->SetError($this->Lang("file_access") . $path);
+            return false;
+        }
+
+        $filename = basename($path);
+        if($name == "")
+            $name = $filename;
+
+        $cur = count($this->attachment);
+        $this->attachment[$cur][0] = $path;
+        $this->attachment[$cur][1] = $filename;
+        $this->attachment[$cur][2] = $name;
+        $this->attachment[$cur][3] = $encoding;
+        $this->attachment[$cur][4] = $type;
+        $this->attachment[$cur][5] = false; // isStringAttachment
+        $this->attachment[$cur][6] = "attachment";
+        $this->attachment[$cur][7] = 0;
+
+        return true;
+    }
+
+    /**
+     * Attaches all fs, string, and binary attachments to the message.
+     * Returns an empty string on failure.
+     * @access private
+     * @return string
+     */
+    function AttachAll() {
+        // Return text of body
+        $mime = array();
+
+        // Add all attachments
+        for($i = 0; $i < count($this->attachment); $i++)
+        {
+            // Check for string attachment
+            $bString = $this->attachment[$i][5];
+            if ($bString)
+                $string = $this->attachment[$i][0];
+            else
+                $path = $this->attachment[$i][0];
+
+            $filename    = $this->attachment[$i][1];
+            $name        = $this->attachment[$i][2];
+            $encoding    = $this->attachment[$i][3];
+            $type        = $this->attachment[$i][4];
+            $disposition = $this->attachment[$i][6];
+            $cid         = $this->attachment[$i][7];
+            
+            $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
+            $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
+            $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
+
+            if($disposition == "inline")
+                $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
+
+            $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", 
+                              $disposition, $name, $this->LE.$this->LE);
+
+            // Encode as string attachment
+            if($bString)
+            {
+                $mime[] = $this->EncodeString($string, $encoding);
+                if($this->IsError()) { return ""; }
+                $mime[] = $this->LE.$this->LE;
+            }
+            else
+            {
+                $mime[] = $this->EncodeFile($path, $encoding);                
+                if($this->IsError()) { return ""; }
+                $mime[] = $this->LE.$this->LE;
+            }
+        }
+
+        $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+
+        return join("", $mime);
+    }
+    
+    /**
+     * Encodes attachment in requested format.  Returns an
+     * empty string on failure.
+     * @access private
+     * @return string
+     */
+    function EncodeFile ($path, $encoding = "base64") {
+        if(!@$fd = fopen($path, "rb"))
+        {
+            $this->SetError($this->Lang("file_open") . $path);
+            return "";
+        }
+        $file_buffer = fread($fd, filesize($path));
+        $file_buffer = $this->EncodeString($file_buffer, $encoding);
+        fclose($fd);
+
+        return $file_buffer;
+    }
+
+    /**
+     * Encodes string to requested format. Returns an
+     * empty string on failure.
+     * @access private
+     * @return string
+     */
+    function EncodeString ($str, $encoding = "base64") {
+        $encoded = "";
+        switch(strtolower($encoding)) {
+          case "base64":
+              // chunk_split is found in PHP >= 3.0.6
+              $encoded = chunk_split(base64_encode($str), 76, $this->LE);
+              break;
+          case "7bit":
+          case "8bit":
+              $encoded = $this->FixEOL($str);
+              if (substr($encoded, -(strlen($this->LE))) != $this->LE)
+                $encoded .= $this->LE;
+              break;
+          case "binary":
+              $encoded = $str;
+              break;
+          case "quoted-printable":
+              $encoded = $this->EncodeQP($str);
+              break;
+          default:
+              $this->SetError($this->Lang("encoding") . $encoding);
+              break;
+        }
+        return $encoded;
+    }
+
+    /**
+     * Encode a header string to best of Q, B, quoted or none.  
+     * @access private
+     * @return string
+     */
+    function EncodeHeader ($str, $position = 'text') {
+      $x = 0;
+      
+      switch (strtolower($position)) {
+        case 'phrase':
+          if (!preg_match('/[\200-\377]/', $str)) {
+            // Can't use addslashes as we don't know what value has magic_quotes_sybase.
+            $encoded = addcslashes($str, "\0..\37\177\\\"");
+
+            if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str))
+              return ($encoded);
+            else
+              return ("\"$encoded\"");
+          }
+          $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
+          break;
+        case 'comment':
+          $x = preg_match_all('/[()"]/', $str, $matches);
+          // Fall-through
+        case 'text':
+        default:
+          $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
+          break;
+      }
+
+      if ($x == 0)
+        return ($str);
+
+      $maxlen = 75 - 7 - strlen($this->CharSet);
+      // Try to select the encoding which should produce the shortest output
+      if (strlen($str)/3 < $x) {
+        $encoding = 'B';
+        $encoded = base64_encode($str);
+        $maxlen -= $maxlen % 4;
+        $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+      } else {
+        $encoding = 'Q';
+        $encoded = $this->EncodeQ($str, $position);
+        $encoded = $this->WrapText($encoded, $maxlen, true);
+        $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
+      }
+
+      $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
+      $encoded = trim(str_replace("\n", $this->LE, $encoded));
+      
+      return $encoded;
+    }
+    
+    /**
+     * Encode string to quoted-printable.  
+     * @access private
+     * @return string
+     */
+    function EncodeQP ($str) {
+        $encoded = $this->FixEOL($str);
+        if (substr($encoded, -(strlen($this->LE))) != $this->LE)
+            $encoded .= $this->LE;
+
+        // Replace every high ascii, control and = characters
+        $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
+                  "'='.sprintf('%02X', ord('\\1'))", $encoded);
+        // Replace every spaces and tabs when it's the last character on a line
+        $encoded = preg_replace("/([\011\040])".$this->LE."/e",
+                  "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
+
+        // Maximum line length of 76 characters before CRLF (74 + space + '=')
+        $encoded = $this->WrapText($encoded, 74, true);
+
+        return $encoded;
+    }
+
+    /**
+     * Encode string to q encoding.  
+     * @access private
+     * @return string
+     */
+    function EncodeQ ($str, $position = "text") {
+        // There should not be any EOL in the string
+        $encoded = preg_replace("[\r\n]", "", $str);
+
+        switch (strtolower($position)) {
+          case "phrase":
+            $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+            break;
+          case "comment":
+            $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+          case "text":
+          default:
+            // Replace every high ascii, control =, ? and _ characters
+            $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
+                  "'='.sprintf('%02X', ord('\\1'))", $encoded);
+            break;
+        }
+        
+        // Replace every spaces to _ (more readable than =20)
+        $encoded = str_replace(" ", "_", $encoded);
+
+        return $encoded;
+    }
+
+    /**
+     * Adds a string or binary attachment (non-filesystem) to the list.
+     * This method can be used to attach ascii or binary data,
+     * such as a BLOB record from a database.
+     * @param string $string String attachment data.
+     * @param string $filename Name of the attachment.
+     * @param string $encoding File encoding (see $Encoding).
+     * @param string $type File extension (MIME) type.
+     * @return void
+     */
+    function AddStringAttachment($string, $filename, $encoding = "base64", 
+                                 $type = "application/octet-stream") {
+        // Append to $attachment array
+        $cur = count($this->attachment);
+        $this->attachment[$cur][0] = $string;
+        $this->attachment[$cur][1] = $filename;
+        $this->attachment[$cur][2] = $filename;
+        $this->attachment[$cur][3] = $encoding;
+        $this->attachment[$cur][4] = $type;
+        $this->attachment[$cur][5] = true; // isString
+        $this->attachment[$cur][6] = "attachment";
+        $this->attachment[$cur][7] = 0;
+    }
+    
+    /**
+     * Adds an embedded attachment.  This can include images, sounds, and 
+     * just about any other document.  Make sure to set the $type to an 
+     * image type.  For JPEG images use "image/jpeg" and for GIF images 
+     * use "image/gif".
+     * @param string $path Path to the attachment.
+     * @param string $cid Content ID of the attachment.  Use this to identify 
+     *        the Id for accessing the image in an HTML form.
+     * @param string $name Overrides the attachment name.
+     * @param string $encoding File encoding (see $Encoding).
+     * @param string $type File extension (MIME) type.  
+     * @return bool
+     */
+    function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", 
+                              $type = "application/octet-stream") {
+    
+        if(!@is_file($path))
+        {
+            $this->SetError($this->Lang("file_access") . $path);
+            return false;
+        }
+
+        $filename = basename($path);
+        if($name == "")
+            $name = $filename;
+
+        // Append to $attachment array
+        $cur = count($this->attachment);
+        $this->attachment[$cur][0] = $path;
+        $this->attachment[$cur][1] = $filename;
+        $this->attachment[$cur][2] = $name;
+        $this->attachment[$cur][3] = $encoding;
+        $this->attachment[$cur][4] = $type;
+        $this->attachment[$cur][5] = false; // isStringAttachment
+        $this->attachment[$cur][6] = "inline";
+        $this->attachment[$cur][7] = $cid;
+    
+        return true;
+    }
+    
+    /**
+     * Returns true if an inline attachment is present.
+     * @access private
+     * @return bool
+     */
+    function InlineImageExists() {
+        $result = false;
+        for($i = 0; $i < count($this->attachment); $i++)
+        {
+            if($this->attachment[$i][6] == "inline")
+            {
+                $result = true;
+                break;
+            }
+        }
+        
+        return $result;
+    }
+
+    /////////////////////////////////////////////////
+    // MESSAGE RESET METHODS
+    /////////////////////////////////////////////////
+
+    /**
+     * Clears all recipients assigned in the TO array.  Returns void.
+     * @return void
+     */
+    function ClearAddresses() {
+        $this->to = array();
+    }
+
+    /**
+     * Clears all recipients assigned in the CC array.  Returns void.
+     * @return void
+     */
+    function ClearCCs() {
+        $this->cc = array();
+    }
+
+    /**
+     * Clears all recipients assigned in the BCC array.  Returns void.
+     * @return void
+     */
+    function ClearBCCs() {
+        $this->bcc = array();
+    }
+
+    /**
+     * Clears all recipients assigned in the ReplyTo array.  Returns void.
+     * @return void
+     */
+    function ClearReplyTos() {
+        $this->ReplyTo = array();
+    }
+
+    /**
+     * Clears all recipients assigned in the TO, CC and BCC
+     * array.  Returns void.
+     * @return void
+     */
+    function ClearAllRecipients() {
+        $this->to = array();
+        $this->cc = array();
+        $this->bcc = array();
+    }
+
+    /**
+     * Clears all previously set filesystem, string, and binary
+     * attachments.  Returns void.
+     * @return void
+     */
+    function ClearAttachments() {
+        $this->attachment = array();
+    }
+
+    /**
+     * Clears all custom headers.  Returns void.
+     * @return void
+     */
+    function ClearCustomHeaders() {
+        $this->CustomHeader = array();
+    }
+
+
+    /////////////////////////////////////////////////
+    // MISCELLANEOUS METHODS
+    /////////////////////////////////////////////////
+
+    /**
+     * Adds the error message to the error container.
+     * Returns void.
+     * @access private
+     * @return void
+     */
+    function SetError($msg) {
+        $this->error_count++;
+        $this->ErrorInfo = $msg;
+    }
+
+    /**
+     * Returns the proper RFC 822 formatted date. 
+     * @access private
+     * @return string
+     */
+    function RFCDate() {
+        $tz = date("Z");
+        $tzs = ($tz < 0) ? "-" : "+";
+        $tz = abs($tz);
+        $tz = ($tz/3600)*100 + ($tz%3600)/60;
+        $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
+
+        return $result;
+    }
+    
+    /**
+     * Returns the appropriate server variable.  Should work with both 
+     * PHP 4.1.0+ as well as older versions.  Returns an empty string 
+     * if nothing is found.
+     * @access private
+     * @return mixed
+     */
+    function ServerVar($varName) {
+        global $HTTP_SERVER_VARS;
+        global $HTTP_ENV_VARS;
+
+        if(!isset($_SERVER))
+        {
+            $_SERVER = $HTTP_SERVER_VARS;
+            if(!isset($_SERVER["REMOTE_ADDR"]))
+                $_SERVER = $HTTP_ENV_VARS; // must be Apache
+        }
+        
+        if(isset($_SERVER[$varName]))
+            return $_SERVER[$varName];
+        else
+            return "";
+    }
+
+    /**
+     * Returns the server hostname or 'localhost.localdomain' if unknown.
+     * @access private
+     * @return string
+     */
+    function ServerHostname() {
+        if ($this->Hostname != "")
+            $result = $this->Hostname;
+        elseif ($this->ServerVar('SERVER_NAME') != "")
+            $result = $this->ServerVar('SERVER_NAME');
+        else
+            $result = "localhost.localdomain";
+
+        return $result;
+    }
+
+    /**
+     * Returns a message in the appropriate language.
+     * @access private
+     * @return string
+     */
+    function Lang($key) {
+        if(count($this->language) < 1)
+            $this->SetLanguage("en"); // set the default language
+    
+        if(isset($this->language[$key]))
+            return $this->language[$key];
+        else
+            return "Language string failed to load: " . $key;
+    }
+    
+    /**
+     * Returns true if an error occurred.
+     * @return bool
+     */
+    function IsError() {
+        return ($this->error_count > 0);
+    }
+
+    /**
+     * Changes every end of line from CR or LF to CRLF.  
+     * @access private
+     * @return string
+     */
+    function FixEOL($str) {
+        $str = str_replace("\r\n", "\n", $str);
+        $str = str_replace("\r", "\n", $str);
+        $str = str_replace("\n", $this->LE, $str);
+        return $str;
+    }
+
+    /**
+     * Adds a custom header. 
+     * @return void
+     */
+    function AddCustomHeader($custom_header) {
+        $this->CustomHeader[] = explode(":", $custom_header, 2);
+    }
+}
+
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/class.smtp.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/class.smtp.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/class.smtp.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,1039 +1,1039 @@
-<?php
-////////////////////////////////////////////////////
-// SMTP - PHP SMTP class
-//
-// Version 1.02
-//
-// Define an SMTP class that can be used to connect
-// and communicate with any SMTP server. It implements
-// all the SMTP functions defined in RFC821 except TURN.
-//
-// Author: Chris Ryan
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
-
-/**
- * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
- * commands except TURN which will always return a not implemented
- * error. SMTP also provides some utility methods for sending mail
- * to an SMTP server.
- * @package PHPMailer
- * @author Chris Ryan
- */
-class SMTP
-{
-    /**
-     *  SMTP server port
-     *  @var int
-     */
-    var $SMTP_PORT = 25;
-    
-    /**
-     *  SMTP reply line ending
-     *  @var string
-     */
-    var $CRLF = "\r\n";
-    
-    /**
-     *  Sets whether debugging is turned on
-     *  @var bool
-     */
-    var $do_debug;       # the level of debug to perform
-
-    /**#@+
-     * @access private
-     */
-    var $smtp_conn;      # the socket to the server
-    var $error;          # error if any on the last call
-    var $helo_rply;      # the reply the server sent to us for HELO
-    /**#@-*/
-
-    /**
-     * Initialize the class so that the data is in a known state.
-     * @access public
-     * @return void
-     */
-    function SMTP() {
-        $this->smtp_conn = 0;
-        $this->error = null;
-        $this->helo_rply = null;
-
-        $this->do_debug = 0;
-    }
-
-    /*************************************************************
-     *                    CONNECTION FUNCTIONS                  *
-     ***********************************************************/
-
-    /**
-     * Connect to the server specified on the port specified.
-     * If the port is not specified use the default SMTP_PORT.
-     * If tval is specified then a connection will try and be
-     * established with the server for that number of seconds.
-     * If tval is not specified the default is 30 seconds to
-     * try on the connection.
-     *
-     * SMTP CODE SUCCESS: 220
-     * SMTP CODE FAILURE: 421
-     * @access public
-     * @return bool
-     */
-    function Connect($host,$port=0,$tval=30) {
-        # set the error val to null so there is no confusion
-        $this->error = null;
-
-        # make sure we are __not__ connected
-        if($this->connected()) {
-            # ok we are connected! what should we do?
-            # for now we will just give an error saying we
-            # are already connected
-            $this->error =
-                array("error" => "Already connected to a server");
-            return false;
-        }
-
-        if(empty($port)) {
-            $port = $this->SMTP_PORT;
-        }
-
-        #connect to the smtp server
-        $this->smtp_conn = fsockopen($host,    # the host of the server
-                                     $port,    # the port to use
-                                     $errno,   # error number if any
-                                     $errstr,  # error message if any
-                                     $tval);   # give up after ? secs
-        # verify we connected properly
-        if(empty($this->smtp_conn)) {
-            $this->error = array("error" => "Failed to connect to server",
-                                 "errno" => $errno,
-                                 "errstr" => $errstr);
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": $errstr ($errno)" . $this->CRLF;
-            }
-            return false;
-        }
-
-        # sometimes the SMTP server takes a little longer to respond
-        # so we will give it a longer timeout for the first read
-        // Windows still does not have support for this timeout function
-        if(substr(PHP_OS, 0, 3) != "WIN")
-           socket_set_timeout($this->smtp_conn, $tval, 0);
-
-        # get any announcement stuff
-        $announce = $this->get_lines();
-
-        # set the timeout  of any socket functions at 1/10 of a second
-        //if(function_exists("socket_set_timeout"))
-        //   socket_set_timeout($this->smtp_conn, 0, 100000);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
-        }
-
-        return true;
-    }
-
-    /**
-     * Performs SMTP authentication.  Must be run after running the
-     * Hello() method.  Returns true if successfully authenticated.
-     * @access public
-     * @return bool
-     */
-    function Authenticate($username, $password) {
-        // Start authentication
-        fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 334) {
-            $this->error =
-                array("error" => "AUTH not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        // Send encoded username
-        fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 334) {
-            $this->error =
-                array("error" => "Username not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        // Send encoded password
-        fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 235) {
-            $this->error =
-                array("error" => "Password not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Returns true if connected to a server otherwise false
-     * @access private
-     * @return bool
-     */
-    function Connected() {
-        if(!empty($this->smtp_conn)) {
-            $sock_status = socket_get_status($this->smtp_conn);
-            if($sock_status["eof"]) {
-                # hmm this is an odd situation... the socket is
-                # valid but we aren't connected anymore
-                if($this->do_debug >= 1) {
-                    echo "SMTP -> NOTICE:" . $this->CRLF .
-                         "EOF caught while checking if connected";
-                }
-                $this->Close();
-                return false;
-            }
-            return true; # everything looks good
-        }
-        return false;
-    }
-
-    /**
-     * Closes the socket and cleans up the state of the class.
-     * It is not considered good to use this function without
-     * first trying to use QUIT.
-     * @access public
-     * @return void
-     */
-    function Close() {
-        $this->error = null; # so there is no confusion
-        $this->helo_rply = null;
-        if(!empty($this->smtp_conn)) {
-            # close the connection and cleanup
-            fclose($this->smtp_conn);
-            $this->smtp_conn = 0;
-        }
-    }
-
-
-    /***************************************************************
-     *                        SMTP COMMANDS                       *
-     *************************************************************/
-
-    /**
-     * Issues a data command and sends the msg_data to the server
-     * finializing the mail transaction. $msg_data is the message
-     * that is to be send with the headers. Each header needs to be
-     * on a single line followed by a <CRLF> with the message headers
-     * and the message body being seperated by and additional <CRLF>.
-     *
-     * Implements rfc 821: DATA <CRLF>
-     *
-     * SMTP CODE INTERMEDIATE: 354
-     *     [data]
-     *     <CRLF>.<CRLF>
-     *     SMTP CODE SUCCESS: 250
-     *     SMTP CODE FAILURE: 552,554,451,452
-     * SMTP CODE FAILURE: 451,554
-     * SMTP CODE ERROR  : 500,501,503,421
-     * @access public
-     * @return bool
-     */
-    function Data($msg_data) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Data() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"DATA" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 354) {
-            $this->error =
-                array("error" => "DATA command not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        # the server is ready to accept data!
-        # according to rfc 821 we should not send more than 1000
-        # including the CRLF
-        # characters on a single line so we will break the data up
-        # into lines by \r and/or \n then if needed we will break
-        # each of those into smaller lines to fit within the limit.
-        # in addition we will be looking for lines that start with
-        # a period '.' and append and additional period '.' to that
-        # line. NOTE: this does not count towards are limit.
-
-        # normalize the line breaks so we know the explode works
-        $msg_data = str_replace("\r\n","\n",$msg_data);
-        $msg_data = str_replace("\r","\n",$msg_data);
-        $lines = explode("\n",$msg_data);
-
-        # we need to find a good way to determine is headers are
-        # in the msg_data or if it is a straight msg body
-        # currently I'm assuming rfc 822 definitions of msg headers
-        # and if the first field of the first line (':' sperated)
-        # does not contain a space then it _should_ be a header
-        # and we can process all lines before a blank "" line as
-        # headers.
-        $field = substr($lines[0],0,strpos($lines[0],":"));
-        $in_headers = false;
-        if(!empty($field) && !strstr($field," ")) {
-            $in_headers = true;
-        }
-
-        $max_line_length = 998; # used below; set here for ease in change
-
-        while(list(,$line) = @each($lines)) {
-            $lines_out = null;
-            if($line == "" && $in_headers) {
-                $in_headers = false;
-            }
-            # ok we need to break this line up into several
-            # smaller lines
-            while(strlen($line) > $max_line_length) {
-                $pos = strrpos(substr($line,0,$max_line_length)," ");
-                $lines_out[] = substr($line,0,$pos);
-                $line = substr($line,$pos + 1);
-                # if we are processing headers we need to
-                # add a LWSP-char to the front of the new line
-                # rfc 822 on long msg headers
-                if($in_headers) {
-                    $line = "\t" . $line;
-                }
-            }
-            $lines_out[] = $line;
-
-            # now send the lines to the server
-            while(list(,$line_out) = @each($lines_out)) {
-                if(strlen($line_out) > 0)
-                {
-                    if(substr($line_out, 0, 1) == ".") {
-                        $line_out = "." . $line_out;
-                    }
-                }
-                fputs($this->smtp_conn,$line_out . $this->CRLF);
-            }
-        }
-
-        # ok all the message data has been sent so lets get this
-        # over with aleady
-        fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "DATA not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Expand takes the name and asks the server to list all the
-     * people who are members of the _list_. Expand will return
-     * back and array of the result or false if an error occurs.
-     * Each value in the array returned has the format of:
-     *     [ <full-name> <sp> ] <path>
-     * The definition of <path> is defined in rfc 821
-     *
-     * Implements rfc 821: EXPN <SP> <string> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE FAILURE: 550
-     * SMTP CODE ERROR  : 500,501,502,504,421
-     * @access public
-     * @return string array
-     */
-    function Expand($name) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Expand() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "EXPN not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        # parse the reply and place in our array to return to user
-        $entries = explode($this->CRLF,$rply);
-        while(list(,$l) = @each($entries)) {
-            $list[] = substr($l,4);
-        }
-
-        return $list;
-    }
-
-    /**
-     * Sends the HELO command to the smtp server.
-     * This makes sure that we and the server are in
-     * the same known state.
-     *
-     * Implements from rfc 821: HELO <SP> <domain> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500, 501, 504, 421
-     * @access public
-     * @return bool
-     */
-    function Hello($host="") {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Hello() without being connected");
-            return false;
-        }
-
-        # if a hostname for the HELO wasn't specified determine
-        # a suitable one to send
-        if(empty($host)) {
-            # we need to determine some sort of appopiate default
-            # to send to the server
-            $host = "localhost";
-        }
-
-        // Send extended hello first (RFC 2821)
-        if(!$this->SendHello("EHLO", $host))
-        {
-            if(!$this->SendHello("HELO", $host))
-                return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Sends a HELO/EHLO command.
-     * @access private
-     * @return bool
-     */
-    function SendHello($hello, $host) {
-        fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => $hello . " not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        $this->helo_rply = $rply;
-        
-        return true;
-    }
-
-    /**
-     * Gets help information on the keyword specified. If the keyword
-     * is not specified then returns generic help, ussually contianing
-     * A list of keywords that help is available on. This function
-     * returns the results back to the user. It is up to the user to
-     * handle the returned data. If an error occurs then false is
-     * returned with $this->error set appropiately.
-     *
-     * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
-     *
-     * SMTP CODE SUCCESS: 211,214
-     * SMTP CODE ERROR  : 500,501,502,504,421
-     * @access public
-     * @return string
-     */
-    function Help($keyword="") {
-        $this->error = null; # to avoid confusion
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Help() without being connected");
-            return false;
-        }
-
-        $extra = "";
-        if(!empty($keyword)) {
-            $extra = " " . $keyword;
-        }
-
-        fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 211 && $code != 214) {
-            $this->error =
-                array("error" => "HELP not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        return $rply;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command.
-     *
-     * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,421
-     * @access public
-     * @return bool
-     */
-    function Mail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Mail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "MAIL not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Sends the command NOOP to the SMTP server.
-     *
-     * Implements from rfc 821: NOOP <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500, 421
-     * @access public
-     * @return bool
-     */
-    function Noop() {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Noop() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"NOOP" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "NOOP not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Sends the quit command to the server and then closes the socket
-     * if there is no error or the $close_on_error argument is true.
-     *
-     * Implements from rfc 821: QUIT <CRLF>
-     *
-     * SMTP CODE SUCCESS: 221
-     * SMTP CODE ERROR  : 500
-     * @access public
-     * @return bool
-     */
-    function Quit($close_on_error=true) {
-        $this->error = null; # so there is no confusion
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Quit() without being connected");
-            return false;
-        }
-
-        # send the quit command to the server
-        fputs($this->smtp_conn,"quit" . $this->CRLF);
-
-        # get any good-bye messages
-        $byemsg = $this->get_lines();
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
-        }
-
-        $rval = true;
-        $e = null;
-
-        $code = substr($byemsg,0,3);
-        if($code != 221) {
-            # use e as a tmp var cause Close will overwrite $this->error
-            $e = array("error" => "SMTP server rejected quit command",
-                       "smtp_code" => $code,
-                       "smtp_rply" => substr($byemsg,4));
-            $rval = false;
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $e["error"] . ": " .
-                         $byemsg . $this->CRLF;
-            }
-        }
-
-        if(empty($e) || $close_on_error) {
-            $this->Close();
-        }
-
-        return $rval;
-    }
-
-    /**
-     * Sends the command RCPT to the SMTP server with the TO: argument of $to.
-     * Returns true if the recipient was accepted false if it was rejected.
-     *
-     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250,251
-     * SMTP CODE FAILURE: 550,551,552,553,450,451,452
-     * SMTP CODE ERROR  : 500,501,503,421
-     * @access public
-     * @return bool
-     */
-    function Recipient($to) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Recipient() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250 && $code != 251) {
-            $this->error =
-                array("error" => "RCPT not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Sends the RSET command to abort and transaction that is
-     * currently in progress. Returns true if successful false
-     * otherwise.
-     *
-     * Implements rfc 821: RSET <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500,501,504,421
-     * @access public
-     * @return bool
-     */
-    function Reset() {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Reset() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"RSET" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "RSET failed",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in.
-     *
-     * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function Send($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Send() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "SEND not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in and send them an email.
-     *
-     * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function SendAndMail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                "error" => "Called SendAndMail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "SAML not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in or mail it to them if they are not.
-     *
-     * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function SendOrMail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                "error" => "Called SendOrMail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "SOML not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * This is an optional command for SMTP that this class does not
-     * support. This method is here to make the RFC821 Definition
-     * complete for this class and __may__ be implimented in the future
-     *
-     * Implements from rfc 821: TURN <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE FAILURE: 502
-     * SMTP CODE ERROR  : 500, 503
-     * @access public
-     * @return bool
-     */
-    function Turn() {
-        $this->error = array("error" => "This method, TURN, of the SMTP ".
-                                        "is not implemented");
-        if($this->do_debug >= 1) {
-            echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
-        }
-        return false;
-    }
-
-    /**
-     * Verifies that the name is recognized by the server.
-     * Returns false if the name could not be verified otherwise
-     * the response from the server is returned.
-     *
-     * Implements rfc 821: VRFY <SP> <string> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250,251
-     * SMTP CODE FAILURE: 550,551,553
-     * SMTP CODE ERROR  : 500,501,502,421
-     * @access public
-     * @return int
-     */
-    function Verify($name) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Verify() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250 && $code != 251) {
-            $this->error =
-                array("error" => "VRFY failed on name '$name'",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return $rply;
-    }
-
-    /*******************************************************************
-     *                       INTERNAL FUNCTIONS                       *
-     ******************************************************************/
-
-    /**
-     * Read in as many lines as possible
-     * either before eof or socket timeout occurs on the operation.
-     * With SMTP we can tell if we have more lines to read if the
-     * 4th character is '-' symbol. If it is a space then we don't
-     * need to read anything else.
-     * @access private
-     * @return string
-     */
-    function get_lines() {
-        $data = "";
-        while($str = fgets($this->smtp_conn,515)) {
-            if($this->do_debug >= 4) {
-                echo "SMTP -> get_lines(): \$data was \"$data\"" .
-                         $this->CRLF;
-                echo "SMTP -> get_lines(): \$str is \"$str\"" .
-                         $this->CRLF;
-            }
-            $data .= $str;
-            if($this->do_debug >= 4) {
-                echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
-            }
-            # if the 4th character is a space then we are done reading
-            # so just break the loop
-            if(substr($str,3,1) == " ") { break; }
-        }
-        return $data;
-    }
-
-}
-
-
- ?>
+<?php
+////////////////////////////////////////////////////
+// SMTP - PHP SMTP class
+//
+// Version 1.02
+//
+// Define an SMTP class that can be used to connect
+// and communicate with any SMTP server. It implements
+// all the SMTP functions defined in RFC821 except TURN.
+//
+// Author: Chris Ryan
+//
+// License: LGPL, see LICENSE
+////////////////////////////////////////////////////
+
+/**
+ * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
+ * commands except TURN which will always return a not implemented
+ * error. SMTP also provides some utility methods for sending mail
+ * to an SMTP server.
+ * @package PHPMailer
+ * @author Chris Ryan
+ */
+class SMTP
+{
+    /**
+     *  SMTP server port
+     *  @var int
+     */
+    var $SMTP_PORT = 25;
+    
+    /**
+     *  SMTP reply line ending
+     *  @var string
+     */
+    var $CRLF = "\r\n";
+    
+    /**
+     *  Sets whether debugging is turned on
+     *  @var bool
+     */
+    var $do_debug;       # the level of debug to perform
+
+    /**#@+
+     * @access private
+     */
+    var $smtp_conn;      # the socket to the server
+    var $error;          # error if any on the last call
+    var $helo_rply;      # the reply the server sent to us for HELO
+    /**#@-*/
+
+    /**
+     * Initialize the class so that the data is in a known state.
+     * @access public
+     * @return void
+     */
+    function SMTP() {
+        $this->smtp_conn = 0;
+        $this->error = null;
+        $this->helo_rply = null;
+
+        $this->do_debug = 0;
+    }
+
+    /*************************************************************
+     *                    CONNECTION FUNCTIONS                  *
+     ***********************************************************/
+
+    /**
+     * Connect to the server specified on the port specified.
+     * If the port is not specified use the default SMTP_PORT.
+     * If tval is specified then a connection will try and be
+     * established with the server for that number of seconds.
+     * If tval is not specified the default is 30 seconds to
+     * try on the connection.
+     *
+     * SMTP CODE SUCCESS: 220
+     * SMTP CODE FAILURE: 421
+     * @access public
+     * @return bool
+     */
+    function Connect($host,$port=0,$tval=30) {
+        # set the error val to null so there is no confusion
+        $this->error = null;
+
+        # make sure we are __not__ connected
+        if($this->connected()) {
+            # ok we are connected! what should we do?
+            # for now we will just give an error saying we
+            # are already connected
+            $this->error =
+                array("error" => "Already connected to a server");
+            return false;
+        }
+
+        if(empty($port)) {
+            $port = $this->SMTP_PORT;
+        }
+
+        #connect to the smtp server
+        $this->smtp_conn = fsockopen($host,    # the host of the server
+                                     $port,    # the port to use
+                                     $errno,   # error number if any
+                                     $errstr,  # error message if any
+                                     $tval);   # give up after ? secs
+        # verify we connected properly
+        if(empty($this->smtp_conn)) {
+            $this->error = array("error" => "Failed to connect to server",
+                                 "errno" => $errno,
+                                 "errstr" => $errstr);
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": $errstr ($errno)" . $this->CRLF;
+            }
+            return false;
+        }
+
+        # sometimes the SMTP server takes a little longer to respond
+        # so we will give it a longer timeout for the first read
+        // Windows still does not have support for this timeout function
+        if(substr(PHP_OS, 0, 3) != "WIN")
+           socket_set_timeout($this->smtp_conn, $tval, 0);
+
+        # get any announcement stuff
+        $announce = $this->get_lines();
+
+        # set the timeout  of any socket functions at 1/10 of a second
+        //if(function_exists("socket_set_timeout"))
+        //   socket_set_timeout($this->smtp_conn, 0, 100000);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
+        }
+
+        return true;
+    }
+
+    /**
+     * Performs SMTP authentication.  Must be run after running the
+     * Hello() method.  Returns true if successfully authenticated.
+     * @access public
+     * @return bool
+     */
+    function Authenticate($username, $password) {
+        // Start authentication
+        fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($code != 334) {
+            $this->error =
+                array("error" => "AUTH not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        // Send encoded username
+        fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($code != 334) {
+            $this->error =
+                array("error" => "Username not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        // Send encoded password
+        fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($code != 235) {
+            $this->error =
+                array("error" => "Password not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns true if connected to a server otherwise false
+     * @access private
+     * @return bool
+     */
+    function Connected() {
+        if(!empty($this->smtp_conn)) {
+            $sock_status = socket_get_status($this->smtp_conn);
+            if($sock_status["eof"]) {
+                # hmm this is an odd situation... the socket is
+                # valid but we aren't connected anymore
+                if($this->do_debug >= 1) {
+                    echo "SMTP -> NOTICE:" . $this->CRLF .
+                         "EOF caught while checking if connected";
+                }
+                $this->Close();
+                return false;
+            }
+            return true; # everything looks good
+        }
+        return false;
+    }
+
+    /**
+     * Closes the socket and cleans up the state of the class.
+     * It is not considered good to use this function without
+     * first trying to use QUIT.
+     * @access public
+     * @return void
+     */
+    function Close() {
+        $this->error = null; # so there is no confusion
+        $this->helo_rply = null;
+        if(!empty($this->smtp_conn)) {
+            # close the connection and cleanup
+            fclose($this->smtp_conn);
+            $this->smtp_conn = 0;
+        }
+    }
+
+
+    /***************************************************************
+     *                        SMTP COMMANDS                       *
+     *************************************************************/
+
+    /**
+     * Issues a data command and sends the msg_data to the server
+     * finializing the mail transaction. $msg_data is the message
+     * that is to be send with the headers. Each header needs to be
+     * on a single line followed by a <CRLF> with the message headers
+     * and the message body being seperated by and additional <CRLF>.
+     *
+     * Implements rfc 821: DATA <CRLF>
+     *
+     * SMTP CODE INTERMEDIATE: 354
+     *     [data]
+     *     <CRLF>.<CRLF>
+     *     SMTP CODE SUCCESS: 250
+     *     SMTP CODE FAILURE: 552,554,451,452
+     * SMTP CODE FAILURE: 451,554
+     * SMTP CODE ERROR  : 500,501,503,421
+     * @access public
+     * @return bool
+     */
+    function Data($msg_data) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Data() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"DATA" . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 354) {
+            $this->error =
+                array("error" => "DATA command not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        # the server is ready to accept data!
+        # according to rfc 821 we should not send more than 1000
+        # including the CRLF
+        # characters on a single line so we will break the data up
+        # into lines by \r and/or \n then if needed we will break
+        # each of those into smaller lines to fit within the limit.
+        # in addition we will be looking for lines that start with
+        # a period '.' and append and additional period '.' to that
+        # line. NOTE: this does not count towards are limit.
+
+        # normalize the line breaks so we know the explode works
+        $msg_data = str_replace("\r\n","\n",$msg_data);
+        $msg_data = str_replace("\r","\n",$msg_data);
+        $lines = explode("\n",$msg_data);
+
+        # we need to find a good way to determine is headers are
+        # in the msg_data or if it is a straight msg body
+        # currently I'm assuming rfc 822 definitions of msg headers
+        # and if the first field of the first line (':' sperated)
+        # does not contain a space then it _should_ be a header
+        # and we can process all lines before a blank "" line as
+        # headers.
+        $field = substr($lines[0],0,strpos($lines[0],":"));
+        $in_headers = false;
+        if(!empty($field) && !strstr($field," ")) {
+            $in_headers = true;
+        }
+
+        $max_line_length = 998; # used below; set here for ease in change
+
+        while(list(,$line) = @each($lines)) {
+            $lines_out = null;
+            if($line == "" && $in_headers) {
+                $in_headers = false;
+            }
+            # ok we need to break this line up into several
+            # smaller lines
+            while(strlen($line) > $max_line_length) {
+                $pos = strrpos(substr($line,0,$max_line_length)," ");
+                $lines_out[] = substr($line,0,$pos);
+                $line = substr($line,$pos + 1);
+                # if we are processing headers we need to
+                # add a LWSP-char to the front of the new line
+                # rfc 822 on long msg headers
+                if($in_headers) {
+                    $line = "\t" . $line;
+                }
+            }
+            $lines_out[] = $line;
+
+            # now send the lines to the server
+            while(list(,$line_out) = @each($lines_out)) {
+                if(strlen($line_out) > 0)
+                {
+                    if(substr($line_out, 0, 1) == ".") {
+                        $line_out = "." . $line_out;
+                    }
+                }
+                fputs($this->smtp_conn,$line_out . $this->CRLF);
+            }
+        }
+
+        # ok all the message data has been sent so lets get this
+        # over with aleady
+        fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "DATA not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Expand takes the name and asks the server to list all the
+     * people who are members of the _list_. Expand will return
+     * back and array of the result or false if an error occurs.
+     * Each value in the array returned has the format of:
+     *     [ <full-name> <sp> ] <path>
+     * The definition of <path> is defined in rfc 821
+     *
+     * Implements rfc 821: EXPN <SP> <string> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE FAILURE: 550
+     * SMTP CODE ERROR  : 500,501,502,504,421
+     * @access public
+     * @return string array
+     */
+    function Expand($name) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Expand() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "EXPN not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        # parse the reply and place in our array to return to user
+        $entries = explode($this->CRLF,$rply);
+        while(list(,$l) = @each($entries)) {
+            $list[] = substr($l,4);
+        }
+
+        return $list;
+    }
+
+    /**
+     * Sends the HELO command to the smtp server.
+     * This makes sure that we and the server are in
+     * the same known state.
+     *
+     * Implements from rfc 821: HELO <SP> <domain> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE ERROR  : 500, 501, 504, 421
+     * @access public
+     * @return bool
+     */
+    function Hello($host="") {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Hello() without being connected");
+            return false;
+        }
+
+        # if a hostname for the HELO wasn't specified determine
+        # a suitable one to send
+        if(empty($host)) {
+            # we need to determine some sort of appopiate default
+            # to send to the server
+            $host = "localhost";
+        }
+
+        // Send extended hello first (RFC 2821)
+        if(!$this->SendHello("EHLO", $host))
+        {
+            if(!$this->SendHello("HELO", $host))
+                return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Sends a HELO/EHLO command.
+     * @access private
+     * @return bool
+     */
+    function SendHello($hello, $host) {
+        fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => $hello . " not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        $this->helo_rply = $rply;
+        
+        return true;
+    }
+
+    /**
+     * Gets help information on the keyword specified. If the keyword
+     * is not specified then returns generic help, ussually contianing
+     * A list of keywords that help is available on. This function
+     * returns the results back to the user. It is up to the user to
+     * handle the returned data. If an error occurs then false is
+     * returned with $this->error set appropiately.
+     *
+     * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
+     *
+     * SMTP CODE SUCCESS: 211,214
+     * SMTP CODE ERROR  : 500,501,502,504,421
+     * @access public
+     * @return string
+     */
+    function Help($keyword="") {
+        $this->error = null; # to avoid confusion
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Help() without being connected");
+            return false;
+        }
+
+        $extra = "";
+        if(!empty($keyword)) {
+            $extra = " " . $keyword;
+        }
+
+        fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 211 && $code != 214) {
+            $this->error =
+                array("error" => "HELP not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        return $rply;
+    }
+
+    /**
+     * Starts a mail transaction from the email address specified in
+     * $from. Returns true if successful or false otherwise. If True
+     * the mail transaction is started and then one or more Recipient
+     * commands may be called followed by a Data command.
+     *
+     * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE SUCCESS: 552,451,452
+     * SMTP CODE SUCCESS: 500,501,421
+     * @access public
+     * @return bool
+     */
+    function Mail($from) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Mail() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "MAIL not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Sends the command NOOP to the SMTP server.
+     *
+     * Implements from rfc 821: NOOP <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE ERROR  : 500, 421
+     * @access public
+     * @return bool
+     */
+    function Noop() {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Noop() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"NOOP" . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "NOOP not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Sends the quit command to the server and then closes the socket
+     * if there is no error or the $close_on_error argument is true.
+     *
+     * Implements from rfc 821: QUIT <CRLF>
+     *
+     * SMTP CODE SUCCESS: 221
+     * SMTP CODE ERROR  : 500
+     * @access public
+     * @return bool
+     */
+    function Quit($close_on_error=true) {
+        $this->error = null; # so there is no confusion
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Quit() without being connected");
+            return false;
+        }
+
+        # send the quit command to the server
+        fputs($this->smtp_conn,"quit" . $this->CRLF);
+
+        # get any good-bye messages
+        $byemsg = $this->get_lines();
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
+        }
+
+        $rval = true;
+        $e = null;
+
+        $code = substr($byemsg,0,3);
+        if($code != 221) {
+            # use e as a tmp var cause Close will overwrite $this->error
+            $e = array("error" => "SMTP server rejected quit command",
+                       "smtp_code" => $code,
+                       "smtp_rply" => substr($byemsg,4));
+            $rval = false;
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $e["error"] . ": " .
+                         $byemsg . $this->CRLF;
+            }
+        }
+
+        if(empty($e) || $close_on_error) {
+            $this->Close();
+        }
+
+        return $rval;
+    }
+
+    /**
+     * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+     * Returns true if the recipient was accepted false if it was rejected.
+     *
+     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250,251
+     * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+     * SMTP CODE ERROR  : 500,501,503,421
+     * @access public
+     * @return bool
+     */
+    function Recipient($to) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Recipient() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250 && $code != 251) {
+            $this->error =
+                array("error" => "RCPT not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Sends the RSET command to abort and transaction that is
+     * currently in progress. Returns true if successful false
+     * otherwise.
+     *
+     * Implements rfc 821: RSET <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE ERROR  : 500,501,504,421
+     * @access public
+     * @return bool
+     */
+    function Reset() {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Reset() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"RSET" . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "RSET failed",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Starts a mail transaction from the email address specified in
+     * $from. Returns true if successful or false otherwise. If True
+     * the mail transaction is started and then one or more Recipient
+     * commands may be called followed by a Data command. This command
+     * will send the message to the users terminal if they are logged
+     * in.
+     *
+     * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE SUCCESS: 552,451,452
+     * SMTP CODE SUCCESS: 500,501,502,421
+     * @access public
+     * @return bool
+     */
+    function Send($from) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Send() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "SEND not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Starts a mail transaction from the email address specified in
+     * $from. Returns true if successful or false otherwise. If True
+     * the mail transaction is started and then one or more Recipient
+     * commands may be called followed by a Data command. This command
+     * will send the message to the users terminal if they are logged
+     * in and send them an email.
+     *
+     * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE SUCCESS: 552,451,452
+     * SMTP CODE SUCCESS: 500,501,502,421
+     * @access public
+     * @return bool
+     */
+    function SendAndMail($from) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                "error" => "Called SendAndMail() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "SAML not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Starts a mail transaction from the email address specified in
+     * $from. Returns true if successful or false otherwise. If True
+     * the mail transaction is started and then one or more Recipient
+     * commands may be called followed by a Data command. This command
+     * will send the message to the users terminal if they are logged
+     * in or mail it to them if they are not.
+     *
+     * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE SUCCESS: 552,451,452
+     * SMTP CODE SUCCESS: 500,501,502,421
+     * @access public
+     * @return bool
+     */
+    function SendOrMail($from) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                "error" => "Called SendOrMail() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250) {
+            $this->error =
+                array("error" => "SOML not accepted from server",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * This is an optional command for SMTP that this class does not
+     * support. This method is here to make the RFC821 Definition
+     * complete for this class and __may__ be implimented in the future
+     *
+     * Implements from rfc 821: TURN <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250
+     * SMTP CODE FAILURE: 502
+     * SMTP CODE ERROR  : 500, 503
+     * @access public
+     * @return bool
+     */
+    function Turn() {
+        $this->error = array("error" => "This method, TURN, of the SMTP ".
+                                        "is not implemented");
+        if($this->do_debug >= 1) {
+            echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
+        }
+        return false;
+    }
+
+    /**
+     * Verifies that the name is recognized by the server.
+     * Returns false if the name could not be verified otherwise
+     * the response from the server is returned.
+     *
+     * Implements rfc 821: VRFY <SP> <string> <CRLF>
+     *
+     * SMTP CODE SUCCESS: 250,251
+     * SMTP CODE FAILURE: 550,551,553
+     * SMTP CODE ERROR  : 500,501,502,421
+     * @access public
+     * @return int
+     */
+    function Verify($name) {
+        $this->error = null; # so no confusion is caused
+
+        if(!$this->connected()) {
+            $this->error = array(
+                    "error" => "Called Verify() without being connected");
+            return false;
+        }
+
+        fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
+
+        $rply = $this->get_lines();
+        $code = substr($rply,0,3);
+
+        if($this->do_debug >= 2) {
+            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+        }
+
+        if($code != 250 && $code != 251) {
+            $this->error =
+                array("error" => "VRFY failed on name '$name'",
+                      "smtp_code" => $code,
+                      "smtp_msg" => substr($rply,4));
+            if($this->do_debug >= 1) {
+                echo "SMTP -> ERROR: " . $this->error["error"] .
+                         ": " . $rply . $this->CRLF;
+            }
+            return false;
+        }
+        return $rply;
+    }
+
+    /*******************************************************************
+     *                       INTERNAL FUNCTIONS                       *
+     ******************************************************************/
+
+    /**
+     * Read in as many lines as possible
+     * either before eof or socket timeout occurs on the operation.
+     * With SMTP we can tell if we have more lines to read if the
+     * 4th character is '-' symbol. If it is a space then we don't
+     * need to read anything else.
+     * @access private
+     * @return string
+     */
+    function get_lines() {
+        $data = "";
+        while($str = fgets($this->smtp_conn,515)) {
+            if($this->do_debug >= 4) {
+                echo "SMTP -> get_lines(): \$data was \"$data\"" .
+                         $this->CRLF;
+                echo "SMTP -> get_lines(): \$str is \"$str\"" .
+                         $this->CRLF;
+            }
+            $data .= $str;
+            if($this->do_debug >= 4) {
+                echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
+            }
+            # if the 4th character is a space then we are done reading
+            # so just break the loop
+            if(substr($str,3,1) == " ") { break; }
+        }
+        return $data;
+    }
+
+}
+
+
+ ?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/docs/extending.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/docs/extending.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/docs/extending.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,148 +1,148 @@
-<html>
-<head>
-<title>Examples using phpmailer</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<h2>Examples using phpmailer</h2>
-
-<h3>1. Advanced Example</h3>
-<p>
-
-This demonstrates sending out multiple email messages with binary attachments
-from a MySQL database with multipart/alternative support.<p>
-<table cellpadding="4" border="1" width="80%">
-<tr>
-<td bgcolor="#CCCCCC">
-<pre>
-require(dirname(__FILE__) . "/class.phpmailer.php");
-
-$mail = new phpmailer();
-
-$mail->From     = "list at example.com";
-$mail->FromName = "List manager";
-$mail->Host     = "smtp1.example.com;smtp2.example.com";
-$mail->Mailer   = "smtp";
-
- at MYSQL_CONNECT("localhost","root","password");
- at mysql_select_db("my_company");
-$query� =�"SELECT full_name, email,�photo�FROM employee�WHERE�id=$id";
-$result�=�@MYSQL_QUERY($query);
-
-while ($row = mysql_fetch_array ($result))
-{
-    // HTML body
-    $body  = "Hello &lt;font size=\"4\"&gt;" . $row["full_name"] . "&lt;/font&gt;, &lt;p&gt;";
-    $body .= "&lt;i&gt;Your&lt;/i&gt; personal photograph to this message.&lt;p&gt;";
-    $body .= "Sincerely, &lt;br&gt;";
-    $body .= "phpmailer List manager";
-
-    // Plain text body (for mail clients that cannot read HTML)
-    $text_body  = "Hello " . $row["full_name"] . ", \n\n";
-    $text_body .= "Your personal photograph to this message.\n\n";
-    $text_body .= "Sincerely, \n";
-    $text_body .= "phpmailer List manager";
-
-    $mail->Body    = $body;
-    $mail->AltBody = $text_body;
-    $mail->AddAddress($row["email"], $row["full_name");
-    $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
-
-    if(!$mail->Send())
-        echo "There has been a mail error sending to " . $row["email"] . "&lt;br&gt;";
-
-    // Clear all addresses and attachments for next loop
-    $mail->ClearAddresses();
-    $mail->ClearAttachments();
-}
-</pre>
-</td>
-</tr>
-</table>
-<p>
-
-<h3>2. Extending phpmailer</h3>
-<p>
-
-Extending classes with inheritance is one of the most
-powerful features of object-oriented
-programming.  It allows you to make changes to the
-original class for your
-own personal use without hacking the original
-classes.  Plus, it is very
-easy to do. I've provided an example:
-
-<p>
-Here's a class that extends the phpmailer class and sets the defaults
-for the particular site:<br>
-PHP include file: <b>mail.inc.php</b>
-<p>
-
-<table cellpadding="4" border="1" width="80%">
-<tr>
-<td bgcolor="#CCCCCC">
-<pre>
-require(dirname(__FILE__) . "/class.phpmailer.php");
-
-class my_phpmailer extends phpmailer {
-    // Set default variables for all new objects
-    var $From     = "from at example.com";
-    var $FromName = "Mailer";
-    var $Host     = "smtp1.example.com;smtp2.example.com";
-    var $Mailer   = "smtp";                         // Alternative to IsSMTP()
-    var $WordWrap = 75;
-
-    // Replace the default error_handler
-    function error_handler($msg) {
-        print("My Site Error");
-        print("Description:");
-        printf("%s", $msg);
-        exit;
-    }
-
-    // Create an additional function
-    function do_something($something) {
-        // Place your new code here
-    }
-}
-</td>
-</tr>
-</table>
-<br>
-
-Now here's a normal PHP page in the site, which will have all the defaults set
-above:<br>
-Normal PHP file: <b>mail_test.php</b>
-<p>
-
-<table cellpadding="4" border="1" width="80%">
-<tr>
-<td bgcolor="#CCCCCC">
-<pre>
-require(dirname(__FILE__) . "/mail.inc.php");
-
-// Instantiate your new class
-$mail = new my_phpmailer;
-
-// Now you only need to add the necessary stuff
-$mail->AddAddress("josh at example.com", "Josh Adams");
-$mail->Subject = "Here is the subject";
-$mail->Body    = "This is the message body";
-$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip");  // optional name
-
-if(!$mail->Send())
-{
-   echo "There was an error sending the message";
-   exit;
-}
-
-echo "Message was sent successfully";
-</pre>
-</td>
-</tr>
-</table>
-</p>
-
-</body>
-</html>
+<html>
+<head>
+<title>Examples using phpmailer</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<h2>Examples using phpmailer</h2>
+
+<h3>1. Advanced Example</h3>
+<p>
+
+This demonstrates sending out multiple email messages with binary attachments
+from a MySQL database with multipart/alternative support.<p>
+<table cellpadding="4" border="1" width="80%">
+<tr>
+<td bgcolor="#CCCCCC">
+<pre>
+require(dirname(__FILE__) . "/class.phpmailer.php");
+
+$mail = new phpmailer();
+
+$mail->From     = "list at example.com";
+$mail->FromName = "List manager";
+$mail->Host     = "smtp1.example.com;smtp2.example.com";
+$mail->Mailer   = "smtp";
+
+ at MYSQL_CONNECT("localhost","root","password");
+ at mysql_select_db("my_company");
+$query� =�"SELECT full_name, email,�photo�FROM employee�WHERE�id=$id";
+$result�=�@MYSQL_QUERY($query);
+
+while ($row = mysql_fetch_array ($result))
+{
+    // HTML body
+    $body  = "Hello &lt;font size=\"4\"&gt;" . $row["full_name"] . "&lt;/font&gt;, &lt;p&gt;";
+    $body .= "&lt;i&gt;Your&lt;/i&gt; personal photograph to this message.&lt;p&gt;";
+    $body .= "Sincerely, &lt;br&gt;";
+    $body .= "phpmailer List manager";
+
+    // Plain text body (for mail clients that cannot read HTML)
+    $text_body  = "Hello " . $row["full_name"] . ", \n\n";
+    $text_body .= "Your personal photograph to this message.\n\n";
+    $text_body .= "Sincerely, \n";
+    $text_body .= "phpmailer List manager";
+
+    $mail->Body    = $body;
+    $mail->AltBody = $text_body;
+    $mail->AddAddress($row["email"], $row["full_name");
+    $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
+
+    if(!$mail->Send())
+        echo "There has been a mail error sending to " . $row["email"] . "&lt;br&gt;";
+
+    // Clear all addresses and attachments for next loop
+    $mail->ClearAddresses();
+    $mail->ClearAttachments();
+}
+</pre>
+</td>
+</tr>
+</table>
+<p>
+
+<h3>2. Extending phpmailer</h3>
+<p>
+
+Extending classes with inheritance is one of the most
+powerful features of object-oriented
+programming.  It allows you to make changes to the
+original class for your
+own personal use without hacking the original
+classes.  Plus, it is very
+easy to do. I've provided an example:
+
+<p>
+Here's a class that extends the phpmailer class and sets the defaults
+for the particular site:<br>
+PHP include file: <b>mail.inc.php</b>
+<p>
+
+<table cellpadding="4" border="1" width="80%">
+<tr>
+<td bgcolor="#CCCCCC">
+<pre>
+require(dirname(__FILE__) . "/class.phpmailer.php");
+
+class my_phpmailer extends phpmailer {
+    // Set default variables for all new objects
+    var $From     = "from at example.com";
+    var $FromName = "Mailer";
+    var $Host     = "smtp1.example.com;smtp2.example.com";
+    var $Mailer   = "smtp";                         // Alternative to IsSMTP()
+    var $WordWrap = 75;
+
+    // Replace the default error_handler
+    function error_handler($msg) {
+        print("My Site Error");
+        print("Description:");
+        printf("%s", $msg);
+        exit;
+    }
+
+    // Create an additional function
+    function do_something($something) {
+        // Place your new code here
+    }
+}
+</td>
+</tr>
+</table>
+<br>
+
+Now here's a normal PHP page in the site, which will have all the defaults set
+above:<br>
+Normal PHP file: <b>mail_test.php</b>
+<p>
+
+<table cellpadding="4" border="1" width="80%">
+<tr>
+<td bgcolor="#CCCCCC">
+<pre>
+require(dirname(__FILE__) . "/mail.inc.php");
+
+// Instantiate your new class
+$mail = new my_phpmailer;
+
+// Now you only need to add the necessary stuff
+$mail->AddAddress("josh at example.com", "Josh Adams");
+$mail->Subject = "Here is the subject";
+$mail->Body    = "This is the message body";
+$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip");  // optional name
+
+if(!$mail->Send())
+{
+   echo "There was an error sending the message";
+   exit;
+}
+
+echo "Message was sent successfully";
+</pre>
+</td>
+</tr>
+</table>
+</p>
+
+</body>
+</html>

Modified: branches/print_dev/http/classes/phpmailer-1.72/docs/faq.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/docs/faq.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/docs/faq.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,66 +1,66 @@
-<html>
-<head>
-<title>phpmailer FAQ</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<h2>phpmailer FAQ</h2>
-
-<p>
-<b>I'm using the SMTP mailer and I keep on getting a timeout message 
-well before the X seconds I set it for.  What gives?</b>
-<br>
-PHP versions 4.0.4pl1 and earlier have a bug in which sockets timeout 
-early.  You can fix this by re-compiling PHP 4.0.4pl1 with this fix: 
-<a href="timeoutfix.diff">timeoutfix.diff</a>. Otherwise you can wait 
-for the new PHP release.
-</p>
-
-<p>
-<b>I am concerned that using include files will take up too much
-processing time on my computer.  How can I make it run faster?</b>
-<br>
-PHP by itself is very fast.  Much faster than ASP or JSP running on
-the same type of server.  This is because it has very little overhead compared
-to its competitors and it pre-compiles all of
-its code before it runs each script (in PHP4).  However, all of
-this compiling and re-compiling can take up a lot of valuable
-computer resources.  However, there are programs out there that compile
-PHP code and store it in memory (or on mmaped files) to reduce the
-processing immensely.  Two of these: <a href="http://apc.communityconnect.com">APC
-(Alternative PHP Cache)</a> and <a href="http://bwcache.bware.it/index.htm">Afterburner</a> 
-(<a href="http://www.mm4.de/php4win/mod_php4_win32/">Win32 download</a>) 
-are excellent free tools that do just this.  If you have the money
-you might also try <a href="http://www.zend.com">Zend Cache</a>, it is
-even faster than the open source varieties.  All of these tools make your
-scripts run faster while also reducing the load on your server. I have tried
-them myself and they are quite stable too.
-</p>
-
-
-<p>
-<b>What mailer gives me the best performance?</b>
-<br>
-On a single machine the mail() or sendmail mailers give you the best 
-performance because they do not have the added overhead of SMTP.
-If you have you have your mail server on a another machine then
-SMTP is your only option, but you do get the benefit of redundant
-mail servers.
-</p>
-
-<p>
-<b>When I try to attach a file with on my server I get a 
-"Could not find {file} on filesystem error".  Why is this?</b>
-<br>
-If you are using a Unix machine this is probably because the user 
-running your web server does not have read access to the directory 
-in question.  If you are using Windows, then the problem probably is 
-that you have used single backslashes to denote directories ("\").  
-A single backslash has a special meaning to PHP so these are not 
-valid.  Instead use double backslashes ("\\") or a single forward 
-slash ("/").
-</p>
-
-</body>
+<html>
+<head>
+<title>phpmailer FAQ</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<h2>phpmailer FAQ</h2>
+
+<p>
+<b>I'm using the SMTP mailer and I keep on getting a timeout message 
+well before the X seconds I set it for.  What gives?</b>
+<br>
+PHP versions 4.0.4pl1 and earlier have a bug in which sockets timeout 
+early.  You can fix this by re-compiling PHP 4.0.4pl1 with this fix: 
+<a href="timeoutfix.diff">timeoutfix.diff</a>. Otherwise you can wait 
+for the new PHP release.
+</p>
+
+<p>
+<b>I am concerned that using include files will take up too much
+processing time on my computer.  How can I make it run faster?</b>
+<br>
+PHP by itself is very fast.  Much faster than ASP or JSP running on
+the same type of server.  This is because it has very little overhead compared
+to its competitors and it pre-compiles all of
+its code before it runs each script (in PHP4).  However, all of
+this compiling and re-compiling can take up a lot of valuable
+computer resources.  However, there are programs out there that compile
+PHP code and store it in memory (or on mmaped files) to reduce the
+processing immensely.  Two of these: <a href="http://apc.communityconnect.com">APC
+(Alternative PHP Cache)</a> and <a href="http://bwcache.bware.it/index.htm">Afterburner</a> 
+(<a href="http://www.mm4.de/php4win/mod_php4_win32/">Win32 download</a>) 
+are excellent free tools that do just this.  If you have the money
+you might also try <a href="http://www.zend.com">Zend Cache</a>, it is
+even faster than the open source varieties.  All of these tools make your
+scripts run faster while also reducing the load on your server. I have tried
+them myself and they are quite stable too.
+</p>
+
+
+<p>
+<b>What mailer gives me the best performance?</b>
+<br>
+On a single machine the mail() or sendmail mailers give you the best 
+performance because they do not have the added overhead of SMTP.
+If you have you have your mail server on a another machine then
+SMTP is your only option, but you do get the benefit of redundant
+mail servers.
+</p>
+
+<p>
+<b>When I try to attach a file with on my server I get a 
+"Could not find {file} on filesystem error".  Why is this?</b>
+<br>
+If you are using a Unix machine this is probably because the user 
+running your web server does not have read access to the directory 
+in question.  If you are using Windows, then the problem probably is 
+that you have used single backslashes to denote directories ("\").  
+A single backslash has a special meaning to PHP so these are not 
+valid.  Instead use double backslashes ("\\") or a single forward 
+slash ("/").
+</p>
+
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-br.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-br.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-br.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,21 +1,21 @@
-<?php
-/**
- * PHPMailer language file.  
- * Portuguese Version
- * By Paulo Henrique Garcia - paulo at controllerweb.com.br
- */
-
-$PHPMAILER_LANG = array();
-$PHPMAILER_LANG["provide_address"] = 'Você deve fornecer pelo menos um endereço de destinatário de email.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer não suportado.';
-$PHPMAILER_LANG["execute"] = 'Não foi possível executar: ';
-$PHPMAILER_LANG["instantiate"] = 'Não foi possível instanciar a função mail.';
-$PHPMAILER_LANG["authenticate"] = 'Erro de SMTP: Não foi possível autenticar.';
-$PHPMAILER_LANG["from_failed"] = 'Os endereços de rementente a seguir falharam: ';
-$PHPMAILER_LANG["recipients_failed"] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'Erro de SMTP: Dados não aceitos.';
-$PHPMAILER_LANG["connect_host"] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.';
-$PHPMAILER_LANG["file_access"] = 'Não foi possível acessar o arquivo: ';
-$PHPMAILER_LANG["file_open"] = 'Erro de Arquivo: Não foi possível abrir o arquivo: ';
-$PHPMAILER_LANG["encoding"] = 'Codificação desconhecida: ';
-?>
+<?php
+/**
+ * PHPMailer language file.  
+ * Portuguese Version
+ * By Paulo Henrique Garcia - paulo at controllerweb.com.br
+ */
+
+$PHPMAILER_LANG = array();
+$PHPMAILER_LANG["provide_address"] = 'Voc� deve fornecer pelo menos um endere�o de destinat�rio de email.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer n�o suportado.';
+$PHPMAILER_LANG["execute"] = 'N�o foi poss�vel executar: ';
+$PHPMAILER_LANG["instantiate"] = 'N�o foi poss�vel instanciar a fun��o mail.';
+$PHPMAILER_LANG["authenticate"] = 'Erro de SMTP: N�o foi poss�vel autenticar.';
+$PHPMAILER_LANG["from_failed"] = 'Os endere�os de rementente a seguir falharam: ';
+$PHPMAILER_LANG["recipients_failed"] = 'Erro de SMTP: Os endere�os de destinat�rio a seguir falharam: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Erro de SMTP: Dados n�o aceitos.';
+$PHPMAILER_LANG["connect_host"] = 'Erro de SMTP: N�o foi poss�vel conectar com o servidor SMTP.';
+$PHPMAILER_LANG["file_access"] = 'N�o foi poss�vel acessar o arquivo: ';
+$PHPMAILER_LANG["file_open"] = 'Erro de Arquivo: N�o foi poss�vel abrir o arquivo: ';
+$PHPMAILER_LANG["encoding"] = 'Codifica��o desconhecida: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-cz.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-cz.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-cz.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,24 +1,24 @@
-<?php
-/**
- * PHPMailer language file.  
- * Czech Version
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'Musíte zadat alespoò jednu ' .
-                                     'emailovou adresu pøíjemce.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailový klient není podporován.';
-$PHPMAILER_LANG["execute"] = 'Nelze provést: ';
-$PHPMAILER_LANG["instantiate"] = 'Nelze vytvoøit instanci emailové funkce.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Chyba autentikace.';
-$PHPMAILER_LANG["from_failed"] = 'Následující adresa From je nesprávná: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: Adresy pøíjemcù ' .
-                                       'nejsou správné ' .
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data nebyla pøijata';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Nelze navázat spojení se ' .
-                                  ' SMTP serverem.';
-$PHPMAILER_LANG["file_access"] = 'Soubor nenalezen: ';
-$PHPMAILER_LANG["file_open"] = 'File Error: Nelze otevøít soubor pro ètení: ';
-$PHPMAILER_LANG["encoding"] = 'Neznámé kódování: ';
-?>
+<?php
+/**
+ * PHPMailer language file.  
+ * Czech Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Mus�te zadat alespo� jednu ' .
+                                     'emailovou adresu p��jemce.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailov� klient nen� podporov�n.';
+$PHPMAILER_LANG["execute"] = 'Nelze prov�st: ';
+$PHPMAILER_LANG["instantiate"] = 'Nelze vytvo�it instanci emailov� funkce.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Chyba autentikace.';
+$PHPMAILER_LANG["from_failed"] = 'N�sleduj�c� adresa From je nespr�vn�: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: Adresy p��jemc� ' .
+                                       'nejsou spr�vn� ' .
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data nebyla p�ijata';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Nelze nav�zat spojen� se ' .
+                                  ' SMTP serverem.';
+$PHPMAILER_LANG["file_access"] = 'Soubor nenalezen: ';
+$PHPMAILER_LANG["file_open"] = 'File Error: Nelze otev��t soubor pro �ten�: ';
+$PHPMAILER_LANG["encoding"] = 'Nezn�m� k�dov�n�: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-de.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-de.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-de.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,23 +1,23 @@
-<?php
-/**
- * PHPMailer language file.  
- * German Version
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'Bitte geben Sie mindestens eine ' .
-                                     'Empf&auml;nger Emailadresse an.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer wird nicht unterst&uuml;tzt.';
-$PHPMAILER_LANG["execute"] = 'Konnte folgenden Befehl nicht ausf&uuml;hren: ';
-$PHPMAILER_LANG["instantiate"] = 'Mail Funktion konnte nicht initialisiert werden.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.';
-$PHPMAILER_LANG["from_failed"] = 'Die folgende Absenderadresse ist nicht korrekt: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fehler: Die folgenden ' .
-                                       'Empf&auml;nger sind nicht korrekt: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fehler: Daten werden nicht akzeptiert.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
-$PHPMAILER_LANG["file_access"] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
-$PHPMAILER_LANG["file_open"] = 'Datei Fehler: Konnte Date nicht &ouml;ffnen: ';
-$PHPMAILER_LANG["encoding"] = 'Unbekanntes Encoding-Format: ';
-?>
+<?php
+/**
+ * PHPMailer language file.  
+ * German Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Bitte geben Sie mindestens eine ' .
+                                     'Empf&auml;nger Emailadresse an.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer wird nicht unterst&uuml;tzt.';
+$PHPMAILER_LANG["execute"] = 'Konnte folgenden Befehl nicht ausf&uuml;hren: ';
+$PHPMAILER_LANG["instantiate"] = 'Mail Funktion konnte nicht initialisiert werden.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.';
+$PHPMAILER_LANG["from_failed"] = 'Die folgende Absenderadresse ist nicht korrekt: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fehler: Die folgenden ' .
+                                       'Empf&auml;nger sind nicht korrekt: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fehler: Daten werden nicht akzeptiert.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
+$PHPMAILER_LANG["file_access"] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
+$PHPMAILER_LANG["file_open"] = 'Datei Fehler: Konnte Date nicht &ouml;ffnen: ';
+$PHPMAILER_LANG["encoding"] = 'Unbekanntes Encoding-Format: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-en.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-en.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-en.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,23 +1,23 @@
-<?php
-/**
- * PHPMailer language file.  
- * English Version
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
-                                     'recipient email address.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
-$PHPMAILER_LANG["execute"] = 'Could not execute: ';
-$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
-$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
-                                       'recipients failed: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
-$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
-$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
-$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
-?>
+<?php
+/**
+ * PHPMailer language file.  
+ * English Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
+                                     'recipient email address.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+$PHPMAILER_LANG["execute"] = 'Could not execute: ';
+$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
+$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
+                                       'recipients failed: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
+$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
+$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
+$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-es.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-es.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-es.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,23 +1,23 @@
-<?php
-/**
- * PHPMailer language file.  
- * Versión en español
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'Debe proveer al menos una ' .
-                                     'dirección de email como destinatario.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer no está soportado.';
-$PHPMAILER_LANG["execute"] = 'No puedo ejecutar: ';
-$PHPMAILER_LANG["instantiate"] = 'No pude crear una instancia de la función Mail.';
-$PHPMAILER_LANG["authenticate"] = 'Error SMTP: No se pudo autentificar.';
-$PHPMAILER_LANG["from_failed"] = 'La(s) siguiente(s) direcciones de remitente fallaron: ';
-$PHPMAILER_LANG["recipients_failed"] = 'Error SMTP: Los siguientes ' .
-                                       'destinatarios fallaron: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'Error SMTP: Datos no aceptados.';
-$PHPMAILER_LANG["connect_host"] = 'Error SMTP: No puedo conectar al servidor SMTP.';
-$PHPMAILER_LANG["file_access"] = 'No puedo acceder al archivo: ';
-$PHPMAILER_LANG["file_open"] = 'Error de Archivo: No puede abrir el archivo: ';
-$PHPMAILER_LANG["encoding"] = 'Codificación desconocida: ';
-?>
+<?php
+/**
+ * PHPMailer language file.  
+ * Versi�n en espa�ol
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Debe proveer al menos una ' .
+                                     'direcci�n de email como destinatario.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer no est� soportado.';
+$PHPMAILER_LANG["execute"] = 'No puedo ejecutar: ';
+$PHPMAILER_LANG["instantiate"] = 'No pude crear una instancia de la funci�n Mail.';
+$PHPMAILER_LANG["authenticate"] = 'Error SMTP: No se pudo autentificar.';
+$PHPMAILER_LANG["from_failed"] = 'La(s) siguiente(s) direcciones de remitente fallaron: ';
+$PHPMAILER_LANG["recipients_failed"] = 'Error SMTP: Los siguientes ' .
+                                       'destinatarios fallaron: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Error SMTP: Datos no aceptados.';
+$PHPMAILER_LANG["connect_host"] = 'Error SMTP: No puedo conectar al servidor SMTP.';
+$PHPMAILER_LANG["file_access"] = 'No puedo acceder al archivo: ';
+$PHPMAILER_LANG["file_open"] = 'Error de Archivo: No puede abrir el archivo: ';
+$PHPMAILER_LANG["encoding"] = 'Codificaci�n desconocida: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-fr.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-fr.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-fr.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,24 +1,24 @@
-<?php
-/**
- * PHPMailer language file.  
- * French Version
- * bruno at ioda-net.ch 09.08.2003
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'Vous devez fournir au moins ' .
-                                     'une adresse de destinataire.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer non supporté.';
-$PHPMAILER_LANG["execute"] = 'Ne peut pas lancer l\'exécution: ';
-$PHPMAILER_LANG["instantiate"] = 'Impossible d\'instancier la fonction mail.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP Erreur: Echec de l\'authentification.';
-$PHPMAILER_LANG["from_failed"] = 'L\'adresse From suivante a échoué : ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Erreur: Les destinataires ' .
-                                       'suivants sont en erreur : ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Erreur: Data non acceptée.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Erreur: Impossible de connecter le serveur SMTP .';
-$PHPMAILER_LANG["file_access"] = 'N\'arrive pas à accéder au fichier: ';
-$PHPMAILER_LANG["file_open"] = 'Erreur Fichier: ouverture impossible: ';
-$PHPMAILER_LANG["encoding"] = 'Encodage inconnu: ';
-?>
+<?php
+/**
+ * PHPMailer language file.  
+ * French Version
+ * bruno at ioda-net.ch 09.08.2003
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Vous devez fournir au moins ' .
+                                     'une adresse de destinataire.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer non support�.';
+$PHPMAILER_LANG["execute"] = 'Ne peut pas lancer l\'ex�cution: ';
+$PHPMAILER_LANG["instantiate"] = 'Impossible d\'instancier la fonction mail.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Erreur: Echec de l\'authentification.';
+$PHPMAILER_LANG["from_failed"] = 'L\'adresse From suivante a �chou� : ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Erreur: Les destinataires ' .
+                                       'suivants sont en erreur : ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Erreur: Data non accept�e.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Erreur: Impossible de connecter le serveur SMTP .';
+$PHPMAILER_LANG["file_access"] = 'N\'arrive pas � acc�der au fichier: ';
+$PHPMAILER_LANG["file_open"] = 'Erreur Fichier: ouverture impossible: ';
+$PHPMAILER_LANG["encoding"] = 'Encodage inconnu: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-it.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-it.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-it.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,28 +1,28 @@
-<?php
-/**
-* PHPMailer language file.
-* Italian version
-* @package PHPMailer
-* @author Ilias Bartolini <brain79 at inwind.it>
-*/
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'Deve essere fornito almeno un'.
-                                     ' indirizzo ricevente';
-$PHPMAILER_LANG["mailer_not_supported"] = 'Mailer non supportato';
-$PHPMAILER_LANG["execute"] = "Impossibile eseguire l'operazione: ";
-$PHPMAILER_LANG["instantiate"] = 'Impossibile istanziare la funzione mail';
-$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Impossibile autenticarsi.';
-$PHPMAILER_LANG["from_failed"] = 'I seguenti indirizzi mittenti hanno'.
-                                 ' generato errore: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: I seguenti indirizzi'.
-                                       'destinatari hanno generato errore: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data non accettati dal'.
-                                       'server.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Impossibile connettersi'.
-                                  ' all\'host SMTP.';
-$PHPMAILER_LANG["file_access"] = 'Impossibile accedere al file: ';
-$PHPMAILER_LANG["file_open"] = 'File Error: Impossibile aprire il file: ';
-$PHPMAILER_LANG["encoding"] = 'Encoding set dei caratteri sconosciuto: ';
-?>
+<?php
+/**
+* PHPMailer language file.
+* Italian version
+* @package PHPMailer
+* @author Ilias Bartolini <brain79 at inwind.it>
+*/
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Deve essere fornito almeno un'.
+                                     ' indirizzo ricevente';
+$PHPMAILER_LANG["mailer_not_supported"] = 'Mailer non supportato';
+$PHPMAILER_LANG["execute"] = "Impossibile eseguire l'operazione: ";
+$PHPMAILER_LANG["instantiate"] = 'Impossibile istanziare la funzione mail';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Impossibile autenticarsi.';
+$PHPMAILER_LANG["from_failed"] = 'I seguenti indirizzi mittenti hanno'.
+                                 ' generato errore: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: I seguenti indirizzi'.
+                                       'destinatari hanno generato errore: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data non accettati dal'.
+                                       'server.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Impossibile connettersi'.
+                                  ' all\'host SMTP.';
+$PHPMAILER_LANG["file_access"] = 'Impossibile accedere al file: ';
+$PHPMAILER_LANG["file_open"] = 'File Error: Impossibile aprire il file: ';
+$PHPMAILER_LANG["encoding"] = 'Encoding set dei caratteri sconosciuto: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-nl.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-nl.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-nl.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,23 +1,23 @@
-<?php
-/**
- * PHPMailer language file.
- * Dutch Version
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'U moet op zijn minst één ontvanger ' .
-                                     'opgeven';
-$PHPMAILER_LANG["mailer_not_supported"] = ' e-mail service wordt niet ondersteund.';
-$PHPMAILER_LANG["execute"] = 'Kan niet worden uitgevoerd: ';
-$PHPMAILER_LANG["instantiate"] = 'Kan mail functie niet op gang brengen.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP fout: Ongeldige gebruikersnaam of wachtwoord.';
-$PHPMAILER_LANG["from_failed"] = 'De volgende afzenders zijn ongeldig: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fout: Kon email niet verzend ' .
-                                       'naar de volgende ontvangers : ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fout: Data niet geaccepteerd.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Fout: Kan geen verbinding maken met de SMTP server.';
-$PHPMAILER_LANG["file_access"] = 'Bijlage kon niet worden geopend: ';
-$PHPMAILER_LANG["file_open"] = 'Bijlage kon niet worden geopend: ';
-$PHPMAILER_LANG["encoding"] = 'Onbekende codering: ';
-?>
+<?php
+/**
+ * PHPMailer language file.
+ * Dutch Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'U moet op zijn minst ��n ontvanger ' .
+                                     'opgeven';
+$PHPMAILER_LANG["mailer_not_supported"] = ' e-mail service wordt niet ondersteund.';
+$PHPMAILER_LANG["execute"] = 'Kan niet worden uitgevoerd: ';
+$PHPMAILER_LANG["instantiate"] = 'Kan mail functie niet op gang brengen.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP fout: Ongeldige gebruikersnaam of wachtwoord.';
+$PHPMAILER_LANG["from_failed"] = 'De volgende afzenders zijn ongeldig: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fout: Kon email niet verzend ' .
+                                       'naar de volgende ontvangers : ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fout: Data niet geaccepteerd.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Fout: Kan geen verbinding maken met de SMTP server.';
+$PHPMAILER_LANG["file_access"] = 'Bijlage kon niet worden geopend: ';
+$PHPMAILER_LANG["file_open"] = 'Bijlage kon niet worden geopend: ';
+$PHPMAILER_LANG["encoding"] = 'Onbekende codering: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-no.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-no.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-no.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,23 +1,23 @@
-<?php
-/**
- * Norwegian language file.
- * English Version
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'Du må ha med minst en' .
-                                     'mottager adresse.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer er ikke supportert.';
-$PHPMAILER_LANG["execute"] = 'Kunne ikke utføre: ';
-$PHPMAILER_LANG["instantiate"] = 'Kunne ikke instantiate mail funksjonen.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP Feil: Kunne ikke authentisere.';
-$PHPMAILER_LANG["from_failed"] = 'Følgende Fra feilet: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feil: Følgende' .
-                                       'mottagere feilet: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Feil: Data ble ikke akseptert.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Feil: Kunne ikke koble til SMTP host.';
-$PHPMAILER_LANG["file_access"] = 'Kunne ikke få tilgang til filen: ';
-$PHPMAILER_LANG["file_open"] = 'Fil feil: Kunne ikke åpne filen: ';
-$PHPMAILER_LANG["encoding"] = 'Ukjent encoding: ';
-?>
+<?php
+/**
+ * Norwegian language file.
+ * English Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Du m� ha med minst en' .
+                                     'mottager adresse.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer er ikke supportert.';
+$PHPMAILER_LANG["execute"] = 'Kunne ikke utf�re: ';
+$PHPMAILER_LANG["instantiate"] = 'Kunne ikke instantiate mail funksjonen.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Feil: Kunne ikke authentisere.';
+$PHPMAILER_LANG["from_failed"] = 'F�lgende Fra feilet: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feil: F�lgende' .
+                                       'mottagere feilet: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Feil: Data ble ikke akseptert.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Feil: Kunne ikke koble til SMTP host.';
+$PHPMAILER_LANG["file_access"] = 'Kunne ikke f� tilgang til filen: ';
+$PHPMAILER_LANG["file_open"] = 'Fil feil: Kunne ikke �pne filen: ';
+$PHPMAILER_LANG["encoding"] = 'Ukjent encoding: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-se.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-se.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/language/phpmailer.lang-se.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,24 +1,24 @@
-<?php
-/**
- * PHPMailer language file.  
- * Swedish Version
- * Author: Johan Linnér <johan at linner.biz>
- */
-
-$PHPMAILER_LANG = array();
-
-$PHPMAILER_LANG["provide_address"] = 'Du måste ange minst en ' .
-                                     'mottagares e-postadress.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer stöds inte.';
-$PHPMAILER_LANG["execute"] = 'Kunde inte köra: ';
-$PHPMAILER_LANG["instantiate"] = 'Kunde inte initiera e-postfunktion.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP fel: Kunde inte autentisera.';
-$PHPMAILER_LANG["from_failed"] = 'Följande avsändaradress är felaktig: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP fel: Följande ' .
-                                       'mottagare är felaktig: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP fel: Data accepterades inte.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP fel: Kunde inte ansluta till SMTP-server.';
-$PHPMAILER_LANG["file_access"] = 'Ingen åtkomst till fil: ';
-$PHPMAILER_LANG["file_open"] = 'Fil fel: Kunde inte öppna fil: ';
-$PHPMAILER_LANG["encoding"] = 'Okänt encode-format: ';
-?>
+<?php
+/**
+ * PHPMailer language file.  
+ * Swedish Version
+ * Author: Johan Linn�r <johan at linner.biz>
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Du m�ste ange minst en ' .
+                                     'mottagares e-postadress.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer st�ds inte.';
+$PHPMAILER_LANG["execute"] = 'Kunde inte k�ra: ';
+$PHPMAILER_LANG["instantiate"] = 'Kunde inte initiera e-postfunktion.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP fel: Kunde inte autentisera.';
+$PHPMAILER_LANG["from_failed"] = 'F�ljande avs�ndaradress �r felaktig: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP fel: F�ljande ' .
+                                       'mottagare �r felaktig: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP fel: Data accepterades inte.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP fel: Kunde inte ansluta till SMTP-server.';
+$PHPMAILER_LANG["file_access"] = 'Ingen �tkomst till fil: ';
+$PHPMAILER_LANG["file_open"] = 'Fil fel: Kunde inte �ppna fil: ';
+$PHPMAILER_LANG["encoding"] = 'Ok�nt encode-format: ';
+?>

Modified: branches/print_dev/http/classes/phpmailer-1.72/mail.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/mail.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/mail.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,102 +1,102 @@
-PHPMailer
-Full Featured Email Transfer Class for PHP
-==========================================
-
-http://phpmailer.sourceforge.net/
-
-This software is licenced under the LGPL.  Please read LICENSE for information on the
-software availability and distribution.
-
-Class Features:
-- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs
-- Redundant SMTP servers
-- Multipart/alternative emails for mail clients that do not read HTML email
-- Support for 8bit, base64, binary, and quoted-printable encoding
-- Uses the same methods as the very popular AspEmail active server (COM) component
-- SMTP authentication
-- Native language support
-- Word wrap, and more!
-
-Why you might need it:
-
-Many PHP developers utilize email in their code.  The only PHP function
-that supports this is the mail() function.  However, it does not expose
-any of the popular features that many email clients use nowadays like
-HTML-based emails and attachments. There are two proprietary
-development tools out there that have all the functionality built into
-easy to use classes: AspEmail(tm) and AspMail.  Both of these
-programs are COM components only available on Windows.  They are also a
-little pricey for smaller projects.
-
-Since I do Linux development I�ve missed these tools for my PHP coding.
-So I built a version myself that implements the same methods (object
-calls) that the Windows-based components do. It is open source and the
-LGPL license allows you to place the class in your proprietary PHP
-projects.
-
-
-Installation:
-
-Copy class.phpmailer.php into your php.ini include_path. If you are
-using the SMTP mailer then place class.smtp.php in your path as well.
-In the language directory you will find several files like 
-phpmailer.lang-en.php.  If you look right before the .php extension 
-that there are two letters.  These represent the language type of the 
-translation file.  For instance "en" is the English file and "br" is 
-the Portuguese file.  Chose the file that best fits with your language 
-and place it in the PHP include path.  If your language is English 
-then you have nothing more to do.  If it is a different language then 
-you must point PHPMailer to the correct translation.  To do this, call 
-the PHPMailer SetLanguage method like so:
-
-// To load the Portuguese version
-$mail->SetLanguage("br", "/optional/path/to/language/directory/");
-
-That's it.  You should now be ready to use PHPMailer!
-
-
-A Simple Example:
-
-<?php
-require(dirname(__FILE__) . "/class.phpmailer.php");
-
-$mail = new PHPMailer();
-
-$mail->IsSMTP();                                      // set mailer to use SMTP
-$mail->Host = "mail.ccgis";  // specify main and backup server
-$mail->SMTPAuth = true;     // turn on SMTP authentication
-$mail->Username = "uli.rothstein";  // SMTP username
-$mail->Password = ""; // SMTP password
-
-$mail->From = "willi at example.com";
-$mail->FromName = "MailerWilli";
-$mail->AddAddress("uli.rothstein at ccgis.de", "uli");
-#$mail->AddAddress("ellen at example.com");                  // name is optional
-$mail->AddReplyTo("info at ccgis.de", "Information");
-
-$mail->WordWrap = 50;                                 // set word wrap to 50 characters
-#$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
-#$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
-$mail->IsHTML(false);                                  // set email format to HTML
-
-$mail->Subject = "Here is the subject";
-$mail->Body    = "This is the HTML message body <b>in bold!</b>";
-$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
-
-if(!$mail->Send())
-{
-   echo "Message could not be sent. <p>";
-   echo "Mailer Error: " . $mail->ErrorInfo;
-   exit;
-}
-
-echo "Message has been sent";
-?>
-
-CHANGELOG
-
-See ChangeLog.txt
-
-Download: http://sourceforge.net/project/showfiles.php?group_id=26031
-
-Brent R. Matzelle
+PHPMailer
+Full Featured Email Transfer Class for PHP
+==========================================
+
+http://phpmailer.sourceforge.net/
+
+This software is licenced under the LGPL.  Please read LICENSE for information on the
+software availability and distribution.
+
+Class Features:
+- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs
+- Redundant SMTP servers
+- Multipart/alternative emails for mail clients that do not read HTML email
+- Support for 8bit, base64, binary, and quoted-printable encoding
+- Uses the same methods as the very popular AspEmail active server (COM) component
+- SMTP authentication
+- Native language support
+- Word wrap, and more!
+
+Why you might need it:
+
+Many PHP developers utilize email in their code.  The only PHP function
+that supports this is the mail() function.  However, it does not expose
+any of the popular features that many email clients use nowadays like
+HTML-based emails and attachments. There are two proprietary
+development tools out there that have all the functionality built into
+easy to use classes: AspEmail(tm) and AspMail.  Both of these
+programs are COM components only available on Windows.  They are also a
+little pricey for smaller projects.
+
+Since I do Linux development I�ve missed these tools for my PHP coding.
+So I built a version myself that implements the same methods (object
+calls) that the Windows-based components do. It is open source and the
+LGPL license allows you to place the class in your proprietary PHP
+projects.
+
+
+Installation:
+
+Copy class.phpmailer.php into your php.ini include_path. If you are
+using the SMTP mailer then place class.smtp.php in your path as well.
+In the language directory you will find several files like 
+phpmailer.lang-en.php.  If you look right before the .php extension 
+that there are two letters.  These represent the language type of the 
+translation file.  For instance "en" is the English file and "br" is 
+the Portuguese file.  Chose the file that best fits with your language 
+and place it in the PHP include path.  If your language is English 
+then you have nothing more to do.  If it is a different language then 
+you must point PHPMailer to the correct translation.  To do this, call 
+the PHPMailer SetLanguage method like so:
+
+// To load the Portuguese version
+$mail->SetLanguage("br", "/optional/path/to/language/directory/");
+
+That's it.  You should now be ready to use PHPMailer!
+
+
+A Simple Example:
+
+<?php
+require(dirname(__FILE__) . "/class.phpmailer.php");
+
+$mail = new PHPMailer();
+
+$mail->IsSMTP();                                      // set mailer to use SMTP
+$mail->Host = "mail.ccgis";  // specify main and backup server
+$mail->SMTPAuth = true;     // turn on SMTP authentication
+$mail->Username = "uli.rothstein";  // SMTP username
+$mail->Password = ""; // SMTP password
+
+$mail->From = "willi at example.com";
+$mail->FromName = "MailerWilli";
+$mail->AddAddress("uli.rothstein at ccgis.de", "uli");
+#$mail->AddAddress("ellen at example.com");                  // name is optional
+$mail->AddReplyTo("info at ccgis.de", "Information");
+
+$mail->WordWrap = 50;                                 // set word wrap to 50 characters
+#$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
+#$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
+$mail->IsHTML(false);                                  // set email format to HTML
+
+$mail->Subject = "Here is the subject";
+$mail->Body    = "This is the HTML message body <b>in bold!</b>";
+$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
+
+if(!$mail->Send())
+{
+   echo "Message could not be sent. <p>";
+   echo "Mailer Error: " . $mail->ErrorInfo;
+   exit;
+}
+
+echo "Message has been sent";
+?>
+
+CHANGELOG
+
+See ChangeLog.txt
+
+Download: http://sourceforge.net/project/showfiles.php?group_id=26031
+
+Brent R. Matzelle

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/allclasses-frame.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/allclasses-frame.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/allclasses-frame.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,25 +1,25 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
-<TITLE>
-All Classes
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-<FONT size="+1" CLASS="FrameHeadingFont">
-<B>All Classes</B></FONT>
-<BR>
-
-<TABLE BORDER="0" WIDTH="100%">
-<TR>
-<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="phpmailer.html" TARGET="classFrame">phpmailer</A>
-<BR>
-</FONT></TD>
-</TR>
-</TABLE>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
+<TITLE>
+All Classes
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+<FONT size="+1" CLASS="FrameHeadingFont">
+<B>All Classes</B></FONT>
+<BR>
+
+<TABLE BORDER="0" WIDTH="100%">
+<TR>
+<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="phpmailer.html" TARGET="classFrame">phpmailer</A>
+<BR>
+</FONT></TD>
+</TR>
+</TABLE>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/deprecated-list.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/deprecated-list.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/deprecated-list.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,87 +1,87 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
-<TITLE>
-: Deprecated List
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_top"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_top_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="deprecated-list.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-<CENTER>
-<H2>
-<B>Deprecated API</B></H2>
-</CENTER>
-<HR>
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_bottom"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_bottom_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="deprecated-list.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
+<TITLE>
+: Deprecated List
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_top"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="deprecated-list.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+<CENTER>
+<H2>
+<B>Deprecated API</B></H2>
+</CENTER>
+<HR>
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="deprecated-list.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/help-doc.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/help-doc.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/help-doc.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,136 +1,136 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
-<TITLE>
-: API Help
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_top"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_top_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="help-doc.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-<CENTER>
-<H1>
-How This API Document Is Organized</H1>
-</CENTER>
-This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3>
-Package</H3>
-<BLOCKQUOTE>
-
-<P>
-Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL>
-<LI>Interfaces (italic)<LI>Classes<LI>Exceptions<LI>Errors</UL>
-</BLOCKQUOTE>
-<H3>
-Class/Interface</H3>
-<BLOCKQUOTE>
-
-<P>
-Each class, interface, inner class and inner interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL>
-<LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description
-<P>
-<LI>Inner Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary
-<P>
-<LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL>
-Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE>
-<H3>
-Tree (Class Hierarchy)</H3>
-<BLOCKQUOTE>
-There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL>
-<LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL>
-</BLOCKQUOTE>
-<H3>
-Deprecated API</H3>
-<BLOCKQUOTE>
-The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE>
-<H3>
-Index</H3>
-<BLOCKQUOTE>
-The <A HREF="index-all.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE>
-<H3>
-Prev/Next</H3>
-These links take you to the next or previous class, interface, package, or related page.<H3>
-Frames/No Frames</H3>
-These links show and hide the HTML frames.  All pages are available with or without frames.
-<P>
-<H3>
-Serialized Form</H3>
-Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
-<P>
-<FONT SIZE="-1">
-<EM>
-This help file applies to API documentation generated using the standard doclet. </EM>
-</FONT>
-<BR>
-<HR>
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_bottom"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_bottom_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="help-doc.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
+<TITLE>
+: API Help
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_top"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="help-doc.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+<CENTER>
+<H1>
+How This API Document Is Organized</H1>
+</CENTER>
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3>
+Package</H3>
+<BLOCKQUOTE>
+
+<P>
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL>
+<LI>Interfaces (italic)<LI>Classes<LI>Exceptions<LI>Errors</UL>
+</BLOCKQUOTE>
+<H3>
+Class/Interface</H3>
+<BLOCKQUOTE>
+
+<P>
+Each class, interface, inner class and inner interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL>
+<LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description
+<P>
+<LI>Inner Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary
+<P>
+<LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL>
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE>
+<H3>
+Tree (Class Hierarchy)</H3>
+<BLOCKQUOTE>
+There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL>
+<LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL>
+</BLOCKQUOTE>
+<H3>
+Deprecated API</H3>
+<BLOCKQUOTE>
+The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE>
+<H3>
+Index</H3>
+<BLOCKQUOTE>
+The <A HREF="index-all.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE>
+<H3>
+Prev/Next</H3>
+These links take you to the next or previous class, interface, package, or related page.<H3>
+Frames/No Frames</H3>
+These links show and hide the HTML frames.  All pages are available with or without frames.
+<P>
+<H3>
+Serialized Form</H3>
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+<P>
+<FONT SIZE="-1">
+<EM>
+This help file applies to API documentation generated using the standard doclet. </EM>
+</FONT>
+<BR>
+<HR>
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="help-doc.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index-all.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index-all.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index-all.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,293 +1,293 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Sat Mar 30 14:15:49 EST 2002 -->
-<TITLE>
-: Index
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_top"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_top_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="index-all.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<A HREF="#_$_">$</A> <A HREF="#_A_">A</A> <A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_G_">G</A> <A HREF="#_I_">I</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <HR>
-<A NAME="_$_"><!-- --></A><H2>
-<B>$</B></H2>
-<DL>
-<DT><A HREF="phpmailer.html#$AltBody"><B>$AltBody</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the text-only body of the message.
-<DT><A HREF="phpmailer.html#$Body"><B>$Body</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the Body of the message.
-<DT><A HREF="phpmailer.html#$CharSet"><B>$CharSet</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the CharSet of the message.
-<DT><A HREF="Boundary.html#$CharSet"><B>$CharSet</B></A> - 
-Variable in class <A HREF="Boundary.html">Boundary</A>
-<DD>Sets the Char set.
-<DT><A HREF="phpmailer.html#$ConfirmReadingTo"><B>$ConfirmReadingTo</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the email address that a reading confirmation will be sent.
-<DT><A HREF="phpmailer.html#$ContentType"><B>$ContentType</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the Content-type of the message.
-<DT><A HREF="Boundary.html#$ContentType"><B>$ContentType</B></A> - 
-Variable in class <A HREF="Boundary.html">Boundary</A>
-<DD>Sets the boundary Content Type.
-<DT><A HREF="Boundary.html#$Disposition"><B>$Disposition</B></A> - 
-Variable in class <A HREF="Boundary.html">Boundary</A>
-<DD>Sets an attachment disposition.
-<DT><A HREF="phpmailer.html#$Encoding"><B>$Encoding</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the Encoding of the message.
-<DT><A HREF="Boundary.html#$Encoding"><B>$Encoding</B></A> - 
-Variable in class <A HREF="Boundary.html">Boundary</A>
-<DD>Sets the Encoding.
-<DT><A HREF="phpmailer.html#$ErrorInfo"><B>$ErrorInfo</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Holds the most recent mailer error message.
-<DT><A HREF="Boundary.html#$FileName"><B>$FileName</B></A> - 
-Variable in class <A HREF="Boundary.html">Boundary</A>
-<DD>Sets an attachment file name.
-<DT><A HREF="phpmailer.html#$From"><B>$From</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the From email address for the message.
-<DT><A HREF="phpmailer.html#$FromName"><B>$FromName</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the From name of the message.
-<DT><A HREF="phpmailer.html#$Helo"><B>$Helo</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the SMTP HELO of the message.
-<DT><A HREF="phpmailer.html#$Host"><B>$Host</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the SMTP hosts.
-<DT><A HREF="phpmailer.html#$LE"><B>$LE</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the line endings of the message.
-<DT><A HREF="Boundary.html#$LE"><B>$LE</B></A> - 
-Variable in class <A HREF="Boundary.html">Boundary</A>
-<DD>Sets the line endings of the message.
-<DT><A HREF="phpmailer.html#$Mailer"><B>$Mailer</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Method to send mail: ("mail", "sendmail", or "smtp").
-<DT><A HREF="phpmailer.html#$Password"><B>$Password</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets SMTP password.
-<DT><A HREF="phpmailer.html#$PluginDir"><B>$PluginDir</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Path to phpmailer plugins.
-<DT><A HREF="phpmailer.html#$Port"><B>$Port</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the default SMTP server port.
-<DT><A HREF="phpmailer.html#$Priority"><B>$Priority</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Email priority (1 = High, 3 = Normal, 5 = low).
-<DT><A HREF="phpmailer.html#$Sender"><B>$Sender</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the Sender email of the message.
-<DT><A HREF="phpmailer.html#$Sendmail"><B>$Sendmail</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the path of the sendmail program.
-<DT><A HREF="phpmailer.html#$SMTPAuth"><B>$SMTPAuth</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets SMTP authentication.
-<DT><A HREF="phpmailer.html#$Subject"><B>$Subject</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets the Subject of the message.
-<DT><A HREF="phpmailer.html#$UseMSMailHeaders"><B>$UseMSMailHeaders</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Turns Microsoft mail client headers on and off.
-<DT><A HREF="phpmailer.html#$Username"><B>$Username</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets SMTP username.
-<DT><A HREF="phpmailer.html#$Version"><B>$Version</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Holds phpmailer version.
-<DT><A HREF="phpmailer.html#$WordWrap"><B>$WordWrap</B></A> - 
-Variable in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets word wrapping on the body of the message to a given number of 
- characters.
-</DL>
-<HR>
-<A NAME="_A_"><!-- --></A><H2>
-<B>A</B></H2>
-<DL>
-<DT><A HREF="phpmailer.html#AddAddress(var, var)"><B>AddAddress(var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds a "To" address.
-<DT><A HREF="phpmailer.html#AddAttachment(var, var, var, var)"><B>AddAttachment(var, var, var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds an attachment from a path on the filesystem.
-<DT><A HREF="phpmailer.html#AddBCC(var, var)"><B>AddBCC(var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds a "Bcc" address.
-<DT><A HREF="phpmailer.html#AddCC(var, var)"><B>AddCC(var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds a "Cc" address.
-<DT><A HREF="phpmailer.html#AddCustomHeader(var)"><B>AddCustomHeader(var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds a custom header.
-<DT><A HREF="phpmailer.html#AddEmbeddedImage(var, var, var, var, var)"><B>AddEmbeddedImage(var, var, var, var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds an embedded attachment.
-<DT><A HREF="phpmailer.html#AddReplyTo(var, var)"><B>AddReplyTo(var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds a "Reply-to" address.
-<DT><A HREF="phpmailer.html#AddStringAttachment(var, var, var, var)"><B>AddStringAttachment(var, var, var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Adds a string or binary attachment (non-filesystem) to the list.
-</DL>
-<HR>
-<A NAME="_B_"><!-- --></A><H2>
-<B>B</B></H2>
-<DL>
-<DT><A HREF="Boundary.html"><B>Boundary</B></A> - class <A HREF="Boundary.html">Boundary</A>.<DD>Boundary - MIME message boundary class<DT><A HREF="Boundary.html#Boundary(var)"><B>Boundary(var)</B></A> - 
-Constructor for class <A HREF="Boundary.html">Boundary</A>
-<DD>Main constructor.
-</DL>
-<HR>
-<A NAME="_C_"><!-- --></A><H2>
-<B>C</B></H2>
-<DL>
-<DT><A HREF="phpmailer.html#ClearAddresses()"><B>ClearAddresses()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Clears all recipients assigned in the TO array.
-<DT><A HREF="phpmailer.html#ClearAllRecipients()"><B>ClearAllRecipients()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Clears all recipients assigned in the TO, CC and BCC
- array.
-<DT><A HREF="phpmailer.html#ClearAttachments()"><B>ClearAttachments()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Clears all previously set filesystem, string, and binary
- attachments.
-<DT><A HREF="phpmailer.html#ClearBCCs()"><B>ClearBCCs()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Clears all recipients assigned in the BCC array.
-<DT><A HREF="phpmailer.html#ClearCCs()"><B>ClearCCs()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Clears all recipients assigned in the CC array.
-<DT><A HREF="phpmailer.html#ClearCustomHeaders()"><B>ClearCustomHeaders()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Clears all custom headers.
-<DT><A HREF="phpmailer.html#ClearReplyTos()"><B>ClearReplyTos()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Clears all recipients assigned in the ReplyTo array.
-</DL>
-<HR>
-<A NAME="_G_"><!-- --></A><H2>
-<B>G</B></H2>
-<DL>
-<DT><A HREF="Boundary.html#GetSource(var)"><B>GetSource(var)</B></A> - 
-Method in class <A HREF="Boundary.html">Boundary</A>
-<DD>Returns the source of the boundary.
-</DL>
-<HR>
-<A NAME="_I_"><!-- --></A><H2>
-<B>I</B></H2>
-<DL>
-<DT><A HREF="phpmailer.html#IsHTML(var)"><B>IsHTML(var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets message type to HTML.
-<DT><A HREF="phpmailer.html#IsMail()"><B>IsMail()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets Mailer to send message using PHP mail() function.
-<DT><A HREF="phpmailer.html#IsQmail()"><B>IsQmail()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets Mailer to send message using the qmail MTA.
-<DT><A HREF="phpmailer.html#IsSendmail()"><B>IsSendmail()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets Mailer to send message using the $Sendmail program.
-<DT><A HREF="phpmailer.html#IsSMTP()"><B>IsSMTP()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sets Mailer to send message using SMTP.
-</DL>
-<HR>
-<A NAME="_P_"><!-- --></A><H2>
-<B>P</B></H2>
-<DL>
-<DT><A HREF="phpmailer.html"><B>phpmailer</B></A> - class <A HREF="phpmailer.html">phpmailer</A>.<DD>phpmailer - PHP email transport class<DT><A HREF="phpmailer.html#phpmailer()"><B>phpmailer()</B></A> - 
-Constructor for class <A HREF="phpmailer.html">phpmailer</A>
-<DD>&nbsp;
-</DL>
-<HR>
-<A NAME="_S_"><!-- --></A><H2>
-<B>S</B></H2>
-<DL>
-<DT><A HREF="phpmailer.html#Send()"><B>Send()</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Creates message and assigns Mailer.
-<DT><A HREF="phpmailer.html#SendToQueue(var, var)"><B>SendToQueue(var, var)</B></A> - 
-Method in class <A HREF="phpmailer.html">phpmailer</A>
-<DD>Sends mail message to an assigned queue directory.
-</DL>
-<HR>
-<A HREF="#_$_">$</A> <A HREF="#_A_">A</A> <A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_G_">G</A> <A HREF="#_I_">I</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> 
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_bottom"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_bottom_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="index-all.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Sat Mar 30 14:15:49 EST 2002 -->
+<TITLE>
+: Index
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_top"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="index-all.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<A HREF="#_$_">$</A> <A HREF="#_A_">A</A> <A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_G_">G</A> <A HREF="#_I_">I</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <HR>
+<A NAME="_$_"><!-- --></A><H2>
+<B>$</B></H2>
+<DL>
+<DT><A HREF="phpmailer.html#$AltBody"><B>$AltBody</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the text-only body of the message.
+<DT><A HREF="phpmailer.html#$Body"><B>$Body</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the Body of the message.
+<DT><A HREF="phpmailer.html#$CharSet"><B>$CharSet</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the CharSet of the message.
+<DT><A HREF="Boundary.html#$CharSet"><B>$CharSet</B></A> - 
+Variable in class <A HREF="Boundary.html">Boundary</A>
+<DD>Sets the Char set.
+<DT><A HREF="phpmailer.html#$ConfirmReadingTo"><B>$ConfirmReadingTo</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the email address that a reading confirmation will be sent.
+<DT><A HREF="phpmailer.html#$ContentType"><B>$ContentType</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the Content-type of the message.
+<DT><A HREF="Boundary.html#$ContentType"><B>$ContentType</B></A> - 
+Variable in class <A HREF="Boundary.html">Boundary</A>
+<DD>Sets the boundary Content Type.
+<DT><A HREF="Boundary.html#$Disposition"><B>$Disposition</B></A> - 
+Variable in class <A HREF="Boundary.html">Boundary</A>
+<DD>Sets an attachment disposition.
+<DT><A HREF="phpmailer.html#$Encoding"><B>$Encoding</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the Encoding of the message.
+<DT><A HREF="Boundary.html#$Encoding"><B>$Encoding</B></A> - 
+Variable in class <A HREF="Boundary.html">Boundary</A>
+<DD>Sets the Encoding.
+<DT><A HREF="phpmailer.html#$ErrorInfo"><B>$ErrorInfo</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Holds the most recent mailer error message.
+<DT><A HREF="Boundary.html#$FileName"><B>$FileName</B></A> - 
+Variable in class <A HREF="Boundary.html">Boundary</A>
+<DD>Sets an attachment file name.
+<DT><A HREF="phpmailer.html#$From"><B>$From</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the From email address for the message.
+<DT><A HREF="phpmailer.html#$FromName"><B>$FromName</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the From name of the message.
+<DT><A HREF="phpmailer.html#$Helo"><B>$Helo</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the SMTP HELO of the message.
+<DT><A HREF="phpmailer.html#$Host"><B>$Host</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the SMTP hosts.
+<DT><A HREF="phpmailer.html#$LE"><B>$LE</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the line endings of the message.
+<DT><A HREF="Boundary.html#$LE"><B>$LE</B></A> - 
+Variable in class <A HREF="Boundary.html">Boundary</A>
+<DD>Sets the line endings of the message.
+<DT><A HREF="phpmailer.html#$Mailer"><B>$Mailer</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Method to send mail: ("mail", "sendmail", or "smtp").
+<DT><A HREF="phpmailer.html#$Password"><B>$Password</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets SMTP password.
+<DT><A HREF="phpmailer.html#$PluginDir"><B>$PluginDir</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Path to phpmailer plugins.
+<DT><A HREF="phpmailer.html#$Port"><B>$Port</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the default SMTP server port.
+<DT><A HREF="phpmailer.html#$Priority"><B>$Priority</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Email priority (1 = High, 3 = Normal, 5 = low).
+<DT><A HREF="phpmailer.html#$Sender"><B>$Sender</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the Sender email of the message.
+<DT><A HREF="phpmailer.html#$Sendmail"><B>$Sendmail</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the path of the sendmail program.
+<DT><A HREF="phpmailer.html#$SMTPAuth"><B>$SMTPAuth</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets SMTP authentication.
+<DT><A HREF="phpmailer.html#$Subject"><B>$Subject</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets the Subject of the message.
+<DT><A HREF="phpmailer.html#$UseMSMailHeaders"><B>$UseMSMailHeaders</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Turns Microsoft mail client headers on and off.
+<DT><A HREF="phpmailer.html#$Username"><B>$Username</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets SMTP username.
+<DT><A HREF="phpmailer.html#$Version"><B>$Version</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Holds phpmailer version.
+<DT><A HREF="phpmailer.html#$WordWrap"><B>$WordWrap</B></A> - 
+Variable in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets word wrapping on the body of the message to a given number of 
+ characters.
+</DL>
+<HR>
+<A NAME="_A_"><!-- --></A><H2>
+<B>A</B></H2>
+<DL>
+<DT><A HREF="phpmailer.html#AddAddress(var, var)"><B>AddAddress(var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds a "To" address.
+<DT><A HREF="phpmailer.html#AddAttachment(var, var, var, var)"><B>AddAttachment(var, var, var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds an attachment from a path on the filesystem.
+<DT><A HREF="phpmailer.html#AddBCC(var, var)"><B>AddBCC(var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds a "Bcc" address.
+<DT><A HREF="phpmailer.html#AddCC(var, var)"><B>AddCC(var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds a "Cc" address.
+<DT><A HREF="phpmailer.html#AddCustomHeader(var)"><B>AddCustomHeader(var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds a custom header.
+<DT><A HREF="phpmailer.html#AddEmbeddedImage(var, var, var, var, var)"><B>AddEmbeddedImage(var, var, var, var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds an embedded attachment.
+<DT><A HREF="phpmailer.html#AddReplyTo(var, var)"><B>AddReplyTo(var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds a "Reply-to" address.
+<DT><A HREF="phpmailer.html#AddStringAttachment(var, var, var, var)"><B>AddStringAttachment(var, var, var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Adds a string or binary attachment (non-filesystem) to the list.
+</DL>
+<HR>
+<A NAME="_B_"><!-- --></A><H2>
+<B>B</B></H2>
+<DL>
+<DT><A HREF="Boundary.html"><B>Boundary</B></A> - class <A HREF="Boundary.html">Boundary</A>.<DD>Boundary - MIME message boundary class<DT><A HREF="Boundary.html#Boundary(var)"><B>Boundary(var)</B></A> - 
+Constructor for class <A HREF="Boundary.html">Boundary</A>
+<DD>Main constructor.
+</DL>
+<HR>
+<A NAME="_C_"><!-- --></A><H2>
+<B>C</B></H2>
+<DL>
+<DT><A HREF="phpmailer.html#ClearAddresses()"><B>ClearAddresses()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Clears all recipients assigned in the TO array.
+<DT><A HREF="phpmailer.html#ClearAllRecipients()"><B>ClearAllRecipients()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Clears all recipients assigned in the TO, CC and BCC
+ array.
+<DT><A HREF="phpmailer.html#ClearAttachments()"><B>ClearAttachments()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Clears all previously set filesystem, string, and binary
+ attachments.
+<DT><A HREF="phpmailer.html#ClearBCCs()"><B>ClearBCCs()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Clears all recipients assigned in the BCC array.
+<DT><A HREF="phpmailer.html#ClearCCs()"><B>ClearCCs()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Clears all recipients assigned in the CC array.
+<DT><A HREF="phpmailer.html#ClearCustomHeaders()"><B>ClearCustomHeaders()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Clears all custom headers.
+<DT><A HREF="phpmailer.html#ClearReplyTos()"><B>ClearReplyTos()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Clears all recipients assigned in the ReplyTo array.
+</DL>
+<HR>
+<A NAME="_G_"><!-- --></A><H2>
+<B>G</B></H2>
+<DL>
+<DT><A HREF="Boundary.html#GetSource(var)"><B>GetSource(var)</B></A> - 
+Method in class <A HREF="Boundary.html">Boundary</A>
+<DD>Returns the source of the boundary.
+</DL>
+<HR>
+<A NAME="_I_"><!-- --></A><H2>
+<B>I</B></H2>
+<DL>
+<DT><A HREF="phpmailer.html#IsHTML(var)"><B>IsHTML(var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets message type to HTML.
+<DT><A HREF="phpmailer.html#IsMail()"><B>IsMail()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets Mailer to send message using PHP mail() function.
+<DT><A HREF="phpmailer.html#IsQmail()"><B>IsQmail()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets Mailer to send message using the qmail MTA.
+<DT><A HREF="phpmailer.html#IsSendmail()"><B>IsSendmail()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets Mailer to send message using the $Sendmail program.
+<DT><A HREF="phpmailer.html#IsSMTP()"><B>IsSMTP()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sets Mailer to send message using SMTP.
+</DL>
+<HR>
+<A NAME="_P_"><!-- --></A><H2>
+<B>P</B></H2>
+<DL>
+<DT><A HREF="phpmailer.html"><B>phpmailer</B></A> - class <A HREF="phpmailer.html">phpmailer</A>.<DD>phpmailer - PHP email transport class<DT><A HREF="phpmailer.html#phpmailer()"><B>phpmailer()</B></A> - 
+Constructor for class <A HREF="phpmailer.html">phpmailer</A>
+<DD>&nbsp;
+</DL>
+<HR>
+<A NAME="_S_"><!-- --></A><H2>
+<B>S</B></H2>
+<DL>
+<DT><A HREF="phpmailer.html#Send()"><B>Send()</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Creates message and assigns Mailer.
+<DT><A HREF="phpmailer.html#SendToQueue(var, var)"><B>SendToQueue(var, var)</B></A> - 
+Method in class <A HREF="phpmailer.html">phpmailer</A>
+<DD>Sends mail message to an assigned queue directory.
+</DL>
+<HR>
+<A HREF="#_$_">$</A> <A HREF="#_A_">A</A> <A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_G_">G</A> <A HREF="#_I_">I</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> 
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="index-all.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/index.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,22 +1,22 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd>
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001-->
-<TITLE>
-Generated Documentation (Untitled)
-</TITLE>
-</HEAD>
-<FRAMESET cols="20%,80%">
-<FRAME src="allclasses-frame.html" name="packageFrame">
-<FRAME src="phpmailer.html" name="classFrame">
-</FRAMESET>
-<NOFRAMES>
-<H2>
-Frame Alert</H2>
-
-<P>
-This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
-<BR>
-Link to <A HREF="phpmailer.html">Non-frame version.</A></NOFRAMES>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd>
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001-->
+<TITLE>
+Generated Documentation (Untitled)
+</TITLE>
+</HEAD>
+<FRAMESET cols="20%,80%">
+<FRAME src="allclasses-frame.html" name="packageFrame">
+<FRAME src="phpmailer.html" name="classFrame">
+</FRAMESET>
+<NOFRAMES>
+<H2>
+Frame Alert</H2>
+
+<P>
+This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
+<BR>
+Link to <A HREF="phpmailer.html">Non-frame version.</A></NOFRAMES>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/overview-tree.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/overview-tree.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/overview-tree.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,92 +1,92 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
-<TITLE>
-: Class Hierarchy
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_top"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_top_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="overview-tree.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-<CENTER>
-<H2>
-Hierarchy For All Packages</H2>
-</CENTER>
-<H2>
-Class Hierarchy
-</H2>
-<UL>
-<LI TYPE="circle">class <A HREF="phpmailer.html"><B>phpmailer</B></A></UL>
-<HR>
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_bottom"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_bottom_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="overview-tree.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
+<TITLE>
+: Class Hierarchy
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_top"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="overview-tree.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+<CENTER>
+<H2>
+Hierarchy For All Packages</H2>
+</CENTER>
+<H2>
+Class Hierarchy
+</H2>
+<UL>
+<LI TYPE="circle">class <A HREF="phpmailer.html"><B>phpmailer</B></A></UL>
+<HR>
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="overview-tree.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/packages.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/packages.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/packages.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,26 +1,26 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
-<TITLE>
-
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-
-<BR>
-
-<BR>
-
-<BR>
-<CENTER>
-The front page has been relocated.Please see:
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="index.html">Frame version</A>
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="phpmailer.html">Non-frame version.</A></CENTER>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
+<TITLE>
+
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+
+<BR>
+
+<BR>
+
+<BR>
+<CENTER>
+The front page has been relocated.Please see:
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="index.html">Frame version</A>
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="phpmailer.html">Non-frame version.</A></CENTER>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/phpmailer.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/phpmailer.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/phpmailer.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,1043 +1,1043 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Sat Mar 30 14:15:49 EST 2002 -->
-<TITLE>
-: Class  phpmailer
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_top"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_top_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;<A HREF="Boundary.html"><B>PREV CLASS</B></A>&nbsp;
-&nbsp;NEXT CLASS</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="phpmailer.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-<TR>
-<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
-  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
-<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
-DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-<!-- ======== START OF CLASS DATA ======== -->
-<H2>
-Class  phpmailer</H2>
-<PRE>
-<B>phpmailer</B>
-</PRE>
-<HR>
-<DL>
-<DT>public class <B>phpmailer</B></DL>
-
-<P>
-phpmailer - PHP email transport class
-<P>
-<HR>
-
-<P>
-<!-- ======== INNER CLASS SUMMARY ======== -->
-
-
-<!-- =========== FIELD SUMMARY =========== -->
-
-<A NAME="field_summary"><!-- --></A>
-<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
-<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
-<TD COLSPAN=2><FONT SIZE="+2">
-<B>Field Summary</B></FONT></TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$AltBody">$AltBody</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the text-only body of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Body">$Body</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Body of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$CharSet">$CharSet</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the CharSet of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$ConfirmReadingTo">$ConfirmReadingTo</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the email address that a reading confirmation will be sent.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$ContentType">$ContentType</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Content-type of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Encoding">$Encoding</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Encoding of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$ErrorInfo">$ErrorInfo</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Holds the most recent mailer error message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$From">$From</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the From email address for the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$FromName">$FromName</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the From name of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Helo">$Helo</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the SMTP HELO of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Host">$Host</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the SMTP hosts.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$LE">$LE</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the line endings of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Mailer">$Mailer</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method to send mail: ("mail", "sendmail", or "smtp").</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Password">$Password</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets SMTP password.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$PluginDir">$PluginDir</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Path to phpmailer plugins.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;int</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Port">$Port</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the default SMTP server port.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;int</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Priority">$Priority</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Email priority (1 = High, 3 = Normal, 5 = low).</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Sender">$Sender</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Sender email of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Sendmail">$Sendmail</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the path of the sendmail program.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;bool</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$SMTPAuth">$SMTPAuth</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets SMTP authentication.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Subject">$Subject</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Subject of the message.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;bool</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$UseMSMailHeaders">$UseMSMailHeaders</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Turns Microsoft mail client headers on and off.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Username">$Username</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets SMTP username.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$Version">$Version</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Holds phpmailer version.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;int</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#$WordWrap">$WordWrap</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets word wrapping on the body of the message to a given number of 
- characters.</TD>
-</TR>
-</TABLE>
-&nbsp;
-<!-- ======== CONSTRUCTOR SUMMARY ======== -->
-
-<A NAME="constructor_summary"><!-- --></A>
-<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
-<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
-<TD COLSPAN=2><FONT SIZE="+2">
-<B>Constructor Summary</B></FONT></TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD><CODE><B><A HREF="phpmailer.html#phpmailer()">phpmailer</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
-</TR>
-</TABLE>
-&nbsp;
-<!-- ========== METHOD SUMMARY =========== -->
-
-<A NAME="method_summary"><!-- --></A>
-<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
-<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
-<TD COLSPAN=2><FONT SIZE="+2">
-<B>Method Summary</B></FONT></TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddAddress(var, var)">AddAddress</A></B>(var&nbsp;$address,
-           var&nbsp;$name)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "To" address.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;bool</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddAttachment(var, var, var, var)">AddAttachment</A></B>(var&nbsp;$path,
-              var&nbsp;$name,
-              var&nbsp;$encoding,
-              var&nbsp;$type)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds an attachment from a path on the filesystem.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddBCC(var, var)">AddBCC</A></B>(var&nbsp;$address,
-       var&nbsp;$name)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "Bcc" address.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddCC(var, var)">AddCC</A></B>(var&nbsp;$address,
-      var&nbsp;$name)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "Cc" address.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddCustomHeader(var)">AddCustomHeader</A></B>(var&nbsp;$custom_header)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a custom header.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;bool</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddEmbeddedImage(var, var, var, var, var)">AddEmbeddedImage</A></B>(var&nbsp;$path,
-                 var&nbsp;$cid,
-                 var&nbsp;$name,
-                 var&nbsp;$encoding,
-                 var&nbsp;$type)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds an embedded attachment.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddReplyTo(var, var)">AddReplyTo</A></B>(var&nbsp;$address,
-           var&nbsp;$name)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "Reply-to" address.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#AddStringAttachment(var, var, var, var)">AddStringAttachment</A></B>(var&nbsp;$string,
-                    var&nbsp;$filename,
-                    var&nbsp;$encoding,
-                    var&nbsp;$type)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a string or binary attachment (non-filesystem) to the list.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#ClearAddresses()">ClearAddresses</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the TO array.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#ClearAllRecipients()">ClearAllRecipients</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the TO, CC and BCC
- array.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#ClearAttachments()">ClearAttachments</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all previously set filesystem, string, and binary
- attachments.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#ClearBCCs()">ClearBCCs</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the BCC array.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#ClearCCs()">ClearCCs</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the CC array.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#ClearCustomHeaders()">ClearCustomHeaders</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all custom headers.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#ClearReplyTos()">ClearReplyTos</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the ReplyTo array.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#IsHTML(var)">IsHTML</A></B>(var&nbsp;$bool)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets message type to HTML.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#IsMail()">IsMail</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using PHP mail() function.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#IsQmail()">IsQmail</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using the qmail MTA.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#IsSendmail()">IsSendmail</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using the $Sendmail program.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;void</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#IsSMTP()">IsSMTP</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using SMTP.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;bool</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#Send()">Send</A></B>()</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates message and assigns Mailer.</TD>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;string</CODE></FONT></TD>
-<TD><CODE><B><A HREF="phpmailer.html#SendToQueue(var, var)">SendToQueue</A></B>(var&nbsp;$queue_path,
-            var&nbsp;$send_time)</CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sends mail message to an assigned queue directory.</TD>
-</TR>
-</TABLE>
-&nbsp;
-<P>
-
-<!-- ============ FIELD DETAIL =========== -->
-
-<A NAME="field_detail"><!-- --></A>
-<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
-<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
-<TD COLSPAN=1><FONT SIZE="+2">
-<B>Field Detail</B></FONT></TD>
-</TR>
-</TABLE>
-
-<A NAME="$Priority"><!-- --></A><H3>
-$Priority</H3>
-<PRE>
-public int <B>$Priority</B></PRE>
-<DL>
-<DD>Email priority (1 = High, 3 = Normal, 5 = low). Default value is 3.</DL>
-<HR>
-
-<A NAME="$CharSet"><!-- --></A><H3>
-$CharSet</H3>
-<PRE>
-public string <B>$CharSet</B></PRE>
-<DL>
-<DD>Sets the CharSet of the message. Default value is "iso-8859-1".</DL>
-<HR>
-
-<A NAME="$ContentType"><!-- --></A><H3>
-$ContentType</H3>
-<PRE>
-public string <B>$ContentType</B></PRE>
-<DL>
-<DD>Sets the Content-type of the message. Default value is "text/plain".</DL>
-<HR>
-
-<A NAME="$Encoding"><!-- --></A><H3>
-$Encoding</H3>
-<PRE>
-public string <B>$Encoding</B></PRE>
-<DL>
-<DD>Sets the Encoding of the message. Options for this are "8bit" (default),
- "7bit", "binary", "base64", and "quoted-printable".</DL>
-<HR>
-
-<A NAME="$ErrorInfo"><!-- --></A><H3>
-$ErrorInfo</H3>
-<PRE>
-public string <B>$ErrorInfo</B></PRE>
-<DL>
-<DD>Holds the most recent mailer error message. Default value is "".</DL>
-<HR>
-
-<A NAME="$From"><!-- --></A><H3>
-$From</H3>
-<PRE>
-public string <B>$From</B></PRE>
-<DL>
-<DD>Sets the From email address for the message. Default value is "root at localhost".</DL>
-<HR>
-
-<A NAME="$FromName"><!-- --></A><H3>
-$FromName</H3>
-<PRE>
-public string <B>$FromName</B></PRE>
-<DL>
-<DD>Sets the From name of the message. Default value is "Root User".</DL>
-<HR>
-
-<A NAME="$Sender"><!-- --></A><H3>
-$Sender</H3>
-<PRE>
-public string <B>$Sender</B></PRE>
-<DL>
-<DD>Sets the Sender email of the message. If not empty, will be sent via -f to sendmail
- or as 'MAIL FROM' in smtp mode. Default value is "".</DL>
-<HR>
-
-<A NAME="$Subject"><!-- --></A><H3>
-$Subject</H3>
-<PRE>
-public string <B>$Subject</B></PRE>
-<DL>
-<DD>Sets the Subject of the message. Default value is "".</DL>
-<HR>
-
-<A NAME="$Body"><!-- --></A><H3>
-$Body</H3>
-<PRE>
-public string <B>$Body</B></PRE>
-<DL>
-<DD>Sets the Body of the message.  This can be either an HTML or text body.
- If HTML then run IsHTML(true). Default value is "".</DL>
-<HR>
-
-<A NAME="$AltBody"><!-- --></A><H3>
-$AltBody</H3>
-<PRE>
-public string <B>$AltBody</B></PRE>
-<DL>
-<DD>Sets the text-only body of the message.  This automatically sets the
- email to multipart/alternative.  This body can be read by mail
- clients that do not have HTML email capability such as mutt. Clients
- that can read HTML will view the normal Body.
- Default value is "".</DL>
-<HR>
-
-<A NAME="$WordWrap"><!-- --></A><H3>
-$WordWrap</H3>
-<PRE>
-public int <B>$WordWrap</B></PRE>
-<DL>
-<DD>Sets word wrapping on the body of the message to a given number of 
- characters. Default value is 0 (off).</DL>
-<HR>
-
-<A NAME="$Mailer"><!-- --></A><H3>
-$Mailer</H3>
-<PRE>
-public string <B>$Mailer</B></PRE>
-<DL>
-<DD>Method to send mail: ("mail", "sendmail", or "smtp").
- Default value is "mail".</DL>
-<HR>
-
-<A NAME="$Sendmail"><!-- --></A><H3>
-$Sendmail</H3>
-<PRE>
-public string <B>$Sendmail</B></PRE>
-<DL>
-<DD>Sets the path of the sendmail program. Default value is
- "/usr/sbin/sendmail".</DL>
-<HR>
-
-<A NAME="$UseMSMailHeaders"><!-- --></A><H3>
-$UseMSMailHeaders</H3>
-<PRE>
-public bool <B>$UseMSMailHeaders</B></PRE>
-<DL>
-<DD>Turns Microsoft mail client headers on and off.  Useful mostly
-  for older clients. Default value is false (off).</DL>
-<HR>
-
-<A NAME="$PluginDir"><!-- --></A><H3>
-$PluginDir</H3>
-<PRE>
-public string <B>$PluginDir</B></PRE>
-<DL>
-<DD>Path to phpmailer plugins.  This is now only useful if the SMTP class 
- is in a different directory than the PHP include path.  
- Default is empty ("").</DL>
-<HR>
-
-<A NAME="$Version"><!-- --></A><H3>
-$Version</H3>
-<PRE>
-public string <B>$Version</B></PRE>
-<DL>
-<DD>Holds phpmailer version.</DL>
-<HR>
-
-<A NAME="$ConfirmReadingTo"><!-- --></A><H3>
-$ConfirmReadingTo</H3>
-<PRE>
-public string <B>$ConfirmReadingTo</B></PRE>
-<DL>
-<DD>Sets the email address that a reading confirmation will be sent. Default value is "".</DL>
-<HR>
-
-<A NAME="$LE"><!-- --></A><H3>
-$LE</H3>
-<PRE>
-public string <B>$LE</B></PRE>
-<DL>
-<DD>Sets the line endings of the message.  Default is "\n";</DL>
-<HR>
-
-<A NAME="$Host"><!-- --></A><H3>
-$Host</H3>
-<PRE>
-public string <B>$Host</B></PRE>
-<DL>
-<DD>Sets the SMTP hosts.  All hosts must be separated by a
-  semicolon.  You can also specify a different port
-  for each host by using this format: [hostname:port]
-  (e.g. "smtp1.domain.com:25;smtp2.domain.com").
-  Hosts will be tried in order.
-  Default value is "localhost".</DL>
-<HR>
-
-<A NAME="$Port"><!-- --></A><H3>
-$Port</H3>
-<PRE>
-public int <B>$Port</B></PRE>
-<DL>
-<DD>Sets the default SMTP server port. Default value is 25.</DL>
-<HR>
-
-<A NAME="$Helo"><!-- --></A><H3>
-$Helo</H3>
-<PRE>
-public string <B>$Helo</B></PRE>
-<DL>
-<DD>Sets the SMTP HELO of the message.
-  Default value is "localhost.localdomain".</DL>
-<HR>
-
-<A NAME="$SMTPAuth"><!-- --></A><H3>
-$SMTPAuth</H3>
-<PRE>
-public bool <B>$SMTPAuth</B></PRE>
-<DL>
-<DD>Sets SMTP authentication. Utilizes the Username and Password variables.
-  Default value is false (off).</DL>
-<HR>
-
-<A NAME="$Username"><!-- --></A><H3>
-$Username</H3>
-<PRE>
-public string <B>$Username</B></PRE>
-<DL>
-<DD>Sets SMTP username. Default value is "".</DL>
-<HR>
-
-<A NAME="$Password"><!-- --></A><H3>
-$Password</H3>
-<PRE>
-public string <B>$Password</B></PRE>
-<DL>
-<DD>Sets SMTP password. Default value is "".</DL>
-
-<!-- ========= CONSTRUCTOR DETAIL ======== -->
-
-<A NAME="constructor_detail"><!-- --></A>
-<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
-<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
-<TD COLSPAN=1><FONT SIZE="+2">
-<B>Constructor Detail</B></FONT></TD>
-</TR>
-</TABLE>
-
-<A NAME="phpmailer()"><!-- --></A><H3>
-phpmailer</H3>
-<PRE>
-public <B>phpmailer</B>()</PRE>
-<DL>
-</DL>
-
-<!-- ============ METHOD DETAIL ========== -->
-
-<A NAME="method_detail"><!-- --></A>
-<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
-<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
-<TD COLSPAN=1><FONT SIZE="+2">
-<B>Method Detail</B></FONT></TD>
-</TR>
-</TABLE>
-
-<A NAME="IsHTML(var)"><!-- --></A><H3>
-IsHTML</H3>
-<PRE>
-public void <B>IsHTML</B>(var&nbsp;$bool)</PRE>
-<DL>
-<DD>Sets message type to HTML.  Returns void.</DL>
-<HR>
-
-<A NAME="IsSMTP()"><!-- --></A><H3>
-IsSMTP</H3>
-<PRE>
-public void <B>IsSMTP</B>()</PRE>
-<DL>
-<DD>Sets Mailer to send message using SMTP.
- Returns void.</DL>
-<HR>
-
-<A NAME="IsMail()"><!-- --></A><H3>
-IsMail</H3>
-<PRE>
-public void <B>IsMail</B>()</PRE>
-<DL>
-<DD>Sets Mailer to send message using PHP mail() function.
- Returns void.</DL>
-<HR>
-
-<A NAME="IsSendmail()"><!-- --></A><H3>
-IsSendmail</H3>
-<PRE>
-public void <B>IsSendmail</B>()</PRE>
-<DL>
-<DD>Sets Mailer to send message using the $Sendmail program.
- Returns void.</DL>
-<HR>
-
-<A NAME="IsQmail()"><!-- --></A><H3>
-IsQmail</H3>
-<PRE>
-public void <B>IsQmail</B>()</PRE>
-<DL>
-<DD>Sets Mailer to send message using the qmail MTA.  Returns void.</DL>
-<HR>
-
-<A NAME="AddAddress(var, var)"><!-- --></A><H3>
-AddAddress</H3>
-<PRE>
-public void <B>AddAddress</B>(var&nbsp;$address,
-                       var&nbsp;$name)</PRE>
-<DL>
-<DD>Adds a "To" address.  Returns void.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="AddCC(var, var)"><!-- --></A><H3>
-AddCC</H3>
-<PRE>
-public void <B>AddCC</B>(var&nbsp;$address,
-                  var&nbsp;$name)</PRE>
-<DL>
-<DD>Adds a "Cc" address. Note: this function works
- with the SMTP mailer on win32, not with the "mail"
- mailer.  This is a PHP bug that has been submitted
- on http:     * functions correctly. Returns void.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="AddBCC(var, var)"><!-- --></A><H3>
-AddBCC</H3>
-<PRE>
-public void <B>AddBCC</B>(var&nbsp;$address,
-                   var&nbsp;$name)</PRE>
-<DL>
-<DD>Adds a "Bcc" address. Note: this function works
- with the SMTP mailer on win32, not with the "mail"
- mailer.  This is a PHP bug that has been submitted
- on http:     * functions correctly.
- Returns void.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="AddReplyTo(var, var)"><!-- --></A><H3>
-AddReplyTo</H3>
-<PRE>
-public void <B>AddReplyTo</B>(var&nbsp;$address,
-                       var&nbsp;$name)</PRE>
-<DL>
-<DD>Adds a "Reply-to" address.  Returns void.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="Send()"><!-- --></A><H3>
-Send</H3>
-<PRE>
-public bool <B>Send</B>()</PRE>
-<DL>
-<DD>Creates message and assigns Mailer. If the message is
- not sent successfully then it returns false.  Use the ErrorInfo
- variable to view description of the error.  Returns bool.</DL>
-<HR>
-
-<A NAME="SendToQueue(var, var)"><!-- --></A><H3>
-SendToQueue</H3>
-<PRE>
-public string <B>SendToQueue</B>(var&nbsp;$queue_path,
-                          var&nbsp;$send_time)</PRE>
-<DL>
-<DD>Sends mail message to an assigned queue directory.  Has an optional 
- sendTime argument.  This is used when the user wants the 
- message to be sent from the queue at a predetermined time. 
- The data must be a valid timestamp like that returned from 
- the time() or strtotime() functions.  Returns false on failure 
- or the message file name if success.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>$send_time</CODE> - <b>Default Value</b>: 0</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="AddAttachment(var, var, var, var)"><!-- --></A><H3>
-AddAttachment</H3>
-<PRE>
-public bool <B>AddAttachment</B>(var&nbsp;$path,
-                          var&nbsp;$name,
-                          var&nbsp;$encoding,
-                          var&nbsp;$type)</PRE>
-<DL>
-<DD>Adds an attachment from a path on the filesystem.
- Checks if attachment is valid and then adds
- the attachment to the list.
- Returns false if the file could not be found
- or accessed.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""<DD><CODE>$encoding</CODE> - <b>Default Value</b>: "base64"<DD><CODE>$type</CODE> - <b>Default Value</b>: "application/octet-stream"</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="AddStringAttachment(var, var, var, var)"><!-- --></A><H3>
-AddStringAttachment</H3>
-<PRE>
-public void <B>AddStringAttachment</B>(var&nbsp;$string,
-                                var&nbsp;$filename,
-                                var&nbsp;$encoding,
-                                var&nbsp;$type)</PRE>
-<DL>
-<DD>Adds a string or binary attachment (non-filesystem) to the list.
- This method can be used to attach ascii or binary data,
- such as a BLOB record from a database.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>$encoding</CODE> - <b>Default Value</b>: "base64"<DD><CODE>$type</CODE> - <b>Default Value</b>: "application/octet-stream"</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="AddEmbeddedImage(var, var, var, var, var)"><!-- --></A><H3>
-AddEmbeddedImage</H3>
-<PRE>
-public bool <B>AddEmbeddedImage</B>(var&nbsp;$path,
-                             var&nbsp;$cid,
-                             var&nbsp;$name,
-                             var&nbsp;$encoding,
-                             var&nbsp;$type)</PRE>
-<DL>
-<DD>Adds an embedded attachment.  This can include images, sounds, and 
- just about any other document.<DD><DL>
-<DT><B>Parameters:</B><DD><CODE>cid</CODE> - this is the Content Id of the attachment.  Use this to identify
-        the Id for accessing the image in an HTML form.<DD><CODE>$name</CODE> - <b>Default Value</b>: ""<DD><CODE>$encoding</CODE> - <b>Default Value</b>: "base64"<DD><CODE>$type</CODE> - <b>Default Value</b>: "application/octet-stream"</DL>
-</DD>
-</DL>
-<HR>
-
-<A NAME="ClearAddresses()"><!-- --></A><H3>
-ClearAddresses</H3>
-<PRE>
-public void <B>ClearAddresses</B>()</PRE>
-<DL>
-<DD>Clears all recipients assigned in the TO array.  Returns void.</DL>
-<HR>
-
-<A NAME="ClearCCs()"><!-- --></A><H3>
-ClearCCs</H3>
-<PRE>
-public void <B>ClearCCs</B>()</PRE>
-<DL>
-<DD>Clears all recipients assigned in the CC array.  Returns void.</DL>
-<HR>
-
-<A NAME="ClearBCCs()"><!-- --></A><H3>
-ClearBCCs</H3>
-<PRE>
-public void <B>ClearBCCs</B>()</PRE>
-<DL>
-<DD>Clears all recipients assigned in the BCC array.  Returns void.</DL>
-<HR>
-
-<A NAME="ClearReplyTos()"><!-- --></A><H3>
-ClearReplyTos</H3>
-<PRE>
-public void <B>ClearReplyTos</B>()</PRE>
-<DL>
-<DD>Clears all recipients assigned in the ReplyTo array.  Returns void.</DL>
-<HR>
-
-<A NAME="ClearAllRecipients()"><!-- --></A><H3>
-ClearAllRecipients</H3>
-<PRE>
-public void <B>ClearAllRecipients</B>()</PRE>
-<DL>
-<DD>Clears all recipients assigned in the TO, CC and BCC
- array.  Returns void.</DL>
-<HR>
-
-<A NAME="ClearAttachments()"><!-- --></A><H3>
-ClearAttachments</H3>
-<PRE>
-public void <B>ClearAttachments</B>()</PRE>
-<DL>
-<DD>Clears all previously set filesystem, string, and binary
- attachments.  Returns void.</DL>
-<HR>
-
-<A NAME="ClearCustomHeaders()"><!-- --></A><H3>
-ClearCustomHeaders</H3>
-<PRE>
-public void <B>ClearCustomHeaders</B>()</PRE>
-<DL>
-<DD>Clears all custom headers.  Returns void.</DL>
-<HR>
-
-<A NAME="AddCustomHeader(var)"><!-- --></A><H3>
-AddCustomHeader</H3>
-<PRE>
-public void <B>AddCustomHeader</B>(var&nbsp;$custom_header)</PRE>
-<DL>
-<DD>Adds a custom header.  Returns void.</DL>
-<!-- ========= END OF CLASS DATA ========= -->
-<HR>
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_bottom"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_bottom_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;<A HREF="Boundary.html"><B>PREV CLASS</B></A>&nbsp;
-&nbsp;NEXT CLASS</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="phpmailer.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-<TR>
-<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
-  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
-<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
-DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Sat Mar 30 14:15:49 EST 2002 -->
+<TITLE>
+: Class  phpmailer
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_top"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;<A HREF="Boundary.html"><B>PREV CLASS</B></A>&nbsp;
+&nbsp;NEXT CLASS</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="phpmailer.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+Class  phpmailer</H2>
+<PRE>
+<B>phpmailer</B>
+</PRE>
+<HR>
+<DL>
+<DT>public class <B>phpmailer</B></DL>
+
+<P>
+phpmailer - PHP email transport class
+<P>
+<HR>
+
+<P>
+<!-- ======== INNER CLASS SUMMARY ======== -->
+
+
+<!-- =========== FIELD SUMMARY =========== -->
+
+<A NAME="field_summary"><!-- --></A>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=2><FONT SIZE="+2">
+<B>Field Summary</B></FONT></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$AltBody">$AltBody</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the text-only body of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Body">$Body</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Body of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$CharSet">$CharSet</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the CharSet of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$ConfirmReadingTo">$ConfirmReadingTo</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the email address that a reading confirmation will be sent.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$ContentType">$ContentType</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Content-type of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Encoding">$Encoding</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Encoding of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$ErrorInfo">$ErrorInfo</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Holds the most recent mailer error message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$From">$From</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the From email address for the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$FromName">$FromName</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the From name of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Helo">$Helo</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the SMTP HELO of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Host">$Host</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the SMTP hosts.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$LE">$LE</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the line endings of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Mailer">$Mailer</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method to send mail: ("mail", "sendmail", or "smtp").</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Password">$Password</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets SMTP password.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$PluginDir">$PluginDir</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Path to phpmailer plugins.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Port">$Port</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the default SMTP server port.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Priority">$Priority</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Email priority (1 = High, 3 = Normal, 5 = low).</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Sender">$Sender</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Sender email of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Sendmail">$Sendmail</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the path of the sendmail program.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;bool</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$SMTPAuth">$SMTPAuth</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets SMTP authentication.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Subject">$Subject</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the Subject of the message.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;bool</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$UseMSMailHeaders">$UseMSMailHeaders</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Turns Microsoft mail client headers on and off.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Username">$Username</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets SMTP username.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$Version">$Version</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Holds phpmailer version.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#$WordWrap">$WordWrap</A></B></CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets word wrapping on the body of the message to a given number of 
+ characters.</TD>
+</TR>
+</TABLE>
+&nbsp;
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=2><FONT SIZE="+2">
+<B>Constructor Summary</B></FONT></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="phpmailer.html#phpmailer()">phpmailer</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
+</TR>
+</TABLE>
+&nbsp;
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=2><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddAddress(var, var)">AddAddress</A></B>(var&nbsp;$address,
+           var&nbsp;$name)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "To" address.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;bool</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddAttachment(var, var, var, var)">AddAttachment</A></B>(var&nbsp;$path,
+              var&nbsp;$name,
+              var&nbsp;$encoding,
+              var&nbsp;$type)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds an attachment from a path on the filesystem.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddBCC(var, var)">AddBCC</A></B>(var&nbsp;$address,
+       var&nbsp;$name)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "Bcc" address.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddCC(var, var)">AddCC</A></B>(var&nbsp;$address,
+      var&nbsp;$name)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "Cc" address.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddCustomHeader(var)">AddCustomHeader</A></B>(var&nbsp;$custom_header)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a custom header.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;bool</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddEmbeddedImage(var, var, var, var, var)">AddEmbeddedImage</A></B>(var&nbsp;$path,
+                 var&nbsp;$cid,
+                 var&nbsp;$name,
+                 var&nbsp;$encoding,
+                 var&nbsp;$type)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds an embedded attachment.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddReplyTo(var, var)">AddReplyTo</A></B>(var&nbsp;$address,
+           var&nbsp;$name)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a "Reply-to" address.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#AddStringAttachment(var, var, var, var)">AddStringAttachment</A></B>(var&nbsp;$string,
+                    var&nbsp;$filename,
+                    var&nbsp;$encoding,
+                    var&nbsp;$type)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a string or binary attachment (non-filesystem) to the list.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#ClearAddresses()">ClearAddresses</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the TO array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#ClearAllRecipients()">ClearAllRecipients</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the TO, CC and BCC
+ array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#ClearAttachments()">ClearAttachments</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all previously set filesystem, string, and binary
+ attachments.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#ClearBCCs()">ClearBCCs</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the BCC array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#ClearCCs()">ClearCCs</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the CC array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#ClearCustomHeaders()">ClearCustomHeaders</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all custom headers.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#ClearReplyTos()">ClearReplyTos</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all recipients assigned in the ReplyTo array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#IsHTML(var)">IsHTML</A></B>(var&nbsp;$bool)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets message type to HTML.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#IsMail()">IsMail</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using PHP mail() function.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#IsQmail()">IsQmail</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using the qmail MTA.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#IsSendmail()">IsSendmail</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using the $Sendmail program.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#IsSMTP()">IsSMTP</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets Mailer to send message using SMTP.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;bool</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#Send()">Send</A></B>()</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates message and assigns Mailer.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>&nbsp;string</CODE></FONT></TD>
+<TD><CODE><B><A HREF="phpmailer.html#SendToQueue(var, var)">SendToQueue</A></B>(var&nbsp;$queue_path,
+            var&nbsp;$send_time)</CODE>
+
+<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sends mail message to an assigned queue directory.</TD>
+</TR>
+</TABLE>
+&nbsp;
+<P>
+
+<!-- ============ FIELD DETAIL =========== -->
+
+<A NAME="field_detail"><!-- --></A>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=1><FONT SIZE="+2">
+<B>Field Detail</B></FONT></TD>
+</TR>
+</TABLE>
+
+<A NAME="$Priority"><!-- --></A><H3>
+$Priority</H3>
+<PRE>
+public int <B>$Priority</B></PRE>
+<DL>
+<DD>Email priority (1 = High, 3 = Normal, 5 = low). Default value is 3.</DL>
+<HR>
+
+<A NAME="$CharSet"><!-- --></A><H3>
+$CharSet</H3>
+<PRE>
+public string <B>$CharSet</B></PRE>
+<DL>
+<DD>Sets the CharSet of the message. Default value is "iso-8859-1".</DL>
+<HR>
+
+<A NAME="$ContentType"><!-- --></A><H3>
+$ContentType</H3>
+<PRE>
+public string <B>$ContentType</B></PRE>
+<DL>
+<DD>Sets the Content-type of the message. Default value is "text/plain".</DL>
+<HR>
+
+<A NAME="$Encoding"><!-- --></A><H3>
+$Encoding</H3>
+<PRE>
+public string <B>$Encoding</B></PRE>
+<DL>
+<DD>Sets the Encoding of the message. Options for this are "8bit" (default),
+ "7bit", "binary", "base64", and "quoted-printable".</DL>
+<HR>
+
+<A NAME="$ErrorInfo"><!-- --></A><H3>
+$ErrorInfo</H3>
+<PRE>
+public string <B>$ErrorInfo</B></PRE>
+<DL>
+<DD>Holds the most recent mailer error message. Default value is "".</DL>
+<HR>
+
+<A NAME="$From"><!-- --></A><H3>
+$From</H3>
+<PRE>
+public string <B>$From</B></PRE>
+<DL>
+<DD>Sets the From email address for the message. Default value is "root at localhost".</DL>
+<HR>
+
+<A NAME="$FromName"><!-- --></A><H3>
+$FromName</H3>
+<PRE>
+public string <B>$FromName</B></PRE>
+<DL>
+<DD>Sets the From name of the message. Default value is "Root User".</DL>
+<HR>
+
+<A NAME="$Sender"><!-- --></A><H3>
+$Sender</H3>
+<PRE>
+public string <B>$Sender</B></PRE>
+<DL>
+<DD>Sets the Sender email of the message. If not empty, will be sent via -f to sendmail
+ or as 'MAIL FROM' in smtp mode. Default value is "".</DL>
+<HR>
+
+<A NAME="$Subject"><!-- --></A><H3>
+$Subject</H3>
+<PRE>
+public string <B>$Subject</B></PRE>
+<DL>
+<DD>Sets the Subject of the message. Default value is "".</DL>
+<HR>
+
+<A NAME="$Body"><!-- --></A><H3>
+$Body</H3>
+<PRE>
+public string <B>$Body</B></PRE>
+<DL>
+<DD>Sets the Body of the message.  This can be either an HTML or text body.
+ If HTML then run IsHTML(true). Default value is "".</DL>
+<HR>
+
+<A NAME="$AltBody"><!-- --></A><H3>
+$AltBody</H3>
+<PRE>
+public string <B>$AltBody</B></PRE>
+<DL>
+<DD>Sets the text-only body of the message.  This automatically sets the
+ email to multipart/alternative.  This body can be read by mail
+ clients that do not have HTML email capability such as mutt. Clients
+ that can read HTML will view the normal Body.
+ Default value is "".</DL>
+<HR>
+
+<A NAME="$WordWrap"><!-- --></A><H3>
+$WordWrap</H3>
+<PRE>
+public int <B>$WordWrap</B></PRE>
+<DL>
+<DD>Sets word wrapping on the body of the message to a given number of 
+ characters. Default value is 0 (off).</DL>
+<HR>
+
+<A NAME="$Mailer"><!-- --></A><H3>
+$Mailer</H3>
+<PRE>
+public string <B>$Mailer</B></PRE>
+<DL>
+<DD>Method to send mail: ("mail", "sendmail", or "smtp").
+ Default value is "mail".</DL>
+<HR>
+
+<A NAME="$Sendmail"><!-- --></A><H3>
+$Sendmail</H3>
+<PRE>
+public string <B>$Sendmail</B></PRE>
+<DL>
+<DD>Sets the path of the sendmail program. Default value is
+ "/usr/sbin/sendmail".</DL>
+<HR>
+
+<A NAME="$UseMSMailHeaders"><!-- --></A><H3>
+$UseMSMailHeaders</H3>
+<PRE>
+public bool <B>$UseMSMailHeaders</B></PRE>
+<DL>
+<DD>Turns Microsoft mail client headers on and off.  Useful mostly
+  for older clients. Default value is false (off).</DL>
+<HR>
+
+<A NAME="$PluginDir"><!-- --></A><H3>
+$PluginDir</H3>
+<PRE>
+public string <B>$PluginDir</B></PRE>
+<DL>
+<DD>Path to phpmailer plugins.  This is now only useful if the SMTP class 
+ is in a different directory than the PHP include path.  
+ Default is empty ("").</DL>
+<HR>
+
+<A NAME="$Version"><!-- --></A><H3>
+$Version</H3>
+<PRE>
+public string <B>$Version</B></PRE>
+<DL>
+<DD>Holds phpmailer version.</DL>
+<HR>
+
+<A NAME="$ConfirmReadingTo"><!-- --></A><H3>
+$ConfirmReadingTo</H3>
+<PRE>
+public string <B>$ConfirmReadingTo</B></PRE>
+<DL>
+<DD>Sets the email address that a reading confirmation will be sent. Default value is "".</DL>
+<HR>
+
+<A NAME="$LE"><!-- --></A><H3>
+$LE</H3>
+<PRE>
+public string <B>$LE</B></PRE>
+<DL>
+<DD>Sets the line endings of the message.  Default is "\n";</DL>
+<HR>
+
+<A NAME="$Host"><!-- --></A><H3>
+$Host</H3>
+<PRE>
+public string <B>$Host</B></PRE>
+<DL>
+<DD>Sets the SMTP hosts.  All hosts must be separated by a
+  semicolon.  You can also specify a different port
+  for each host by using this format: [hostname:port]
+  (e.g. "smtp1.domain.com:25;smtp2.domain.com").
+  Hosts will be tried in order.
+  Default value is "localhost".</DL>
+<HR>
+
+<A NAME="$Port"><!-- --></A><H3>
+$Port</H3>
+<PRE>
+public int <B>$Port</B></PRE>
+<DL>
+<DD>Sets the default SMTP server port. Default value is 25.</DL>
+<HR>
+
+<A NAME="$Helo"><!-- --></A><H3>
+$Helo</H3>
+<PRE>
+public string <B>$Helo</B></PRE>
+<DL>
+<DD>Sets the SMTP HELO of the message.
+  Default value is "localhost.localdomain".</DL>
+<HR>
+
+<A NAME="$SMTPAuth"><!-- --></A><H3>
+$SMTPAuth</H3>
+<PRE>
+public bool <B>$SMTPAuth</B></PRE>
+<DL>
+<DD>Sets SMTP authentication. Utilizes the Username and Password variables.
+  Default value is false (off).</DL>
+<HR>
+
+<A NAME="$Username"><!-- --></A><H3>
+$Username</H3>
+<PRE>
+public string <B>$Username</B></PRE>
+<DL>
+<DD>Sets SMTP username. Default value is "".</DL>
+<HR>
+
+<A NAME="$Password"><!-- --></A><H3>
+$Password</H3>
+<PRE>
+public string <B>$Password</B></PRE>
+<DL>
+<DD>Sets SMTP password. Default value is "".</DL>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=1><FONT SIZE="+2">
+<B>Constructor Detail</B></FONT></TD>
+</TR>
+</TABLE>
+
+<A NAME="phpmailer()"><!-- --></A><H3>
+phpmailer</H3>
+<PRE>
+public <B>phpmailer</B>()</PRE>
+<DL>
+</DL>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TD COLSPAN=1><FONT SIZE="+2">
+<B>Method Detail</B></FONT></TD>
+</TR>
+</TABLE>
+
+<A NAME="IsHTML(var)"><!-- --></A><H3>
+IsHTML</H3>
+<PRE>
+public void <B>IsHTML</B>(var&nbsp;$bool)</PRE>
+<DL>
+<DD>Sets message type to HTML.  Returns void.</DL>
+<HR>
+
+<A NAME="IsSMTP()"><!-- --></A><H3>
+IsSMTP</H3>
+<PRE>
+public void <B>IsSMTP</B>()</PRE>
+<DL>
+<DD>Sets Mailer to send message using SMTP.
+ Returns void.</DL>
+<HR>
+
+<A NAME="IsMail()"><!-- --></A><H3>
+IsMail</H3>
+<PRE>
+public void <B>IsMail</B>()</PRE>
+<DL>
+<DD>Sets Mailer to send message using PHP mail() function.
+ Returns void.</DL>
+<HR>
+
+<A NAME="IsSendmail()"><!-- --></A><H3>
+IsSendmail</H3>
+<PRE>
+public void <B>IsSendmail</B>()</PRE>
+<DL>
+<DD>Sets Mailer to send message using the $Sendmail program.
+ Returns void.</DL>
+<HR>
+
+<A NAME="IsQmail()"><!-- --></A><H3>
+IsQmail</H3>
+<PRE>
+public void <B>IsQmail</B>()</PRE>
+<DL>
+<DD>Sets Mailer to send message using the qmail MTA.  Returns void.</DL>
+<HR>
+
+<A NAME="AddAddress(var, var)"><!-- --></A><H3>
+AddAddress</H3>
+<PRE>
+public void <B>AddAddress</B>(var&nbsp;$address,
+                       var&nbsp;$name)</PRE>
+<DL>
+<DD>Adds a "To" address.  Returns void.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="AddCC(var, var)"><!-- --></A><H3>
+AddCC</H3>
+<PRE>
+public void <B>AddCC</B>(var&nbsp;$address,
+                  var&nbsp;$name)</PRE>
+<DL>
+<DD>Adds a "Cc" address. Note: this function works
+ with the SMTP mailer on win32, not with the "mail"
+ mailer.  This is a PHP bug that has been submitted
+ on http:     * functions correctly. Returns void.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="AddBCC(var, var)"><!-- --></A><H3>
+AddBCC</H3>
+<PRE>
+public void <B>AddBCC</B>(var&nbsp;$address,
+                   var&nbsp;$name)</PRE>
+<DL>
+<DD>Adds a "Bcc" address. Note: this function works
+ with the SMTP mailer on win32, not with the "mail"
+ mailer.  This is a PHP bug that has been submitted
+ on http:     * functions correctly.
+ Returns void.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="AddReplyTo(var, var)"><!-- --></A><H3>
+AddReplyTo</H3>
+<PRE>
+public void <B>AddReplyTo</B>(var&nbsp;$address,
+                       var&nbsp;$name)</PRE>
+<DL>
+<DD>Adds a "Reply-to" address.  Returns void.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="Send()"><!-- --></A><H3>
+Send</H3>
+<PRE>
+public bool <B>Send</B>()</PRE>
+<DL>
+<DD>Creates message and assigns Mailer. If the message is
+ not sent successfully then it returns false.  Use the ErrorInfo
+ variable to view description of the error.  Returns bool.</DL>
+<HR>
+
+<A NAME="SendToQueue(var, var)"><!-- --></A><H3>
+SendToQueue</H3>
+<PRE>
+public string <B>SendToQueue</B>(var&nbsp;$queue_path,
+                          var&nbsp;$send_time)</PRE>
+<DL>
+<DD>Sends mail message to an assigned queue directory.  Has an optional 
+ sendTime argument.  This is used when the user wants the 
+ message to be sent from the queue at a predetermined time. 
+ The data must be a valid timestamp like that returned from 
+ the time() or strtotime() functions.  Returns false on failure 
+ or the message file name if success.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>$send_time</CODE> - <b>Default Value</b>: 0</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="AddAttachment(var, var, var, var)"><!-- --></A><H3>
+AddAttachment</H3>
+<PRE>
+public bool <B>AddAttachment</B>(var&nbsp;$path,
+                          var&nbsp;$name,
+                          var&nbsp;$encoding,
+                          var&nbsp;$type)</PRE>
+<DL>
+<DD>Adds an attachment from a path on the filesystem.
+ Checks if attachment is valid and then adds
+ the attachment to the list.
+ Returns false if the file could not be found
+ or accessed.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>$name</CODE> - <b>Default Value</b>: ""<DD><CODE>$encoding</CODE> - <b>Default Value</b>: "base64"<DD><CODE>$type</CODE> - <b>Default Value</b>: "application/octet-stream"</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="AddStringAttachment(var, var, var, var)"><!-- --></A><H3>
+AddStringAttachment</H3>
+<PRE>
+public void <B>AddStringAttachment</B>(var&nbsp;$string,
+                                var&nbsp;$filename,
+                                var&nbsp;$encoding,
+                                var&nbsp;$type)</PRE>
+<DL>
+<DD>Adds a string or binary attachment (non-filesystem) to the list.
+ This method can be used to attach ascii or binary data,
+ such as a BLOB record from a database.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>$encoding</CODE> - <b>Default Value</b>: "base64"<DD><CODE>$type</CODE> - <b>Default Value</b>: "application/octet-stream"</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="AddEmbeddedImage(var, var, var, var, var)"><!-- --></A><H3>
+AddEmbeddedImage</H3>
+<PRE>
+public bool <B>AddEmbeddedImage</B>(var&nbsp;$path,
+                             var&nbsp;$cid,
+                             var&nbsp;$name,
+                             var&nbsp;$encoding,
+                             var&nbsp;$type)</PRE>
+<DL>
+<DD>Adds an embedded attachment.  This can include images, sounds, and 
+ just about any other document.<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>cid</CODE> - this is the Content Id of the attachment.  Use this to identify
+        the Id for accessing the image in an HTML form.<DD><CODE>$name</CODE> - <b>Default Value</b>: ""<DD><CODE>$encoding</CODE> - <b>Default Value</b>: "base64"<DD><CODE>$type</CODE> - <b>Default Value</b>: "application/octet-stream"</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="ClearAddresses()"><!-- --></A><H3>
+ClearAddresses</H3>
+<PRE>
+public void <B>ClearAddresses</B>()</PRE>
+<DL>
+<DD>Clears all recipients assigned in the TO array.  Returns void.</DL>
+<HR>
+
+<A NAME="ClearCCs()"><!-- --></A><H3>
+ClearCCs</H3>
+<PRE>
+public void <B>ClearCCs</B>()</PRE>
+<DL>
+<DD>Clears all recipients assigned in the CC array.  Returns void.</DL>
+<HR>
+
+<A NAME="ClearBCCs()"><!-- --></A><H3>
+ClearBCCs</H3>
+<PRE>
+public void <B>ClearBCCs</B>()</PRE>
+<DL>
+<DD>Clears all recipients assigned in the BCC array.  Returns void.</DL>
+<HR>
+
+<A NAME="ClearReplyTos()"><!-- --></A><H3>
+ClearReplyTos</H3>
+<PRE>
+public void <B>ClearReplyTos</B>()</PRE>
+<DL>
+<DD>Clears all recipients assigned in the ReplyTo array.  Returns void.</DL>
+<HR>
+
+<A NAME="ClearAllRecipients()"><!-- --></A><H3>
+ClearAllRecipients</H3>
+<PRE>
+public void <B>ClearAllRecipients</B>()</PRE>
+<DL>
+<DD>Clears all recipients assigned in the TO, CC and BCC
+ array.  Returns void.</DL>
+<HR>
+
+<A NAME="ClearAttachments()"><!-- --></A><H3>
+ClearAttachments</H3>
+<PRE>
+public void <B>ClearAttachments</B>()</PRE>
+<DL>
+<DD>Clears all previously set filesystem, string, and binary
+ attachments.  Returns void.</DL>
+<HR>
+
+<A NAME="ClearCustomHeaders()"><!-- --></A><H3>
+ClearCustomHeaders</H3>
+<PRE>
+public void <B>ClearCustomHeaders</B>()</PRE>
+<DL>
+<DD>Clears all custom headers.  Returns void.</DL>
+<HR>
+
+<A NAME="AddCustomHeader(var)"><!-- --></A><H3>
+AddCustomHeader</H3>
+<PRE>
+public void <B>AddCustomHeader</B>(var&nbsp;$custom_header)</PRE>
+<DL>
+<DD>Adds a custom header.  Returns void.</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;<A HREF="Boundary.html"><B>PREV CLASS</B></A>&nbsp;
+&nbsp;NEXT CLASS</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="phpmailer.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/serialized-form.html
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/serialized-form.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/serialized-form.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,87 +1,87 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
-<TITLE>
-Serialized Form
-</TITLE>
-<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
-</HEAD>
-<BODY BGCOLOR="white">
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_top"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_top_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="serialized-form.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-<CENTER>
-<H1>
-Serialized Form</H1>
-</CENTER>
-<HR>
-
-<!-- ========== START OF NAVBAR ========== -->
-<A NAME="navbar_bottom"><!-- --></A>
-<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
-<TR>
-<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
-<A NAME="navbar_bottom_firstrow"><!-- --></A>
-<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
-  <TR ALIGN="center" VALIGN="top">
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
-  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
-  </TR>
-</TABLE>
-</TD>
-<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
-</EM>
-</TD>
-</TR>
-
-<TR>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-&nbsp;PREV&nbsp;
-&nbsp;NEXT</FONT></TD>
-<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
-  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
-&nbsp;<A HREF="serialized-form.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
-</TR>
-</TABLE>
-<!-- =========== END OF NAVBAR =========== -->
-
-<HR>
-
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Tue Jun 05 13:47:44 EDT 2001 -->
+<TITLE>
+Serialized Form
+</TITLE>
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+</HEAD>
+<BODY BGCOLOR="white">
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_top"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="serialized-form.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+<CENTER>
+<H1>
+Serialized Form</H1>
+</CENTER>
+<HR>
+
+<!-- ========== START OF NAVBAR ========== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
+  <TR ALIGN="center" VALIGN="top">
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
+  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
+  </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+&nbsp;PREV&nbsp;
+&nbsp;NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
+&nbsp;<A HREF="serialized-form.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
+</TR>
+</TABLE>
+<!-- =========== END OF NAVBAR =========== -->
+
+<HR>
+
+</BODY>
+</HTML>

Modified: branches/print_dev/http/classes/phpmailer-1.72/phpdoc/stylesheet.css
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/phpdoc/stylesheet.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/phpdoc/stylesheet.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,29 +1,29 @@
-/* Javadoc style sheet */
-
-/* Define colors, fonts and other style attributes here to override the defaults  */
-
-/* Page background color */
-body { background-color: #FFFFFF }
-
-/* Table colors */
-.TableHeadingColor     { background: #CCCCFF } /* Dark mauve */
-.TableSubHeadingColor  { background: #EEEEFF } /* Light mauve */
-.TableRowColor         { background: #FFFFFF } /* White */
-
-/* Font used in left-hand frame lists */
-.FrameTitleFont   { font-size: normal; font-family: normal }
-.FrameHeadingFont { font-size: normal; font-family: normal }
-.FrameItemFont    { font-size: normal; font-family: normal }
-
-/* Example of smaller, sans-serif font in frames */
-/* .FrameItemFont  { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
-
-/* Navigation bar fonts and colors */
-.NavBarCell1    { background-color:#EEEEFF;}/* Light mauve */
-.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */
-.NavBarFont1    { font-family: Arial, Helvetica, sans-serif; color:#000000;}
-.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
-
-.NavBarCell2    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
-.NavBarCell3    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
-
+/* Javadoc style sheet */
+
+/* Define colors, fonts and other style attributes here to override the defaults  */
+
+/* Page background color */
+body { background-color: #FFFFFF }
+
+/* Table colors */
+.TableHeadingColor     { background: #CCCCFF } /* Dark mauve */
+.TableSubHeadingColor  { background: #EEEEFF } /* Light mauve */
+.TableRowColor         { background: #FFFFFF } /* White */
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont   { font-size: normal; font-family: normal }
+.FrameHeadingFont { font-size: normal; font-family: normal }
+.FrameItemFont    { font-size: normal; font-family: normal }
+
+/* Example of smaller, sans-serif font in frames */
+/* .FrameItemFont  { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
+
+/* Navigation bar fonts and colors */
+.NavBarCell1    { background-color:#EEEEFF;}/* Light mauve */
+.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */
+.NavBarFont1    { font-family: Arial, Helvetica, sans-serif; color:#000000;}
+.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
+
+.NavBarCell2    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+.NavBarCell3    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+

Modified: branches/print_dev/http/classes/phpmailer-1.72/test/phpmailer_test.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/test/phpmailer_test.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/test/phpmailer_test.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,560 +1,560 @@
-<?php
-/*******************
-  Unit Test
-  Type: phpmailer class
-********************/
-
-$INCLUDE_DIR = "";
-
-require(dirname(__FILE__) . "/phpunit.php");
-require($INCLUDE_DIR . "class.phpmailer.php");
-error_reporting(E_ALL);
-
-/**
- * Performs authentication tests
- */
-class phpmailerTest extends TestCase
-{
-    /**
-     * Holds the default phpmailer instance.
-     * @private
-     * @type object
-     */
-    var $Mail = false;
-
-    /**
-     * Holds the SMTP mail host.
-     * @public
-     * @type string
-     */
-    var $Host = "";
-    
-    /**
-     * Holds the change log.
-     * @private
-     * @type string array
-     */
-    var $ChangeLog = array();
-    
-     /**
-     * Holds the note log.
-     * @private
-     * @type string array
-     */
-    var $NoteLog = array();   
-
-    /**
-     * Class constuctor.
-     */
-    function phpmailerTest($name) {
-        /* must define this constructor */
-        $this->TestCase( $name );
-    }
-    
-    /**
-     * Run before each test is started.
-     */
-    function setUp() {
-        global $global_vars;
-        global $INCLUDE_DIR;
-
-        $this->Mail = new PHPMailer();
-
-        $this->Mail->Priority = 3;
-        $this->Mail->Encoding = "8bit";
-        $this->Mail->CharSet = "iso-8859-1";
-        $this->Mail->From = "unit_test at phpmailer.sf.net";
-        $this->Mail->FromName = "Unit Tester";
-        $this->Mail->Sender = "";
-        $this->Mail->Subject = "Unit Test";
-        $this->Mail->Body = "";
-        $this->Mail->AltBody = "";
-        $this->Mail->WordWrap = 0;
-        $this->Mail->Host = $global_vars["mail_host"];
-        $this->Mail->Port = 25;
-        $this->Mail->Helo = "localhost.localdomain";
-        $this->Mail->SMTPAuth = false;
-        $this->Mail->Username = "";
-        $this->Mail->Password = "";
-        $this->Mail->PluginDir = $INCLUDE_DIR;
-		$this->Mail->AddReplyTo("no_reply at phpmailer.sf.net", "Reply Guy");
-        $this->Mail->Sender = "nobody at example.com";
-
-        if(strlen($this->Mail->Host) > 0)
-            $this->Mail->Mailer = "smtp";
-        else
-        {
-            $this->Mail->Mailer = "mail";
-            $this->Sender = "unit_test at phpmailer.sf.net";
-        }
-        
-        global $global_vars;
-        $this->SetAddress($global_vars["mail_to"], "Test User");
-        if(strlen($global_vars["mail_cc"]) > 0)
-            $this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc");
-    }     
-
-    /**
-     * Run after each test is completed.
-     */
-    function tearDown() {
-        // Clean global variables
-        $this->Mail = NULL;
-        $this->ChangeLog = array();
-        $this->NoteLog = array();
-    }
-
-
-    /**
-     * Build the body of the message in the appropriate format.
-     * @private
-     * @returns void
-     */
-    function BuildBody() {
-        $this->CheckChanges();
-        
-        // Determine line endings for message        
-        if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)
-        {
-            $eol = "<br/>";
-            $bullet = "<li>";
-            $bullet_start = "<ul>";
-            $bullet_end = "</ul>";
-        }
-        else
-        {
-            $eol = "\n";
-            $bullet = " - ";
-            $bullet_start = "";
-            $bullet_end = "";
-        }
-        
-        $ReportBody = "";
-        
-        $ReportBody .= "---------------------" . $eol;
-        $ReportBody .= "Unit Test Information" . $eol;
-        $ReportBody .= "---------------------" . $eol;
-        $ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;
-        $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;
-        
-        if(strlen($this->Mail->Host) > 0)
-            $ReportBody .= "Host: " . $this->Mail->Host . $eol;
-        
-        // If attachments then create an attachment list
-        if(count($this->Mail->attachment) > 0)
-        {
-            $ReportBody .= "Attachments:" . $eol;
-            $ReportBody .= $bullet_start;
-            for($i = 0; $i < count($this->Mail->attachment); $i++)
-            {
-                $ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", ";
-                $ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", ";
-                $ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol;
-            }
-            $ReportBody .= $bullet_end . $eol;
-        }
-        
-        // If there are changes then list them
-        if(count($this->ChangeLog) > 0)
-        {
-            $ReportBody .= "Changes" . $eol;
-            $ReportBody .= "-------" . $eol;
-
-            $ReportBody .= $bullet_start;
-            for($i = 0; $i < count($this->ChangeLog); $i++)
-            {
-                $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" . 
-                               $this->ChangeLog[$i][1] . "]" . $eol;
-            }
-            $ReportBody .= $bullet_end . $eol . $eol;
-        }
-        
-        // If there are notes then list them
-        if(count($this->NoteLog) > 0)
-        {
-            $ReportBody .= "Notes" . $eol;
-            $ReportBody .= "-----" . $eol;
-
-            $ReportBody .= $bullet_start;
-            for($i = 0; $i < count($this->NoteLog); $i++)
-            {
-                $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;
-            }
-            $ReportBody .= $bullet_end;
-        }
-        
-        // Re-attach the original body
-        $this->Mail->Body .= $eol . $eol . $ReportBody;
-    }
-    
-    /**
-     * Check which default settings have been changed for the report.
-     * @private
-     * @returns void
-     */
-    function CheckChanges() {
-        if($this->Mail->Priority != 3)
-            $this->AddChange("Priority", $this->Mail->Priority);
-        if($this->Mail->Encoding != "8bit")
-            $this->AddChange("Encoding", $this->Mail->Encoding);
-        if($this->Mail->CharSet != "iso-8859-1")
-            $this->AddChange("CharSet", $this->Mail->CharSet);
-        if($this->Mail->Sender != "")
-            $this->AddChange("Sender", $this->Mail->Sender);
-        if($this->Mail->WordWrap != 0)
-            $this->AddChange("WordWrap", $this->Mail->WordWrap);
-        if($this->Mail->Mailer != "mail")
-            $this->AddChange("Mailer", $this->Mail->Mailer);
-        if($this->Mail->Port != 25)
-            $this->AddChange("Port", $this->Mail->Port);
-        if($this->Mail->Helo != "localhost.localdomain")
-            $this->AddChange("Helo", $this->Mail->Helo);
-        if($this->Mail->SMTPAuth)
-            $this->AddChange("SMTPAuth", "true");
-    }
-    
-    /**
-     * Adds a change entry.
-     * @private
-     * @returns void
-     */
-    function AddChange($sName, $sNewValue) {
-        $cur = count($this->ChangeLog);
-        $this->ChangeLog[$cur][0] = $sName;
-        $this->ChangeLog[$cur][1] = $sNewValue;
-    }
-    
-    /**
-     * Adds a simple note to the message.
-     * @public
-     * @returns void
-     */
-    function AddNote($sValue) {
-        $this->NoteLog[] = $sValue;
-    }
-
-    /**
-     * Adds all of the addresses
-     * @public
-     * @returns void
-     */
-    function SetAddress($sAddress, $sName = "", $sType = "to") {
-        switch($sType)
-        {
-            case "to":
-                $this->Mail->AddAddress($sAddress, $sName);
-                break;
-            case "cc":
-                $this->Mail->AddCC($sAddress, $sName);
-                break;
-            case "bcc":
-                $this->Mail->AddBCC($sAddress, $sName);
-                break;
-        }
-    }
-
-    /////////////////////////////////////////////////
-    // UNIT TESTS
-    /////////////////////////////////////////////////
-
-    /**
-     * Try a plain message.
-     */
-    function test_WordWrap() {
-
-        $this->Mail->WordWrap = 40;
-        $my_body = "Here is the main body of this message.  It should " .
-                   "be quite a few lines.  It should be wrapped at the " .
-                   "40 characters.  Make sure that it is.";
-        $nBodyLen = strlen($my_body);
-        $my_body .= "\n\nThis is the above body length: " . $nBodyLen;
-
-        $this->Mail->Body = $my_body;
-        $this->Mail->Subject .= ": Wordwrap";
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Try a plain message.
-     */
-    function test_Low_Priority() {
-    
-        $this->Mail->Priority = 5;
-        $this->Mail->Body = "Here is the main body.  There should be " .
-                            "a reply to address in this message.";
-        $this->Mail->Subject .= ": Low Priority";
-        $this->Mail->AddReplyTo("nobody at nobody.com", "Nobody (Unit Test)");
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Simple plain file attachment test.
-     */
-    function test_Multiple_Plain_FileAttachment() {
-
-        $this->Mail->Body = "Here is the text body";
-        $this->Mail->Subject .= ": Plain + Multiple FileAttachments";
-
-        if(!$this->Mail->AddAttachment("rocks.png"))
-        {
-            $this->assert(false, $this->Mail->ErrorInfo);
-            return;
-        }
-
-        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
-        {
-            $this->assert(false, $this->Mail->ErrorInfo);
-            return;
-        }
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Simple plain string attachment test.
-     */
-    function test_Plain_StringAttachment() {
-
-        $this->Mail->Body = "Here is the text body";
-        $this->Mail->Subject .= ": Plain + StringAttachment";
-        
-        $sAttachment = "These characters are the content of the " .
-                       "string attachment.\nThis might be taken from a ".
-                       "database or some other such thing. ";
-        
-        $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Plain quoted-printable message.
-     */
-    function test_Quoted_Printable() {
-
-        $this->Mail->Body = "Here is the main body";
-        $this->Mail->Subject .= ": Plain + Quoted-printable";
-        $this->Mail->Encoding = "quoted-printable";
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Try a plain message.
-     */
-    function test_Html() {
-    
-        $this->Mail->IsHTML(true);
-        $this->Mail->Subject .= ": HTML only";
-        
-        $this->Mail->Body = "This is a <b>test message</b> written in HTML. </br>" .
-                            "Go to <a href=\"http://phpmailer.sourceforge.net/\">" .
-                            "http://phpmailer.sourceforge.net/</a> for new versions of " .
-                            "phpmailer.  <p/> Thank you!";
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Simple HTML and attachment test
-     */
-    function test_HTML_Attachment() {
-
-        $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
-        $this->Mail->Subject .= ": HTML + Attachment";
-        $this->Mail->IsHTML(true);
-        
-        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
-        {
-            $this->assert(false, $this->Mail->ErrorInfo);
-            return;
-        }
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * An embedded attachment test.
-     */
-    function test_Embedded_Image() {
-
-        $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
-                     "Here is an image!</a>";
-        $this->Mail->Subject .= ": Embedded Image";
-        $this->Mail->IsHTML(true);
-        
-        if(!$this->Mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png",
-                                          "base64", "image/png"))
-        {
-            $this->assert(false, $this->Mail->ErrorInfo);
-            return;
-        }
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * An embedded attachment test.
-     */
-    function test_Multi_Embedded_Image() {
-
-        $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
-                     "Here is an image!</a>";
-        $this->Mail->Subject .= ": Embedded Image + Attachment";
-        $this->Mail->IsHTML(true);
-        
-        if(!$this->Mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png",
-                                          "base64", "image/png"))
-        {
-            $this->assert(false, $this->Mail->ErrorInfo);
-            return;
-        }
-
-        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
-        {
-            $this->assert(false, $this->Mail->ErrorInfo);
-            return;
-        }
-        
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Simple multipart/alternative test.
-     */
-    function test_AltBody() {
-
-        $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
-        $this->Mail->AltBody = "Here is the text body of this message.  " .
-                   "It should be quite a few lines.  It should be wrapped at the " .
-                   "40 characters.  Make sure that it is.";
-        $this->Mail->WordWrap = 40;
-        $this->AddNote("This is a mulipart alternative email");
-        $this->Mail->Subject .= ": AltBody + Word Wrap";
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    /**
-     * Simple HTML and attachment test
-     */
-    function test_AltBody_Attachment() {
-
-        $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
-        $this->Mail->AltBody = "This is the text part of the email.";
-        $this->Mail->Subject .= ": AltBody + Attachment";
-        $this->Mail->IsHTML(true);
-        
-        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
-        {
-            $this->assert(false, $this->Mail->ErrorInfo);
-            return;
-        }
-
-        $this->BuildBody();
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-
-        $fp = fopen("message.txt", "w");
-        fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());
-        fclose($fp);
-    }    
-
-    function test_MultipleSend() {
-        $this->Mail->Body = "Sending two messages without keepalive";
-        $this->BuildBody();
-        $subject = $this->Mail->Subject;
-
-        $this->Mail->Subject = $subject . ": SMTP 1";
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-        
-        $this->Mail->Subject = $subject . ": SMTP 2";
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-    }
-
-    function test_SmtpKeepAlive() {
-        $this->Mail->Body = "This was done using the SMTP keep-alive.";
-        $this->BuildBody();
-        $subject = $this->Mail->Subject;
-
-        $this->Mail->SMTPKeepAlive = true;
-        $this->Mail->Subject = $subject . ": SMTP keep-alive 1";
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-        
-        $this->Mail->Subject = $subject . ": SMTP keep-alive 2";
-        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
-        $this->Mail->SmtpClose();
-    }
-    
-    function test_Error() {
-        $this->Mail->Subject .= ": This should be sent"; 
-        $this->BuildBody();
-        $this->Mail->ClearAllRecipients(); // no addresses should cause an error
-        $this->assert($this->Mail->IsError() == false, "Error found");
-        $this->assert($this->Mail->Send() == false, "Send succeeded");
-        $this->assert($this->Mail->IsError(), "No error found");
-        $this->assertEquals('You must provide at least one ' .
-                            'recipient email address.', $this->Mail->ErrorInfo);
-        $this->Mail->AddAddress(get("mail_to"));
-        $this->assert($this->Mail->Send(), "Send failed");
-    }
-}  
- 
-/**
- * Create and run test instance.
- */
- 
-if(isset($HTTP_GET_VARS))
-    $global_vars = $HTTP_GET_VARS;
-else
-    $global_vars = $_REQUEST;
-
-if(isset($global_vars["submitted"]))
-{
-    echo "Test results:<br>";
-    $suite = new TestSuite( "phpmailerTest" );
-    
-    $testRunner = new TestRunner;
-    $testRunner->run($suite);
-    echo "<hr noshade/>";
-}
-
-function get($sName) {
-    global $global_vars;
-    if(isset($global_vars[$sName]))
-        return $global_vars[$sName];
-    else
-        return "";
-}
-
-?>
-
-<html>
-<body>
-<h3>phpmailer Unit Test</h3>
-By entering a SMTP hostname it will automatically perform tests with SMTP.
-
-<form name="phpmailer_unit" action="phpmailer_test.php" method="get">
-<input type="hidden" name="submitted" value="1"/>
-To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>
-<br/>
-Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>
-<br/>
-SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>
-<p/>
-<input type="submit" value="Run Test"/>
-
-</form>
-</body>
-</html>
+<?php
+/*******************
+  Unit Test
+  Type: phpmailer class
+********************/
+
+$INCLUDE_DIR = "";
+
+require(dirname(__FILE__) . "/phpunit.php");
+require($INCLUDE_DIR . "class.phpmailer.php");
+error_reporting(E_ALL);
+
+/**
+ * Performs authentication tests
+ */
+class phpmailerTest extends TestCase
+{
+    /**
+     * Holds the default phpmailer instance.
+     * @private
+     * @type object
+     */
+    var $Mail = false;
+
+    /**
+     * Holds the SMTP mail host.
+     * @public
+     * @type string
+     */
+    var $Host = "";
+    
+    /**
+     * Holds the change log.
+     * @private
+     * @type string array
+     */
+    var $ChangeLog = array();
+    
+     /**
+     * Holds the note log.
+     * @private
+     * @type string array
+     */
+    var $NoteLog = array();   
+
+    /**
+     * Class constuctor.
+     */
+    function phpmailerTest($name) {
+        /* must define this constructor */
+        $this->TestCase( $name );
+    }
+    
+    /**
+     * Run before each test is started.
+     */
+    function setUp() {
+        global $global_vars;
+        global $INCLUDE_DIR;
+
+        $this->Mail = new PHPMailer();
+
+        $this->Mail->Priority = 3;
+        $this->Mail->Encoding = "8bit";
+        $this->Mail->CharSet = "iso-8859-1";
+        $this->Mail->From = "unit_test at phpmailer.sf.net";
+        $this->Mail->FromName = "Unit Tester";
+        $this->Mail->Sender = "";
+        $this->Mail->Subject = "Unit Test";
+        $this->Mail->Body = "";
+        $this->Mail->AltBody = "";
+        $this->Mail->WordWrap = 0;
+        $this->Mail->Host = $global_vars["mail_host"];
+        $this->Mail->Port = 25;
+        $this->Mail->Helo = "localhost.localdomain";
+        $this->Mail->SMTPAuth = false;
+        $this->Mail->Username = "";
+        $this->Mail->Password = "";
+        $this->Mail->PluginDir = $INCLUDE_DIR;
+		$this->Mail->AddReplyTo("no_reply at phpmailer.sf.net", "Reply Guy");
+        $this->Mail->Sender = "nobody at example.com";
+
+        if(strlen($this->Mail->Host) > 0)
+            $this->Mail->Mailer = "smtp";
+        else
+        {
+            $this->Mail->Mailer = "mail";
+            $this->Sender = "unit_test at phpmailer.sf.net";
+        }
+        
+        global $global_vars;
+        $this->SetAddress($global_vars["mail_to"], "Test User");
+        if(strlen($global_vars["mail_cc"]) > 0)
+            $this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc");
+    }     
+
+    /**
+     * Run after each test is completed.
+     */
+    function tearDown() {
+        // Clean global variables
+        $this->Mail = NULL;
+        $this->ChangeLog = array();
+        $this->NoteLog = array();
+    }
+
+
+    /**
+     * Build the body of the message in the appropriate format.
+     * @private
+     * @returns void
+     */
+    function BuildBody() {
+        $this->CheckChanges();
+        
+        // Determine line endings for message        
+        if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)
+        {
+            $eol = "<br/>";
+            $bullet = "<li>";
+            $bullet_start = "<ul>";
+            $bullet_end = "</ul>";
+        }
+        else
+        {
+            $eol = "\n";
+            $bullet = " - ";
+            $bullet_start = "";
+            $bullet_end = "";
+        }
+        
+        $ReportBody = "";
+        
+        $ReportBody .= "---------------------" . $eol;
+        $ReportBody .= "Unit Test Information" . $eol;
+        $ReportBody .= "---------------------" . $eol;
+        $ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;
+        $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;
+        
+        if(strlen($this->Mail->Host) > 0)
+            $ReportBody .= "Host: " . $this->Mail->Host . $eol;
+        
+        // If attachments then create an attachment list
+        if(count($this->Mail->attachment) > 0)
+        {
+            $ReportBody .= "Attachments:" . $eol;
+            $ReportBody .= $bullet_start;
+            for($i = 0; $i < count($this->Mail->attachment); $i++)
+            {
+                $ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", ";
+                $ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", ";
+                $ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol;
+            }
+            $ReportBody .= $bullet_end . $eol;
+        }
+        
+        // If there are changes then list them
+        if(count($this->ChangeLog) > 0)
+        {
+            $ReportBody .= "Changes" . $eol;
+            $ReportBody .= "-------" . $eol;
+
+            $ReportBody .= $bullet_start;
+            for($i = 0; $i < count($this->ChangeLog); $i++)
+            {
+                $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" . 
+                               $this->ChangeLog[$i][1] . "]" . $eol;
+            }
+            $ReportBody .= $bullet_end . $eol . $eol;
+        }
+        
+        // If there are notes then list them
+        if(count($this->NoteLog) > 0)
+        {
+            $ReportBody .= "Notes" . $eol;
+            $ReportBody .= "-----" . $eol;
+
+            $ReportBody .= $bullet_start;
+            for($i = 0; $i < count($this->NoteLog); $i++)
+            {
+                $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;
+            }
+            $ReportBody .= $bullet_end;
+        }
+        
+        // Re-attach the original body
+        $this->Mail->Body .= $eol . $eol . $ReportBody;
+    }
+    
+    /**
+     * Check which default settings have been changed for the report.
+     * @private
+     * @returns void
+     */
+    function CheckChanges() {
+        if($this->Mail->Priority != 3)
+            $this->AddChange("Priority", $this->Mail->Priority);
+        if($this->Mail->Encoding != "8bit")
+            $this->AddChange("Encoding", $this->Mail->Encoding);
+        if($this->Mail->CharSet != "iso-8859-1")
+            $this->AddChange("CharSet", $this->Mail->CharSet);
+        if($this->Mail->Sender != "")
+            $this->AddChange("Sender", $this->Mail->Sender);
+        if($this->Mail->WordWrap != 0)
+            $this->AddChange("WordWrap", $this->Mail->WordWrap);
+        if($this->Mail->Mailer != "mail")
+            $this->AddChange("Mailer", $this->Mail->Mailer);
+        if($this->Mail->Port != 25)
+            $this->AddChange("Port", $this->Mail->Port);
+        if($this->Mail->Helo != "localhost.localdomain")
+            $this->AddChange("Helo", $this->Mail->Helo);
+        if($this->Mail->SMTPAuth)
+            $this->AddChange("SMTPAuth", "true");
+    }
+    
+    /**
+     * Adds a change entry.
+     * @private
+     * @returns void
+     */
+    function AddChange($sName, $sNewValue) {
+        $cur = count($this->ChangeLog);
+        $this->ChangeLog[$cur][0] = $sName;
+        $this->ChangeLog[$cur][1] = $sNewValue;
+    }
+    
+    /**
+     * Adds a simple note to the message.
+     * @public
+     * @returns void
+     */
+    function AddNote($sValue) {
+        $this->NoteLog[] = $sValue;
+    }
+
+    /**
+     * Adds all of the addresses
+     * @public
+     * @returns void
+     */
+    function SetAddress($sAddress, $sName = "", $sType = "to") {
+        switch($sType)
+        {
+            case "to":
+                $this->Mail->AddAddress($sAddress, $sName);
+                break;
+            case "cc":
+                $this->Mail->AddCC($sAddress, $sName);
+                break;
+            case "bcc":
+                $this->Mail->AddBCC($sAddress, $sName);
+                break;
+        }
+    }
+
+    /////////////////////////////////////////////////
+    // UNIT TESTS
+    /////////////////////////////////////////////////
+
+    /**
+     * Try a plain message.
+     */
+    function test_WordWrap() {
+
+        $this->Mail->WordWrap = 40;
+        $my_body = "Here is the main body of this message.  It should " .
+                   "be quite a few lines.  It should be wrapped at the " .
+                   "40 characters.  Make sure that it is.";
+        $nBodyLen = strlen($my_body);
+        $my_body .= "\n\nThis is the above body length: " . $nBodyLen;
+
+        $this->Mail->Body = $my_body;
+        $this->Mail->Subject .= ": Wordwrap";
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Try a plain message.
+     */
+    function test_Low_Priority() {
+    
+        $this->Mail->Priority = 5;
+        $this->Mail->Body = "Here is the main body.  There should be " .
+                            "a reply to address in this message.";
+        $this->Mail->Subject .= ": Low Priority";
+        $this->Mail->AddReplyTo("nobody at nobody.com", "Nobody (Unit Test)");
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Simple plain file attachment test.
+     */
+    function test_Multiple_Plain_FileAttachment() {
+
+        $this->Mail->Body = "Here is the text body";
+        $this->Mail->Subject .= ": Plain + Multiple FileAttachments";
+
+        if(!$this->Mail->AddAttachment("rocks.png"))
+        {
+            $this->assert(false, $this->Mail->ErrorInfo);
+            return;
+        }
+
+        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
+        {
+            $this->assert(false, $this->Mail->ErrorInfo);
+            return;
+        }
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Simple plain string attachment test.
+     */
+    function test_Plain_StringAttachment() {
+
+        $this->Mail->Body = "Here is the text body";
+        $this->Mail->Subject .= ": Plain + StringAttachment";
+        
+        $sAttachment = "These characters are the content of the " .
+                       "string attachment.\nThis might be taken from a ".
+                       "database or some other such thing. ";
+        
+        $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Plain quoted-printable message.
+     */
+    function test_Quoted_Printable() {
+
+        $this->Mail->Body = "Here is the main body";
+        $this->Mail->Subject .= ": Plain + Quoted-printable";
+        $this->Mail->Encoding = "quoted-printable";
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Try a plain message.
+     */
+    function test_Html() {
+    
+        $this->Mail->IsHTML(true);
+        $this->Mail->Subject .= ": HTML only";
+        
+        $this->Mail->Body = "This is a <b>test message</b> written in HTML. </br>" .
+                            "Go to <a href=\"http://phpmailer.sourceforge.net/\">" .
+                            "http://phpmailer.sourceforge.net/</a> for new versions of " .
+                            "phpmailer.  <p/> Thank you!";
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Simple HTML and attachment test
+     */
+    function test_HTML_Attachment() {
+
+        $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
+        $this->Mail->Subject .= ": HTML + Attachment";
+        $this->Mail->IsHTML(true);
+        
+        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
+        {
+            $this->assert(false, $this->Mail->ErrorInfo);
+            return;
+        }
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * An embedded attachment test.
+     */
+    function test_Embedded_Image() {
+
+        $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
+                     "Here is an image!</a>";
+        $this->Mail->Subject .= ": Embedded Image";
+        $this->Mail->IsHTML(true);
+        
+        if(!$this->Mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png",
+                                          "base64", "image/png"))
+        {
+            $this->assert(false, $this->Mail->ErrorInfo);
+            return;
+        }
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * An embedded attachment test.
+     */
+    function test_Multi_Embedded_Image() {
+
+        $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
+                     "Here is an image!</a>";
+        $this->Mail->Subject .= ": Embedded Image + Attachment";
+        $this->Mail->IsHTML(true);
+        
+        if(!$this->Mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png",
+                                          "base64", "image/png"))
+        {
+            $this->assert(false, $this->Mail->ErrorInfo);
+            return;
+        }
+
+        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
+        {
+            $this->assert(false, $this->Mail->ErrorInfo);
+            return;
+        }
+        
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Simple multipart/alternative test.
+     */
+    function test_AltBody() {
+
+        $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
+        $this->Mail->AltBody = "Here is the text body of this message.  " .
+                   "It should be quite a few lines.  It should be wrapped at the " .
+                   "40 characters.  Make sure that it is.";
+        $this->Mail->WordWrap = 40;
+        $this->AddNote("This is a mulipart alternative email");
+        $this->Mail->Subject .= ": AltBody + Word Wrap";
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    /**
+     * Simple HTML and attachment test
+     */
+    function test_AltBody_Attachment() {
+
+        $this->Mail->Body = "This is the <b>HTML</b> part of the email.";
+        $this->Mail->AltBody = "This is the text part of the email.";
+        $this->Mail->Subject .= ": AltBody + Attachment";
+        $this->Mail->IsHTML(true);
+        
+        if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
+        {
+            $this->assert(false, $this->Mail->ErrorInfo);
+            return;
+        }
+
+        $this->BuildBody();
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+
+        $fp = fopen("message.txt", "w");
+        fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());
+        fclose($fp);
+    }    
+
+    function test_MultipleSend() {
+        $this->Mail->Body = "Sending two messages without keepalive";
+        $this->BuildBody();
+        $subject = $this->Mail->Subject;
+
+        $this->Mail->Subject = $subject . ": SMTP 1";
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+        
+        $this->Mail->Subject = $subject . ": SMTP 2";
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+    }
+
+    function test_SmtpKeepAlive() {
+        $this->Mail->Body = "This was done using the SMTP keep-alive.";
+        $this->BuildBody();
+        $subject = $this->Mail->Subject;
+
+        $this->Mail->SMTPKeepAlive = true;
+        $this->Mail->Subject = $subject . ": SMTP keep-alive 1";
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+        
+        $this->Mail->Subject = $subject . ": SMTP keep-alive 2";
+        $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
+        $this->Mail->SmtpClose();
+    }
+    
+    function test_Error() {
+        $this->Mail->Subject .= ": This should be sent"; 
+        $this->BuildBody();
+        $this->Mail->ClearAllRecipients(); // no addresses should cause an error
+        $this->assert($this->Mail->IsError() == false, "Error found");
+        $this->assert($this->Mail->Send() == false, "Send succeeded");
+        $this->assert($this->Mail->IsError(), "No error found");
+        $this->assertEquals('You must provide at least one ' .
+                            'recipient email address.', $this->Mail->ErrorInfo);
+        $this->Mail->AddAddress(get("mail_to"));
+        $this->assert($this->Mail->Send(), "Send failed");
+    }
+}  
+ 
+/**
+ * Create and run test instance.
+ */
+ 
+if(isset($HTTP_GET_VARS))
+    $global_vars = $HTTP_GET_VARS;
+else
+    $global_vars = $_REQUEST;
+
+if(isset($global_vars["submitted"]))
+{
+    echo "Test results:<br>";
+    $suite = new TestSuite( "phpmailerTest" );
+    
+    $testRunner = new TestRunner;
+    $testRunner->run($suite);
+    echo "<hr noshade/>";
+}
+
+function get($sName) {
+    global $global_vars;
+    if(isset($global_vars[$sName]))
+        return $global_vars[$sName];
+    else
+        return "";
+}
+
+?>
+
+<html>
+<body>
+<h3>phpmailer Unit Test</h3>
+By entering a SMTP hostname it will automatically perform tests with SMTP.
+
+<form name="phpmailer_unit" action="phpmailer_test.php" method="get">
+<input type="hidden" name="submitted" value="1"/>
+To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>
+<br/>
+Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>
+<br/>
+SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>
+<p/>
+<input type="submit" value="Run Test"/>
+
+</form>
+</body>
+</html>

Modified: branches/print_dev/http/classes/phpmailer-1.72/test/phpunit.php
===================================================================
--- branches/print_dev/http/classes/phpmailer-1.72/test/phpunit.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/classes/phpmailer-1.72/test/phpunit.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,376 +1,376 @@
-<?php
-//
-// PHP framework for testing, based on the design of "JUnit".
-//
-// Written by Fred Yankowski <fred at ontosys.com>
-//            OntoSys, Inc  <http://www.OntoSys.com>
-//
-// $Id: phpunit.php,v 1.3 2005/09/13 09:36:59 bjoern_heuser Exp $
-
-// Copyright (c) 2000 Fred Yankowski
-
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use, copy,
-// modify, merge, publish, distribute, sublicense, and/or sell copies
-// of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-//
-error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |
-		E_CORE_ERROR | E_CORE_WARNING);
-
-/*
-interface Test {
-  function run(&$aTestResult);
-  function countTestCases();
-}
-*/
-
-function trace($msg) {
-  return;
-  print($msg);
-  flush();
-}
-
-
-class Exception {
-    /* Emulate a Java exception, sort of... */
-  var $message;
-  function Exception($message) {
-    $this->message = $message;
-  }
-  function getMessage() {
-    return $this->message;
-  }
-}
-
-class Assert {
-  function assert($boolean, $message=0) {
-    if (! $boolean)
-      $this->fail($message);
-  }
-
-  function assertEquals($expected, $actual, $message=0) {
-    if ($expected != $actual) {
-      $this->failNotEquals($expected, $actual, "expected", $message);
-    }
-  }
-
-  function assertRegexp($regexp, $actual, $message=false) {
-    if (! preg_match($regexp, $actual)) {
-      $this->failNotEquals($regexp, $actual, "pattern", $message);
-    }
-  }
-
-  function failNotEquals($expected, $actual, $expected_label, $message=0) {
-    // Private function for reporting failure to match.
-    $str = $message ? ($message . ' ') : '';
-    $str .= "($expected_label/actual)<br>";
-    $htmlExpected = htmlspecialchars($expected);
-    $htmlActual = htmlspecialchars($actual);
-    $str .= sprintf("<pre>%s\n--------\n%s</pre>",
-		    $htmlExpected, $htmlActual);
-    $this->fail($str);
-  }
-}
-
-class TestCase extends Assert /* implements Test */ {
-  /* Defines context for running tests.  Specific context -- such as
-     instance variables, global variables, global state -- is defined
-     by creating a subclass that specializes the setUp() and
-     tearDown() methods.  A specific test is defined by a subclass
-     that specializes the runTest() method. */
-  var $fName;
-  var $fResult;
-  var $fExceptions = array();
-
-  function TestCase($name) {
-    $this->fName = $name;
-  }
-
-  function run($testResult=0) {
-    /* Run this single test, by calling the run() method of the
-       TestResult object which will in turn call the runBare() method
-       of this object.  That complication allows the TestResult object
-       to do various kinds of progress reporting as it invokes each
-       test.  Create/obtain a TestResult object if none was passed in.
-       Note that if a TestResult object was passed in, it must be by
-       reference. */
-    if (! $testResult)
-      $testResult = $this->_createResult();
-    $this->fResult = $testResult;
-    $testResult->run(&$this);
-    $this->fResult = 0;
-    return $testResult;
-  }
-
-  function countTestCases() {
-    return 1;
-  }
-
-  function runTest() {
-    $name = $this->name();
-    // Since isset($this->$name) is false, no way to run defensive checks
-    $this->$name();
-  }
-
-  function setUp() /* expect override */ {
-    //print("TestCase::setUp()<br>\n");
-  }
-
-  function tearDown() /* possible override */ {
-    //print("TestCase::tearDown()<br>\n");
-  }
-
-  ////////////////////////////////////////////////////////////////
-
-
-  function _createResult() /* protected */ {
-    /* override this to use specialized subclass of TestResult */
-    return new TestResult;
-  }
-
-  function fail($message=0) {
-    //printf("TestCase::fail(%s)<br>\n", ($message) ? $message : '');
-    /* JUnit throws AssertionFailedError here.  We just record the
-       failure and carry on */
-    $this->fExceptions[] = new Exception(&$message);
-  }
-
-  function error($message) {
-    /* report error that requires correction in the test script
-       itself, or (heaven forbid) in this testing infrastructure */
-    printf('<b>ERROR: ' . $message . '</b><br>');
-    $this->fResult->stop();
-  }
-
-  function failed() {
-    return count($this->fExceptions);
-  }
-
-  function getExceptions() {
-    return $this->fExceptions;
-  }
-
-  function name() {
-    return $this->fName;
-  }
-
-  function runBare() {
-    $this->setup();
-    $this->runTest();
-    $this->tearDown();
-  }
-}
-
-
-class TestSuite /* implements Test */ {
-  /* Compose a set of Tests (instances of TestCase or TestSuite), and
-     run them all. */
-  var $fTests = array();
-
-  function TestSuite($classname=false) {
-    if ($classname) {
-      // Find all methods of the given class whose name starts with
-      // "test" and add them to the test suite.  We are just _barely_
-      // able to do this with PHP's limited introspection...  Note
-      // that PHP seems to store method names in lower case, and we
-      // have to avoid the constructor function for the TestCase class
-      // superclass.  This will fail when $classname starts with
-      // "Test" since that will have a constructor method that will
-      // get matched below and then treated (incorrectly) as a test
-      // method.  So don't name any TestCase subclasses as "Test..."!
-      if (floor(phpversion()) >= 4) {
-	// PHP4 introspection, submitted by Dylan Kuhn
-	$names = get_class_methods($classname);
-	while (list($key, $method) = each($names)) {
-	  if (preg_match('/^test/', $method) && $method != "testcase") {  
-	    $this->addTest(new $classname($method));
-	  }
-	}
-      }
-      else {
-	$dummy = new $classname("dummy");
-	$names = (array) $dummy;
-	while (list($key, $value) = each($names)) {
-	  $type = gettype($value);
-	  if ($type == "user function" && preg_match('/^test/', $key)
-	  && $key != "testcase") {  
-	    $this->addTest(new $classname($key));
-	  }
-	}
-      }
-    }
-  }
-
-  function addTest($test) {
-    /* Add TestCase or TestSuite to this TestSuite */
-    $this->fTests[] = $test;
-  }
-
-  function run(&$testResult) {
-    /* Run all TestCases and TestSuites comprising this TestSuite,
-       accumulating results in the given TestResult object. */
-    reset($this->fTests);
-    while (list($na, $test) = each($this->fTests)) {
-      if ($testResult->shouldStop())
-	break;
-      $test->run(&$testResult);
-    }
-  }
-
-  function countTestCases() {
-    /* Number of TestCases comprising this TestSuite (including those
-       in any constituent TestSuites) */
-    $count = 0;
-    reset($fTests);
-    while (list($na, $test_case) = each($this->fTests)) {
-      $count += $test_case->countTestCases();
-    }
-    return $count;
-  }
-}
-
-
-class TestFailure {
-  /* Record failure of a single TestCase, associating it with the
-     exception(s) that occurred */
-  var $fFailedTestName;
-  var $fExceptions;
-
-  function TestFailure(&$test, &$exceptions) {
-    $this->fFailedTestName = $test->name();
-    $this->fExceptions = $exceptions;
-  }
-
-  function getExceptions() {
-      return $this->fExceptions;
-  }
-  function getTestName() {
-    return $this->fFailedTestName;
-  }
-}
-
-
-class TestResult {
-  /* Collect the results of running a set of TestCases. */
-  var $fFailures = array();
-  var $fRunTests = 0;
-  var $fStop = false;
-
-  function TestResult() { }
-
-  function _endTest($test) /* protected */ {
-      /* specialize this for end-of-test action, such as progress
-	 reports  */
-  }
-
-  function getFailures() {
-    return $this->fFailures;
-  }
-
-  function run($test) {
-    /* Run a single TestCase in the context of this TestResult */
-    $this->_startTest($test);
-    $this->fRunTests++;
-
-    $test->runBare();
-
-    /* this is where JUnit would catch AssertionFailedError */
-    $exceptions = $test->getExceptions();
-    if ($exceptions)
-      $this->fFailures[] = new TestFailure(&$test, &$exceptions);
-    $this->_endTest($test);
-  }
-
-  function countTests() {
-    return $this->fRunTests;
-  }
-
-  function shouldStop() {
-    return $this->fStop;
-  }
-
-  function _startTest($test) /* protected */ {
-      /* specialize this for start-of-test actions */
-  }
-
-  function stop() {
-    /* set indication that the test sequence should halt */
-    $fStop = true;
-  }
-
-  function countFailures() {
-    return count($this->fFailures);
-  }
-}
-
-
-class TextTestResult extends TestResult {
-  /* Specialize TestResult to produce text/html report */
-  function TextTestResult() {
-    $this->TestResult();  // call superclass constructor
-  }
-  
-  function report() {
-    /* report result of test run */
-    $nRun = $this->countTests();
-    $nFailures = $this->countFailures();
-    printf("<p>%s test%s run<br>", $nRun, ($nRun == 1) ? '' : 's');
-    printf("%s failure%s.<br>\n", $nFailures, ($nFailures == 1) ? '' : 's');
-    if ($nFailures == 0)
-      return;
-
-    print("<ol>\n");
-    $failures = $this->getFailures();
-    while (list($i, $failure) = each($failures)) {
-      $failedTestName = $failure->getTestName();
-      printf("<li>%s\n", $failedTestName);
-
-      $exceptions = $failure->getExceptions();
-      print("<ul>");
-      while (list($na, $exception) = each($exceptions))
-	printf("<li>%s\n", $exception->getMessage());
-      print("</ul>");
-    }
-    print("</ol>\n");
-  }
-
-  function _startTest($test) {
-    printf("%s ", $test->name());
-    flush();
-  }
-
-  function _endTest($test) {
-    $outcome = $test->failed()
-       ? "<font color=\"red\">FAIL</font>"
-       : "<font color=\"green\">ok</font>";
-    printf("$outcome<br>\n");
-    flush();
-  }
-}
-
-
-class TestRunner {
-  /* Run a suite of tests and report results. */
-  function run($suite) {
-    $result = new TextTestResult;
-    $suite->run($result);
-    $result->report();
-  }
-}
-
-?>
+<?php
+//
+// PHP framework for testing, based on the design of "JUnit".
+//
+// Written by Fred Yankowski <fred at ontosys.com>
+//            OntoSys, Inc  <http://www.OntoSys.com>
+//
+// $Id: phpunit.php,v 1.3 2005/09/13 09:36:59 bjoern_heuser Exp $
+
+// Copyright (c) 2000 Fred Yankowski
+
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use, copy,
+// modify, merge, publish, distribute, sublicense, and/or sell copies
+// of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+//
+error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |
+		E_CORE_ERROR | E_CORE_WARNING);
+
+/*
+interface Test {
+  function run(&$aTestResult);
+  function countTestCases();
+}
+*/
+
+function trace($msg) {
+  return;
+  print($msg);
+  flush();
+}
+
+
+class Exception {
+    /* Emulate a Java exception, sort of... */
+  var $message;
+  function Exception($message) {
+    $this->message = $message;
+  }
+  function getMessage() {
+    return $this->message;
+  }
+}
+
+class Assert {
+  function assert($boolean, $message=0) {
+    if (! $boolean)
+      $this->fail($message);
+  }
+
+  function assertEquals($expected, $actual, $message=0) {
+    if ($expected != $actual) {
+      $this->failNotEquals($expected, $actual, "expected", $message);
+    }
+  }
+
+  function assertRegexp($regexp, $actual, $message=false) {
+    if (! preg_match($regexp, $actual)) {
+      $this->failNotEquals($regexp, $actual, "pattern", $message);
+    }
+  }
+
+  function failNotEquals($expected, $actual, $expected_label, $message=0) {
+    // Private function for reporting failure to match.
+    $str = $message ? ($message . ' ') : '';
+    $str .= "($expected_label/actual)<br>";
+    $htmlExpected = htmlspecialchars($expected);
+    $htmlActual = htmlspecialchars($actual);
+    $str .= sprintf("<pre>%s\n--------\n%s</pre>",
+		    $htmlExpected, $htmlActual);
+    $this->fail($str);
+  }
+}
+
+class TestCase extends Assert /* implements Test */ {
+  /* Defines context for running tests.  Specific context -- such as
+     instance variables, global variables, global state -- is defined
+     by creating a subclass that specializes the setUp() and
+     tearDown() methods.  A specific test is defined by a subclass
+     that specializes the runTest() method. */
+  var $fName;
+  var $fResult;
+  var $fExceptions = array();
+
+  function TestCase($name) {
+    $this->fName = $name;
+  }
+
+  function run($testResult=0) {
+    /* Run this single test, by calling the run() method of the
+       TestResult object which will in turn call the runBare() method
+       of this object.  That complication allows the TestResult object
+       to do various kinds of progress reporting as it invokes each
+       test.  Create/obtain a TestResult object if none was passed in.
+       Note that if a TestResult object was passed in, it must be by
+       reference. */
+    if (! $testResult)
+      $testResult = $this->_createResult();
+    $this->fResult = $testResult;
+    $testResult->run(&$this);
+    $this->fResult = 0;
+    return $testResult;
+  }
+
+  function countTestCases() {
+    return 1;
+  }
+
+  function runTest() {
+    $name = $this->name();
+    // Since isset($this->$name) is false, no way to run defensive checks
+    $this->$name();
+  }
+
+  function setUp() /* expect override */ {
+    //print("TestCase::setUp()<br>\n");
+  }
+
+  function tearDown() /* possible override */ {
+    //print("TestCase::tearDown()<br>\n");
+  }
+
+  ////////////////////////////////////////////////////////////////
+
+
+  function _createResult() /* protected */ {
+    /* override this to use specialized subclass of TestResult */
+    return new TestResult;
+  }
+
+  function fail($message=0) {
+    //printf("TestCase::fail(%s)<br>\n", ($message) ? $message : '');
+    /* JUnit throws AssertionFailedError here.  We just record the
+       failure and carry on */
+    $this->fExceptions[] = new Exception(&$message);
+  }
+
+  function error($message) {
+    /* report error that requires correction in the test script
+       itself, or (heaven forbid) in this testing infrastructure */
+    printf('<b>ERROR: ' . $message . '</b><br>');
+    $this->fResult->stop();
+  }
+
+  function failed() {
+    return count($this->fExceptions);
+  }
+
+  function getExceptions() {
+    return $this->fExceptions;
+  }
+
+  function name() {
+    return $this->fName;
+  }
+
+  function runBare() {
+    $this->setup();
+    $this->runTest();
+    $this->tearDown();
+  }
+}
+
+
+class TestSuite /* implements Test */ {
+  /* Compose a set of Tests (instances of TestCase or TestSuite), and
+     run them all. */
+  var $fTests = array();
+
+  function TestSuite($classname=false) {
+    if ($classname) {
+      // Find all methods of the given class whose name starts with
+      // "test" and add them to the test suite.  We are just _barely_
+      // able to do this with PHP's limited introspection...  Note
+      // that PHP seems to store method names in lower case, and we
+      // have to avoid the constructor function for the TestCase class
+      // superclass.  This will fail when $classname starts with
+      // "Test" since that will have a constructor method that will
+      // get matched below and then treated (incorrectly) as a test
+      // method.  So don't name any TestCase subclasses as "Test..."!
+      if (floor(phpversion()) >= 4) {
+	// PHP4 introspection, submitted by Dylan Kuhn
+	$names = get_class_methods($classname);
+	while (list($key, $method) = each($names)) {
+	  if (preg_match('/^test/', $method) && $method != "testcase") {  
+	    $this->addTest(new $classname($method));
+	  }
+	}
+      }
+      else {
+	$dummy = new $classname("dummy");
+	$names = (array) $dummy;
+	while (list($key, $value) = each($names)) {
+	  $type = gettype($value);
+	  if ($type == "user function" && preg_match('/^test/', $key)
+	  && $key != "testcase") {  
+	    $this->addTest(new $classname($key));
+	  }
+	}
+      }
+    }
+  }
+
+  function addTest($test) {
+    /* Add TestCase or TestSuite to this TestSuite */
+    $this->fTests[] = $test;
+  }
+
+  function run(&$testResult) {
+    /* Run all TestCases and TestSuites comprising this TestSuite,
+       accumulating results in the given TestResult object. */
+    reset($this->fTests);
+    while (list($na, $test) = each($this->fTests)) {
+      if ($testResult->shouldStop())
+	break;
+      $test->run(&$testResult);
+    }
+  }
+
+  function countTestCases() {
+    /* Number of TestCases comprising this TestSuite (including those
+       in any constituent TestSuites) */
+    $count = 0;
+    reset($fTests);
+    while (list($na, $test_case) = each($this->fTests)) {
+      $count += $test_case->countTestCases();
+    }
+    return $count;
+  }
+}
+
+
+class TestFailure {
+  /* Record failure of a single TestCase, associating it with the
+     exception(s) that occurred */
+  var $fFailedTestName;
+  var $fExceptions;
+
+  function TestFailure(&$test, &$exceptions) {
+    $this->fFailedTestName = $test->name();
+    $this->fExceptions = $exceptions;
+  }
+
+  function getExceptions() {
+      return $this->fExceptions;
+  }
+  function getTestName() {
+    return $this->fFailedTestName;
+  }
+}
+
+
+class TestResult {
+  /* Collect the results of running a set of TestCases. */
+  var $fFailures = array();
+  var $fRunTests = 0;
+  var $fStop = false;
+
+  function TestResult() { }
+
+  function _endTest($test) /* protected */ {
+      /* specialize this for end-of-test action, such as progress
+	 reports  */
+  }
+
+  function getFailures() {
+    return $this->fFailures;
+  }
+
+  function run($test) {
+    /* Run a single TestCase in the context of this TestResult */
+    $this->_startTest($test);
+    $this->fRunTests++;
+
+    $test->runBare();
+
+    /* this is where JUnit would catch AssertionFailedError */
+    $exceptions = $test->getExceptions();
+    if ($exceptions)
+      $this->fFailures[] = new TestFailure(&$test, &$exceptions);
+    $this->_endTest($test);
+  }
+
+  function countTests() {
+    return $this->fRunTests;
+  }
+
+  function shouldStop() {
+    return $this->fStop;
+  }
+
+  function _startTest($test) /* protected */ {
+      /* specialize this for start-of-test actions */
+  }
+
+  function stop() {
+    /* set indication that the test sequence should halt */
+    $fStop = true;
+  }
+
+  function countFailures() {
+    return count($this->fFailures);
+  }
+}
+
+
+class TextTestResult extends TestResult {
+  /* Specialize TestResult to produce text/html report */
+  function TextTestResult() {
+    $this->TestResult();  // call superclass constructor
+  }
+  
+  function report() {
+    /* report result of test run */
+    $nRun = $this->countTests();
+    $nFailures = $this->countFailures();
+    printf("<p>%s test%s run<br>", $nRun, ($nRun == 1) ? '' : 's');
+    printf("%s failure%s.<br>\n", $nFailures, ($nFailures == 1) ? '' : 's');
+    if ($nFailures == 0)
+      return;
+
+    print("<ol>\n");
+    $failures = $this->getFailures();
+    while (list($i, $failure) = each($failures)) {
+      $failedTestName = $failure->getTestName();
+      printf("<li>%s\n", $failedTestName);
+
+      $exceptions = $failure->getExceptions();
+      print("<ul>");
+      while (list($na, $exception) = each($exceptions))
+	printf("<li>%s\n", $exception->getMessage());
+      print("</ul>");
+    }
+    print("</ol>\n");
+  }
+
+  function _startTest($test) {
+    printf("%s ", $test->name());
+    flush();
+  }
+
+  function _endTest($test) {
+    $outcome = $test->failed()
+       ? "<font color=\"red\">FAIL</font>"
+       : "<font color=\"green\">ok</font>";
+    printf("$outcome<br>\n");
+    flush();
+  }
+}
+
+
+class TestRunner {
+  /* Run a suite of tests and report results. */
+  function run($suite) {
+    $result = new TextTestResult;
+    $suite->run($result);
+    $result->report();
+  }
+}
+
+?>

Modified: branches/print_dev/http/css/admin.css
===================================================================
--- branches/print_dev/http/css/admin.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/admin.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,32 +1,32 @@
-body{
-	font-size: 11px;
-	line-height: 12px;
-	font-family: "Verdana","Arial",sans-serif;
-	overflow-x: hidden;
-	background: white;
-	color: ThreedDarkShadow;
-}
-/* links */
-a {
-  text-decoration:none;
-  color:black;
-}
-a:visited {
-	color: ThreedDarkShadow;
-}
-a:active {
-	color: Lime;
-}
-a:hover {
-	color: ThreedDarkShadow;
-	background-color: #DCDCDC;
-
-}
-div{
-	font-size: 12px;
-	font-weight: bold;
-	text-decoration: underline;
-	color: Red;
-	margin-left: 2px;
-	background-color:#FFEDED;
+body{
+	font-size: 11px;
+	line-height: 12px;
+	font-family: "Verdana","Arial",sans-serif;
+	overflow-x: hidden;
+	background: white;
+	color: ThreedDarkShadow;
+}
+/* links */
+a {
+  text-decoration:none;
+  color:black;
+}
+a:visited {
+	color: ThreedDarkShadow;
+}
+a:active {
+	color: Lime;
+}
+a:hover {
+	color: ThreedDarkShadow;
+	background-color: #DCDCDC;
+
+}
+div{
+	font-size: 12px;
+	font-weight: bold;
+	text-decoration: underline;
+	color: Red;
+	margin-left: 2px;
+	background-color:#FFEDED;
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/admin.screen.css
===================================================================
--- branches/print_dev/http/css/admin.screen.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/admin.screen.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,123 +1,123 @@
- at charset "utf8";
-
-/* ################################################## */
-
-* {
-	font-weight: normal;
-	font-style: normal;
-}
-
-body {
-	padding: 1em;
-	font-family: "Lucida Sans Unicode","Lucida Sans","Lucida Grande","Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
-	font-size: 12px;
-	line-height: 1.2em;
-	color: #000;
-	background-color: #FFF;
-}
-
-/* ################################################## */
-
-h1 {
-	margin-bottom: 1em;
-	font-size: 2em;
-	color: #600;
-}
-
-p {
-	margin-bottom: 1em;
+ at charset "utf8";
+
+/* ################################################## */
+
+* {
+	font-weight: normal;
+	font-style: normal;
 }
 
+body {
+	padding: 1em;
+	font-family: "Lucida Sans Unicode","Lucida Sans","Lucida Grande","Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
+	font-size: 12px;
+	line-height: 1.2em;
+	color: #000;
+	background-color: #FFF;
+}
+
+/* ################################################## */
+
+h1 {
+	margin-bottom: 1em;
+	font-size: 2em;
+	color: #600;
+}
+
+p {
+	margin-bottom: 1em;
+}
+
 a {
 	color: #09C;
 }
 
 a:hover {
 	text-decoration: none;
-}
-
-/* ################################################## */
-
-form {
-	clear: both;
-	margin-top: 1em;
-}
-
+}
+
+/* ################################################## */
+
+form {
+	clear: both;
+	margin-top: 1em;
+}
+
 fieldset {
 	padding: 0;
 	border: 0;
-}
-
-legend {
+}
+
+legend {
 	display: block;
 	margin: 0;
 	padding: 0;
-	font-weight: bold;
-	text-transform: uppercase;
+	font-weight: bold;
+	text-transform: uppercase;
 	color: #600;
-}
-
+}
+
 label {
-	margin-bottom: .5em;
-	white-space: nowrap;
-}
-
+	margin-bottom: .5em;
+	white-space: nowrap;
+}
+
 input, textarea, select {
-	font: inherit;
+	font: inherit;
 	background-color: #EEE;
-	border: 1px solid #CCC;
-}
+	border: 1px solid #CCC;
+}
 
-hr {
+hr {
 	clear: both;
 	height: 1px;
-	color: #FFF;
-	background-color: transparent;
-	border: 0;
-}
-
-/* ################################################## */
+	color: #FFF;
+	background-color: transparent;
+	border: 0;
+}
 
+/* ################################################## */
+
 input.wide {
 	width: 100%;
 }
 
-.rightContainer {
-	float: right;
+.rightContainer {
+	float: right;
 	width: 40%;
-	margin-left: -1%;
-}
-
-
-.leftContainer {
-	float: left;
+	margin-left: -1%;
+}
+
+
+.leftContainer {
+	float: left;
 	width: 40%;
 	margin-right: -1%;
-}
-
-.centerContainer {
+}
+
+.centerContainer {
 	float: left;
-	width: 20%;
-	text-align: center;
-}
-
-.centerContainer legend {
-	visibility: hidden;
-}
-
-.rightContainer select,
-.leftContainer select {
-	width: 100%;
-}
-
-.centerContainer input#add,
-.centerContainer input#remove {
+	width: 20%;
+	text-align: center;
+}
+
+.centerContainer legend {
+	visibility: hidden;
+}
+
+.rightContainer select,
+.leftContainer select {
+	width: 100%;
+}
+
+.centerContainer input#add,
+.centerContainer input#remove {
 	margin-top: .5em;
 	margin-bottom: .5em;
-	padding-right: 1em;
+	padding-right: 1em;
 	padding-left: 1em;
-}
-
+}
+
 #indicator img {
 	vertical-align: middle;
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/admin_service.css
===================================================================
--- branches/print_dev/http/css/admin_service.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/admin_service.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,32 +1,32 @@
-body{
-	font-size: 11px;
-	line-height: 12px;
-	font-family: "Verdana","Arial",sans-serif;
-	overflow-x: hidden;
-	background: white;
-	color: ThreedDarkShadow;
-}
-/* links */
-a {
-  text-decoration:none;
-  color:black;
-}
-a:visited {
-	color: ThreedDarkShadow;
-}
-a:active {
-	color: Lime;
-}
-a:hover {
-	color: Navy;
-	background-color: #DCDCDC;
-	font-weight: bold;
-}
-div{
-	font-size: 12px;
-	font-weight: bold;
-	text-decoration: underline;
-	color: Navy;
-	margin-left: 2px;
-	background-color:#E5F9FD;
+body{
+	font-size: 11px;
+	line-height: 12px;
+	font-family: "Verdana","Arial",sans-serif;
+	overflow-x: hidden;
+	background: white;
+	color: ThreedDarkShadow;
+}
+/* links */
+a {
+  text-decoration:none;
+  color:black;
+}
+a:visited {
+	color: ThreedDarkShadow;
+}
+a:active {
+	color: Lime;
+}
+a:hover {
+	color: Navy;
+	background-color: #DCDCDC;
+	font-weight: bold;
+}
+div{
+	font-size: 12px;
+	font-weight: bold;
+	text-decoration: underline;
+	color: Navy;
+	margin-left: 2px;
+	background-color:#E5F9FD;
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/admin_user.css
===================================================================
--- branches/print_dev/http/css/admin_user.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/admin_user.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,32 +1,32 @@
-body{
-	font-size: 11px;
-	line-height: 12px;
-	font-family: "Verdana","Arial",sans-serif;
-	overflow-x: hidden;
-	background: white;
-	color: ThreedDarkShadow;
-}
-/* links */
-a {
-  text-decoration:none;
-  color:black;
-}
-a:visited {
-	color: ThreedDarkShadow;
-}
-a:active {
-	color: Lime;
-}
-a:hover {
-	color: green;
-	background-color: #DCDCDC;
-	font-weight: bold;
-}
-div{
-	font-size: 12px;
-	font-weight: bold;
-	text-decoration: underline;
-	color: Green;
-	margin-left: 2px;
-	background-color:#ECFFE7;
+body{
+	font-size: 11px;
+	line-height: 12px;
+	font-family: "Verdana","Arial",sans-serif;
+	overflow-x: hidden;
+	background: white;
+	color: ThreedDarkShadow;
+}
+/* links */
+a {
+  text-decoration:none;
+  color:black;
+}
+a:visited {
+	color: ThreedDarkShadow;
+}
+a:active {
+	color: Lime;
+}
+a:hover {
+	color: green;
+	background-color: #DCDCDC;
+	font-weight: bold;
+}
+div{
+	font-size: 12px;
+	font-weight: bold;
+	text-decoration: underline;
+	color: Green;
+	margin-left: 2px;
+	background-color:#ECFFE7;
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/edit_gui.css
===================================================================
--- branches/print_dev/http/css/edit_gui.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/edit_gui.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,48 +1,48 @@
-body{
-	background-color : #ffffff;
-	font-family: Arial, Helvetica, sans-serif;
-	font-size: 14px;
-}
-
-table{
-	font-size: 12px;
-}
-
-.table_top{
-	font-size: 14px;
-}
-
-select {
-	font-size: 14;
-	width: 200px;
-	size: 12px;
-}
-
-.select_short{
-	width: auto;
-}
-
-.Lbutton{
-		font-size : 9pt;
-		width:56px;
-}
-
-.button2{
-		font-size : 9pt;
-		width: 30px;
-}
-
-.button_on_off{
-		font-size : 9pt;
-		width: 24px;
-}
-
-.button_wfs{
-		font-size : 9pt;
-		width: 48px;
-}
-
-.myButton{
-		font-size : 14;
-		width: 100px;
-}
+body{
+	background-color : #ffffff;
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 14px;
+}
+
+table{
+	font-size: 12px;
+}
+
+.table_top{
+	font-size: 14px;
+}
+
+select {
+	font-size: 14;
+	width: 200px;
+	size: 12px;
+}
+
+.select_short{
+	width: auto;
+}
+
+.Lbutton{
+		font-size : 9pt;
+		width:56px;
+}
+
+.button2{
+		font-size : 9pt;
+		width: 30px;
+}
+
+.button_on_off{
+		font-size : 9pt;
+		width: 24px;
+}
+
+.button_wfs{
+		font-size : 9pt;
+		width: 48px;
+}
+
+.myButton{
+		font-size : 14;
+		width: 100px;
+}

Modified: branches/print_dev/http/css/gazetteerSQL_ALB.css
===================================================================
--- branches/print_dev/http/css/gazetteerSQL_ALB.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/gazetteerSQL_ALB.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,81 +1,81 @@
-	    body{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .selectCommune{
-	    	position:absolute;
-	    	top:10px;
-	    	left:5px;
-	    	width:150px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .selectStreet{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:40px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    .selectDistrict{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:40px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    .divOwner{
-	    	position:absolute;
-	    	top:40px;
-	    	left:5px;
-	    }
-	    .inputOwner{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 55px;
-	    }
-	    .divParcel{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:125px;
-	    	left:5px;
-	    }
-	    .inputParcel1{
-			visibility:hidden;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 30px;
-	    }
-	    .inputParcel2{
-			visibility:hidden;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 30px;
-	    }
-	    .divResults{
-	    	position:absolute;
-	    	top:90px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    a:link {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
-	    }
-	    a:visited {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
-	    }
-	    a:active {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
+	    body{
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    }
+	    .selectCommune{
+	    	position:absolute;
+	    	top:10px;
+	    	left:5px;
+	    	width:150px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    }
+	    .selectStreet{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:40px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    .selectDistrict{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:40px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    .divOwner{
+	    	position:absolute;
+	    	top:40px;
+	    	left:5px;
+	    }
+	    .inputOwner{
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 55px;
+	    }
+	    .divParcel{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:125px;
+	    	left:5px;
+	    }
+	    .inputParcel1{
+			visibility:hidden;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 30px;
+	    }
+	    .inputParcel2{
+			visibility:hidden;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 30px;
+	    }
+	    .divResults{
+	    	position:absolute;
+	    	top:90px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    a:link {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
+	    }
+	    a:visited {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
+	    }
+	    a:active {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
 	    }
\ No newline at end of file

Modified: branches/print_dev/http/css/gazetteerSQL_ALK.css
===================================================================
--- branches/print_dev/http/css/gazetteerSQL_ALK.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/gazetteerSQL_ALK.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,79 +1,79 @@
-	    body{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .selectCommune{
-	    	position:absolute;
-	    	top:10px;
-	    	left:5px;
-	    	width:150px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .selectStreet{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:40px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    .selectDistrict{
-	    	position:absolute;
-	    	top:40px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    .divOwner{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:125px;
-	    	left:5px;
-	    }
-	    .inputOwner{
-			visibility:hidden;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 100px;
-	    }
-	    .divParcel{
-	    	position:absolute;
-	    	top:125px;
-	    	left:5px;
-	    }
-	    .inputParcel1{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 30px;
-	    }
-	    .inputParcel2{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 30px;
-	    }
-	    .divResults{
-	    	position:absolute;
-	    	top:160px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    a:link {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
-	    }
-	    a:visited {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
-	    }
-	    a:active {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
+	    body{
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    }
+	    .selectCommune{
+	    	position:absolute;
+	    	top:10px;
+	    	left:5px;
+	    	width:150px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    }
+	    .selectStreet{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:40px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    .selectDistrict{
+	    	position:absolute;
+	    	top:40px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    .divOwner{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:125px;
+	    	left:5px;
+	    }
+	    .inputOwner{
+			visibility:hidden;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 100px;
+	    }
+	    .divParcel{
+	    	position:absolute;
+	    	top:125px;
+	    	left:5px;
+	    }
+	    .inputParcel1{
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 30px;
+	    }
+	    .inputParcel2{
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 30px;
+	    }
+	    .divResults{
+	    	position:absolute;
+	    	top:160px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    a:link {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
+	    }
+	    a:visited {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
+	    }
+	    a:active {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
 	    }
\ No newline at end of file

Modified: branches/print_dev/http/css/gazetteerSQL_Address.css
===================================================================
--- branches/print_dev/http/css/gazetteerSQL_Address.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/gazetteerSQL_Address.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,82 +1,82 @@
-	    body{
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .selectCommune{
-	    	position:absolute;
-	    	top:10px;
-	    	left:5px;
-	    	width:150px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    }
-	    .selectStreet{
-	    	position:absolute;
-	    	top:40px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    .selectDistrict{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:40px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    .divOwner{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:125px;
-	    	left:5px;
-	    }
-	    .inputOwner{
-			visibility:hidden;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 100px;
-	    }
-	    .divParcel{
-			visibility:hidden;
-	    	position:absolute;
-	    	top:125px;
-	    	left:5px;
-	    }
-	    .inputParcel1{
-			visibility:hidden;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 30px;
-	    }
-	    .inputParcel2{
-			visibility:hidden;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 30px;
-	    }
-	    .divResults{
-	    	position:absolute;
-	    	top:120px;
-	    	left:5px;
-	    	font-family : Arial, Helvetica, sans-serif;
-	    	font-size: 11px;
-	    	width: 150px;
-	    }
-	    a:link {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
-	    }
-	    a:visited {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
-	    }
-	    a:active {
-	    	text-decoration: none;
-	    	font-family: Arial, Helvetica, sans-serif;
-	    	color: black;
+	    body{
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    }
+	    .selectCommune{
+	    	position:absolute;
+	    	top:10px;
+	    	left:5px;
+	    	width:150px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    }
+	    .selectStreet{
+	    	position:absolute;
+	    	top:40px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    .selectDistrict{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:40px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    .divOwner{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:125px;
+	    	left:5px;
+	    }
+	    .inputOwner{
+			visibility:hidden;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 100px;
+	    }
+	    .divParcel{
+			visibility:hidden;
+	    	position:absolute;
+	    	top:125px;
+	    	left:5px;
+	    }
+	    .inputParcel1{
+			visibility:hidden;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 30px;
+	    }
+	    .inputParcel2{
+			visibility:hidden;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 30px;
+	    }
+	    .divResults{
+	    	position:absolute;
+	    	top:120px;
+	    	left:5px;
+	    	font-family : Arial, Helvetica, sans-serif;
+	    	font-size: 11px;
+	    	width: 150px;
+	    }
+	    a:link {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
+	    }
+	    a:visited {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
+	    }
+	    a:active {
+	    	text-decoration: none;
+	    	font-family: Arial, Helvetica, sans-serif;
+	    	color: black;
 	    }
\ No newline at end of file

Modified: branches/print_dev/http/css/mapbender.css
===================================================================
--- branches/print_dev/http/css/mapbender.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/mapbender.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,59 +1,59 @@
-body, .body, td, form, input, select {
-  font-size: 12px;
-  font-family: "Verdana","Arial","Tahoma",sans-serif;
-}
-
-td h2, td h3, div h2, div h3, div h4 {
-  margin-top: 0px;
-}
-
-/* body colors */
-body, .body {
-  background-color:#F0F0F0;
-}
-body table, h1 {
-  margin:0px;
-  background-color:#ffffff;
-  margin-left: 15px;
-}
-body table tr td {
-  padding-left: 10px;
-  padding-right: 10px;
-}
-
-/* links */
-a {
-  text-decoration:underline;
-  color:#000099;
-}
-a:visited {
-  color:#555555;
-}
-a:active {
-  color:#4241DE;
-  background-color:#ce0000;
-}
-a:hover {
-  
-  color:#FF0000;
-}
-
-.mapbender_headline{
-	font-size: 32px; 
-	font-stretch:extra-expanded;
-	font-weight:bold;
-	margin-bottom:4px;
-}
-
-.mapbender_welcome{
-	font-size: 20px; 
-	font-weight:bold;
-	margin-top:3px;
-	margin-bottom:4px;
-}
-
-
-img{
-	border:0;
-	
+body, .body, td, form, input, select {
+  font-size: 12px;
+  font-family: "Verdana","Arial","Tahoma",sans-serif;
+}
+
+td h2, td h3, div h2, div h3, div h4 {
+  margin-top: 0px;
+}
+
+/* body colors */
+body, .body {
+  background-color:#F0F0F0;
+}
+body table, h1 {
+  margin:0px;
+  background-color:#ffffff;
+  margin-left: 15px;
+}
+body table tr td {
+  padding-left: 10px;
+  padding-right: 10px;
+}
+
+/* links */
+a {
+  text-decoration:underline;
+  color:#000099;
+}
+a:visited {
+  color:#555555;
+}
+a:active {
+  color:#4241DE;
+  background-color:#ce0000;
+}
+a:hover {
+  
+  color:#FF0000;
+}
+
+.mapbender_headline{
+	font-size: 32px; 
+	font-stretch:extra-expanded;
+	font-weight:bold;
+	margin-bottom:4px;
+}
+
+.mapbender_welcome{
+	font-size: 20px; 
+	font-weight:bold;
+	margin-top:3px;
+	margin-bottom:4px;
+}
+
+
+img{
+	border:0;
+	
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/meetingPoint.css
===================================================================
--- branches/print_dev/http/css/meetingPoint.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/meetingPoint.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,44 +1,44 @@
-body{
-	font-family : Verdana, Arial, Helvetica, sans-serif;
-	font-size : 11px;
-	color: #000000;
-}
-
-.strinput{
-	font-family : Verdana, Arial, Helvetica, sans-serif;
-	font-size : 10px;
-	height: 40px;
-	width: 150px;
-	color: #000000;
-	background: #FFFFFF;   
-}
-
-.coord{
-	border: 0;
-	font-family: Verdana, Arial, Helvetica, sans-serif;
-	font-size: 10px;
-	height: 20px;
-	color: #888888;
-	background: #FFFFFF;
-	width: 80px;
-}
-
-.okbutton{
-	font-family : Verdana, Arial, Helvetica, sans-serif;
-	font-size : 10px;
-	font-weight: normal;
-	border : solid thin;
-	width: 26px;
-	height: 20px;
-	background: #c0c0c0;   
-}
-
-.ibutton{
-	font-family : Verdana, Arial, Helvetica, sans-serif;
-	font-size : 10px;
-	font-weight: normal;
-	border : solid thin;
-	width: 40px;
-	height: 20px;
-	background: #c0c0c0;   
+body{
+	font-family : Verdana, Arial, Helvetica, sans-serif;
+	font-size : 11px;
+	color: #000000;
+}
+
+.strinput{
+	font-family : Verdana, Arial, Helvetica, sans-serif;
+	font-size : 10px;
+	height: 40px;
+	width: 150px;
+	color: #000000;
+	background: #FFFFFF;   
+}
+
+.coord{
+	border: 0;
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 10px;
+	height: 20px;
+	color: #888888;
+	background: #FFFFFF;
+	width: 80px;
+}
+
+.okbutton{
+	font-family : Verdana, Arial, Helvetica, sans-serif;
+	font-size : 10px;
+	font-weight: normal;
+	border : solid thin;
+	width: 26px;
+	height: 20px;
+	background: #c0c0c0;   
+}
+
+.ibutton{
+	font-family : Verdana, Arial, Helvetica, sans-serif;
+	font-size : 10px;
+	font-weight: normal;
+	border : solid thin;
+	width: 40px;
+	height: 20px;
+	background: #c0c0c0;   
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/metadata.css
===================================================================
--- branches/print_dev/http/css/metadata.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/metadata.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,62 +1,62 @@
-body,td, form, input, select{
-	font-size: 12px;
-	line-height: 16px;
-	font-family: "Verdana","Arial",sans-serif;
-	color: black;
-}
-
-select{
-	color:black;
-	width:300px;
-}
-
-.sbutton{
-	width:100px;
-	height:40px;
-}
-
-
-table{
-	font-size: 12px;
-	border: 1px;
-	margin-right: 4px;
-	margin-left: 6px;
-	text-align: left;	
-}
-
-
-.table_top{
-	color:black;
-	font-size: 12px;
-	margin-right: 2px;
-	text-align: right;	
-}
-
-.table_layer{
-	border:1px;
-	font-size: 12px;
-	border: 1px;
-	margin-right: 2px;
-	text-align: left;	
-}
-
-a {
-  text-decoration:none;
-  color:black;
-	text-decoration: underline;
-}
-
-a:active {
-	color: red;
-}
-a:hover {
-	color: blue;
-	text-decoration: underline;
-}
-div{
-	font-weight: bold;
-	text-decoration: underline;
-	color: Red;
-	margin-left: 2px;
-	background-color:#FFEDED;
+body,td, form, input, select{
+	font-size: 12px;
+	line-height: 16px;
+	font-family: "Verdana","Arial",sans-serif;
+	color: black;
+}
+
+select{
+	color:black;
+	width:300px;
+}
+
+.sbutton{
+	width:100px;
+	height:40px;
+}
+
+
+table{
+	font-size: 12px;
+	border: 1px;
+	margin-right: 4px;
+	margin-left: 6px;
+	text-align: left;	
+}
+
+
+.table_top{
+	color:black;
+	font-size: 12px;
+	margin-right: 2px;
+	text-align: right;	
+}
+
+.table_layer{
+	border:1px;
+	font-size: 12px;
+	border: 1px;
+	margin-right: 2px;
+	text-align: left;	
+}
+
+a {
+  text-decoration:none;
+  color:black;
+	text-decoration: underline;
+}
+
+a:active {
+	color: red;
+}
+a:hover {
+	color: blue;
+	text-decoration: underline;
+}
+div{
+	font-weight: bold;
+	text-decoration: underline;
+	color: Red;
+	margin-left: 2px;
+	background-color:#FFEDED;
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/print_div.css
===================================================================
--- branches/print_dev/http/css/print_div.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/print_div.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,54 +1,54 @@
- at CHARSET "ISO-8859-1";
-
-#printPDF label,input,select,textarea {
-	display: block;
-	width: 120px;
-	float: left;
-	margin-bottom: 2px;
-	margin-top: 2px;
-}
-
-#printPDF input#submit {
-	display: block;
-	width: 80px;
-	float: left;
-	margin-bottom: 2px;
-	margin-top: 2px;
-	margin-left: 50px;
-}
-
-#printPDF select {
-	width: 135px;
-}
-
-#printPDF label {
-	text-align: left;
-	width: 45px;
-	padding-right: 5px;
-}
-
-#printPDF br {
-	clear: left;
-}
-#printPDF_input {
-	display:block;
-	position:absolute;
-	z-index:1;	
-}
-#printPDF_working {
-	position:absolute;
-	z-index: 4;
-	display: none;
-	visibility: visible;
-	padding: 50px 0 0 20px;
-}
-#printPDF_working_bg {
-	position:absolute;
-	z-index: 3;
-	display: none;
-	visibility: visible;
-	background-color: #bbbbbb;
-	opacity: 0.75;
-	width:100%;
-	height:100%;
+ at CHARSET "ISO-8859-1";
+
+#printPDF label,input,select,textarea {
+	display: block;
+	width: 120px;
+	float: left;
+	margin-bottom: 2px;
+	margin-top: 2px;
+}
+
+#printPDF input#submit {
+	display: block;
+	width: 80px;
+	float: left;
+	margin-bottom: 2px;
+	margin-top: 2px;
+	margin-left: 50px;
+}
+
+#printPDF select {
+	width: 135px;
+}
+
+#printPDF label {
+	text-align: left;
+	width: 45px;
+	padding-right: 5px;
+}
+
+#printPDF br {
+	clear: left;
+}
+#printPDF_input {
+	display:block;
+	position:absolute;
+	z-index:1;	
+}
+#printPDF_working {
+	position:absolute;
+	z-index: 4;
+	display: none;
+	visibility: visible;
+	padding: 50px 0 0 20px;
+}
+#printPDF_working_bg {
+	position:absolute;
+	z-index: 3;
+	display: none;
+	visibility: visible;
+	background-color: #bbbbbb;
+	opacity: 0.75;
+	width:100%;
+	height:100%;
 }
\ No newline at end of file

Modified: branches/print_dev/http/css/sldEditor.css
===================================================================
--- branches/print_dev/http/css/sldEditor.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/sldEditor.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,218 +1,218 @@
-.inputfield{
-	border : 1px solid #1C5284;
-}
-.head{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:16px;
-	color:#1C5284;
-	text-align:left;
-	font-weight: bold;
-}
-.sub{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:13px;
-	color:#1C5284;
-	text-align:left;
-	left-margin:10px;
-}
-.text{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:12px;
-	color:black;
-	text-align:left;
-}
-.text1{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:12px;
-	color:#6699CC;
-}
-.text2{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:12px;
-	color:white;
-	text-align:left;
-	left-margin:10px;
-}
-.text3{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:12px;
-	color:white;
-}
-.text4{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:12px;
-	color:#6699CC;
-	text-align:left;
-}
-.edit_text{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:12px;
-	color:#6699CC;
-	margin: 2px;
-}
-.smalltext{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:11px;
-	color:black;
-	text-align:left;
-	left-margin:10px;
-}
-.line_ {
-	font-family: Arial, Helvetica, sans-serif;
-   	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:13px;
-	color:#1C5284;
-	text-align:left;
-	text-decoration: none	;
-}
-.imp {
-	font-family: Arial, Helvetica, sans-serif;
-   	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:11px;
-
-}    
-.button{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:12px;
-	color:#1C5284;
-	text-align:center;
-	border: 1px solid #1C5284;
-	background-color:#EAF2FA;
-}
-body{
-	scrollbar-3dlight-color:#1C5284;
-	scrollbar-darkshadow-color:#1C5284;
-	scrollbar-highlight-color:white;
-	scrollbar-shadow-color:white;
-	scrollbar-arrow-color:#1C5284;
-	scrollbar-track-color:white;
-	scrollbar-face-color:#BEC1C4;
-}
-.space{
- 	leftmargin: 10px;
-}
-.edit{
-	font-family: Arial, Helvetica, sans-serif;
-   	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:11px;
-	color:black;
-	text-decoration:none;
-	background-color:#86A6C5;
-	border:1px solid #143365;
-	padding-left:4px;
-	padding-right:4px;
-}
-a.edit{
-	font-family: Arial, Helvetica, sans-serif;
-   	font:Verdana, Arial, Helvetica, sans-serif;
-	font-size:11px;
-	color:black;
-	text-decoration:none;
-	background-color:#86A6C5;
-	border:1px solid #143365;
-	padding-left:4px;
-	padding-right:4px;
-}
-a.edit:hover {
-	color:white	;
-}   
-.line{
-border: 1px solid #B2D1F0;
-}
-.line2{
-border: 3px solid #B2D1F0;
-}
-.line_up{
-border-top: 1px solid #B2D1F0;
-}
-.line_down{
-border-bottom: 1px solid #B2D1F0;
-}
-.line_left{
-border-left: 1px solid #B2D1F0;
-}
-.line_right{
-border-right: 1px solid #B2D1F0;
-}
-.line_up2{
-border-top: 3px solid #B2D1F0;
-}
-.line_down2{
-border-bottom: 3px solid #B2D1F0;
-}
-.line_left2{
-border-left: 3px solid #B2D1F0;
-}
-.line_right2{
-border-right: 3px solid #B2D1F0;
-}
-
-.line_dash{
-border-bottom:1px dashed #B2D1F0;
-}
-.bg{
-background-color:#EAF2FA;
-}
-.bg1{
-background-color:#EAEBEB;
-}
-.bg2{
-background-color:#B2D1F0;
-}
-
-
-.edit_bg_menu{
-	background-color:#EAF2FA;
-	border:1px solid #B2D1F0;
-	border-bottom: 1px solid #EAF2FA;
-}
-.edit_label_bg{
-background-color:#EAF2FA;
-border:1px solid #B2D1F0;
-}
-.edit_label_bg2{
-background-color:#EAF2FA;
-border:3px solid #B2D1F0;
-}
-.edit_label_text{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font: Verdana, Arial, Helvetica, sans-serif;
-	font-size: 13px;
-	color: #6699CC;
-	text-align: left;
-	padding-left:3px;
-	padding-top:4px;
-	padding-bottom:4px;
-}
-.edit_label_text_head{
- 	font-family: Arial, Helvetica, sans-serif;
- 	font: Verdana, Arial, Helvetica, sans-serif;
-	font-size: 15px;
-	color: #4E769D;
-	text-align: left;
-}
-.hand{
-	cursor:hand;
-}
-.edit_label_width{
-	width:180px;
-}
-hr.sep {
-	color: #f00;
-	background-color: #ccc;
-	height: 1px;	
-}
-
-
-
-
+.inputfield{
+	border : 1px solid #1C5284;
+}
+.head{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:16px;
+	color:#1C5284;
+	text-align:left;
+	font-weight: bold;
+}
+.sub{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:13px;
+	color:#1C5284;
+	text-align:left;
+	left-margin:10px;
+}
+.text{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:black;
+	text-align:left;
+}
+.text1{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:#6699CC;
+}
+.text2{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:white;
+	text-align:left;
+	left-margin:10px;
+}
+.text3{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:white;
+}
+.text4{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:#6699CC;
+	text-align:left;
+}
+.edit_text{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:#6699CC;
+	margin: 2px;
+}
+.smalltext{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:11px;
+	color:black;
+	text-align:left;
+	left-margin:10px;
+}
+.line_ {
+	font-family: Arial, Helvetica, sans-serif;
+   	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:13px;
+	color:#1C5284;
+	text-align:left;
+	text-decoration: none	;
+}
+.imp {
+	font-family: Arial, Helvetica, sans-serif;
+   	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:11px;
+
+}    
+.button{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:#1C5284;
+	text-align:center;
+	border: 1px solid #1C5284;
+	background-color:#EAF2FA;
+}
+body{
+	scrollbar-3dlight-color:#1C5284;
+	scrollbar-darkshadow-color:#1C5284;
+	scrollbar-highlight-color:white;
+	scrollbar-shadow-color:white;
+	scrollbar-arrow-color:#1C5284;
+	scrollbar-track-color:white;
+	scrollbar-face-color:#BEC1C4;
+}
+.space{
+ 	leftmargin: 10px;
+}
+.edit{
+	font-family: Arial, Helvetica, sans-serif;
+   	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:11px;
+	color:black;
+	text-decoration:none;
+	background-color:#86A6C5;
+	border:1px solid #143365;
+	padding-left:4px;
+	padding-right:4px;
+}
+a.edit{
+	font-family: Arial, Helvetica, sans-serif;
+   	font:Verdana, Arial, Helvetica, sans-serif;
+	font-size:11px;
+	color:black;
+	text-decoration:none;
+	background-color:#86A6C5;
+	border:1px solid #143365;
+	padding-left:4px;
+	padding-right:4px;
+}
+a.edit:hover {
+	color:white	;
+}   
+.line{
+border: 1px solid #B2D1F0;
+}
+.line2{
+border: 3px solid #B2D1F0;
+}
+.line_up{
+border-top: 1px solid #B2D1F0;
+}
+.line_down{
+border-bottom: 1px solid #B2D1F0;
+}
+.line_left{
+border-left: 1px solid #B2D1F0;
+}
+.line_right{
+border-right: 1px solid #B2D1F0;
+}
+.line_up2{
+border-top: 3px solid #B2D1F0;
+}
+.line_down2{
+border-bottom: 3px solid #B2D1F0;
+}
+.line_left2{
+border-left: 3px solid #B2D1F0;
+}
+.line_right2{
+border-right: 3px solid #B2D1F0;
+}
+
+.line_dash{
+border-bottom:1px dashed #B2D1F0;
+}
+.bg{
+background-color:#EAF2FA;
+}
+.bg1{
+background-color:#EAEBEB;
+}
+.bg2{
+background-color:#B2D1F0;
+}
+
+
+.edit_bg_menu{
+	background-color:#EAF2FA;
+	border:1px solid #B2D1F0;
+	border-bottom: 1px solid #EAF2FA;
+}
+.edit_label_bg{
+background-color:#EAF2FA;
+border:1px solid #B2D1F0;
+}
+.edit_label_bg2{
+background-color:#EAF2FA;
+border:3px solid #B2D1F0;
+}
+.edit_label_text{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 13px;
+	color: #6699CC;
+	text-align: left;
+	padding-left:3px;
+	padding-top:4px;
+	padding-bottom:4px;
+}
+.edit_label_text_head{
+ 	font-family: Arial, Helvetica, sans-serif;
+ 	font: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 15px;
+	color: #4E769D;
+	text-align: left;
+}
+.hand{
+	cursor:hand;
+}
+.edit_label_width{
+	width:180px;
+}
+hr.sep {
+	color: #f00;
+	background-color: #ccc;
+	height: 1px;	
+}
+
+
+
+

Modified: branches/print_dev/http/css/styler-mod_treefolder.css
===================================================================
--- branches/print_dev/http/css/styler-mod_treefolder.css	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/css/styler-mod_treefolder.css	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,45 +1,45 @@
-body{	
-				background-color:#accdee;
-				text-decoration: none;
-				font-family: Verdana, Arial, Helvetica, sans-serif;
-				font-weight: bold;
-				font-size:9pt;	
-				color: #000000;
-				margin-left: 0px;
-				margin-top: 0px;
-				border:1px, solid black;
-}
-
-.schrift {
-		font-family:Verdana;
-		font-size:8pt;
-		line-height:6pt;
-		color: #000000;	
-		font-weight: bold;
-		text-decoration:none;
-}
-
-
-.folder {
-		font-family:Verdana;
-		font-size:9pt;
-		line-height:6pt;
-		color: #000000;	
-		font-weight: bold;
-		text-decoration:none;
-}
-.header{
-	font-family: Arial, Helvetica, sans-serif;
-	font-weight: bold;
-	font-size: 12px;	
-}
-.switch{
-	font-family: Arial, Helvetica, sans-serif;
-	font-size: 10px;
-	font-weight: bold;
-}
-.titles{
-	font-family: Arial, Helvetica, sans-serif;
-	font-weight: bold;
-	font-size: 11px;
+body{	
+				background-color:#accdee;
+				text-decoration: none;
+				font-family: Verdana, Arial, Helvetica, sans-serif;
+				font-weight: bold;
+				font-size:9pt;	
+				color: #000000;
+				margin-left: 0px;
+				margin-top: 0px;
+				border:1px, solid black;
+}
+
+.schrift {
+		font-family:Verdana;
+		font-size:8pt;
+		line-height:6pt;
+		color: #000000;	
+		font-weight: bold;
+		text-decoration:none;
+}
+
+
+.folder {
+		font-family:Verdana;
+		font-size:9pt;
+		line-height:6pt;
+		color: #000000;	
+		font-weight: bold;
+		text-decoration:none;
+}
+.header{
+	font-family: Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	font-size: 12px;	
+}
+.switch{
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 10px;
+	font-weight: bold;
+}
+.titles{
+	font-family: Arial, Helvetica, sans-serif;
+	font-weight: bold;
+	font-size: 11px;
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/DifferenceEngine.php
===================================================================
--- branches/print_dev/http/extensions/DifferenceEngine.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/DifferenceEngine.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,1062 +1,1062 @@
-<?php
-/**
- * A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)
- *
- * Additions by Axel Boldt for MediaWiki
- *
- * @copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki at dairiki.org>
- * @license  You may copy this code freely under the conditions of the GPL.
- */
-define('USE_ASSERTS', function_exists('assert'));
-
-class _DiffOp {
-  var $type;
-  var $orig;
-  var $closing;
-
-  function reverse() {
-    trigger_error("pure virtual", E_USER_ERROR);
-  }
-
-  function norig() {
-    return $this->orig ? sizeof($this->orig) : 0;
-  }
-
-  function nclosing() {
-    return $this->closing ? sizeof($this->closing) : 0;
-  }
-}
-
-class _DiffOp_Copy extends _DiffOp {
-  var $type = 'copy';
-
-  function _DiffOp_Copy ($orig, $closing = false) {
-    if (!is_array($closing))
-      $closing = $orig;
-    $this->orig = $orig;
-    $this->closing = $closing;
-  }
-
-  function reverse() {
-    return new _DiffOp_Copy($this->closing, $this->orig);
-  }
-}
-
-class _DiffOp_Delete extends _DiffOp {
-  var $type = 'delete';
-
-  function _DiffOp_Delete ($lines) {
-    $this->orig = $lines;
-    $this->closing = false;
-  }
-
-  function reverse() {
-    return new _DiffOp_Add($this->orig);
-  }
-}
-
-class _DiffOp_Add extends _DiffOp {
-  var $type = 'add';
-
-  function _DiffOp_Add ($lines) {
-    $this->closing = $lines;
-    $this->orig = false;
-  }
-
-  function reverse() {
-    return new _DiffOp_Delete($this->closing);
-  }
-}
-
-class _DiffOp_Change extends _DiffOp {
-  var $type = 'change';
-
-  function _DiffOp_Change ($orig, $closing) {
-    $this->orig = $orig;
-    $this->closing = $closing;
-  }
-
-  function reverse() {
-    return new _DiffOp_Change($this->closing, $this->orig);
-  }
-}
-
-
-/**
- * Class used internally by Diff to actually compute the diffs.
- *
- * The algorithm used here is mostly lifted from the perl module
- * Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
- *   http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
- *
- * More ideas are taken from:
- *   http://www.ics.uci.edu/~eppstein/161/960229.html
- *
- * Some ideas are (and a bit of code) are from from analyze.c, from GNU
- * diffutils-2.7, which can be found at:
- *   ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz
- *
- * closingly, some ideas (subdivision by NCHUNKS > 2, and some optimizations)
- * are my own.
- *
- * @author Geoffrey T. Dairiki
- * @access private
- */
-class _DiffEngine
-{
-  function diff ($from_lines, $to_lines) {
-    $n_from = sizeof($from_lines);
-    $n_to = sizeof($to_lines);
-
-    $this->xchanged = $this->ychanged = array();
-    $this->xv = $this->yv = array();
-    $this->xind = $this->yind = array();
-    unset($this->seq);
-    unset($this->in_seq);
-    unset($this->lcs);
-
-    // Skip leading common lines.
-    for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) {
-      if ($from_lines[$skip] != $to_lines[$skip])
-        break;
-      $this->xchanged[$skip] = $this->ychanged[$skip] = false;
-    }
-    // Skip trailing common lines.
-    $xi = $n_from; $yi = $n_to;
-    for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) {
-      if ($from_lines[$xi] != $to_lines[$yi])
-        break;
-      $this->xchanged[$xi] = $this->ychanged[$yi] = false;
-    }
-
-    // Ignore lines which do not exist in both files.
-    for ($xi = $skip; $xi < $n_from - $endskip; $xi++)
-      $xhash[$from_lines[$xi]] = 1;
-    for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
-      $line = $to_lines[$yi];
-      if ( ($this->ychanged[$yi] = empty($xhash[$line])) )
-        continue;
-      $yhash[$line] = 1;
-      $this->yv[] = $line;
-      $this->yind[] = $yi;
-    }
-    for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
-      $line = $from_lines[$xi];
-      if ( ($this->xchanged[$xi] = empty($yhash[$line])) )
-        continue;
-      $this->xv[] = $line;
-      $this->xind[] = $xi;
-    }
-
-    // Find the LCS.
-    $this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
-
-    // Merge edits when possible
-    $this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
-    $this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
-
-    // Compute the edit operations.
-    $edits = array();
-    $xi = $yi = 0;
-    while ($xi < $n_from || $yi < $n_to) {
-      USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]);
-      USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]);
-
-      // Skip matching "snake".
-      $copy = array();
-      while ( $xi < $n_from && $yi < $n_to
-          && !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
-        $copy[] = $from_lines[$xi++];
-        ++$yi;
-      }
-      if ($copy)
-        $edits[] = new _DiffOp_Copy($copy);
-
-      // Find deletes & adds.
-      $delete = array();
-      while ($xi < $n_from && $this->xchanged[$xi])
-        $delete[] = $from_lines[$xi++];
-
-      $add = array();
-      while ($yi < $n_to && $this->ychanged[$yi])
-        $add[] = $to_lines[$yi++];
-
-      if ($delete && $add)
-        $edits[] = new _DiffOp_Change($delete, $add);
-      elseif ($delete)
-        $edits[] = new _DiffOp_Delete($delete);
-      elseif ($add)
-        $edits[] = new _DiffOp_Add($add);
-    }
-    return $edits;
-  }
-
-
-  /**
-   * Divide the Largest Common Subsequence (LCS) of the sequences
-   * [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
-   * sized segments.
-   *
-   * Returns (LCS, PTS).  LCS is the length of the LCS. PTS is an
-   * array of NCHUNKS+1 (X, Y) indexes giving the diving points between
-   * sub sequences.  The first sub-sequence is contained in [X0, X1),
-   * [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on.  Note
-   * that (X0, Y0) == (XOFF, YOFF) and
-   * (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
-   *
-   * This function assumes that the first lines of the specified portions
-   * of the two files do not match, and likewise that the last lines do not
-   * match.  The caller must trim matching lines from the beginning and end
-   * of the portions it is going to specify.
-   */
-  function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) {
-  $flip = false;
-
-  if ($xlim - $xoff > $ylim - $yoff) {
-    // Things seems faster (I'm not sure I understand why)
-      // when the shortest sequence in X.
-      $flip = true;
-    list ($xoff, $xlim, $yoff, $ylim)
-    = array( $yoff, $ylim, $xoff, $xlim);
-    }
-
-  if ($flip)
-    for ($i = $ylim - 1; $i >= $yoff; $i--)
-    $ymatches[$this->xv[$i]][] = $i;
-  else
-    for ($i = $ylim - 1; $i >= $yoff; $i--)
-    $ymatches[$this->yv[$i]][] = $i;
-
-  $this->lcs = 0;
-  $this->seq[0]= $yoff - 1;
-  $this->in_seq = array();
-  $ymids[0] = array();
-
-  $numer = $xlim - $xoff + $nchunks - 1;
-  $x = $xoff;
-  for ($chunk = 0; $chunk < $nchunks; $chunk++) {
-    if ($chunk > 0)
-    for ($i = 0; $i <= $this->lcs; $i++)
-      $ymids[$i][$chunk-1] = $this->seq[$i];
-
-    $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
-    for ( ; $x < $x1; $x++) {
-        $line = $flip ? $this->yv[$x] : $this->xv[$x];
-        if (empty($ymatches[$line]))
-      continue;
-    $matches = $ymatches[$line];
-        reset($matches);
-    while (list ($junk, $y) = each($matches))
-      if (empty($this->in_seq[$y])) {
-      $k = $this->_lcs_pos($y);
-      USE_ASSERTS && assert($k > 0);
-      $ymids[$k] = $ymids[$k-1];
-      break;
-          }
-    while (list ($junk, $y) = each($matches)) {
-      if ($y > $this->seq[$k-1]) {
-      USE_ASSERTS && assert($y < $this->seq[$k]);
-      // Optimization: this is a common case:
-      //  next match is just replacing previous match.
-      $this->in_seq[$this->seq[$k]] = false;
-      $this->seq[$k] = $y;
-      $this->in_seq[$y] = 1;
-          }
-      else if (empty($this->in_seq[$y])) {
-      $k = $this->_lcs_pos($y);
-      USE_ASSERTS && assert($k > 0);
-      $ymids[$k] = $ymids[$k-1];
-          }
-        }
-      }
-    }
-
-  $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
-  $ymid = $ymids[$this->lcs];
-  for ($n = 0; $n < $nchunks - 1; $n++) {
-    $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
-    $y1 = $ymid[$n] + 1;
-    $seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
-    }
-  $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
-
-  return array($this->lcs, $seps);
-  }
-
-  function _lcs_pos ($ypos) {
-  $end = $this->lcs;
-  if ($end == 0 || $ypos > $this->seq[$end]) {
-    $this->seq[++$this->lcs] = $ypos;
-    $this->in_seq[$ypos] = 1;
-    return $this->lcs;
-    }
-
-  $beg = 1;
-  while ($beg < $end) {
-    $mid = (int)(($beg + $end) / 2);
-    if ( $ypos > $this->seq[$mid] )
-    $beg = $mid + 1;
-    else
-    $end = $mid;
-    }
-
-  USE_ASSERTS && assert($ypos != $this->seq[$end]);
-
-  $this->in_seq[$this->seq[$end]] = false;
-  $this->seq[$end] = $ypos;
-  $this->in_seq[$ypos] = 1;
-  return $end;
-  }
-
-  /**
-   * Find LCS of two sequences.
-   *
-   * The results are recorded in the vectors $this->{x,y}changed[], by
-   * storing a 1 in the element for each line that is an insertion
-   * or deletion (ie. is not in the LCS).
-   *
-   * The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
-   *
-   * Note that XLIM, YLIM are exclusive bounds.
-   * All line numbers are origin-0 and discarded lines are not counted.
-   */
-  function _compareseq ($xoff, $xlim, $yoff, $ylim) {
-  // Slide down the bottom initial diagonal.
-  while ($xoff < $xlim && $yoff < $ylim
-         && $this->xv[$xoff] == $this->yv[$yoff]) {
-    ++$xoff;
-    ++$yoff;
-    }
-
-  // Slide up the top initial diagonal.
-  while ($xlim > $xoff && $ylim > $yoff
-         && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
-    --$xlim;
-    --$ylim;
-    }
-
-  if ($xoff == $xlim || $yoff == $ylim)
-    $lcs = 0;
-  else {
-    // This is ad hoc but seems to work well.
-    //$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);
-    //$nchunks = max(2,min(8,(int)$nchunks));
-    $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1;
-    list ($lcs, $seps)
-    = $this->_diag($xoff,$xlim,$yoff, $ylim,$nchunks);
-    }
-
-  if ($lcs == 0) {
-    // X and Y sequences have no common subsequence:
-    // mark all changed.
-    while ($yoff < $ylim)
-    $this->ychanged[$this->yind[$yoff++]] = 1;
-    while ($xoff < $xlim)
-    $this->xchanged[$this->xind[$xoff++]] = 1;
-    }
-  else {
-    // Use the partitions to split this problem into subproblems.
-    reset($seps);
-    $pt1 = $seps[0];
-    while ($pt2 = next($seps)) {
-    $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
-    $pt1 = $pt2;
-      }
-    }
-  }
-
-  /**
-   * Adjust inserts/deletes of identical lines to join changes
-   * as much as possible.
-   *
-   * We do something when a run of changed lines include a
-   * line at one end and has an excluded, identical line at the other.
-   * We are free to choose which identical line is included.
-   * `compareseq' usually chooses the one at the beginning,
-   * but usually it is cleaner to consider the following identical line
-   * to be the "change".
-   *
-   * This is extracted verbatim from analyze.c (GNU diffutils-2.7).
-   */
-  function _shift_boundaries ($lines, &$changed, $other_changed) {
-  $i = 0;
-  $j = 0;
-
-  USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
-  $len = sizeof($lines);
-  $other_len = sizeof($other_changed);
-
-  while (1) {
-    /*
-     * Scan forwards to find beginning of another run of changes.
-     * Also keep track of the corresponding point in the other file.
-     *
-     * Throughout this code, $i and $j are adjusted together so that
-     * the first $i elements of $changed and the first $j elements
-     * of $other_changed both contain the same number of zeros
-     * (unchanged lines).
-     * Furthermore, $j is always kept so that $j == $other_len or
-     * $other_changed[$j] == false.
-     */
-    while ($j < $other_len && $other_changed[$j])
-    $j++;
-
-    while ($i < $len && ! $changed[$i]) {
-    USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
-    $i++; $j++;
-    while ($j < $other_len && $other_changed[$j])
-      $j++;
-      }
-
-    if ($i == $len)
-    break;
-
-    $start = $i;
-
-    // Find the end of this run of changes.
-    while (++$i < $len && $changed[$i])
-    continue;
-
-    do {
-    /*
-     * Record the length of this run of changes, so that
-     * we can later determine whether the run has grown.
-     */
-    $runlength = $i - $start;
-
-    /*
-     * Move the changed region back, so long as the
-     * previous unchanged line matches the last changed one.
-     * This merges with previous changed regions.
-     */
-    while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) {
-      $changed[--$start] = 1;
-      $changed[--$i] = false;
-      while ($start > 0 && $changed[$start - 1])
-      $start--;
-      USE_ASSERTS && assert('$j > 0');
-      while ($other_changed[--$j])
-      continue;
-      USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
-        }
-
-    /*
-     * Set CORRESPONDING to the end of the changed run, at the last
-     * point where it corresponds to a changed run in the other file.
-     * CORRESPONDING == LEN means no such point has been found.
-     */
-    $corresponding = $j < $other_len ? $i : $len;
-
-    /*
-     * Move the changed region forward, so long as the
-     * first changed line matches the following unchanged one.
-     * This merges with following changed regions.
-     * Do this second, so that if there are no merges,
-     * the changed region is moved forward as far as possible.
-     */
-    while ($i < $len && $lines[$start] == $lines[$i]) {
-      $changed[$start++] = false;
-      $changed[$i++] = 1;
-      while ($i < $len && $changed[$i])
-      $i++;
-
-      USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
-      $j++;
-      if ($j < $other_len && $other_changed[$j]) {
-      $corresponding = $i;
-      while ($j < $other_len && $other_changed[$j])
-        $j++;
-          }
-        }
-      } while ($runlength != $i - $start);
-
-    /*
-     * If possible, move the fully-merged run of changes
-     * back to a corresponding run in the other file.
-     */
-    while ($corresponding < $i) {
-    $changed[--$start] = 1;
-    $changed[--$i] = 0;
-    USE_ASSERTS && assert('$j > 0');
-    while ($other_changed[--$j])
-      continue;
-    USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
-      }
-    }
-  }
-}
-
-/**
- * Class representing a 'diff' between two sequences of strings.
- */
-class Diff
-{
-  var $edits;
-
-  /**
-   * Constructor.
-   * Computes diff between sequences of strings.
-   *
-   * @param $from_lines array An array of strings.
-   *      (Typically these are lines from a file.)
-   * @param $to_lines array An array of strings.
-   */
-  function Diff($from_lines, $to_lines) {
-    $eng = new _DiffEngine;
-    $this->edits = $eng->diff($from_lines, $to_lines);
-    //$this->_check($from_lines, $to_lines);
-  }
-
-  /**
-   * Compute reversed Diff.
-   *
-   * SYNOPSIS:
-   *
-   *  $diff = new Diff($lines1, $lines2);
-   *  $rev = $diff->reverse();
-   * @return object A Diff object representing the inverse of the
-   *          original diff.
-   */
-  function reverse () {
-  $rev = $this;
-    $rev->edits = array();
-    foreach ($this->edits as $edit) {
-      $rev->edits[] = $edit->reverse();
-    }
-  return $rev;
-  }
-
-  /**
-   * Check for empty diff.
-   *
-   * @return bool True iff two sequences were identical.
-   */
-  function isEmpty () {
-    foreach ($this->edits as $edit) {
-      if ($edit->type != 'copy')
-        return false;
-    }
-    return true;
-  }
-
-  /**
-   * Compute the length of the Longest Common Subsequence (LCS).
-   *
-   * This is mostly for diagnostic purposed.
-   *
-   * @return int The length of the LCS.
-   */
-  function lcs () {
-  $lcs = 0;
-    foreach ($this->edits as $edit) {
-      if ($edit->type == 'copy')
-        $lcs += sizeof($edit->orig);
-    }
-  return $lcs;
-  }
-
-  /**
-   * Get the original set of lines.
-   *
-   * This reconstructs the $from_lines parameter passed to the
-   * constructor.
-   *
-   * @return array The original sequence of strings.
-   */
-  function orig() {
-    $lines = array();
-
-    foreach ($this->edits as $edit) {
-      if ($edit->orig)
-        array_splice($lines, sizeof($lines), 0, $edit->orig);
-    }
-    return $lines;
-  }
-
-  /**
-   * Get the closing set of lines.
-   *
-   * This reconstructs the $to_lines parameter passed to the
-   * constructor.
-   *
-   * @return array The sequence of strings.
-   */
-  function closing() {
-    $lines = array();
-
-    foreach ($this->edits as $edit) {
-      if ($edit->closing)
-        array_splice($lines, sizeof($lines), 0, $edit->closing);
-    }
-    return $lines;
-  }
-
-  /**
-   * Check a Diff for validity.
-   *
-   * This is here only for debugging purposes.
-   */
-  function _check ($from_lines, $to_lines) {
-    if (serialize($from_lines) != serialize($this->orig()))
-      trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
-    if (serialize($to_lines) != serialize($this->closing()))
-      trigger_error("Reconstructed closing doesn't match", E_USER_ERROR);
-
-    $rev = $this->reverse();
-    if (serialize($to_lines) != serialize($rev->orig()))
-      trigger_error("Reversed original doesn't match", E_USER_ERROR);
-    if (serialize($from_lines) != serialize($rev->closing()))
-      trigger_error("Reversed closing doesn't match", E_USER_ERROR);
-
-
-    $prevtype = 'none';
-    foreach ($this->edits as $edit) {
-      if ( $prevtype == $edit->type )
-        trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
-      $prevtype = $edit->type;
-    }
-
-    $lcs = $this->lcs();
-    trigger_error("Diff okay: LCS = $lcs", E_USER_NOTICE);
-  }
-}
-
-/**
- * FIXME: bad name.
- */
-class MappedDiff
-extends Diff
-{
-  /**
-   * Constructor.
-   *
-   * Computes diff between sequences of strings.
-   *
-   * This can be used to compute things like
-   * case-insensitve diffs, or diffs which ignore
-   * changes in white-space.
-   *
-   * @param $from_lines array An array of strings.
-   *  (Typically these are lines from a file.)
-   *
-   * @param $to_lines array An array of strings.
-   *
-   * @param $mapped_from_lines array This array should
-   *  have the same size number of elements as $from_lines.
-   *  The elements in $mapped_from_lines and
-   *  $mapped_to_lines are what is actually compared
-   *  when computing the diff.
-   *
-   * @param $mapped_to_lines array This array should
-   *  have the same number of elements as $to_lines.
-   */
-  function MappedDiff($from_lines, $to_lines,
-            $mapped_from_lines, $mapped_to_lines) {
-
-    assert(sizeof($from_lines) == sizeof($mapped_from_lines));
-    assert(sizeof($to_lines) == sizeof($mapped_to_lines));
-
-    $this->Diff($mapped_from_lines, $mapped_to_lines);
-
-    $xi = $yi = 0;
-    for ($i = 0; $i < sizeof($this->edits); $i++) {
-      $orig = &$this->edits[$i]->orig;
-      if (is_array($orig)) {
-        $orig = array_slice($from_lines, $xi, sizeof($orig));
-        $xi += sizeof($orig);
-      }
-
-      $closing = &$this->edits[$i]->closing;
-      if (is_array($closing)) {
-        $closing = array_slice($to_lines, $yi, sizeof($closing));
-        $yi += sizeof($closing);
-      }
-    }
-  }
-}
-
-/**
- * A class to format Diffs
- *
- * This class formats the diff in classic diff format.
- * It is intended that this class be customized via inheritance,
- * to obtain fancier outputs.
- */
-class DiffFormatter
-{
-  /**
-   * Number of leading context "lines" to preserve.
-   *
-   * This should be left at zero for this class, but subclasses
-   * may want to set this to other values.
-   */
-  var $leading_context_lines = 0;
-
-  /**
-   * Number of trailing context "lines" to preserve.
-   *
-   * This should be left at zero for this class, but subclasses
-   * may want to set this to other values.
-   */
-  var $trailing_context_lines = 0;
-
-  /**
-   * Format a diff.
-   *
-   * @param $diff object A Diff object.
-   * @return string The formatted output.
-   */
-  function format($diff) {
-
-    $xi = $yi = 1;
-    $block = false;
-    $context = array();
-
-    $nlead = $this->leading_context_lines;
-    $ntrail = $this->trailing_context_lines;
-
-    $this->_start_diff();
-
-    foreach ($diff->edits as $edit) {
-      if ($edit->type == 'copy') {
-        if (is_array($block)) {
-          if (sizeof($edit->orig) <= $nlead + $ntrail) {
-            $block[] = $edit;
-          }
-          else{
-            if ($ntrail) {
-              $context = array_slice($edit->orig, 0, $ntrail);
-              $block[] = new _DiffOp_Copy($context);
-            }
-            $this->_block($x0, $ntrail + $xi - $x0,
-                    $y0, $ntrail + $yi - $y0,
-                    $block);
-            $block = false;
-          }
-        }
-        $context = $edit->orig;
-      }
-      else {
-        if (! is_array($block)) {
-          $context = array_slice($context, sizeof($context) - $nlead);
-          $x0 = $xi - sizeof($context);
-          $y0 = $yi - sizeof($context);
-          $block = array();
-          if ($context)
-            $block[] = new _DiffOp_Copy($context);
-        }
-        $block[] = $edit;
-      }
-
-      if ($edit->orig)
-        $xi += sizeof($edit->orig);
-      if ($edit->closing)
-        $yi += sizeof($edit->closing);
-    }
-
-    if (is_array($block))
-      $this->_block($x0, $xi - $x0,
-              $y0, $yi - $y0,
-              $block);
-
-    return $this->_end_diff();
-  }
-
-  function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
-    $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
-    foreach ($edits as $edit) {
-      if ($edit->type == 'copy')
-        $this->_context($edit->orig);
-      elseif ($edit->type == 'add')
-        $this->_added($edit->closing);
-      elseif ($edit->type == 'delete')
-        $this->_deleted($edit->orig);
-      elseif ($edit->type == 'change')
-        $this->_changed($edit->orig, $edit->closing);
-      else
-        trigger_error("Unknown edit type", E_USER_ERROR);
-    }
-    $this->_end_block();
-  }
-
-  function _start_diff() {
-    ob_start();
-  }
-
-  function _end_diff() {
-    $val = ob_get_contents();
-    ob_end_clean();
-    return $val;
-  }
-
-  function _block_header($xbeg, $xlen, $ybeg, $ylen) {
-    if ($xlen > 1)
-      $xbeg .= "," . ($xbeg + $xlen - 1);
-    if ($ylen > 1)
-      $ybeg .= "," . ($ybeg + $ylen - 1);
-
-    return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
-  }
-
-  function _start_block($header) {
-    echo $header;
-  }
-
-  function _end_block() {
-  }
-
-  function _lines($lines, $prefix = ' ') {
-    foreach ($lines as $line)
-      echo "$prefix $line\n";
-  }
-
-  function _context($lines) {
-    $this->_lines($lines);
-  }
-
-  function _added($lines) {
-    $this->_lines($lines, ">");
-  }
-  function _deleted($lines) {
-    $this->_lines($lines, "<");
-  }
-
-  function _changed($orig, $closing) {
-    $this->_deleted($orig);
-    echo "---\n";
-    $this->_added($closing);
-  }
-}
-
-
-/**
- *  Additions by Axel Boldt follow, partly taken from diff.php, phpwiki-1.3.3
- *
- */
-
-define('NBSP', "\xC2\xA0");     // utf-8 non-breaking space.
-
-class _HWLDF_WordAccumulator {
-  function _HWLDF_WordAccumulator () {
-    $this->_lines = array();
-    $this->_line = '';
-    $this->_group = '';
-    $this->_tag = '';
-  }
-
-  function _flushGroup ($new_tag) {
-    if ($this->_group !== '') {
-    if ($this->_tag == 'mark')
-      $this->_line .= '<strong>'.$this->_group.'</strong>';
-    else
-    $this->_line .= $this->_group;
-  }
-    $this->_group = '';
-    $this->_tag = $new_tag;
-  }
-
-  function _flushLine ($new_tag) {
-    $this->_flushGroup($new_tag);
-    if ($this->_line != '')
-      $this->_lines[] = $this->_line;
-    $this->_line = '';
-  }
-
-  function addWords ($words, $tag = '') {
-    if ($tag != $this->_tag)
-      $this->_flushGroup($tag);
-
-    foreach ($words as $word) {
-      // new-line should only come as first char of word.
-      if ($word == '')
-        continue;
-      if ($word[0] == "\n") {
-        $this->_group .= NBSP;
-        $this->_flushLine($tag);
-        $word = substr($word, 1);
-      }
-      assert(!strstr($word, "\n"));
-      $this->_group .= $word;
-    }
-  }
-
-  function getLines() {
-    $this->_flushLine('~done');
-    return $this->_lines;
-  }
-}
-
-class WordLevelDiff extends MappedDiff
-{
-  function WordLevelDiff ($orig_lines, $closing_lines) {
-    list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
-    list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
-
-
-    $this->MappedDiff($orig_words, $closing_words,
-              $orig_stripped, $closing_stripped);
-  }
-
-  function _split($lines) {
-    // FIXME: fix POSIX char class.
-#    if (!preg_match_all('/ ( [^\S\n]+ | [[:alnum:]]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
-    if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
-              implode("\n", $lines),
-              $m)) {
-      return array(array(''), array(''));
-    }
-    return array($m[0], $m[1]);
-  }
-
-  function orig () {
-    $orig = new _HWLDF_WordAccumulator;
-
-    foreach ($this->edits as $edit) {
-      if ($edit->type == 'copy')
-        $orig->addWords($edit->orig);
-      elseif ($edit->orig)
-        $orig->addWords($edit->orig, 'mark');
-    }
-    return $orig->getLines();
-  }
-
-  function closing () {
-    $closing = new _HWLDF_WordAccumulator;
-
-    foreach ($this->edits as $edit) {
-      if ($edit->type == 'copy')
-        $closing->addWords($edit->closing);
-      elseif ($edit->closing)
-        $closing->addWords($edit->closing, 'mark');
-    }
-    return $closing->getLines();
-  }
-}
-
-/**
- * "Unified" diff formatter.
- *
- * This class formats the diff in classic "unified diff" format.
- */
-class UnifiedDiffFormatter extends DiffFormatter
-{
-    function UnifiedDiffFormatter($context_lines = 4) {
-        $this->leading_context_lines = $context_lines;
-        $this->trailing_context_lines = $context_lines;
-    }
-
-    function _block_header($xbeg, $xlen, $ybeg, $ylen) {
-        if ($xlen != 1)
-            $xbeg .= "," . $xlen;
-        if ($ylen != 1)
-            $ybeg .= "," . $ylen;
-        return "@@ -$xbeg +$ybeg @@\n";
-    }
-
-    function _added($lines) {
-        $this->_lines($lines, "+");
-    }
-    function _deleted($lines) {
-        $this->_lines($lines, "-");
-    }
-    function _changed($orig, $final) {
-        $this->_deleted($orig);
-        $this->_added($final);
-    }
-}
-
-/**
- *  Wikipedia Table style diff formatter.
- *
- */
-class TableDiffFormatter extends DiffFormatter
-{
-  function TableDiffFormatter() {
-    $this->leading_context_lines = 2;
-    $this->trailing_context_lines = 2;
-  }
-
-  function _pre($text){
-    $text = htmlspecialchars($text);
-    $text = str_replace('  ',' &nbsp;',$text);
-    return $text;
-  }
-
-  function _block_header( $xbeg, $xlen, $ybeg, $ylen ) {
-    global $lang;
-    $l1 = $lang['line'].' '.$xbeg;
-    $l2 = $lang['line'].' '.$ybeg;
-    $r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n" .
-      '<td class="diff-blockheader" colspan="2">'.$l2.":</td></tr>\n";
-    return $r;
-  }
-
-  function _start_block( $header ) {
-    print( $header );
-  }
-
-  function _end_block() {
-  }
-
-  function _lines( $lines, $prefix=' ', $color="white" ) {
-  }
-
-  function addedLine( $line ) {
-    $line = str_replace('  ','&nbsp; ',$line);
-    return '<td>+</td><td class="diff-addedline">' .
-      $line.'</td>';
-  }
-
-  function deletedLine( $line ) {
-    $line = str_replace('  ','&nbsp; ',$line);
-    return '<td>-</td><td class="diff-deletedline">' .
-      $line.'</td>';
-  }
-
-  function emptyLine() {
-    //$line = str_replace('  ','&nbsp; ',$line);
-    return '<td colspan="2">&nbsp;</td>';
-  }
-
-  function contextLine( $line ) {
-    $line = str_replace('  ','&nbsp; ',$line);
-    return '<td> </td><td class="diff-context">'.$line.'</td>';
-  }
-
-  function _added($lines) {
-    foreach ($lines as $line) {
-      print( '<tr>' . $this->emptyLine() .
-        $this->addedLine( $line ) . "</tr>\n" );
-    }
-  }
-
-  function _deleted($lines) {
-    foreach ($lines as $line) {
-      print( '<tr>' . $this->deletedLine( $line ) .
-        $this->emptyLine() . "</tr>\n" );
-    }
-  }
-
-  function _context( $lines ) {
-    foreach ($lines as $line) {
-      print( '<tr>' . $this->contextLine( $line ) .
-        $this->contextLine( $line ) . "</tr>\n" );
-    }
-  }
-
-  function _changed( $orig, $closing ) {
-    $diff = new WordLevelDiff( $orig, $closing );
-    $del = $diff->orig();
-    $add = $diff->closing();
-
-    while ( $line = array_shift( $del ) ) {
-      $aline = array_shift( $add );
-      print( '<tr>' . $this->deletedLine( $line ) .
-        $this->addedLine( $aline ) . "</tr>\n" );
-    }
-    $this->_added( $add ); # If any leftovers
-  }
-}
-
-
-//Setup VIM: ex: et ts=2 enc=utf-8 :
+<?php
+/**
+ * A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)
+ *
+ * Additions by Axel Boldt for MediaWiki
+ *
+ * @copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki at dairiki.org>
+ * @license  You may copy this code freely under the conditions of the GPL.
+ */
+define('USE_ASSERTS', function_exists('assert'));
+
+class _DiffOp {
+  var $type;
+  var $orig;
+  var $closing;
+
+  function reverse() {
+    trigger_error("pure virtual", E_USER_ERROR);
+  }
+
+  function norig() {
+    return $this->orig ? sizeof($this->orig) : 0;
+  }
+
+  function nclosing() {
+    return $this->closing ? sizeof($this->closing) : 0;
+  }
+}
+
+class _DiffOp_Copy extends _DiffOp {
+  var $type = 'copy';
+
+  function _DiffOp_Copy ($orig, $closing = false) {
+    if (!is_array($closing))
+      $closing = $orig;
+    $this->orig = $orig;
+    $this->closing = $closing;
+  }
+
+  function reverse() {
+    return new _DiffOp_Copy($this->closing, $this->orig);
+  }
+}
+
+class _DiffOp_Delete extends _DiffOp {
+  var $type = 'delete';
+
+  function _DiffOp_Delete ($lines) {
+    $this->orig = $lines;
+    $this->closing = false;
+  }
+
+  function reverse() {
+    return new _DiffOp_Add($this->orig);
+  }
+}
+
+class _DiffOp_Add extends _DiffOp {
+  var $type = 'add';
+
+  function _DiffOp_Add ($lines) {
+    $this->closing = $lines;
+    $this->orig = false;
+  }
+
+  function reverse() {
+    return new _DiffOp_Delete($this->closing);
+  }
+}
+
+class _DiffOp_Change extends _DiffOp {
+  var $type = 'change';
+
+  function _DiffOp_Change ($orig, $closing) {
+    $this->orig = $orig;
+    $this->closing = $closing;
+  }
+
+  function reverse() {
+    return new _DiffOp_Change($this->closing, $this->orig);
+  }
+}
+
+
+/**
+ * Class used internally by Diff to actually compute the diffs.
+ *
+ * The algorithm used here is mostly lifted from the perl module
+ * Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
+ *   http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
+ *
+ * More ideas are taken from:
+ *   http://www.ics.uci.edu/~eppstein/161/960229.html
+ *
+ * Some ideas are (and a bit of code) are from from analyze.c, from GNU
+ * diffutils-2.7, which can be found at:
+ *   ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz
+ *
+ * closingly, some ideas (subdivision by NCHUNKS > 2, and some optimizations)
+ * are my own.
+ *
+ * @author Geoffrey T. Dairiki
+ * @access private
+ */
+class _DiffEngine
+{
+  function diff ($from_lines, $to_lines) {
+    $n_from = sizeof($from_lines);
+    $n_to = sizeof($to_lines);
+
+    $this->xchanged = $this->ychanged = array();
+    $this->xv = $this->yv = array();
+    $this->xind = $this->yind = array();
+    unset($this->seq);
+    unset($this->in_seq);
+    unset($this->lcs);
+
+    // Skip leading common lines.
+    for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) {
+      if ($from_lines[$skip] != $to_lines[$skip])
+        break;
+      $this->xchanged[$skip] = $this->ychanged[$skip] = false;
+    }
+    // Skip trailing common lines.
+    $xi = $n_from; $yi = $n_to;
+    for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) {
+      if ($from_lines[$xi] != $to_lines[$yi])
+        break;
+      $this->xchanged[$xi] = $this->ychanged[$yi] = false;
+    }
+
+    // Ignore lines which do not exist in both files.
+    for ($xi = $skip; $xi < $n_from - $endskip; $xi++)
+      $xhash[$from_lines[$xi]] = 1;
+    for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
+      $line = $to_lines[$yi];
+      if ( ($this->ychanged[$yi] = empty($xhash[$line])) )
+        continue;
+      $yhash[$line] = 1;
+      $this->yv[] = $line;
+      $this->yind[] = $yi;
+    }
+    for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
+      $line = $from_lines[$xi];
+      if ( ($this->xchanged[$xi] = empty($yhash[$line])) )
+        continue;
+      $this->xv[] = $line;
+      $this->xind[] = $xi;
+    }
+
+    // Find the LCS.
+    $this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
+
+    // Merge edits when possible
+    $this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
+    $this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
+
+    // Compute the edit operations.
+    $edits = array();
+    $xi = $yi = 0;
+    while ($xi < $n_from || $yi < $n_to) {
+      USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]);
+      USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]);
+
+      // Skip matching "snake".
+      $copy = array();
+      while ( $xi < $n_from && $yi < $n_to
+          && !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
+        $copy[] = $from_lines[$xi++];
+        ++$yi;
+      }
+      if ($copy)
+        $edits[] = new _DiffOp_Copy($copy);
+
+      // Find deletes & adds.
+      $delete = array();
+      while ($xi < $n_from && $this->xchanged[$xi])
+        $delete[] = $from_lines[$xi++];
+
+      $add = array();
+      while ($yi < $n_to && $this->ychanged[$yi])
+        $add[] = $to_lines[$yi++];
+
+      if ($delete && $add)
+        $edits[] = new _DiffOp_Change($delete, $add);
+      elseif ($delete)
+        $edits[] = new _DiffOp_Delete($delete);
+      elseif ($add)
+        $edits[] = new _DiffOp_Add($add);
+    }
+    return $edits;
+  }
+
+
+  /**
+   * Divide the Largest Common Subsequence (LCS) of the sequences
+   * [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
+   * sized segments.
+   *
+   * Returns (LCS, PTS).  LCS is the length of the LCS. PTS is an
+   * array of NCHUNKS+1 (X, Y) indexes giving the diving points between
+   * sub sequences.  The first sub-sequence is contained in [X0, X1),
+   * [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on.  Note
+   * that (X0, Y0) == (XOFF, YOFF) and
+   * (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
+   *
+   * This function assumes that the first lines of the specified portions
+   * of the two files do not match, and likewise that the last lines do not
+   * match.  The caller must trim matching lines from the beginning and end
+   * of the portions it is going to specify.
+   */
+  function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) {
+  $flip = false;
+
+  if ($xlim - $xoff > $ylim - $yoff) {
+    // Things seems faster (I'm not sure I understand why)
+      // when the shortest sequence in X.
+      $flip = true;
+    list ($xoff, $xlim, $yoff, $ylim)
+    = array( $yoff, $ylim, $xoff, $xlim);
+    }
+
+  if ($flip)
+    for ($i = $ylim - 1; $i >= $yoff; $i--)
+    $ymatches[$this->xv[$i]][] = $i;
+  else
+    for ($i = $ylim - 1; $i >= $yoff; $i--)
+    $ymatches[$this->yv[$i]][] = $i;
+
+  $this->lcs = 0;
+  $this->seq[0]= $yoff - 1;
+  $this->in_seq = array();
+  $ymids[0] = array();
+
+  $numer = $xlim - $xoff + $nchunks - 1;
+  $x = $xoff;
+  for ($chunk = 0; $chunk < $nchunks; $chunk++) {
+    if ($chunk > 0)
+    for ($i = 0; $i <= $this->lcs; $i++)
+      $ymids[$i][$chunk-1] = $this->seq[$i];
+
+    $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
+    for ( ; $x < $x1; $x++) {
+        $line = $flip ? $this->yv[$x] : $this->xv[$x];
+        if (empty($ymatches[$line]))
+      continue;
+    $matches = $ymatches[$line];
+        reset($matches);
+    while (list ($junk, $y) = each($matches))
+      if (empty($this->in_seq[$y])) {
+      $k = $this->_lcs_pos($y);
+      USE_ASSERTS && assert($k > 0);
+      $ymids[$k] = $ymids[$k-1];
+      break;
+          }
+    while (list ($junk, $y) = each($matches)) {
+      if ($y > $this->seq[$k-1]) {
+      USE_ASSERTS && assert($y < $this->seq[$k]);
+      // Optimization: this is a common case:
+      //  next match is just replacing previous match.
+      $this->in_seq[$this->seq[$k]] = false;
+      $this->seq[$k] = $y;
+      $this->in_seq[$y] = 1;
+          }
+      else if (empty($this->in_seq[$y])) {
+      $k = $this->_lcs_pos($y);
+      USE_ASSERTS && assert($k > 0);
+      $ymids[$k] = $ymids[$k-1];
+          }
+        }
+      }
+    }
+
+  $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
+  $ymid = $ymids[$this->lcs];
+  for ($n = 0; $n < $nchunks - 1; $n++) {
+    $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
+    $y1 = $ymid[$n] + 1;
+    $seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
+    }
+  $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
+
+  return array($this->lcs, $seps);
+  }
+
+  function _lcs_pos ($ypos) {
+  $end = $this->lcs;
+  if ($end == 0 || $ypos > $this->seq[$end]) {
+    $this->seq[++$this->lcs] = $ypos;
+    $this->in_seq[$ypos] = 1;
+    return $this->lcs;
+    }
+
+  $beg = 1;
+  while ($beg < $end) {
+    $mid = (int)(($beg + $end) / 2);
+    if ( $ypos > $this->seq[$mid] )
+    $beg = $mid + 1;
+    else
+    $end = $mid;
+    }
+
+  USE_ASSERTS && assert($ypos != $this->seq[$end]);
+
+  $this->in_seq[$this->seq[$end]] = false;
+  $this->seq[$end] = $ypos;
+  $this->in_seq[$ypos] = 1;
+  return $end;
+  }
+
+  /**
+   * Find LCS of two sequences.
+   *
+   * The results are recorded in the vectors $this->{x,y}changed[], by
+   * storing a 1 in the element for each line that is an insertion
+   * or deletion (ie. is not in the LCS).
+   *
+   * The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
+   *
+   * Note that XLIM, YLIM are exclusive bounds.
+   * All line numbers are origin-0 and discarded lines are not counted.
+   */
+  function _compareseq ($xoff, $xlim, $yoff, $ylim) {
+  // Slide down the bottom initial diagonal.
+  while ($xoff < $xlim && $yoff < $ylim
+         && $this->xv[$xoff] == $this->yv[$yoff]) {
+    ++$xoff;
+    ++$yoff;
+    }
+
+  // Slide up the top initial diagonal.
+  while ($xlim > $xoff && $ylim > $yoff
+         && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
+    --$xlim;
+    --$ylim;
+    }
+
+  if ($xoff == $xlim || $yoff == $ylim)
+    $lcs = 0;
+  else {
+    // This is ad hoc but seems to work well.
+    //$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);
+    //$nchunks = max(2,min(8,(int)$nchunks));
+    $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1;
+    list ($lcs, $seps)
+    = $this->_diag($xoff,$xlim,$yoff, $ylim,$nchunks);
+    }
+
+  if ($lcs == 0) {
+    // X and Y sequences have no common subsequence:
+    // mark all changed.
+    while ($yoff < $ylim)
+    $this->ychanged[$this->yind[$yoff++]] = 1;
+    while ($xoff < $xlim)
+    $this->xchanged[$this->xind[$xoff++]] = 1;
+    }
+  else {
+    // Use the partitions to split this problem into subproblems.
+    reset($seps);
+    $pt1 = $seps[0];
+    while ($pt2 = next($seps)) {
+    $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
+    $pt1 = $pt2;
+      }
+    }
+  }
+
+  /**
+   * Adjust inserts/deletes of identical lines to join changes
+   * as much as possible.
+   *
+   * We do something when a run of changed lines include a
+   * line at one end and has an excluded, identical line at the other.
+   * We are free to choose which identical line is included.
+   * `compareseq' usually chooses the one at the beginning,
+   * but usually it is cleaner to consider the following identical line
+   * to be the "change".
+   *
+   * This is extracted verbatim from analyze.c (GNU diffutils-2.7).
+   */
+  function _shift_boundaries ($lines, &$changed, $other_changed) {
+  $i = 0;
+  $j = 0;
+
+  USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
+  $len = sizeof($lines);
+  $other_len = sizeof($other_changed);
+
+  while (1) {
+    /*
+     * Scan forwards to find beginning of another run of changes.
+     * Also keep track of the corresponding point in the other file.
+     *
+     * Throughout this code, $i and $j are adjusted together so that
+     * the first $i elements of $changed and the first $j elements
+     * of $other_changed both contain the same number of zeros
+     * (unchanged lines).
+     * Furthermore, $j is always kept so that $j == $other_len or
+     * $other_changed[$j] == false.
+     */
+    while ($j < $other_len && $other_changed[$j])
+    $j++;
+
+    while ($i < $len && ! $changed[$i]) {
+    USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
+    $i++; $j++;
+    while ($j < $other_len && $other_changed[$j])
+      $j++;
+      }
+
+    if ($i == $len)
+    break;
+
+    $start = $i;
+
+    // Find the end of this run of changes.
+    while (++$i < $len && $changed[$i])
+    continue;
+
+    do {
+    /*
+     * Record the length of this run of changes, so that
+     * we can later determine whether the run has grown.
+     */
+    $runlength = $i - $start;
+
+    /*
+     * Move the changed region back, so long as the
+     * previous unchanged line matches the last changed one.
+     * This merges with previous changed regions.
+     */
+    while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) {
+      $changed[--$start] = 1;
+      $changed[--$i] = false;
+      while ($start > 0 && $changed[$start - 1])
+      $start--;
+      USE_ASSERTS && assert('$j > 0');
+      while ($other_changed[--$j])
+      continue;
+      USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
+        }
+
+    /*
+     * Set CORRESPONDING to the end of the changed run, at the last
+     * point where it corresponds to a changed run in the other file.
+     * CORRESPONDING == LEN means no such point has been found.
+     */
+    $corresponding = $j < $other_len ? $i : $len;
+
+    /*
+     * Move the changed region forward, so long as the
+     * first changed line matches the following unchanged one.
+     * This merges with following changed regions.
+     * Do this second, so that if there are no merges,
+     * the changed region is moved forward as far as possible.
+     */
+    while ($i < $len && $lines[$start] == $lines[$i]) {
+      $changed[$start++] = false;
+      $changed[$i++] = 1;
+      while ($i < $len && $changed[$i])
+      $i++;
+
+      USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
+      $j++;
+      if ($j < $other_len && $other_changed[$j]) {
+      $corresponding = $i;
+      while ($j < $other_len && $other_changed[$j])
+        $j++;
+          }
+        }
+      } while ($runlength != $i - $start);
+
+    /*
+     * If possible, move the fully-merged run of changes
+     * back to a corresponding run in the other file.
+     */
+    while ($corresponding < $i) {
+    $changed[--$start] = 1;
+    $changed[--$i] = 0;
+    USE_ASSERTS && assert('$j > 0');
+    while ($other_changed[--$j])
+      continue;
+    USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
+      }
+    }
+  }
+}
+
+/**
+ * Class representing a 'diff' between two sequences of strings.
+ */
+class Diff
+{
+  var $edits;
+
+  /**
+   * Constructor.
+   * Computes diff between sequences of strings.
+   *
+   * @param $from_lines array An array of strings.
+   *      (Typically these are lines from a file.)
+   * @param $to_lines array An array of strings.
+   */
+  function Diff($from_lines, $to_lines) {
+    $eng = new _DiffEngine;
+    $this->edits = $eng->diff($from_lines, $to_lines);
+    //$this->_check($from_lines, $to_lines);
+  }
+
+  /**
+   * Compute reversed Diff.
+   *
+   * SYNOPSIS:
+   *
+   *  $diff = new Diff($lines1, $lines2);
+   *  $rev = $diff->reverse();
+   * @return object A Diff object representing the inverse of the
+   *          original diff.
+   */
+  function reverse () {
+  $rev = $this;
+    $rev->edits = array();
+    foreach ($this->edits as $edit) {
+      $rev->edits[] = $edit->reverse();
+    }
+  return $rev;
+  }
+
+  /**
+   * Check for empty diff.
+   *
+   * @return bool True iff two sequences were identical.
+   */
+  function isEmpty () {
+    foreach ($this->edits as $edit) {
+      if ($edit->type != 'copy')
+        return false;
+    }
+    return true;
+  }
+
+  /**
+   * Compute the length of the Longest Common Subsequence (LCS).
+   *
+   * This is mostly for diagnostic purposed.
+   *
+   * @return int The length of the LCS.
+   */
+  function lcs () {
+  $lcs = 0;
+    foreach ($this->edits as $edit) {
+      if ($edit->type == 'copy')
+        $lcs += sizeof($edit->orig);
+    }
+  return $lcs;
+  }
+
+  /**
+   * Get the original set of lines.
+   *
+   * This reconstructs the $from_lines parameter passed to the
+   * constructor.
+   *
+   * @return array The original sequence of strings.
+   */
+  function orig() {
+    $lines = array();
+
+    foreach ($this->edits as $edit) {
+      if ($edit->orig)
+        array_splice($lines, sizeof($lines), 0, $edit->orig);
+    }
+    return $lines;
+  }
+
+  /**
+   * Get the closing set of lines.
+   *
+   * This reconstructs the $to_lines parameter passed to the
+   * constructor.
+   *
+   * @return array The sequence of strings.
+   */
+  function closing() {
+    $lines = array();
+
+    foreach ($this->edits as $edit) {
+      if ($edit->closing)
+        array_splice($lines, sizeof($lines), 0, $edit->closing);
+    }
+    return $lines;
+  }
+
+  /**
+   * Check a Diff for validity.
+   *
+   * This is here only for debugging purposes.
+   */
+  function _check ($from_lines, $to_lines) {
+    if (serialize($from_lines) != serialize($this->orig()))
+      trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
+    if (serialize($to_lines) != serialize($this->closing()))
+      trigger_error("Reconstructed closing doesn't match", E_USER_ERROR);
+
+    $rev = $this->reverse();
+    if (serialize($to_lines) != serialize($rev->orig()))
+      trigger_error("Reversed original doesn't match", E_USER_ERROR);
+    if (serialize($from_lines) != serialize($rev->closing()))
+      trigger_error("Reversed closing doesn't match", E_USER_ERROR);
+
+
+    $prevtype = 'none';
+    foreach ($this->edits as $edit) {
+      if ( $prevtype == $edit->type )
+        trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
+      $prevtype = $edit->type;
+    }
+
+    $lcs = $this->lcs();
+    trigger_error("Diff okay: LCS = $lcs", E_USER_NOTICE);
+  }
+}
+
+/**
+ * FIXME: bad name.
+ */
+class MappedDiff
+extends Diff
+{
+  /**
+   * Constructor.
+   *
+   * Computes diff between sequences of strings.
+   *
+   * This can be used to compute things like
+   * case-insensitve diffs, or diffs which ignore
+   * changes in white-space.
+   *
+   * @param $from_lines array An array of strings.
+   *  (Typically these are lines from a file.)
+   *
+   * @param $to_lines array An array of strings.
+   *
+   * @param $mapped_from_lines array This array should
+   *  have the same size number of elements as $from_lines.
+   *  The elements in $mapped_from_lines and
+   *  $mapped_to_lines are what is actually compared
+   *  when computing the diff.
+   *
+   * @param $mapped_to_lines array This array should
+   *  have the same number of elements as $to_lines.
+   */
+  function MappedDiff($from_lines, $to_lines,
+            $mapped_from_lines, $mapped_to_lines) {
+
+    assert(sizeof($from_lines) == sizeof($mapped_from_lines));
+    assert(sizeof($to_lines) == sizeof($mapped_to_lines));
+
+    $this->Diff($mapped_from_lines, $mapped_to_lines);
+
+    $xi = $yi = 0;
+    for ($i = 0; $i < sizeof($this->edits); $i++) {
+      $orig = &$this->edits[$i]->orig;
+      if (is_array($orig)) {
+        $orig = array_slice($from_lines, $xi, sizeof($orig));
+        $xi += sizeof($orig);
+      }
+
+      $closing = &$this->edits[$i]->closing;
+      if (is_array($closing)) {
+        $closing = array_slice($to_lines, $yi, sizeof($closing));
+        $yi += sizeof($closing);
+      }
+    }
+  }
+}
+
+/**
+ * A class to format Diffs
+ *
+ * This class formats the diff in classic diff format.
+ * It is intended that this class be customized via inheritance,
+ * to obtain fancier outputs.
+ */
+class DiffFormatter
+{
+  /**
+   * Number of leading context "lines" to preserve.
+   *
+   * This should be left at zero for this class, but subclasses
+   * may want to set this to other values.
+   */
+  var $leading_context_lines = 0;
+
+  /**
+   * Number of trailing context "lines" to preserve.
+   *
+   * This should be left at zero for this class, but subclasses
+   * may want to set this to other values.
+   */
+  var $trailing_context_lines = 0;
+
+  /**
+   * Format a diff.
+   *
+   * @param $diff object A Diff object.
+   * @return string The formatted output.
+   */
+  function format($diff) {
+
+    $xi = $yi = 1;
+    $block = false;
+    $context = array();
+
+    $nlead = $this->leading_context_lines;
+    $ntrail = $this->trailing_context_lines;
+
+    $this->_start_diff();
+
+    foreach ($diff->edits as $edit) {
+      if ($edit->type == 'copy') {
+        if (is_array($block)) {
+          if (sizeof($edit->orig) <= $nlead + $ntrail) {
+            $block[] = $edit;
+          }
+          else{
+            if ($ntrail) {
+              $context = array_slice($edit->orig, 0, $ntrail);
+              $block[] = new _DiffOp_Copy($context);
+            }
+            $this->_block($x0, $ntrail + $xi - $x0,
+                    $y0, $ntrail + $yi - $y0,
+                    $block);
+            $block = false;
+          }
+        }
+        $context = $edit->orig;
+      }
+      else {
+        if (! is_array($block)) {
+          $context = array_slice($context, sizeof($context) - $nlead);
+          $x0 = $xi - sizeof($context);
+          $y0 = $yi - sizeof($context);
+          $block = array();
+          if ($context)
+            $block[] = new _DiffOp_Copy($context);
+        }
+        $block[] = $edit;
+      }
+
+      if ($edit->orig)
+        $xi += sizeof($edit->orig);
+      if ($edit->closing)
+        $yi += sizeof($edit->closing);
+    }
+
+    if (is_array($block))
+      $this->_block($x0, $xi - $x0,
+              $y0, $yi - $y0,
+              $block);
+
+    return $this->_end_diff();
+  }
+
+  function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
+    $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
+    foreach ($edits as $edit) {
+      if ($edit->type == 'copy')
+        $this->_context($edit->orig);
+      elseif ($edit->type == 'add')
+        $this->_added($edit->closing);
+      elseif ($edit->type == 'delete')
+        $this->_deleted($edit->orig);
+      elseif ($edit->type == 'change')
+        $this->_changed($edit->orig, $edit->closing);
+      else
+        trigger_error("Unknown edit type", E_USER_ERROR);
+    }
+    $this->_end_block();
+  }
+
+  function _start_diff() {
+    ob_start();
+  }
+
+  function _end_diff() {
+    $val = ob_get_contents();
+    ob_end_clean();
+    return $val;
+  }
+
+  function _block_header($xbeg, $xlen, $ybeg, $ylen) {
+    if ($xlen > 1)
+      $xbeg .= "," . ($xbeg + $xlen - 1);
+    if ($ylen > 1)
+      $ybeg .= "," . ($ybeg + $ylen - 1);
+
+    return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
+  }
+
+  function _start_block($header) {
+    echo $header;
+  }
+
+  function _end_block() {
+  }
+
+  function _lines($lines, $prefix = ' ') {
+    foreach ($lines as $line)
+      echo "$prefix $line\n";
+  }
+
+  function _context($lines) {
+    $this->_lines($lines);
+  }
+
+  function _added($lines) {
+    $this->_lines($lines, ">");
+  }
+  function _deleted($lines) {
+    $this->_lines($lines, "<");
+  }
+
+  function _changed($orig, $closing) {
+    $this->_deleted($orig);
+    echo "---\n";
+    $this->_added($closing);
+  }
+}
+
+
+/**
+ *  Additions by Axel Boldt follow, partly taken from diff.php, phpwiki-1.3.3
+ *
+ */
+
+define('NBSP', "\xC2\xA0");     // utf-8 non-breaking space.
+
+class _HWLDF_WordAccumulator {
+  function _HWLDF_WordAccumulator () {
+    $this->_lines = array();
+    $this->_line = '';
+    $this->_group = '';
+    $this->_tag = '';
+  }
+
+  function _flushGroup ($new_tag) {
+    if ($this->_group !== '') {
+    if ($this->_tag == 'mark')
+      $this->_line .= '<strong>'.$this->_group.'</strong>';
+    else
+    $this->_line .= $this->_group;
+  }
+    $this->_group = '';
+    $this->_tag = $new_tag;
+  }
+
+  function _flushLine ($new_tag) {
+    $this->_flushGroup($new_tag);
+    if ($this->_line != '')
+      $this->_lines[] = $this->_line;
+    $this->_line = '';
+  }
+
+  function addWords ($words, $tag = '') {
+    if ($tag != $this->_tag)
+      $this->_flushGroup($tag);
+
+    foreach ($words as $word) {
+      // new-line should only come as first char of word.
+      if ($word == '')
+        continue;
+      if ($word[0] == "\n") {
+        $this->_group .= NBSP;
+        $this->_flushLine($tag);
+        $word = substr($word, 1);
+      }
+      assert(!strstr($word, "\n"));
+      $this->_group .= $word;
+    }
+  }
+
+  function getLines() {
+    $this->_flushLine('~done');
+    return $this->_lines;
+  }
+}
+
+class WordLevelDiff extends MappedDiff
+{
+  function WordLevelDiff ($orig_lines, $closing_lines) {
+    list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
+    list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
+
+
+    $this->MappedDiff($orig_words, $closing_words,
+              $orig_stripped, $closing_stripped);
+  }
+
+  function _split($lines) {
+    // FIXME: fix POSIX char class.
+#    if (!preg_match_all('/ ( [^\S\n]+ | [[:alnum:]]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
+    if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
+              implode("\n", $lines),
+              $m)) {
+      return array(array(''), array(''));
+    }
+    return array($m[0], $m[1]);
+  }
+
+  function orig () {
+    $orig = new _HWLDF_WordAccumulator;
+
+    foreach ($this->edits as $edit) {
+      if ($edit->type == 'copy')
+        $orig->addWords($edit->orig);
+      elseif ($edit->orig)
+        $orig->addWords($edit->orig, 'mark');
+    }
+    return $orig->getLines();
+  }
+
+  function closing () {
+    $closing = new _HWLDF_WordAccumulator;
+
+    foreach ($this->edits as $edit) {
+      if ($edit->type == 'copy')
+        $closing->addWords($edit->closing);
+      elseif ($edit->closing)
+        $closing->addWords($edit->closing, 'mark');
+    }
+    return $closing->getLines();
+  }
+}
+
+/**
+ * "Unified" diff formatter.
+ *
+ * This class formats the diff in classic "unified diff" format.
+ */
+class UnifiedDiffFormatter extends DiffFormatter
+{
+    function UnifiedDiffFormatter($context_lines = 4) {
+        $this->leading_context_lines = $context_lines;
+        $this->trailing_context_lines = $context_lines;
+    }
+
+    function _block_header($xbeg, $xlen, $ybeg, $ylen) {
+        if ($xlen != 1)
+            $xbeg .= "," . $xlen;
+        if ($ylen != 1)
+            $ybeg .= "," . $ylen;
+        return "@@ -$xbeg +$ybeg @@\n";
+    }
+
+    function _added($lines) {
+        $this->_lines($lines, "+");
+    }
+    function _deleted($lines) {
+        $this->_lines($lines, "-");
+    }
+    function _changed($orig, $final) {
+        $this->_deleted($orig);
+        $this->_added($final);
+    }
+}
+
+/**
+ *  Wikipedia Table style diff formatter.
+ *
+ */
+class TableDiffFormatter extends DiffFormatter
+{
+  function TableDiffFormatter() {
+    $this->leading_context_lines = 2;
+    $this->trailing_context_lines = 2;
+  }
+
+  function _pre($text){
+    $text = htmlspecialchars($text);
+    $text = str_replace('  ',' &nbsp;',$text);
+    return $text;
+  }
+
+  function _block_header( $xbeg, $xlen, $ybeg, $ylen ) {
+    global $lang;
+    $l1 = $lang['line'].' '.$xbeg;
+    $l2 = $lang['line'].' '.$ybeg;
+    $r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n" .
+      '<td class="diff-blockheader" colspan="2">'.$l2.":</td></tr>\n";
+    return $r;
+  }
+
+  function _start_block( $header ) {
+    print( $header );
+  }
+
+  function _end_block() {
+  }
+
+  function _lines( $lines, $prefix=' ', $color="white" ) {
+  }
+
+  function addedLine( $line ) {
+    $line = str_replace('  ','&nbsp; ',$line);
+    return '<td>+</td><td class="diff-addedline">' .
+      $line.'</td>';
+  }
+
+  function deletedLine( $line ) {
+    $line = str_replace('  ','&nbsp; ',$line);
+    return '<td>-</td><td class="diff-deletedline">' .
+      $line.'</td>';
+  }
+
+  function emptyLine() {
+    //$line = str_replace('  ','&nbsp; ',$line);
+    return '<td colspan="2">&nbsp;</td>';
+  }
+
+  function contextLine( $line ) {
+    $line = str_replace('  ','&nbsp; ',$line);
+    return '<td> </td><td class="diff-context">'.$line.'</td>';
+  }
+
+  function _added($lines) {
+    foreach ($lines as $line) {
+      print( '<tr>' . $this->emptyLine() .
+        $this->addedLine( $line ) . "</tr>\n" );
+    }
+  }
+
+  function _deleted($lines) {
+    foreach ($lines as $line) {
+      print( '<tr>' . $this->deletedLine( $line ) .
+        $this->emptyLine() . "</tr>\n" );
+    }
+  }
+
+  function _context( $lines ) {
+    foreach ($lines as $line) {
+      print( '<tr>' . $this->contextLine( $line ) .
+        $this->contextLine( $line ) . "</tr>\n" );
+    }
+  }
+
+  function _changed( $orig, $closing ) {
+    $diff = new WordLevelDiff( $orig, $closing );
+    $del = $diff->orig();
+    $add = $diff->closing();
+
+    while ( $line = array_shift( $del ) ) {
+      $aline = array_shift( $add );
+      print( '<tr>' . $this->deletedLine( $line ) .
+        $this->addedLine( $aline ) . "</tr>\n" );
+    }
+    $this->_added( $add ); # If any leftovers
+  }
+}
+
+
+//Setup VIM: ex: et ts=2 enc=utf-8 :

Modified: branches/print_dev/http/extensions/JSON.php
===================================================================
--- branches/print_dev/http/extensions/JSON.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/JSON.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,806 +1,806 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Converts to and from JSON format.
- *
- * JSON (JavaScript Object Notation) is a lightweight data-interchange
- * format. It is easy for humans to read and write. It is easy for machines
- * to parse and generate. It is based on a subset of the JavaScript
- * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
- * This feature can also be found in  Python. JSON is a text format that is
- * completely language independent but uses conventions that are familiar
- * to programmers of the C-family of languages, including C, C++, C#, Java,
- * JavaScript, Perl, TCL, and many others. These properties make JSON an
- * ideal data-interchange language.
- *
- * This package provides a simple encoder and decoder for JSON notation. It
- * is intended for use with client-side Javascript applications that make
- * use of HTTPRequest to perform server communication functions - data can
- * be encoded into JSON notation for use in a client-side javascript, or
- * decoded from incoming Javascript requests. JSON format is native to
- * Javascript, and can be directly eval()'ed with no further parsing
- * overhead
- *
- * All strings should be in ASCII or UTF-8 format!
- *
- * LICENSE: Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met: Redistributions of source code must retain the
- * above copyright notice, this list of conditions and the following
- * disclaimer. Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
- * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * @category
- * @package     Services_JSON
- * @author      Michal Migurski <mike-json at teczno.com>
- * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
- * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
- * @copyright   2005 Michal Migurski
- * @version     CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
- * @license     http://www.opensource.org/licenses/bsd-license.php
- * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
- */
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_SLICE',   1);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_STR',  2);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_ARR',  3);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_OBJ',  4);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_CMT', 5);
-
-/**
- * Behavior switch for Services_JSON::decode()
- */
-define('SERVICES_JSON_LOOSE_TYPE', 16);
-
-/**
- * Behavior switch for Services_JSON::decode()
- */
-define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
-
-/**
- * Converts to and from JSON format.
- *
- * Brief example of use:
- *
- * <code>
- * // create a new instance of Services_JSON
- * $json = new Services_JSON();
- *
- * // convert a complexe value to JSON notation, and send it to the browser
- * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
- * $output = $json->encode($value);
- *
- * print($output);
- * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
- *
- * // accept incoming POST data, assumed to be in JSON notation
- * $input = file_get_contents('php://input', 1000000);
- * $value = $json->decode($input);
- * </code>
- */
-class Services_JSON
-{
-   /**
-    * constructs a new JSON instance
-    *
-    * @param    int     $use    object behavior flags; combine with boolean-OR
-    *
-    *                           possible values:
-    *                           - SERVICES_JSON_LOOSE_TYPE:  loose typing.
-    *                                   "{...}" syntax creates associative arrays
-    *                                   instead of objects in decode().
-    *                           - SERVICES_JSON_SUPPRESS_ERRORS:  error suppression.
-    *                                   Values which can't be encoded (e.g. resources)
-    *                                   appear as NULL instead of throwing errors.
-    *                                   By default, a deeply-nested resource will
-    *                                   bubble up with an error, so all return values
-    *                                   from encode() should be checked with isError()
-    */
-    function Services_JSON($use = 0)
-    {
-        $this->use = $use;
-    }
-
-   /**
-    * convert a string from one UTF-16 char to one UTF-8 char
-    *
-    * Normally should be handled by mb_convert_encoding, but
-    * provides a slower PHP-only method for installations
-    * that lack the multibye string extension.
-    *
-    * @param    string  $utf16  UTF-16 character
-    * @return   string  UTF-8 character
-    * @access   private
-    */
-    function utf162utf8($utf16)
-    {
-        // oh please oh please oh please oh please oh please
-        if(function_exists('mb_convert_encoding')) {
-            return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
-        }
-
-        $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
-
-        switch(true) {
-            case ((0x7F & $bytes) == $bytes):
-                // this case should never be reached, because we are in ASCII range
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                return chr(0x7F & $bytes);
-
-            case (0x07FF & $bytes) == $bytes:
-                // return a 2-byte UTF-8 character
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                return chr(0xC0 | (($bytes >> 6) & 0x1F))
-                     . chr(0x80 | ($bytes & 0x3F));
-
-            case (0xFFFF & $bytes) == $bytes:
-                // return a 3-byte UTF-8 character
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                return chr(0xE0 | (($bytes >> 12) & 0x0F))
-                     . chr(0x80 | (($bytes >> 6) & 0x3F))
-                     . chr(0x80 | ($bytes & 0x3F));
-        }
-
-        // ignoring UTF-32 for now, sorry
-        return '';
-    }
-
-   /**
-    * convert a string from one UTF-8 char to one UTF-16 char
-    *
-    * Normally should be handled by mb_convert_encoding, but
-    * provides a slower PHP-only method for installations
-    * that lack the multibye string extension.
-    *
-    * @param    string  $utf8   UTF-8 character
-    * @return   string  UTF-16 character
-    * @access   private
-    */
-    function utf82utf16($utf8)
-    {
-        // oh please oh please oh please oh please oh please
-        if(function_exists('mb_convert_encoding')) {
-            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
-        }
-
-        switch(strlen($utf8)) {
-            case 1:
-                // this case should never be reached, because we are in ASCII range
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                return $utf8;
-
-            case 2:
-                // return a UTF-16 character from a 2-byte UTF-8 char
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                return chr(0x07 & (ord($utf8{0}) >> 2))
-                     . chr((0xC0 & (ord($utf8{0}) << 6))
-                         | (0x3F & ord($utf8{1})));
-
-            case 3:
-                // return a UTF-16 character from a 3-byte UTF-8 char
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                return chr((0xF0 & (ord($utf8{0}) << 4))
-                         | (0x0F & (ord($utf8{1}) >> 2)))
-                     . chr((0xC0 & (ord($utf8{1}) << 6))
-                         | (0x7F & ord($utf8{2})));
-        }
-
-        // ignoring UTF-32 for now, sorry
-        return '';
-    }
-
-   /**
-    * encodes an arbitrary variable into JSON format
-    *
-    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
-    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
-    *                           if var is a strng, note that encode() always expects it
-    *                           to be in ASCII or UTF-8 format!
-    *
-    * @return   mixed   JSON string representation of input var or an error if a problem occurs
-    * @access   public
-    */
-    function encode($var)
-    {
-        switch (gettype($var)) {
-            case 'boolean':
-                return $var ? 'true' : 'false';
-
-            case 'NULL':
-                return 'null';
-
-            case 'integer':
-                return (int) $var;
-
-            case 'double':
-            case 'float':
-                return (float) $var;
-
-            case 'string':
-                // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
-                $ascii = '';
-                $strlen_var = strlen($var);
-
-               /*
-                * Iterate over every character in the string,
-                * escaping with a slash or encoding to UTF-8 where necessary
-                */
-                for ($c = 0; $c < $strlen_var; ++$c) {
-
-                    $ord_var_c = ord($var{$c});
-
-                    switch (true) {
-                        case $ord_var_c == 0x08:
-                            $ascii .= '\b';
-                            break;
-                        case $ord_var_c == 0x09:
-                            $ascii .= '\t';
-                            break;
-                        case $ord_var_c == 0x0A:
-                            $ascii .= '\n';
-                            break;
-                        case $ord_var_c == 0x0C:
-                            $ascii .= '\f';
-                            break;
-                        case $ord_var_c == 0x0D:
-                            $ascii .= '\r';
-                            break;
-
-                        case $ord_var_c == 0x22:
-                        case $ord_var_c == 0x2F:
-                        case $ord_var_c == 0x5C:
-                            // double quote, slash, slosh
-                            $ascii .= '\\'.$var{$c};
-                            break;
-
-                        case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
-                            // characters U-00000000 - U-0000007F (same as ASCII)
-                            $ascii .= $var{$c};
-                            break;
-
-                        case (($ord_var_c & 0xE0) == 0xC0):
-                            // characters U-00000080 - U-000007FF, mask 110XXXXX
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
-                            $c += 1;
-                            $utf16 = $this->utf82utf16($char);
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
-                            break;
-
-                        case (($ord_var_c & 0xF0) == 0xE0):
-                            // characters U-00000800 - U-0000FFFF, mask 1110XXXX
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                            $char = pack('C*', $ord_var_c,
-                                         ord($var{$c + 1}),
-                                         ord($var{$c + 2}));
-                            $c += 2;
-                            $utf16 = $this->utf82utf16($char);
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
-                            break;
-
-                        case (($ord_var_c & 0xF8) == 0xF0):
-                            // characters U-00010000 - U-001FFFFF, mask 11110XXX
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                            $char = pack('C*', $ord_var_c,
-                                         ord($var{$c + 1}),
-                                         ord($var{$c + 2}),
-                                         ord($var{$c + 3}));
-                            $c += 3;
-                            $utf16 = $this->utf82utf16($char);
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
-                            break;
-
-                        case (($ord_var_c & 0xFC) == 0xF8):
-                            // characters U-00200000 - U-03FFFFFF, mask 111110XX
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                            $char = pack('C*', $ord_var_c,
-                                         ord($var{$c + 1}),
-                                         ord($var{$c + 2}),
-                                         ord($var{$c + 3}),
-                                         ord($var{$c + 4}));
-                            $c += 4;
-                            $utf16 = $this->utf82utf16($char);
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
-                            break;
-
-                        case (($ord_var_c & 0xFE) == 0xFC):
-                            // characters U-04000000 - U-7FFFFFFF, mask 1111110X
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                            $char = pack('C*', $ord_var_c,
-                                         ord($var{$c + 1}),
-                                         ord($var{$c + 2}),
-                                         ord($var{$c + 3}),
-                                         ord($var{$c + 4}),
-                                         ord($var{$c + 5}));
-                            $c += 5;
-                            $utf16 = $this->utf82utf16($char);
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
-                            break;
-                    }
-                }
-
-                return '"'.$ascii.'"';
-
-            case 'array':
-               /*
-                * As per JSON spec if any array key is not an integer
-                * we must treat the the whole array as an object. We
-                * also try to catch a sparsely populated associative
-                * array with numeric keys here because some JS engines
-                * will create an array with empty indexes up to
-                * max_index which can cause memory issues and because
-                * the keys, which may be relevant, will be remapped
-                * otherwise.
-                *
-                * As per the ECMA and JSON specification an object may
-                * have any string as a property. Unfortunately due to
-                * a hole in the ECMA specification if the key is a
-                * ECMA reserved word or starts with a digit the
-                * parameter is only accessible using ECMAScript's
-                * bracket notation.
-                */
-
-                // treat as a JSON object
-                if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
-                    $properties = array_map(array($this, 'name_value'),
-                                            array_keys($var),
-                                            array_values($var));
-
-                    foreach($properties as $property) {
-                        if(Services_JSON::isError($property)) {
-                            return $property;
-                        }
-                    }
-
-                    return '{' . join(',', $properties) . '}';
-                }
-
-                // treat it like a regular array
-                $elements = array_map(array($this, 'encode'), $var);
-
-                foreach($elements as $element) {
-                    if(Services_JSON::isError($element)) {
-                        return $element;
-                    }
-                }
-
-                return '[' . join(',', $elements) . ']';
-
-            case 'object':
-                $vars = get_object_vars($var);
-
-                $properties = array_map(array($this, 'name_value'),
-                                        array_keys($vars),
-                                        array_values($vars));
-
-                foreach($properties as $property) {
-                    if(Services_JSON::isError($property)) {
-                        return $property;
-                    }
-                }
-
-                return '{' . join(',', $properties) . '}';
-
-            default:
-                return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
-                    ? 'null'
-                    : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
-        }
-    }
-
-   /**
-    * array-walking function for use in generating JSON-formatted name-value pairs
-    *
-    * @param    string  $name   name of key to use
-    * @param    mixed   $value  reference to an array element to be encoded
-    *
-    * @return   string  JSON-formatted name-value pair, like '"name":value'
-    * @access   private
-    */
-    function name_value($name, $value)
-    {
-        $encoded_value = $this->encode($value);
-
-        if(Services_JSON::isError($encoded_value)) {
-            return $encoded_value;
-        }
-
-        return $this->encode(strval($name)) . ':' . $encoded_value;
-    }
-
-   /**
-    * reduce a string by removing leading and trailing comments and whitespace
-    *
-    * @param    $str    string      string value to strip of comments and whitespace
-    *
-    * @return   string  string value stripped of comments and whitespace
-    * @access   private
-    */
-    function reduce_string($str)
-    {
-        $str = preg_replace(array(
-
-                // eliminate single line comments in '// ...' form
-                '#^\s*//(.+)$#m',
-
-                // eliminate multi-line comments in '/* ... */' form, at start of string
-                '#^\s*/\*(.+)\*/#Us',
-
-                // eliminate multi-line comments in '/* ... */' form, at end of string
-                '#/\*(.+)\*/\s*$#Us'
-
-            ), '', $str);
-
-        // eliminate extraneous space
-        return trim($str);
-    }
-
-   /**
-    * decodes a JSON string into appropriate variable
-    *
-    * @param    string  $str    JSON-formatted string
-    *
-    * @return   mixed   number, boolean, string, array, or object
-    *                   corresponding to given JSON input string.
-    *                   See argument 1 to Services_JSON() above for object-output behavior.
-    *                   Note that decode() always returns strings
-    *                   in ASCII or UTF-8 format!
-    * @access   public
-    */
-    function decode($str)
-    {
-        $str = $this->reduce_string($str);
-
-        switch (strtolower($str)) {
-            case 'true':
-                return true;
-
-            case 'false':
-                return false;
-
-            case 'null':
-                return null;
-
-            default:
-                $m = array();
-
-                if (is_numeric($str)) {
-                    // Lookie-loo, it's a number
-
-                    // This would work on its own, but I'm trying to be
-                    // good about returning integers where appropriate:
-                    // return (float)$str;
-
-                    // Return float or int, as appropriate
-                    return ((float)$str == (integer)$str)
-                        ? (integer)$str
-                        : (float)$str;
-
-                } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
-                    // STRINGS RETURNED IN UTF-8 FORMAT
-                    $delim = substr($str, 0, 1);
-                    $chrs = substr($str, 1, -1);
-                    $utf8 = '';
-                    $strlen_chrs = strlen($chrs);
-
-                    for ($c = 0; $c < $strlen_chrs; ++$c) {
-
-                        $substr_chrs_c_2 = substr($chrs, $c, 2);
-                        $ord_chrs_c = ord($chrs{$c});
-
-                        switch (true) {
-                            case $substr_chrs_c_2 == '\b':
-                                $utf8 .= chr(0x08);
-                                ++$c;
-                                break;
-                            case $substr_chrs_c_2 == '\t':
-                                $utf8 .= chr(0x09);
-                                ++$c;
-                                break;
-                            case $substr_chrs_c_2 == '\n':
-                                $utf8 .= chr(0x0A);
-                                ++$c;
-                                break;
-                            case $substr_chrs_c_2 == '\f':
-                                $utf8 .= chr(0x0C);
-                                ++$c;
-                                break;
-                            case $substr_chrs_c_2 == '\r':
-                                $utf8 .= chr(0x0D);
-                                ++$c;
-                                break;
-
-                            case $substr_chrs_c_2 == '\\"':
-                            case $substr_chrs_c_2 == '\\\'':
-                            case $substr_chrs_c_2 == '\\\\':
-                            case $substr_chrs_c_2 == '\\/':
-                                if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
-                                   ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
-                                    $utf8 .= $chrs{++$c};
-                                }
-                                break;
-
-                            case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
-                                // single, escaped unicode character
-                                $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
-                                       . chr(hexdec(substr($chrs, ($c + 4), 2)));
-                                $utf8 .= $this->utf162utf8($utf16);
-                                $c += 5;
-                                break;
-
-                            case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
-                                $utf8 .= $chrs{$c};
-                                break;
-
-                            case ($ord_chrs_c & 0xE0) == 0xC0:
-                                // characters U-00000080 - U-000007FF, mask 110XXXXX
-                                //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                                $utf8 .= substr($chrs, $c, 2);
-                                ++$c;
-                                break;
-
-                            case ($ord_chrs_c & 0xF0) == 0xE0:
-                                // characters U-00000800 - U-0000FFFF, mask 1110XXXX
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                                $utf8 .= substr($chrs, $c, 3);
-                                $c += 2;
-                                break;
-
-                            case ($ord_chrs_c & 0xF8) == 0xF0:
-                                // characters U-00010000 - U-001FFFFF, mask 11110XXX
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                                $utf8 .= substr($chrs, $c, 4);
-                                $c += 3;
-                                break;
-
-                            case ($ord_chrs_c & 0xFC) == 0xF8:
-                                // characters U-00200000 - U-03FFFFFF, mask 111110XX
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                                $utf8 .= substr($chrs, $c, 5);
-                                $c += 4;
-                                break;
-
-                            case ($ord_chrs_c & 0xFE) == 0xFC:
-                                // characters U-04000000 - U-7FFFFFFF, mask 1111110X
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
-                                $utf8 .= substr($chrs, $c, 6);
-                                $c += 5;
-                                break;
-
-                        }
-
-                    }
-
-                    return $utf8;
-
-                } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
-                    // array, or object notation
-
-                    if ($str{0} == '[') {
-                        $stk = array(SERVICES_JSON_IN_ARR);
-                        $arr = array();
-                    } else {
-                        if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
-                            $stk = array(SERVICES_JSON_IN_OBJ);
-                            $obj = array();
-                        } else {
-                            $stk = array(SERVICES_JSON_IN_OBJ);
-                            $obj = new stdClass();
-                        }
-                    }
-
-                    array_push($stk, array('what'  => SERVICES_JSON_SLICE,
-                                           'where' => 0,
-                                           'delim' => false));
-
-                    $chrs = substr($str, 1, -1);
-                    $chrs = $this->reduce_string($chrs);
-
-                    if ($chrs == '') {
-                        if (reset($stk) == SERVICES_JSON_IN_ARR) {
-                            return $arr;
-
-                        } else {
-                            return $obj;
-
-                        }
-                    }
-
-                    //print("\nparsing {$chrs}\n");
-
-                    $strlen_chrs = strlen($chrs);
-
-                    for ($c = 0; $c <= $strlen_chrs; ++$c) {
-
-                        $top = end($stk);
-                        $substr_chrs_c_2 = substr($chrs, $c, 2);
-
-                        if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
-                            // found a comma that is not inside a string, array, etc.,
-                            // OR we've reached the end of the character list
-                            $slice = substr($chrs, $top['where'], ($c - $top['where']));
-                            array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
-                            //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
-                            if (reset($stk) == SERVICES_JSON_IN_ARR) {
-                                // we are in an array, so just push an element onto the stack
-                                array_push($arr, $this->decode($slice));
-
-                            } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
-                                // we are in an object, so figure
-                                // out the property name and set an
-                                // element in an associative array,
-                                // for now
-                                $parts = array();
-                                
-                                if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
-                                    // "name":value pair
-                                    $key = $this->decode($parts[1]);
-                                    $val = $this->decode($parts[2]);
-
-                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
-                                        $obj[$key] = $val;
-                                    } else {
-                                        $obj->$key = $val;
-                                    }
-                                } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
-                                    // name:value pair, where name is unquoted
-                                    $key = $parts[1];
-                                    $val = $this->decode($parts[2]);
-
-                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
-                                        $obj[$key] = $val;
-                                    } else {
-                                        $obj->$key = $val;
-                                    }
-                                }
-
-                            }
-
-                        } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
-                            // found a quote, and we are not inside a string
-                            array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
-                            //print("Found start of string at {$c}\n");
-
-                        } elseif (($chrs{$c} == $top['delim']) &&
-                                 ($top['what'] == SERVICES_JSON_IN_STR) &&
-                                 ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
-                            // found a quote, we're in a string, and it's not escaped
-                            // we know that it's not escaped becase there is _not_ an
-                            // odd number of backslashes at the end of the string so far
-                            array_pop($stk);
-                            //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
-
-                        } elseif (($chrs{$c} == '[') &&
-                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
-                            // found a left-bracket, and we are in an array, object, or slice
-                            array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
-                            //print("Found start of array at {$c}\n");
-
-                        } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
-                            // found a right-bracket, and we're in an array
-                            array_pop($stk);
-                            //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
-                        } elseif (($chrs{$c} == '{') &&
-                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
-                            // found a left-brace, and we are in an array, object, or slice
-                            array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
-                            //print("Found start of object at {$c}\n");
-
-                        } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
-                            // found a right-brace, and we're in an object
-                            array_pop($stk);
-                            //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
-                        } elseif (($substr_chrs_c_2 == '/*') &&
-                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
-                            // found a comment start, and we are in an array, object, or slice
-                            array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
-                            $c++;
-                            //print("Found start of comment at {$c}\n");
-
-                        } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
-                            // found a comment end, and we're in one now
-                            array_pop($stk);
-                            $c++;
-
-                            for ($i = $top['where']; $i <= $c; ++$i)
-                                $chrs = substr_replace($chrs, ' ', $i, 1);
-
-                            //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
-                        }
-
-                    }
-
-                    if (reset($stk) == SERVICES_JSON_IN_ARR) {
-                        return $arr;
-
-                    } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
-                        return $obj;
-
-                    }
-
-                }
-        }
-    }
-
-    /**
-     * @todo Ultimately, this should just call PEAR::isError()
-     */
-    function isError($data, $code = null)
-    {
-        if (class_exists('pear')) {
-            return PEAR::isError($data, $code);
-        } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
-                                 is_subclass_of($data, 'services_json_error'))) {
-            return true;
-        }
-
-        return false;
-    }
-}
-
-if (class_exists('PEAR_Error')) {
-
-    class Services_JSON_Error extends PEAR_Error
-    {
-        function Services_JSON_Error($message = 'unknown error', $code = null,
-                                     $mode = null, $options = null, $userinfo = null)
-        {
-            parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
-        }
-    }
-
-} else {
-
-    /**
-     * @todo Ultimately, this class shall be descended from PEAR_Error
-     */
-    class Services_JSON_Error
-    {
-        function Services_JSON_Error($message = 'unknown error', $code = null,
-                                     $mode = null, $options = null, $userinfo = null)
-        {
-
-        }
-    }
-
-}
-    
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Converts to and from JSON format.
+ *
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
+ * format. It is easy for humans to read and write. It is easy for machines
+ * to parse and generate. It is based on a subset of the JavaScript
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+ * This feature can also be found in  Python. JSON is a text format that is
+ * completely language independent but uses conventions that are familiar
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
+ * ideal data-interchange language.
+ *
+ * This package provides a simple encoder and decoder for JSON notation. It
+ * is intended for use with client-side Javascript applications that make
+ * use of HTTPRequest to perform server communication functions - data can
+ * be encoded into JSON notation for use in a client-side javascript, or
+ * decoded from incoming Javascript requests. JSON format is native to
+ * Javascript, and can be directly eval()'ed with no further parsing
+ * overhead
+ *
+ * All strings should be in ASCII or UTF-8 format!
+ *
+ * LICENSE: Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met: Redistributions of source code must retain the
+ * above copyright notice, this list of conditions and the following
+ * disclaimer. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * @category
+ * @package     Services_JSON
+ * @author      Michal Migurski <mike-json at teczno.com>
+ * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
+ * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
+ * @copyright   2005 Michal Migurski
+ * @version     CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
+ * @license     http://www.opensource.org/licenses/bsd-license.php
+ * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+ */
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_SLICE',   1);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_STR',  2);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_ARR',  3);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_OBJ',  4);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_CMT', 5);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_LOOSE_TYPE', 16);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
+
+/**
+ * Converts to and from JSON format.
+ *
+ * Brief example of use:
+ *
+ * <code>
+ * // create a new instance of Services_JSON
+ * $json = new Services_JSON();
+ *
+ * // convert a complexe value to JSON notation, and send it to the browser
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
+ * $output = $json->encode($value);
+ *
+ * print($output);
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
+ *
+ * // accept incoming POST data, assumed to be in JSON notation
+ * $input = file_get_contents('php://input', 1000000);
+ * $value = $json->decode($input);
+ * </code>
+ */
+class Services_JSON
+{
+   /**
+    * constructs a new JSON instance
+    *
+    * @param    int     $use    object behavior flags; combine with boolean-OR
+    *
+    *                           possible values:
+    *                           - SERVICES_JSON_LOOSE_TYPE:  loose typing.
+    *                                   "{...}" syntax creates associative arrays
+    *                                   instead of objects in decode().
+    *                           - SERVICES_JSON_SUPPRESS_ERRORS:  error suppression.
+    *                                   Values which can't be encoded (e.g. resources)
+    *                                   appear as NULL instead of throwing errors.
+    *                                   By default, a deeply-nested resource will
+    *                                   bubble up with an error, so all return values
+    *                                   from encode() should be checked with isError()
+    */
+    function Services_JSON($use = 0)
+    {
+        $this->use = $use;
+    }
+
+   /**
+    * convert a string from one UTF-16 char to one UTF-8 char
+    *
+    * Normally should be handled by mb_convert_encoding, but
+    * provides a slower PHP-only method for installations
+    * that lack the multibye string extension.
+    *
+    * @param    string  $utf16  UTF-16 character
+    * @return   string  UTF-8 character
+    * @access   private
+    */
+    function utf162utf8($utf16)
+    {
+        // oh please oh please oh please oh please oh please
+        if(function_exists('mb_convert_encoding')) {
+            return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
+        }
+
+        $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
+
+        switch(true) {
+            case ((0x7F & $bytes) == $bytes):
+                // this case should never be reached, because we are in ASCII range
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0x7F & $bytes);
+
+            case (0x07FF & $bytes) == $bytes:
+                // return a 2-byte UTF-8 character
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0xC0 | (($bytes >> 6) & 0x1F))
+                     . chr(0x80 | ($bytes & 0x3F));
+
+            case (0xFFFF & $bytes) == $bytes:
+                // return a 3-byte UTF-8 character
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0xE0 | (($bytes >> 12) & 0x0F))
+                     . chr(0x80 | (($bytes >> 6) & 0x3F))
+                     . chr(0x80 | ($bytes & 0x3F));
+        }
+
+        // ignoring UTF-32 for now, sorry
+        return '';
+    }
+
+   /**
+    * convert a string from one UTF-8 char to one UTF-16 char
+    *
+    * Normally should be handled by mb_convert_encoding, but
+    * provides a slower PHP-only method for installations
+    * that lack the multibye string extension.
+    *
+    * @param    string  $utf8   UTF-8 character
+    * @return   string  UTF-16 character
+    * @access   private
+    */
+    function utf82utf16($utf8)
+    {
+        // oh please oh please oh please oh please oh please
+        if(function_exists('mb_convert_encoding')) {
+            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+        }
+
+        switch(strlen($utf8)) {
+            case 1:
+                // this case should never be reached, because we are in ASCII range
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return $utf8;
+
+            case 2:
+                // return a UTF-16 character from a 2-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr(0x07 & (ord($utf8{0}) >> 2))
+                     . chr((0xC0 & (ord($utf8{0}) << 6))
+                         | (0x3F & ord($utf8{1})));
+
+            case 3:
+                // return a UTF-16 character from a 3-byte UTF-8 char
+                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                return chr((0xF0 & (ord($utf8{0}) << 4))
+                         | (0x0F & (ord($utf8{1}) >> 2)))
+                     . chr((0xC0 & (ord($utf8{1}) << 6))
+                         | (0x7F & ord($utf8{2})));
+        }
+
+        // ignoring UTF-32 for now, sorry
+        return '';
+    }
+
+   /**
+    * encodes an arbitrary variable into JSON format
+    *
+    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
+    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
+    *                           if var is a strng, note that encode() always expects it
+    *                           to be in ASCII or UTF-8 format!
+    *
+    * @return   mixed   JSON string representation of input var or an error if a problem occurs
+    * @access   public
+    */
+    function encode($var)
+    {
+        switch (gettype($var)) {
+            case 'boolean':
+                return $var ? 'true' : 'false';
+
+            case 'NULL':
+                return 'null';
+
+            case 'integer':
+                return (int) $var;
+
+            case 'double':
+            case 'float':
+                return (float) $var;
+
+            case 'string':
+                // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+                $ascii = '';
+                $strlen_var = strlen($var);
+
+               /*
+                * Iterate over every character in the string,
+                * escaping with a slash or encoding to UTF-8 where necessary
+                */
+                for ($c = 0; $c < $strlen_var; ++$c) {
+
+                    $ord_var_c = ord($var{$c});
+
+                    switch (true) {
+                        case $ord_var_c == 0x08:
+                            $ascii .= '\b';
+                            break;
+                        case $ord_var_c == 0x09:
+                            $ascii .= '\t';
+                            break;
+                        case $ord_var_c == 0x0A:
+                            $ascii .= '\n';
+                            break;
+                        case $ord_var_c == 0x0C:
+                            $ascii .= '\f';
+                            break;
+                        case $ord_var_c == 0x0D:
+                            $ascii .= '\r';
+                            break;
+
+                        case $ord_var_c == 0x22:
+                        case $ord_var_c == 0x2F:
+                        case $ord_var_c == 0x5C:
+                            // double quote, slash, slosh
+                            $ascii .= '\\'.$var{$c};
+                            break;
+
+                        case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+                            // characters U-00000000 - U-0000007F (same as ASCII)
+                            $ascii .= $var{$c};
+                            break;
+
+                        case (($ord_var_c & 0xE0) == 0xC0):
+                            // characters U-00000080 - U-000007FF, mask 110XXXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+                            $c += 1;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xF0) == 0xE0):
+                            // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}));
+                            $c += 2;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xF8) == 0xF0):
+                            // characters U-00010000 - U-001FFFFF, mask 11110XXX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}));
+                            $c += 3;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xFC) == 0xF8):
+                            // characters U-00200000 - U-03FFFFFF, mask 111110XX
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}));
+                            $c += 4;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+
+                        case (($ord_var_c & 0xFE) == 0xFC):
+                            // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                            $char = pack('C*', $ord_var_c,
+                                         ord($var{$c + 1}),
+                                         ord($var{$c + 2}),
+                                         ord($var{$c + 3}),
+                                         ord($var{$c + 4}),
+                                         ord($var{$c + 5}));
+                            $c += 5;
+                            $utf16 = $this->utf82utf16($char);
+                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
+                            break;
+                    }
+                }
+
+                return '"'.$ascii.'"';
+
+            case 'array':
+               /*
+                * As per JSON spec if any array key is not an integer
+                * we must treat the the whole array as an object. We
+                * also try to catch a sparsely populated associative
+                * array with numeric keys here because some JS engines
+                * will create an array with empty indexes up to
+                * max_index which can cause memory issues and because
+                * the keys, which may be relevant, will be remapped
+                * otherwise.
+                *
+                * As per the ECMA and JSON specification an object may
+                * have any string as a property. Unfortunately due to
+                * a hole in the ECMA specification if the key is a
+                * ECMA reserved word or starts with a digit the
+                * parameter is only accessible using ECMAScript's
+                * bracket notation.
+                */
+
+                // treat as a JSON object
+                if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+                    $properties = array_map(array($this, 'name_value'),
+                                            array_keys($var),
+                                            array_values($var));
+
+                    foreach($properties as $property) {
+                        if(Services_JSON::isError($property)) {
+                            return $property;
+                        }
+                    }
+
+                    return '{' . join(',', $properties) . '}';
+                }
+
+                // treat it like a regular array
+                $elements = array_map(array($this, 'encode'), $var);
+
+                foreach($elements as $element) {
+                    if(Services_JSON::isError($element)) {
+                        return $element;
+                    }
+                }
+
+                return '[' . join(',', $elements) . ']';
+
+            case 'object':
+                $vars = get_object_vars($var);
+
+                $properties = array_map(array($this, 'name_value'),
+                                        array_keys($vars),
+                                        array_values($vars));
+
+                foreach($properties as $property) {
+                    if(Services_JSON::isError($property)) {
+                        return $property;
+                    }
+                }
+
+                return '{' . join(',', $properties) . '}';
+
+            default:
+                return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
+                    ? 'null'
+                    : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
+        }
+    }
+
+   /**
+    * array-walking function for use in generating JSON-formatted name-value pairs
+    *
+    * @param    string  $name   name of key to use
+    * @param    mixed   $value  reference to an array element to be encoded
+    *
+    * @return   string  JSON-formatted name-value pair, like '"name":value'
+    * @access   private
+    */
+    function name_value($name, $value)
+    {
+        $encoded_value = $this->encode($value);
+
+        if(Services_JSON::isError($encoded_value)) {
+            return $encoded_value;
+        }
+
+        return $this->encode(strval($name)) . ':' . $encoded_value;
+    }
+
+   /**
+    * reduce a string by removing leading and trailing comments and whitespace
+    *
+    * @param    $str    string      string value to strip of comments and whitespace
+    *
+    * @return   string  string value stripped of comments and whitespace
+    * @access   private
+    */
+    function reduce_string($str)
+    {
+        $str = preg_replace(array(
+
+                // eliminate single line comments in '// ...' form
+                '#^\s*//(.+)$#m',
+
+                // eliminate multi-line comments in '/* ... */' form, at start of string
+                '#^\s*/\*(.+)\*/#Us',
+
+                // eliminate multi-line comments in '/* ... */' form, at end of string
+                '#/\*(.+)\*/\s*$#Us'
+
+            ), '', $str);
+
+        // eliminate extraneous space
+        return trim($str);
+    }
+
+   /**
+    * decodes a JSON string into appropriate variable
+    *
+    * @param    string  $str    JSON-formatted string
+    *
+    * @return   mixed   number, boolean, string, array, or object
+    *                   corresponding to given JSON input string.
+    *                   See argument 1 to Services_JSON() above for object-output behavior.
+    *                   Note that decode() always returns strings
+    *                   in ASCII or UTF-8 format!
+    * @access   public
+    */
+    function decode($str)
+    {
+        $str = $this->reduce_string($str);
+
+        switch (strtolower($str)) {
+            case 'true':
+                return true;
+
+            case 'false':
+                return false;
+
+            case 'null':
+                return null;
+
+            default:
+                $m = array();
+
+                if (is_numeric($str)) {
+                    // Lookie-loo, it's a number
+
+                    // This would work on its own, but I'm trying to be
+                    // good about returning integers where appropriate:
+                    // return (float)$str;
+
+                    // Return float or int, as appropriate
+                    return ((float)$str == (integer)$str)
+                        ? (integer)$str
+                        : (float)$str;
+
+                } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
+                    // STRINGS RETURNED IN UTF-8 FORMAT
+                    $delim = substr($str, 0, 1);
+                    $chrs = substr($str, 1, -1);
+                    $utf8 = '';
+                    $strlen_chrs = strlen($chrs);
+
+                    for ($c = 0; $c < $strlen_chrs; ++$c) {
+
+                        $substr_chrs_c_2 = substr($chrs, $c, 2);
+                        $ord_chrs_c = ord($chrs{$c});
+
+                        switch (true) {
+                            case $substr_chrs_c_2 == '\b':
+                                $utf8 .= chr(0x08);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\t':
+                                $utf8 .= chr(0x09);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\n':
+                                $utf8 .= chr(0x0A);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\f':
+                                $utf8 .= chr(0x0C);
+                                ++$c;
+                                break;
+                            case $substr_chrs_c_2 == '\r':
+                                $utf8 .= chr(0x0D);
+                                ++$c;
+                                break;
+
+                            case $substr_chrs_c_2 == '\\"':
+                            case $substr_chrs_c_2 == '\\\'':
+                            case $substr_chrs_c_2 == '\\\\':
+                            case $substr_chrs_c_2 == '\\/':
+                                if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
+                                   ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
+                                    $utf8 .= $chrs{++$c};
+                                }
+                                break;
+
+                            case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
+                                // single, escaped unicode character
+                                $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
+                                       . chr(hexdec(substr($chrs, ($c + 4), 2)));
+                                $utf8 .= $this->utf162utf8($utf16);
+                                $c += 5;
+                                break;
+
+                            case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
+                                $utf8 .= $chrs{$c};
+                                break;
+
+                            case ($ord_chrs_c & 0xE0) == 0xC0:
+                                // characters U-00000080 - U-000007FF, mask 110XXXXX
+                                //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 2);
+                                ++$c;
+                                break;
+
+                            case ($ord_chrs_c & 0xF0) == 0xE0:
+                                // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 3);
+                                $c += 2;
+                                break;
+
+                            case ($ord_chrs_c & 0xF8) == 0xF0:
+                                // characters U-00010000 - U-001FFFFF, mask 11110XXX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 4);
+                                $c += 3;
+                                break;
+
+                            case ($ord_chrs_c & 0xFC) == 0xF8:
+                                // characters U-00200000 - U-03FFFFFF, mask 111110XX
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 5);
+                                $c += 4;
+                                break;
+
+                            case ($ord_chrs_c & 0xFE) == 0xFC:
+                                // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+                                $utf8 .= substr($chrs, $c, 6);
+                                $c += 5;
+                                break;
+
+                        }
+
+                    }
+
+                    return $utf8;
+
+                } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
+                    // array, or object notation
+
+                    if ($str{0} == '[') {
+                        $stk = array(SERVICES_JSON_IN_ARR);
+                        $arr = array();
+                    } else {
+                        if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+                            $stk = array(SERVICES_JSON_IN_OBJ);
+                            $obj = array();
+                        } else {
+                            $stk = array(SERVICES_JSON_IN_OBJ);
+                            $obj = new stdClass();
+                        }
+                    }
+
+                    array_push($stk, array('what'  => SERVICES_JSON_SLICE,
+                                           'where' => 0,
+                                           'delim' => false));
+
+                    $chrs = substr($str, 1, -1);
+                    $chrs = $this->reduce_string($chrs);
+
+                    if ($chrs == '') {
+                        if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                            return $arr;
+
+                        } else {
+                            return $obj;
+
+                        }
+                    }
+
+                    //print("\nparsing {$chrs}\n");
+
+                    $strlen_chrs = strlen($chrs);
+
+                    for ($c = 0; $c <= $strlen_chrs; ++$c) {
+
+                        $top = end($stk);
+                        $substr_chrs_c_2 = substr($chrs, $c, 2);
+
+                        if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
+                            // found a comma that is not inside a string, array, etc.,
+                            // OR we've reached the end of the character list
+                            $slice = substr($chrs, $top['where'], ($c - $top['where']));
+                            array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
+                            //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                            if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                                // we are in an array, so just push an element onto the stack
+                                array_push($arr, $this->decode($slice));
+
+                            } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+                                // we are in an object, so figure
+                                // out the property name and set an
+                                // element in an associative array,
+                                // for now
+                                $parts = array();
+                                
+                                if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+                                    // "name":value pair
+                                    $key = $this->decode($parts[1]);
+                                    $val = $this->decode($parts[2]);
+
+                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+                                        $obj[$key] = $val;
+                                    } else {
+                                        $obj->$key = $val;
+                                    }
+                                } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+                                    // name:value pair, where name is unquoted
+                                    $key = $parts[1];
+                                    $val = $this->decode($parts[2]);
+
+                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+                                        $obj[$key] = $val;
+                                    } else {
+                                        $obj->$key = $val;
+                                    }
+                                }
+
+                            }
+
+                        } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
+                            // found a quote, and we are not inside a string
+                            array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
+                            //print("Found start of string at {$c}\n");
+
+                        } elseif (($chrs{$c} == $top['delim']) &&
+                                 ($top['what'] == SERVICES_JSON_IN_STR) &&
+                                 ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
+                            // found a quote, we're in a string, and it's not escaped
+                            // we know that it's not escaped becase there is _not_ an
+                            // odd number of backslashes at the end of the string so far
+                            array_pop($stk);
+                            //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
+
+                        } elseif (($chrs{$c} == '[') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a left-bracket, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
+                            //print("Found start of array at {$c}\n");
+
+                        } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
+                            // found a right-bracket, and we're in an array
+                            array_pop($stk);
+                            //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        } elseif (($chrs{$c} == '{') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a left-brace, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
+                            //print("Found start of object at {$c}\n");
+
+                        } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
+                            // found a right-brace, and we're in an object
+                            array_pop($stk);
+                            //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        } elseif (($substr_chrs_c_2 == '/*') &&
+                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+                            // found a comment start, and we are in an array, object, or slice
+                            array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
+                            $c++;
+                            //print("Found start of comment at {$c}\n");
+
+                        } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
+                            // found a comment end, and we're in one now
+                            array_pop($stk);
+                            $c++;
+
+                            for ($i = $top['where']; $i <= $c; ++$i)
+                                $chrs = substr_replace($chrs, ' ', $i, 1);
+
+                            //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+                        }
+
+                    }
+
+                    if (reset($stk) == SERVICES_JSON_IN_ARR) {
+                        return $arr;
+
+                    } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+                        return $obj;
+
+                    }
+
+                }
+        }
+    }
+
+    /**
+     * @todo Ultimately, this should just call PEAR::isError()
+     */
+    function isError($data, $code = null)
+    {
+        if (class_exists('pear')) {
+            return PEAR::isError($data, $code);
+        } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
+                                 is_subclass_of($data, 'services_json_error'))) {
+            return true;
+        }
+
+        return false;
+    }
+}
+
+if (class_exists('PEAR_Error')) {
+
+    class Services_JSON_Error extends PEAR_Error
+    {
+        function Services_JSON_Error($message = 'unknown error', $code = null,
+                                     $mode = null, $options = null, $userinfo = null)
+        {
+            parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+        }
+    }
+
+} else {
+
+    /**
+     * @todo Ultimately, this class shall be descended from PEAR_Error
+     */
+    class Services_JSON_Error
+    {
+        function Services_JSON_Error($message = 'unknown error', $code = null,
+                                     $mode = null, $options = null, $userinfo = null)
+        {
+
+        }
+    }
+
+}
+    
+?>

Modified: branches/print_dev/http/extensions/ext_featureInfoTunnel.php
===================================================================
--- branches/print_dev/http/extensions/ext_featureInfoTunnel.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/ext_featureInfoTunnel.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,39 +1,39 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/ext_featureInfoTunnel.php
-# 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.
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../classes/class_stripRequest.php");
-require_once(dirname(__FILE__) . "/../classes/class_connector.php");
-$mr = new stripRequest(urldecode($_REQUEST["url"]));
-$nmr = $mr->encodeGET();
-$isOwsproxyRequest = (mb_strpos($nmr,OWSPROXY) === 0);
-if($isOwsproxyRequest){
-	header("Location: ".$nmr);
-}
-else{
-	$x = new connector($nmr);
-	if (empty($x->file)) {
-		//close window if featureInfo has no result
-		//echo "<body onLoad=\"javascript:window.close()\">";
-		echo "";
-	} 
-	else {
-		echo $x->file;
-	}	
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/ext_featureInfoTunnel.php
+# 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.
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_stripRequest.php");
+require_once(dirname(__FILE__) . "/../classes/class_connector.php");
+$mr = new stripRequest(urldecode($_REQUEST["url"]));
+$nmr = $mr->encodeGET();
+$isOwsproxyRequest = (mb_strpos($nmr,OWSPROXY) === 0);
+if($isOwsproxyRequest){
+	header("Location: ".$nmr);
+}
+else{
+	$x = new connector($nmr);
+	if (empty($x->file)) {
+		//close window if featureInfo has no result
+		//echo "<body onLoad=\"javascript:window.close()\">";
+		echo "";
+	} 
+	else {
+		echo $x->file;
+	}	
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/extensions/ext_weldMaps.php
===================================================================
--- branches/print_dev/http/extensions/ext_weldMaps.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/ext_weldMaps.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,120 +1,120 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/ext_weldMaps.php
-# 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.
-
-/*
-* extension weldMaps
-* expects an array $_SESSION["mb_print_urls"] containing the mapRequests  
-* expects $_SESSION["mb_print_resolution"]
-* **/
-
-require(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-class weldMaps{
-	var $map_width;
-	var $map_height;
-   var $integrateURL;
-   var $matching;
-   var $pattern;
-   var $replacement;
-
-	function weldMaps($map_urls, $factor){
-      #{ file | false }
-
-      #$debug_file = "/data/mapbender2/log/print.log";
-      $debug_file = false;
-      
-      settype($factor, "integer");     
-      
-      if($debug_file){
-         $debug = fopen($debug_file,"a") ;
-         fputs($debug, str_repeat("-",50) . chr(13). chr(10). date("d.m.y, H:i:s") . " Open debug-file: " . chr(13). chr(10));
-         for($i=0; $i<count($map_urls); $i++){
-            fputs($debug, $i . " " . $map_urls[$i] . chr(13). chr(10));
-            //print_r($map_urls);
-         }
-         fclose($debug);
-      }
-
-      if(!isset($factor)){
-         $factor = 1;
-      }
-      include(dirname(__FILE__)."/../../conf/print.conf");
-      $this->integrateURL = $integrateURL;
-      $this->matching = $matching;
-      $this->pattern = $pattern;
-      $this->replacement = $replacement;
-		if(preg_match("/width=(\d*)/i", $map_urls[0], $matches)){
-			$this->map_width = round(intval($matches[1]) * intval($factor) * floatval($deformation));
-		}
-		if(preg_match("/height=(\d*)/i", $map_urls[0], $matches)){
-			$this->map_height = round(intval($matches[1]) * intval($factor) * floatval($deformation));
-		}
-		for($i=0; $i<count($map_urls); $i++){         
-      	$my_urls[$i] = $this->changeResolution($map_urls[$i], $factor);
-         if($debug_file){
-            $debug = fopen($debug_file,"a") ;
-            fputs($debug, "transformated: " . chr(13). chr(10));         
-            fputs($debug, $i . " ". $my_urls[$i] . chr(13). chr(10));
-            fclose($debug);
-         }
-		}  
-		$image = imagecreate($this->map_width, $this->map_height);
-		$white = ImageColorAllocate($image,255,255,255); 
-		ImageFilledRectangle($image,0,0,$this->map_width,$this->map_height,$white); 
-
-		for($i = 0; $i<count($my_urls); $i++){
-    		$im = $this->loadpng($my_urls[$i]);
-	      	imagecopy($image, $im, 0, 0, 0, 0, $this->map_width, $this->map_height); 
-		}
-		ImagePNG($image);
-		ImageDestroy($image);
-	}
-	function loadpng ($imgname) {
-   $im = @ImageCreateFromPNG ($imgname);
-   if (!$im) {                           
-      $im = ImageCreate ($this->map_width, $this->map_height); 
-      $bgc = ImageColorAllocate ($im, 255, 255, 255);
-      $tc  = ImageColorAllocate ($im, 0, 0, 0);
-      ImageFilledRectangle ($im, 0, 0, $map_width, $map_height, $bgc); 
-      ImageString($im, 1, 5, 5, "Fehler beim �ffnen von: ", $tc);
-      $chunk = chunk_split(urldecode($imgname), 60, "###");
-      $array_chunk = explode("###", $chunk);
-      for($i=0; $i<count($array_chunk); $i++){
-         ImageString($im, 1, 5, 20+($i*10), $array_chunk[$i] , $tc);
-      } 
-   }
-   if($this->integrateURL == true){
-      $tc  = ImageColorAllocate ($im, 0, 0, 0);
-      ImageString($im, 1, 5, 5, $imgname, $tc);
-   }
-  	return $im;
-	} 
-	function changeResolution($map_url,$factor){
-		$newResolution = preg_replace("/width=\d*/i", "WIDTH=" . $this->map_width, $map_url);
-		$newResolution = preg_replace("/height=\d*/i", "HEIGHT=" . $this->map_height, $newResolution);
-      if($this->matching == true && $factor > 1){
-         $newResolution = preg_replace($this->pattern, $this->replacement, $newResolution);
-      }
-		return $newResolution;
-	}	
-}
-session_start();
-$map_urls = explode("###",$_SESSION["mb_print_url"]);
-$output = new weldMaps($map_urls, $_SESSION["mb_print_resolution"]);
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/ext_weldMaps.php
+# 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.
+
+/*
+* extension weldMaps
+* expects an array $_SESSION["mb_print_urls"] containing the mapRequests  
+* expects $_SESSION["mb_print_resolution"]
+* **/
+
+require(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+class weldMaps{
+	var $map_width;
+	var $map_height;
+   var $integrateURL;
+   var $matching;
+   var $pattern;
+   var $replacement;
+
+	function weldMaps($map_urls, $factor){
+      #{ file | false }
+
+      #$debug_file = "/data/mapbender2/log/print.log";
+      $debug_file = false;
+      
+      settype($factor, "integer");     
+      
+      if($debug_file){
+         $debug = fopen($debug_file,"a") ;
+         fputs($debug, str_repeat("-",50) . chr(13). chr(10). date("d.m.y, H:i:s") . " Open debug-file: " . chr(13). chr(10));
+         for($i=0; $i<count($map_urls); $i++){
+            fputs($debug, $i . " " . $map_urls[$i] . chr(13). chr(10));
+            //print_r($map_urls);
+         }
+         fclose($debug);
+      }
+
+      if(!isset($factor)){
+         $factor = 1;
+      }
+      include(dirname(__FILE__)."/../../conf/print.conf");
+      $this->integrateURL = $integrateURL;
+      $this->matching = $matching;
+      $this->pattern = $pattern;
+      $this->replacement = $replacement;
+		if(preg_match("/width=(\d*)/i", $map_urls[0], $matches)){
+			$this->map_width = round(intval($matches[1]) * intval($factor) * floatval($deformation));
+		}
+		if(preg_match("/height=(\d*)/i", $map_urls[0], $matches)){
+			$this->map_height = round(intval($matches[1]) * intval($factor) * floatval($deformation));
+		}
+		for($i=0; $i<count($map_urls); $i++){         
+      	$my_urls[$i] = $this->changeResolution($map_urls[$i], $factor);
+         if($debug_file){
+            $debug = fopen($debug_file,"a") ;
+            fputs($debug, "transformated: " . chr(13). chr(10));         
+            fputs($debug, $i . " ". $my_urls[$i] . chr(13). chr(10));
+            fclose($debug);
+         }
+		}  
+		$image = imagecreate($this->map_width, $this->map_height);
+		$white = ImageColorAllocate($image,255,255,255); 
+		ImageFilledRectangle($image,0,0,$this->map_width,$this->map_height,$white); 
+
+		for($i = 0; $i<count($my_urls); $i++){
+    		$im = $this->loadpng($my_urls[$i]);
+	      	imagecopy($image, $im, 0, 0, 0, 0, $this->map_width, $this->map_height); 
+		}
+		ImagePNG($image);
+		ImageDestroy($image);
+	}
+	function loadpng ($imgname) {
+   $im = @ImageCreateFromPNG ($imgname);
+   if (!$im) {                           
+      $im = ImageCreate ($this->map_width, $this->map_height); 
+      $bgc = ImageColorAllocate ($im, 255, 255, 255);
+      $tc  = ImageColorAllocate ($im, 0, 0, 0);
+      ImageFilledRectangle ($im, 0, 0, $map_width, $map_height, $bgc); 
+      ImageString($im, 1, 5, 5, "Fehler beim �ffnen von: ", $tc);
+      $chunk = chunk_split(urldecode($imgname), 60, "###");
+      $array_chunk = explode("###", $chunk);
+      for($i=0; $i<count($array_chunk); $i++){
+         ImageString($im, 1, 5, 20+($i*10), $array_chunk[$i] , $tc);
+      } 
+   }
+   if($this->integrateURL == true){
+      $tc  = ImageColorAllocate ($im, 0, 0, 0);
+      ImageString($im, 1, 5, 5, $imgname, $tc);
+   }
+  	return $im;
+	} 
+	function changeResolution($map_url,$factor){
+		$newResolution = preg_replace("/width=\d*/i", "WIDTH=" . $this->map_width, $map_url);
+		$newResolution = preg_replace("/height=\d*/i", "HEIGHT=" . $this->map_height, $newResolution);
+      if($this->matching == true && $factor > 1){
+         $newResolution = preg_replace($this->pattern, $this->replacement, $newResolution);
+      }
+		return $newResolution;
+	}	
+}
+session_start();
+$map_urls = explode("###",$_SESSION["mb_print_url"]);
+$output = new weldMaps($map_urls, $_SESSION["mb_print_resolution"]);
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/decoders/ASCII85Decode.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/decoders/ASCII85Decode.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/decoders/ASCII85Decode.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,95 +1,95 @@
-<?php
-//
-//  FPDI - Version 1.2.1
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-if (!defined("ORD_z"))
-	define("ORD_z",ord('z'));
-if (!defined("ORD_exclmark"))
-	define("ORD_exclmark", ord('!'));
-if (!defined("ORD_u"))	
-	define("ORD_u", ord("u"));
-if (!defined("ORD_tilde"))
-	define("ORD_tilde", ord('~'));
-
-class ASCII85Decode {
-
-    function ASCII85Decode(&$fpdi) {
-        $this->fpdi =& $fpdi;
-    }
-
-
-    function decode($in) {
-        $out = "";
-        $state = 0;
-        $chn = null;
-        
-        $l = strlen($in);
-        
-        for ($k = 0; $k < $l; ++$k) {
-            $ch = ord($in[$k]) & 0xff;
-            
-            if ($ch == ORD_tilde) {
-                break;
-            }
-            if (preg_match("/^\s$/",chr($ch))) {
-                continue;
-            }
-            if ($ch == ORD_z && $state == 0) {
-                $out .= chr(0).chr(0).chr(0).chr(0);
-                continue;
-            }
-            if ($ch < ORD_exclmark || $ch > ORD_u) {
-                $this->fpdi->error("Illegal character in ASCII85Decode.");
-            }
-            
-            $chn[$state++] = $ch - ORD_exclmark;
-            
-            if ($state == 5) {
-                $state = 0;
-                $r = 0;
-                for ($j = 0; $j < 5; ++$j)
-                    $r = $r * 85 + $chn[$j];
-                $out .= chr($r >> 24);
-                $out .= chr($r >> 16);
-                $out .= chr($r >> 8);
-                $out .= chr($r);
-            }
-        }
-        $r = 0;
-        
-        if ($state == 1)
-            $this->fpdi->error("Illegal length in ASCII85Decode.");
-        if ($state == 2) {
-            $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85;
-            $out .= chr($r >> 24);
-        }
-        else if ($state == 3) {
-            $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85  + ($chn[2]+1) * 85 * 85;
-            $out .= chr($r >> 24);
-            $out .= chr($r >> 16);
-        }
-        else if ($state == 4) {
-            $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85  + $chn[2] * 85 * 85  + ($chn[3]+1) * 85 ;
-            $out .= chr($r >> 24);
-            $out .= chr($r >> 16);
-            $out .= chr($r >> 8);
-        }
-
-        return $out;
-    }
+<?php
+//
+//  FPDI - Version 1.2.1
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+if (!defined("ORD_z"))
+	define("ORD_z",ord('z'));
+if (!defined("ORD_exclmark"))
+	define("ORD_exclmark", ord('!'));
+if (!defined("ORD_u"))	
+	define("ORD_u", ord("u"));
+if (!defined("ORD_tilde"))
+	define("ORD_tilde", ord('~'));
+
+class ASCII85Decode {
+
+    function ASCII85Decode(&$fpdi) {
+        $this->fpdi =& $fpdi;
+    }
+
+
+    function decode($in) {
+        $out = "";
+        $state = 0;
+        $chn = null;
+        
+        $l = strlen($in);
+        
+        for ($k = 0; $k < $l; ++$k) {
+            $ch = ord($in[$k]) & 0xff;
+            
+            if ($ch == ORD_tilde) {
+                break;
+            }
+            if (preg_match("/^\s$/",chr($ch))) {
+                continue;
+            }
+            if ($ch == ORD_z && $state == 0) {
+                $out .= chr(0).chr(0).chr(0).chr(0);
+                continue;
+            }
+            if ($ch < ORD_exclmark || $ch > ORD_u) {
+                $this->fpdi->error("Illegal character in ASCII85Decode.");
+            }
+            
+            $chn[$state++] = $ch - ORD_exclmark;
+            
+            if ($state == 5) {
+                $state = 0;
+                $r = 0;
+                for ($j = 0; $j < 5; ++$j)
+                    $r = $r * 85 + $chn[$j];
+                $out .= chr($r >> 24);
+                $out .= chr($r >> 16);
+                $out .= chr($r >> 8);
+                $out .= chr($r);
+            }
+        }
+        $r = 0;
+        
+        if ($state == 1)
+            $this->fpdi->error("Illegal length in ASCII85Decode.");
+        if ($state == 2) {
+            $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85;
+            $out .= chr($r >> 24);
+        }
+        else if ($state == 3) {
+            $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85  + ($chn[2]+1) * 85 * 85;
+            $out .= chr($r >> 24);
+            $out .= chr($r >> 16);
+        }
+        else if ($state == 4) {
+            $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85  + $chn[2] * 85 * 85  + ($chn[3]+1) * 85 ;
+            $out .= chr($r >> 24);
+            $out .= chr($r >> 16);
+            $out .= chr($r >> 8);
+        }
+
+        return $out;
+    }
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/decoders/LZWDecode.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/decoders/LZWDecode.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/decoders/LZWDecode.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,147 +1,147 @@
-<?php
-//
-//  FPDI - Version 1.2.1
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-class LZWDecode {
-
-    var $sTable = array();
-    var $data = null;
-    var $tIdx;
-    var $bitsToGet = 9;
-    var $bytePointer;
-    var $bitPointer;
-    var $nextData = 0;
-    var $nextBits = 0;
-    var $andTable = array(511, 1023, 2047, 4095);
-
-    function LZWDecode(&$fpdi) {
-        $this->fpdi =& $fpdi;
-    }
-
-    /**
-     * Method to decode LZW compressed data.
-     *
-     * @param string data    The compressed data.
-     */
-    function decode($data) {
-
-        if($data[0] == 0x00 && $data[1] == 0x01) {
-            $this->fpdi->error("LZW flavour not supported.");
-        }
-
-        $this->initsTable();
-
-        $this->data = $data;
-
-        // Initialize pointers
-        $this->bytePointer = 0;
-        $this->bitPointer = 0;
-
-        $this->nextData = 0;
-        $this->nextBits = 0;
-
-        $oldCode = 0;
-
-        $string = "";
-        $uncompData = "";
-
-        while (($code = $this->getNextCode()) != 257) {
-            if ($code == 256) {
-                $this->initsTable();
-                $code = $this->getNextCode();
-
-                if ($code == 257) {
-                    break;
-                }
-
-                $uncompData .= $this->sTable[$code];
-                $oldCode = $code;
-
-            } else {
-
-                if ($code < $this->tIdx) {
-                    $string = $this->sTable[$code];
-                    $uncompData .= $string;
-
-                    $this->addStringToTable($this->sTable[$oldCode], $string[0]);
-                    $oldCode = $code;
-                } else {
-                    $string = $this->sTable[$oldCode];
-                    $string = $string.$string[0];
-                    $uncompData .= $string;
-
-                    $this->addStringToTable($string);
-                    $oldCode = $code;
-                }
-            }
-        }
-        
-        return $uncompData;
-    }
-
-
-    /**
-     * Initialize the string table.
-     */
-    function initsTable() {
-        $this->sTable = array();
-
-        for ($i = 0; $i < 256; $i++)
-            $this->sTable[$i] = chr($i);
-
-        $this->tIdx = 258;
-        $this->bitsToGet = 9;
-    }
-
-    /**
-     * Add a new string to the string table.
-     */
-    function addStringToTable ($oldString, $newString="") {
-        $string = $oldString.$newString;
-
-        // Add this new String to the table
-        $this->sTable[$this->tIdx++] = $string;
-
-        if ($this->tIdx == 511) {
-            $this->bitsToGet = 10;
-        } else if ($this->tIdx == 1023) {
-            $this->bitsToGet = 11;
-        } else if ($this->tIdx == 2047) {
-            $this->bitsToGet = 12;
-        }
-    }
-
-    // Returns the next 9, 10, 11 or 12 bits
-    function getNextCode() {
-        if ($this->bytePointer == strlen($this->data))
-            return 257;
-
-        $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
-        $this->nextBits += 8;
-
-        if ($this->nextBits < $this->bitsToGet) {
-            $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
-            $this->nextBits += 8;
-        }
-
-        $code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9];
-        $this->nextBits -= $this->bitsToGet;
-
-        return $code;
-    }
+<?php
+//
+//  FPDI - Version 1.2.1
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+class LZWDecode {
+
+    var $sTable = array();
+    var $data = null;
+    var $tIdx;
+    var $bitsToGet = 9;
+    var $bytePointer;
+    var $bitPointer;
+    var $nextData = 0;
+    var $nextBits = 0;
+    var $andTable = array(511, 1023, 2047, 4095);
+
+    function LZWDecode(&$fpdi) {
+        $this->fpdi =& $fpdi;
+    }
+
+    /**
+     * Method to decode LZW compressed data.
+     *
+     * @param string data    The compressed data.
+     */
+    function decode($data) {
+
+        if($data[0] == 0x00 && $data[1] == 0x01) {
+            $this->fpdi->error("LZW flavour not supported.");
+        }
+
+        $this->initsTable();
+
+        $this->data = $data;
+
+        // Initialize pointers
+        $this->bytePointer = 0;
+        $this->bitPointer = 0;
+
+        $this->nextData = 0;
+        $this->nextBits = 0;
+
+        $oldCode = 0;
+
+        $string = "";
+        $uncompData = "";
+
+        while (($code = $this->getNextCode()) != 257) {
+            if ($code == 256) {
+                $this->initsTable();
+                $code = $this->getNextCode();
+
+                if ($code == 257) {
+                    break;
+                }
+
+                $uncompData .= $this->sTable[$code];
+                $oldCode = $code;
+
+            } else {
+
+                if ($code < $this->tIdx) {
+                    $string = $this->sTable[$code];
+                    $uncompData .= $string;
+
+                    $this->addStringToTable($this->sTable[$oldCode], $string[0]);
+                    $oldCode = $code;
+                } else {
+                    $string = $this->sTable[$oldCode];
+                    $string = $string.$string[0];
+                    $uncompData .= $string;
+
+                    $this->addStringToTable($string);
+                    $oldCode = $code;
+                }
+            }
+        }
+        
+        return $uncompData;
+    }
+
+
+    /**
+     * Initialize the string table.
+     */
+    function initsTable() {
+        $this->sTable = array();
+
+        for ($i = 0; $i < 256; $i++)
+            $this->sTable[$i] = chr($i);
+
+        $this->tIdx = 258;
+        $this->bitsToGet = 9;
+    }
+
+    /**
+     * Add a new string to the string table.
+     */
+    function addStringToTable ($oldString, $newString="") {
+        $string = $oldString.$newString;
+
+        // Add this new String to the table
+        $this->sTable[$this->tIdx++] = $string;
+
+        if ($this->tIdx == 511) {
+            $this->bitsToGet = 10;
+        } else if ($this->tIdx == 1023) {
+            $this->bitsToGet = 11;
+        } else if ($this->tIdx == 2047) {
+            $this->bitsToGet = 12;
+        }
+    }
+
+    // Returns the next 9, 10, 11 or 12 bits
+    function getNextCode() {
+        if ($this->bytePointer == strlen($this->data))
+            return 257;
+
+        $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
+        $this->nextBits += 8;
+
+        if ($this->nextBits < $this->bitsToGet) {
+            $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
+            $this->nextBits += 8;
+        }
+
+        $code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9];
+        $this->nextBits -= $this->bitsToGet;
+
+        return $code;
+    }
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/font/courier.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/courier.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/courier.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,7 +1,7 @@
-<?php
-for($i=0;$i<=255;$i++)
-	$fpdf_charwidths['courier'][chr($i)]=600;
-$fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];
-$fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];
-$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];
-?>
+<?php
+for($i=0;$i<=255;$i++)
+	$fpdf_charwidths['courier'][chr($i)]=600;
+$fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];
+$fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];
+$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/helvetica.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/helvetica.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/helvetica.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['helvetica']=array(
-	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
-	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
-	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
-	'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
-	'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
-	'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
-	chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
-	chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
-	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
-	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
-	chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
-?>
+<?php
+$fpdf_charwidths['helvetica']=array(
+	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
+	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
+	'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+	'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
+	'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
+	chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+	chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
+	chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/helveticab.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/helveticab.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/helveticab.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['helveticaB']=array(
-	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
-	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
-	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
-	'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
-	'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
-	'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
-	chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
-	chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
-	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
-	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
-	chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
-?>
+<?php
+$fpdf_charwidths['helveticaB']=array(
+	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
+	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
+	'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+	'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
+	'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
+	chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+	chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
+	chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/helveticabi.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/helveticabi.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/helveticabi.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['helveticaBI']=array(
-	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
-	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
-	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
-	'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
-	'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
-	'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
-	chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
-	chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
-	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
-	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
-	chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
-?>
+<?php
+$fpdf_charwidths['helveticaBI']=array(
+	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
+	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
+	'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+	'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
+	'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
+	chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+	chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
+	chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/helveticai.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/helveticai.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/helveticai.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['helveticaI']=array(
-	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
-	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
-	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
-	'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
-	'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
-	'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
-	chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
-	chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
-	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
-	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
-	chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
-?>
+<?php
+$fpdf_charwidths['helveticaI']=array(
+	chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+	chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
+	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
+	'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+	'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
+	'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
+	chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+	chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+	chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
+	chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/makefont/makefont.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/makefont/makefont.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/makefont/makefont.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,419 +1,419 @@
-<?php
-/*******************************************************************************
-* Utility to generate font definition files                                    *
-*                                                                              *
-* Version: 1.14                                                                *
-* Date:    2008-08-03                                                          *
-* Author:  Olivier PLATHEY                                                     *
-*******************************************************************************/
-
-function ReadMap($enc)
-{
-	//Read a map file
-	$file=dirname(__FILE__).'/'.strtolower($enc).'.map';
-	$a=file($file);
-	if(empty($a))
-		die('<b>Error:</b> encoding not found: '.$enc);
-	$cc2gn=array();
-	foreach($a as $l)
-	{
-		if($l[0]=='!')
-		{
-			$e=preg_split('/[ \\t]+/',rtrim($l));
-			$cc=hexdec(substr($e[0],1));
-			$gn=$e[2];
-			$cc2gn[$cc]=$gn;
-		}
-	}
-	for($i=0;$i<=255;$i++)
-	{
-		if(!isset($cc2gn[$i]))
-			$cc2gn[$i]='.notdef';
-	}
-	return $cc2gn;
-}
-
-function ReadAFM($file, &$map)
-{
-	//Read a font metric file
-	$a=file($file);
-	if(empty($a))
-		die('File not found');
-	$widths=array();
-	$fm=array();
-	$fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>'Zdotaccent','zdot'=>'zdotaccent',
-		'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=>'Uhungarumlaut','udblacute'=>'uhungarumlaut',
-		'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcommaaccent','kcedilla'=>'kcommaaccent',
-		'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncommaaccent','ncedilla'=>'ncommaaccent',
-		'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scommaaccent','scedilla'=>'scommaaccent',
-		'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat',
-		'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecomb','combiningtildeaccent'=>'tildecomb',
-		'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb','dongsign'=>'dong');
-	foreach($a as $l)
-	{
-		$e=explode(' ',rtrim($l));
-		if(count($e)<2)
-			continue;
-		$code=$e[0];
-		$param=$e[1];
-		if($code=='C')
-		{
-			//Character metrics
-			$cc=(int)$e[1];
-			$w=$e[4];
-			$gn=$e[7];
-			if(substr($gn,-4)=='20AC')
-				$gn='Euro';
-			if(isset($fix[$gn]))
-			{
-				//Fix incorrect glyph name
-				foreach($map as $c=>$n)
-				{
-					if($n==$fix[$gn])
-						$map[$c]=$gn;
-				}
-			}
-			if(empty($map))
-			{
-				//Symbolic font: use built-in encoding
-				$widths[$cc]=$w;
-			}
-			else
-			{
-				$widths[$gn]=$w;
-				if($gn=='X')
-					$fm['CapXHeight']=$e[13];
-			}
-			if($gn=='.notdef')
-				$fm['MissingWidth']=$w;
-		}
-		elseif($code=='FontName')
-			$fm['FontName']=$param;
-		elseif($code=='Weight')
-			$fm['Weight']=$param;
-		elseif($code=='ItalicAngle')
-			$fm['ItalicAngle']=(double)$param;
-		elseif($code=='Ascender')
-			$fm['Ascender']=(int)$param;
-		elseif($code=='Descender')
-			$fm['Descender']=(int)$param;
-		elseif($code=='UnderlineThickness')
-			$fm['UnderlineThickness']=(int)$param;
-		elseif($code=='UnderlinePosition')
-			$fm['UnderlinePosition']=(int)$param;
-		elseif($code=='IsFixedPitch')
-			$fm['IsFixedPitch']=($param=='true');
-		elseif($code=='FontBBox')
-			$fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]);
-		elseif($code=='CapHeight')
-			$fm['CapHeight']=(int)$param;
-		elseif($code=='StdVW')
-			$fm['StdVW']=(int)$param;
-	}
-	if(!isset($fm['FontName']))
-		die('FontName not found');
-	if(!empty($map))
-	{
-		if(!isset($widths['.notdef']))
-			$widths['.notdef']=600;
-		if(!isset($widths['Delta']) && isset($widths['increment']))
-			$widths['Delta']=$widths['increment'];
-		//Order widths according to map
-		for($i=0;$i<=255;$i++)
-		{
-			if(!isset($widths[$map[$i]]))
-			{
-				echo '<b>Warning:</b> character '.$map[$i].' is missing<br>';
-				$widths[$i]=$widths['.notdef'];
-			}
-			else
-				$widths[$i]=$widths[$map[$i]];
-		}
-	}
-	$fm['Widths']=$widths;
-	return $fm;
-}
-
-function MakeFontDescriptor($fm, $symbolic)
-{
-	//Ascent
-	$asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
-	$fd="array('Ascent'=>".$asc;
-	//Descent
-	$desc=(isset($fm['Descender']) ? $fm['Descender'] : -200);
-	$fd.=",'Descent'=>".$desc;
-	//CapHeight
-	if(isset($fm['CapHeight']))
-		$ch=$fm['CapHeight'];
-	elseif(isset($fm['CapXHeight']))
-		$ch=$fm['CapXHeight'];
-	else
-		$ch=$asc;
-	$fd.=",'CapHeight'=>".$ch;
-	//Flags
-	$flags=0;
-	if(isset($fm['IsFixedPitch']) && $fm['IsFixedPitch'])
-		$flags+=1<<0;
-	if($symbolic)
-		$flags+=1<<2;
-	if(!$symbolic)
-		$flags+=1<<5;
-	if(isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0)
-		$flags+=1<<6;
-	$fd.=",'Flags'=>".$flags;
-	//FontBBox
-	if(isset($fm['FontBBox']))
-		$fbb=$fm['FontBBox'];
-	else
-		$fbb=array(0,$desc-100,1000,$asc+100);
-	$fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
-	//ItalicAngle
-	$ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
-	$fd.=",'ItalicAngle'=>".$ia;
-	//StemV
-	if(isset($fm['StdVW']))
-		$stemv=$fm['StdVW'];
-	elseif(isset($fm['Weight']) && preg_match('/bold|black/i',$fm['Weight']))
-		$stemv=120;
-	else
-		$stemv=70;
-	$fd.=",'StemV'=>".$stemv;
-	//MissingWidth
-	if(isset($fm['MissingWidth']))
-		$fd.=",'MissingWidth'=>".$fm['MissingWidth'];
-	$fd.=')';
-	return $fd;
-}
-
-function MakeWidthArray($fm)
-{
-	//Make character width array
-	$s="array(\n\t";
-	$cw=$fm['Widths'];
-	for($i=0;$i<=255;$i++)
-	{
-		if(chr($i)=="'")
-			$s.="'\\''";
-		elseif(chr($i)=="\\")
-			$s.="'\\\\'";
-		elseif($i>=32 && $i<=126)
-			$s.="'".chr($i)."'";
-		else
-			$s.="chr($i)";
-		$s.='=>'.$fm['Widths'][$i];
-		if($i<255)
-			$s.=',';
-		if(($i+1)%22==0)
-			$s.="\n\t";
-	}
-	$s.=')';
-	return $s;
-}
-
-function MakeFontEncoding($map)
-{
-	//Build differences from reference encoding
-	$ref=ReadMap('cp1252');
-	$s='';
-	$last=0;
-	for($i=32;$i<=255;$i++)
-	{
-		if($map[$i]!=$ref[$i])
-		{
-			if($i!=$last+1)
-				$s.=$i.' ';
-			$last=$i;
-			$s.='/'.$map[$i].' ';
-		}
-	}
-	return rtrim($s);
-}
-
-function SaveToFile($file, $s, $mode)
-{
-	$f=fopen($file,'w'.$mode);
-	if(!$f)
-		die('Can\'t write to file '.$file);
-	fwrite($f,$s,strlen($s));
-	fclose($f);
-}
-
-function ReadShort($f)
-{
-	$a=unpack('n1n',fread($f,2));
-	return $a['n'];
-}
-
-function ReadLong($f)
-{
-	$a=unpack('N1N',fread($f,4));
-	return $a['N'];
-}
-
-function CheckTTF($file)
-{
-	//Check if font license allows embedding
-	$f=fopen($file,'rb');
-	if(!$f)
-		die('<b>Error:</b> Can\'t open '.$file);
-	//Extract number of tables
-	fseek($f,4,SEEK_CUR);
-	$nb=ReadShort($f);
-	fseek($f,6,SEEK_CUR);
-	//Seek OS/2 table
-	$found=false;
-	for($i=0;$i<$nb;$i++)
-	{
-		if(fread($f,4)=='OS/2')
-		{
-			$found=true;
-			break;
-		}
-		fseek($f,12,SEEK_CUR);
-	}
-	if(!$found)
-	{
-		fclose($f);
-		return;
-	}
-	fseek($f,4,SEEK_CUR);
-	$offset=ReadLong($f);
-	fseek($f,$offset,SEEK_SET);
-	//Extract fsType flags
-	fseek($f,8,SEEK_CUR);
-	$fsType=ReadShort($f);
-	$rl=($fsType & 0x02)!=0;
-	$pp=($fsType & 0x04)!=0;
-	$e=($fsType & 0x08)!=0;
-	fclose($f);
-	if($rl && !$pp && !$e)
-		echo '<b>Warning:</b> font license does not allow embedding';
-}
-
-/*******************************************************************************
-* fontfile: path to TTF file (or empty string if not to be embedded)           *
-* afmfile:  path to AFM file                                                   *
-* enc:      font encoding (or empty string for symbolic fonts)                 *
-* patch:    optional patch for encoding                                        *
-* type:     font type if fontfile is empty                                     *
-*******************************************************************************/
-function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='TrueType')
-{
-	//Generate a font definition file
-	if(get_magic_quotes_runtime())
-		@set_magic_quotes_runtime(0);
-	ini_set('auto_detect_line_endings','1');
-	if($enc)
-	{
-		$map=ReadMap($enc);
-		foreach($patch as $cc=>$gn)
-			$map[$cc]=$gn;
-	}
-	else
-		$map=array();
-	if(!file_exists($afmfile))
-		die('<b>Error:</b> AFM file not found: '.$afmfile);
-	$fm=ReadAFM($afmfile,$map);
-	if($enc)
-		$diff=MakeFontEncoding($map);
-	else
-		$diff='';
-	$fd=MakeFontDescriptor($fm,empty($map));
-	//Find font type
-	if($fontfile)
-	{
-		$ext=strtolower(substr($fontfile,-3));
-		if($ext=='ttf')
-			$type='TrueType';
-		elseif($ext=='pfb')
-			$type='Type1';
-		else
-			die('<b>Error:</b> unrecognized font file extension: '.$ext);
-	}
-	else
-	{
-		if($type!='TrueType' && $type!='Type1')
-			die('<b>Error:</b> incorrect font type: '.$type);
-	}
-	//Start generation
-	$s='<?php'."\n";
-	$s.='$type=\''.$type."';\n";
-	$s.='$name=\''.$fm['FontName']."';\n";
-	$s.='$desc='.$fd.";\n";
-	if(!isset($fm['UnderlinePosition']))
-		$fm['UnderlinePosition']=-100;
-	if(!isset($fm['UnderlineThickness']))
-		$fm['UnderlineThickness']=50;
-	$s.='$up='.$fm['UnderlinePosition'].";\n";
-	$s.='$ut='.$fm['UnderlineThickness'].";\n";
-	$w=MakeWidthArray($fm);
-	$s.='$cw='.$w.";\n";
-	$s.='$enc=\''.$enc."';\n";
-	$s.='$diff=\''.$diff."';\n";
-	$basename=substr(basename($afmfile),0,-4);
-	if($fontfile)
-	{
-		//Embedded font
-		if(!file_exists($fontfile))
-			die('<b>Error:</b> font file not found: '.$fontfile);
-		if($type=='TrueType')
-			CheckTTF($fontfile);
-		$f=fopen($fontfile,'rb');
-		if(!$f)
-			die('<b>Error:</b> Can\'t open '.$fontfile);
-		$file=fread($f,filesize($fontfile));
-		fclose($f);
-		if($type=='Type1')
-		{
-			//Find first two sections and discard third one
-			$header=(ord($file[0])==128);
-			if($header)
-			{
-				//Strip first binary header
-				$file=substr($file,6);
-			}
-			$pos=strpos($file,'eexec');
-			if(!$pos)
-				die('<b>Error:</b> font file does not seem to be valid Type1');
-			$size1=$pos+6;
-			if($header && ord($file[$size1])==128)
-			{
-				//Strip second binary header
-				$file=substr($file,0,$size1).substr($file,$size1+6);
-			}
-			$pos=strpos($file,'00000000');
-			if(!$pos)
-				die('<b>Error:</b> font file does not seem to be valid Type1');
-			$size2=$pos-$size1;
-			$file=substr($file,0,$size1+$size2);
-		}
-		if(function_exists('gzcompress'))
-		{
-			$cmp=$basename.'.z';
-			SaveToFile($cmp,gzcompress($file),'b');
-			$s.='$file=\''.$cmp."';\n";
-			echo 'Font file compressed ('.$cmp.')<br>';
-		}
-		else
-		{
-			$s.='$file=\''.basename($fontfile)."';\n";
-			echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>';
-		}
-		if($type=='Type1')
-		{
-			$s.='$size1='.$size1.";\n";
-			$s.='$size2='.$size2.";\n";
-		}
-		else
-			$s.='$originalsize='.filesize($fontfile).";\n";
-	}
-	else
-	{
-		//Not embedded font
-		$s.='$file='."'';\n";
-	}
-	$s.="?>\n";
-	SaveToFile($basename.'.php',$s,'t');
-	echo 'Font definition file generated ('.$basename.'.php'.')<br>';
-}
-?>
+<?php
+/*******************************************************************************
+* Utility to generate font definition files                                    *
+*                                                                              *
+* Version: 1.14                                                                *
+* Date:    2008-08-03                                                          *
+* Author:  Olivier PLATHEY                                                     *
+*******************************************************************************/
+
+function ReadMap($enc)
+{
+	//Read a map file
+	$file=dirname(__FILE__).'/'.strtolower($enc).'.map';
+	$a=file($file);
+	if(empty($a))
+		die('<b>Error:</b> encoding not found: '.$enc);
+	$cc2gn=array();
+	foreach($a as $l)
+	{
+		if($l[0]=='!')
+		{
+			$e=preg_split('/[ \\t]+/',rtrim($l));
+			$cc=hexdec(substr($e[0],1));
+			$gn=$e[2];
+			$cc2gn[$cc]=$gn;
+		}
+	}
+	for($i=0;$i<=255;$i++)
+	{
+		if(!isset($cc2gn[$i]))
+			$cc2gn[$i]='.notdef';
+	}
+	return $cc2gn;
+}
+
+function ReadAFM($file, &$map)
+{
+	//Read a font metric file
+	$a=file($file);
+	if(empty($a))
+		die('File not found');
+	$widths=array();
+	$fm=array();
+	$fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>'Zdotaccent','zdot'=>'zdotaccent',
+		'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=>'Uhungarumlaut','udblacute'=>'uhungarumlaut',
+		'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcommaaccent','kcedilla'=>'kcommaaccent',
+		'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncommaaccent','ncedilla'=>'ncommaaccent',
+		'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scommaaccent','scedilla'=>'scommaaccent',
+		'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat',
+		'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecomb','combiningtildeaccent'=>'tildecomb',
+		'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb','dongsign'=>'dong');
+	foreach($a as $l)
+	{
+		$e=explode(' ',rtrim($l));
+		if(count($e)<2)
+			continue;
+		$code=$e[0];
+		$param=$e[1];
+		if($code=='C')
+		{
+			//Character metrics
+			$cc=(int)$e[1];
+			$w=$e[4];
+			$gn=$e[7];
+			if(substr($gn,-4)=='20AC')
+				$gn='Euro';
+			if(isset($fix[$gn]))
+			{
+				//Fix incorrect glyph name
+				foreach($map as $c=>$n)
+				{
+					if($n==$fix[$gn])
+						$map[$c]=$gn;
+				}
+			}
+			if(empty($map))
+			{
+				//Symbolic font: use built-in encoding
+				$widths[$cc]=$w;
+			}
+			else
+			{
+				$widths[$gn]=$w;
+				if($gn=='X')
+					$fm['CapXHeight']=$e[13];
+			}
+			if($gn=='.notdef')
+				$fm['MissingWidth']=$w;
+		}
+		elseif($code=='FontName')
+			$fm['FontName']=$param;
+		elseif($code=='Weight')
+			$fm['Weight']=$param;
+		elseif($code=='ItalicAngle')
+			$fm['ItalicAngle']=(double)$param;
+		elseif($code=='Ascender')
+			$fm['Ascender']=(int)$param;
+		elseif($code=='Descender')
+			$fm['Descender']=(int)$param;
+		elseif($code=='UnderlineThickness')
+			$fm['UnderlineThickness']=(int)$param;
+		elseif($code=='UnderlinePosition')
+			$fm['UnderlinePosition']=(int)$param;
+		elseif($code=='IsFixedPitch')
+			$fm['IsFixedPitch']=($param=='true');
+		elseif($code=='FontBBox')
+			$fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]);
+		elseif($code=='CapHeight')
+			$fm['CapHeight']=(int)$param;
+		elseif($code=='StdVW')
+			$fm['StdVW']=(int)$param;
+	}
+	if(!isset($fm['FontName']))
+		die('FontName not found');
+	if(!empty($map))
+	{
+		if(!isset($widths['.notdef']))
+			$widths['.notdef']=600;
+		if(!isset($widths['Delta']) && isset($widths['increment']))
+			$widths['Delta']=$widths['increment'];
+		//Order widths according to map
+		for($i=0;$i<=255;$i++)
+		{
+			if(!isset($widths[$map[$i]]))
+			{
+				echo '<b>Warning:</b> character '.$map[$i].' is missing<br>';
+				$widths[$i]=$widths['.notdef'];
+			}
+			else
+				$widths[$i]=$widths[$map[$i]];
+		}
+	}
+	$fm['Widths']=$widths;
+	return $fm;
+}
+
+function MakeFontDescriptor($fm, $symbolic)
+{
+	//Ascent
+	$asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
+	$fd="array('Ascent'=>".$asc;
+	//Descent
+	$desc=(isset($fm['Descender']) ? $fm['Descender'] : -200);
+	$fd.=",'Descent'=>".$desc;
+	//CapHeight
+	if(isset($fm['CapHeight']))
+		$ch=$fm['CapHeight'];
+	elseif(isset($fm['CapXHeight']))
+		$ch=$fm['CapXHeight'];
+	else
+		$ch=$asc;
+	$fd.=",'CapHeight'=>".$ch;
+	//Flags
+	$flags=0;
+	if(isset($fm['IsFixedPitch']) && $fm['IsFixedPitch'])
+		$flags+=1<<0;
+	if($symbolic)
+		$flags+=1<<2;
+	if(!$symbolic)
+		$flags+=1<<5;
+	if(isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0)
+		$flags+=1<<6;
+	$fd.=",'Flags'=>".$flags;
+	//FontBBox
+	if(isset($fm['FontBBox']))
+		$fbb=$fm['FontBBox'];
+	else
+		$fbb=array(0,$desc-100,1000,$asc+100);
+	$fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
+	//ItalicAngle
+	$ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
+	$fd.=",'ItalicAngle'=>".$ia;
+	//StemV
+	if(isset($fm['StdVW']))
+		$stemv=$fm['StdVW'];
+	elseif(isset($fm['Weight']) && preg_match('/bold|black/i',$fm['Weight']))
+		$stemv=120;
+	else
+		$stemv=70;
+	$fd.=",'StemV'=>".$stemv;
+	//MissingWidth
+	if(isset($fm['MissingWidth']))
+		$fd.=",'MissingWidth'=>".$fm['MissingWidth'];
+	$fd.=')';
+	return $fd;
+}
+
+function MakeWidthArray($fm)
+{
+	//Make character width array
+	$s="array(\n\t";
+	$cw=$fm['Widths'];
+	for($i=0;$i<=255;$i++)
+	{
+		if(chr($i)=="'")
+			$s.="'\\''";
+		elseif(chr($i)=="\\")
+			$s.="'\\\\'";
+		elseif($i>=32 && $i<=126)
+			$s.="'".chr($i)."'";
+		else
+			$s.="chr($i)";
+		$s.='=>'.$fm['Widths'][$i];
+		if($i<255)
+			$s.=',';
+		if(($i+1)%22==0)
+			$s.="\n\t";
+	}
+	$s.=')';
+	return $s;
+}
+
+function MakeFontEncoding($map)
+{
+	//Build differences from reference encoding
+	$ref=ReadMap('cp1252');
+	$s='';
+	$last=0;
+	for($i=32;$i<=255;$i++)
+	{
+		if($map[$i]!=$ref[$i])
+		{
+			if($i!=$last+1)
+				$s.=$i.' ';
+			$last=$i;
+			$s.='/'.$map[$i].' ';
+		}
+	}
+	return rtrim($s);
+}
+
+function SaveToFile($file, $s, $mode)
+{
+	$f=fopen($file,'w'.$mode);
+	if(!$f)
+		die('Can\'t write to file '.$file);
+	fwrite($f,$s,strlen($s));
+	fclose($f);
+}
+
+function ReadShort($f)
+{
+	$a=unpack('n1n',fread($f,2));
+	return $a['n'];
+}
+
+function ReadLong($f)
+{
+	$a=unpack('N1N',fread($f,4));
+	return $a['N'];
+}
+
+function CheckTTF($file)
+{
+	//Check if font license allows embedding
+	$f=fopen($file,'rb');
+	if(!$f)
+		die('<b>Error:</b> Can\'t open '.$file);
+	//Extract number of tables
+	fseek($f,4,SEEK_CUR);
+	$nb=ReadShort($f);
+	fseek($f,6,SEEK_CUR);
+	//Seek OS/2 table
+	$found=false;
+	for($i=0;$i<$nb;$i++)
+	{
+		if(fread($f,4)=='OS/2')
+		{
+			$found=true;
+			break;
+		}
+		fseek($f,12,SEEK_CUR);
+	}
+	if(!$found)
+	{
+		fclose($f);
+		return;
+	}
+	fseek($f,4,SEEK_CUR);
+	$offset=ReadLong($f);
+	fseek($f,$offset,SEEK_SET);
+	//Extract fsType flags
+	fseek($f,8,SEEK_CUR);
+	$fsType=ReadShort($f);
+	$rl=($fsType & 0x02)!=0;
+	$pp=($fsType & 0x04)!=0;
+	$e=($fsType & 0x08)!=0;
+	fclose($f);
+	if($rl && !$pp && !$e)
+		echo '<b>Warning:</b> font license does not allow embedding';
+}
+
+/*******************************************************************************
+* fontfile: path to TTF file (or empty string if not to be embedded)           *
+* afmfile:  path to AFM file                                                   *
+* enc:      font encoding (or empty string for symbolic fonts)                 *
+* patch:    optional patch for encoding                                        *
+* type:     font type if fontfile is empty                                     *
+*******************************************************************************/
+function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='TrueType')
+{
+	//Generate a font definition file
+	if(get_magic_quotes_runtime())
+		@set_magic_quotes_runtime(0);
+	ini_set('auto_detect_line_endings','1');
+	if($enc)
+	{
+		$map=ReadMap($enc);
+		foreach($patch as $cc=>$gn)
+			$map[$cc]=$gn;
+	}
+	else
+		$map=array();
+	if(!file_exists($afmfile))
+		die('<b>Error:</b> AFM file not found: '.$afmfile);
+	$fm=ReadAFM($afmfile,$map);
+	if($enc)
+		$diff=MakeFontEncoding($map);
+	else
+		$diff='';
+	$fd=MakeFontDescriptor($fm,empty($map));
+	//Find font type
+	if($fontfile)
+	{
+		$ext=strtolower(substr($fontfile,-3));
+		if($ext=='ttf')
+			$type='TrueType';
+		elseif($ext=='pfb')
+			$type='Type1';
+		else
+			die('<b>Error:</b> unrecognized font file extension: '.$ext);
+	}
+	else
+	{
+		if($type!='TrueType' && $type!='Type1')
+			die('<b>Error:</b> incorrect font type: '.$type);
+	}
+	//Start generation
+	$s='<?php'."\n";
+	$s.='$type=\''.$type."';\n";
+	$s.='$name=\''.$fm['FontName']."';\n";
+	$s.='$desc='.$fd.";\n";
+	if(!isset($fm['UnderlinePosition']))
+		$fm['UnderlinePosition']=-100;
+	if(!isset($fm['UnderlineThickness']))
+		$fm['UnderlineThickness']=50;
+	$s.='$up='.$fm['UnderlinePosition'].";\n";
+	$s.='$ut='.$fm['UnderlineThickness'].";\n";
+	$w=MakeWidthArray($fm);
+	$s.='$cw='.$w.";\n";
+	$s.='$enc=\''.$enc."';\n";
+	$s.='$diff=\''.$diff."';\n";
+	$basename=substr(basename($afmfile),0,-4);
+	if($fontfile)
+	{
+		//Embedded font
+		if(!file_exists($fontfile))
+			die('<b>Error:</b> font file not found: '.$fontfile);
+		if($type=='TrueType')
+			CheckTTF($fontfile);
+		$f=fopen($fontfile,'rb');
+		if(!$f)
+			die('<b>Error:</b> Can\'t open '.$fontfile);
+		$file=fread($f,filesize($fontfile));
+		fclose($f);
+		if($type=='Type1')
+		{
+			//Find first two sections and discard third one
+			$header=(ord($file[0])==128);
+			if($header)
+			{
+				//Strip first binary header
+				$file=substr($file,6);
+			}
+			$pos=strpos($file,'eexec');
+			if(!$pos)
+				die('<b>Error:</b> font file does not seem to be valid Type1');
+			$size1=$pos+6;
+			if($header && ord($file[$size1])==128)
+			{
+				//Strip second binary header
+				$file=substr($file,0,$size1).substr($file,$size1+6);
+			}
+			$pos=strpos($file,'00000000');
+			if(!$pos)
+				die('<b>Error:</b> font file does not seem to be valid Type1');
+			$size2=$pos-$size1;
+			$file=substr($file,0,$size1+$size2);
+		}
+		if(function_exists('gzcompress'))
+		{
+			$cmp=$basename.'.z';
+			SaveToFile($cmp,gzcompress($file),'b');
+			$s.='$file=\''.$cmp."';\n";
+			echo 'Font file compressed ('.$cmp.')<br>';
+		}
+		else
+		{
+			$s.='$file=\''.basename($fontfile)."';\n";
+			echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>';
+		}
+		if($type=='Type1')
+		{
+			$s.='$size1='.$size1.";\n";
+			$s.='$size2='.$size2.";\n";
+		}
+		else
+			$s.='$originalsize='.filesize($fontfile).";\n";
+	}
+	else
+	{
+		//Not embedded font
+		$s.='$file='."'';\n";
+	}
+	$s.="?>\n";
+	SaveToFile($basename.'.php',$s,'t');
+	echo 'Font definition file generated ('.$basename.'.php'.')<br>';
+}
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/symbol.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/symbol.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/symbol.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['symbol']=array(
-	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
-	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549,
-	','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722,
-	'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768,
-	'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576,
-	'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0,
-	chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
-	chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603,
-	chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768,
-	chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,
-	chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,
-	chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);
-?>
+<?php
+$fpdf_charwidths['symbol']=array(
+	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549,
+	','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722,
+	'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768,
+	'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576,
+	'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0,
+	chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
+	chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603,
+	chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768,
+	chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,
+	chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,
+	chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/times.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/times.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/times.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['times']=array(
-	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
-	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
-	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722,
-	'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944,
-	'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
-	'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
-	chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980,
-	chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333,
-	chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
-	chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
-	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);
-?>
+<?php
+$fpdf_charwidths['times']=array(
+	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
+	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722,
+	'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944,
+	'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
+	'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+	chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980,
+	chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333,
+	chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+	chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
+	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/timesb.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/timesb.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/timesb.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['timesB']=array(
-	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
-	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
-	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722,
-	'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000,
-	'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833,
-	'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
-	chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
-	chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333,
-	chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
-	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
-	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
-?>
+<?php
+$fpdf_charwidths['timesB']=array(
+	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
+	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722,
+	'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000,
+	'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833,
+	'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+	chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+	chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333,
+	chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
+	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/timesbi.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/timesbi.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/timesbi.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['timesBI']=array(
-	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
-	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
-	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667,
-	'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889,
-	'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
-	'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
-	chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
-	chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333,
-	chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
-	chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
-	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);
-?>
+<?php
+$fpdf_charwidths['timesBI']=array(
+	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
+	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667,
+	'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889,
+	'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
+	'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+	chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+	chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333,
+	chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+	chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
+	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/timesi.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/timesi.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/timesi.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['timesI']=array(
-	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
-	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
-	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611,
-	'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833,
-	'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722,
-	'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
-	chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980,
-	chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333,
-	chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611,
-	chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
-	chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
-	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);
-?>
+<?php
+$fpdf_charwidths['timesI']=array(
+	chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+	chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
+	','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611,
+	'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833,
+	'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722,
+	'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+	chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980,
+	chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333,
+	chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611,
+	chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+	chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
+	chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);
+?>

Modified: branches/print_dev/http/extensions/fpdf/font/zapfdingbats.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/font/zapfdingbats.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/font/zapfdingbats.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,15 +1,15 @@
-<?php
-$fpdf_charwidths['zapfdingbats']=array(
-	chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,
-	chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
-	','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692,
-	'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776,
-	'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873,
-	'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
-	chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
-	chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788,
-	chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788,
-	chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
-	chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
-	chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
-?>
+<?php
+$fpdf_charwidths['zapfdingbats']=array(
+	chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,
+	chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
+	','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692,
+	'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776,
+	'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873,
+	'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
+	chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
+	chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788,
+	chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788,
+	chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
+	chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
+	chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
+?>

Modified: branches/print_dev/http/extensions/fpdf/fpdf.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/fpdf.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/fpdf.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,1732 +1,1732 @@
-<?php
-/*******************************************************************************
-* FPDF                                                                         *
-*                                                                              *
-* Version: 1.6                                                                 *
-* Date:    2008-08-03                                                          *
-* Author:  Olivier PLATHEY                                                     *
-*******************************************************************************/
-
-define('FPDF_VERSION','1.6');
-
-class FPDF
-{
-var $page;               //current page number
-var $n;                  //current object number
-var $offsets;            //array of object offsets
-var $buffer;             //buffer holding in-memory PDF
-var $pages;              //array containing pages
-var $state;              //current document state
-var $compress;           //compression flag
-var $k;                  //scale factor (number of points in user unit)
-var $DefOrientation;     //default orientation
-var $CurOrientation;     //current orientation
-var $PageFormats;        //available page formats
-var $DefPageFormat;      //default page format
-var $CurPageFormat;      //current page format
-var $PageSizes;          //array storing non-default page sizes
-var $wPt,$hPt;           //dimensions of current page in points
-var $w,$h;               //dimensions of current page in user unit
-var $lMargin;            //left margin
-var $tMargin;            //top margin
-var $rMargin;            //right margin
-var $bMargin;            //page break margin
-var $cMargin;            //cell margin
-var $x,$y;               //current position in user unit
-var $lasth;              //height of last printed cell
-var $LineWidth;          //line width in user unit
-var $CoreFonts;          //array of standard font names
-var $fonts;              //array of used fonts
-var $FontFiles;          //array of font files
-var $diffs;              //array of encoding differences
-var $FontFamily;         //current font family
-var $FontStyle;          //current font style
-var $underline;          //underlining flag
-var $CurrentFont;        //current font info
-var $FontSizePt;         //current font size in points
-var $FontSize;           //current font size in user unit
-var $DrawColor;          //commands for drawing color
-var $FillColor;          //commands for filling color
-var $TextColor;          //commands for text color
-var $ColorFlag;          //indicates whether fill and text colors are different
-var $ws;                 //word spacing
-var $images;             //array of used images
-var $PageLinks;          //array of links in pages
-var $links;              //array of internal links
-var $AutoPageBreak;      //automatic page breaking
-var $PageBreakTrigger;   //threshold used to trigger page breaks
-var $InHeader;           //flag set when processing header
-var $InFooter;           //flag set when processing footer
-var $ZoomMode;           //zoom display mode
-var $LayoutMode;         //layout display mode
-var $title;              //title
-var $subject;            //subject
-var $author;             //author
-var $keywords;           //keywords
-var $creator;            //creator
-var $AliasNbPages;       //alias for total number of pages
-var $PDFVersion;         //PDF version number
-
-/*******************************************************************************
-*                                                                              *
-*                               Public methods                                 *
-*                                                                              *
-*******************************************************************************/
-function FPDF($orientation='P', $unit='mm', $format='A4')
-{
-	//Some checks
-	$this->_dochecks();
-	//Initialization of properties
-	$this->page=0;
-	$this->n=2;
-	$this->buffer='';
-	$this->pages=array();
-	$this->PageSizes=array();
-	$this->state=0;
-	$this->fonts=array();
-	$this->FontFiles=array();
-	$this->diffs=array();
-	$this->images=array();
-	$this->links=array();
-	$this->InHeader=false;
-	$this->InFooter=false;
-	$this->lasth=0;
-	$this->FontFamily='';
-	$this->FontStyle='';
-	$this->FontSizePt=12;
-	$this->underline=false;
-	$this->DrawColor='0 G';
-	$this->FillColor='0 g';
-	$this->TextColor='0 g';
-	$this->ColorFlag=false;
-	$this->ws=0;
-	//Standard fonts
-	$this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique',
-		'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique',
-		'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic',
-		'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats');
-	//Scale factor
-	if($unit=='pt')
-		$this->k=1;
-	elseif($unit=='mm')
-		$this->k=72/25.4;
-	elseif($unit=='cm')
-		$this->k=72/2.54;
-	elseif($unit=='in')
-		$this->k=72;
-	else
-		$this->Error('Incorrect unit: '.$unit);
-	//Page format
-	$this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
-		'letter'=>array(612,792), 'legal'=>array(612,1008));
-	if(is_string($format))
-		$format=$this->_getpageformat($format);
-	$this->DefPageFormat=$format;
-	$this->CurPageFormat=$format;
-	//Page orientation
-	$orientation=strtolower($orientation);
-	if($orientation=='p' || $orientation=='portrait')
-	{
-		$this->DefOrientation='P';
-		$this->w=$this->DefPageFormat[0];
-		$this->h=$this->DefPageFormat[1];
-	}
-	elseif($orientation=='l' || $orientation=='landscape')
-	{
-		$this->DefOrientation='L';
-		$this->w=$this->DefPageFormat[1];
-		$this->h=$this->DefPageFormat[0];
-	}
-	else
-		$this->Error('Incorrect orientation: '.$orientation);
-	$this->CurOrientation=$this->DefOrientation;
-	$this->wPt=$this->w*$this->k;
-	$this->hPt=$this->h*$this->k;
-	//Page margins (1 cm)
-	$margin=28.35/$this->k;
-	$this->SetMargins($margin,$margin);
-	//Interior cell margin (1 mm)
-	$this->cMargin=$margin/10;
-	//Line width (0.2 mm)
-	$this->LineWidth=.567/$this->k;
-	//Automatic page break
-	$this->SetAutoPageBreak(true,2*$margin);
-	//Full width display mode
-	$this->SetDisplayMode('fullwidth');
-	//Enable compression
-	$this->SetCompression(true);
-	//Set default PDF version number
-	$this->PDFVersion='1.3';
-}
-
-function SetMargins($left, $top, $right=null)
-{
-	//Set left, top and right margins
-	$this->lMargin=$left;
-	$this->tMargin=$top;
-	if($right===null)
-		$right=$left;
-	$this->rMargin=$right;
-}
-
-function SetLeftMargin($margin)
-{
-	//Set left margin
-	$this->lMargin=$margin;
-	if($this->page>0 && $this->x<$margin)
-		$this->x=$margin;
-}
-
-function SetTopMargin($margin)
-{
-	//Set top margin
-	$this->tMargin=$margin;
-}
-
-function SetRightMargin($margin)
-{
-	//Set right margin
-	$this->rMargin=$margin;
-}
-
-function SetAutoPageBreak($auto, $margin=0)
-{
-	//Set auto page break mode and triggering margin
-	$this->AutoPageBreak=$auto;
-	$this->bMargin=$margin;
-	$this->PageBreakTrigger=$this->h-$margin;
-}
-
-function SetDisplayMode($zoom, $layout='continuous')
-{
-	//Set display mode in viewer
-	if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
-		$this->ZoomMode=$zoom;
-	else
-		$this->Error('Incorrect zoom display mode: '.$zoom);
-	if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
-		$this->LayoutMode=$layout;
-	else
-		$this->Error('Incorrect layout display mode: '.$layout);
-}
-
-function SetCompression($compress)
-{
-	//Set page compression
-	if(function_exists('gzcompress'))
-		$this->compress=$compress;
-	else
-		$this->compress=false;
-}
-
-function SetTitle($title, $isUTF8=false)
-{
-	//Title of document
-	if($isUTF8)
-		$title=$this->_UTF8toUTF16($title);
-	$this->title=$title;
-}
-
-function SetSubject($subject, $isUTF8=false)
-{
-	//Subject of document
-	if($isUTF8)
-		$subject=$this->_UTF8toUTF16($subject);
-	$this->subject=$subject;
-}
-
-function SetAuthor($author, $isUTF8=false)
-{
-	//Author of document
-	if($isUTF8)
-		$author=$this->_UTF8toUTF16($author);
-	$this->author=$author;
-}
-
-function SetKeywords($keywords, $isUTF8=false)
-{
-	//Keywords of document
-	if($isUTF8)
-		$keywords=$this->_UTF8toUTF16($keywords);
-	$this->keywords=$keywords;
-}
-
-function SetCreator($creator, $isUTF8=false)
-{
-	//Creator of document
-	if($isUTF8)
-		$creator=$this->_UTF8toUTF16($creator);
-	$this->creator=$creator;
-}
-
-function AliasNbPages($alias='{nb}')
-{
-	//Define an alias for total number of pages
-	$this->AliasNbPages=$alias;
-}
-
-function Error($msg)
-{
-	//Fatal error
-	die('<b>FPDF error:</b> '.$msg);
-}
-
-function Open()
-{
-	//Begin document
-	$this->state=1;
-}
-
-function Close()
-{
-	//Terminate document
-	if($this->state==3)
-		return;
-	if($this->page==0)
-		$this->AddPage();
-	//Page footer
-	$this->InFooter=true;
-	$this->Footer();
-	$this->InFooter=false;
-	//Close page
-	$this->_endpage();
-	//Close document
-	$this->_enddoc();
-}
-
-function AddPage($orientation='', $format='')
-{
-	//Start a new page
-	if($this->state==0)
-		$this->Open();
-	$family=$this->FontFamily;
-	$style=$this->FontStyle.($this->underline ? 'U' : '');
-	$size=$this->FontSizePt;
-	$lw=$this->LineWidth;
-	$dc=$this->DrawColor;
-	$fc=$this->FillColor;
-	$tc=$this->TextColor;
-	$cf=$this->ColorFlag;
-	if($this->page>0)
-	{
-		//Page footer
-		$this->InFooter=true;
-		$this->Footer();
-		$this->InFooter=false;
-		//Close page
-		$this->_endpage();
-	}
-	//Start new page
-	$this->_beginpage($orientation,$format);
-	//Set line cap style to square
-	$this->_out('2 J');
-	//Set line width
-	$this->LineWidth=$lw;
-	$this->_out(sprintf('%.2F w',$lw*$this->k));
-	//Set font
-	if($family)
-		$this->SetFont($family,$style,$size);
-	//Set colors
-	$this->DrawColor=$dc;
-	if($dc!='0 G')
-		$this->_out($dc);
-	$this->FillColor=$fc;
-	if($fc!='0 g')
-		$this->_out($fc);
-	$this->TextColor=$tc;
-	$this->ColorFlag=$cf;
-	//Page header
-	$this->InHeader=true;
-	$this->Header();
-	$this->InHeader=false;
-	//Restore line width
-	if($this->LineWidth!=$lw)
-	{
-		$this->LineWidth=$lw;
-		$this->_out(sprintf('%.2F w',$lw*$this->k));
-	}
-	//Restore font
-	if($family)
-		$this->SetFont($family,$style,$size);
-	//Restore colors
-	if($this->DrawColor!=$dc)
-	{
-		$this->DrawColor=$dc;
-		$this->_out($dc);
-	}
-	if($this->FillColor!=$fc)
-	{
-		$this->FillColor=$fc;
-		$this->_out($fc);
-	}
-	$this->TextColor=$tc;
-	$this->ColorFlag=$cf;
-}
-
-function Header()
-{
-	//To be implemented in your own inherited class
-}
-
-function Footer()
-{
-	//To be implemented in your own inherited class
-}
-
-function PageNo()
-{
-	//Get current page number
-	return $this->page;
-}
-
-function SetDrawColor($r, $g=null, $b=null)
-{
-	//Set color for all stroking operations
-	if(($r==0 && $g==0 && $b==0) || $g===null)
-		$this->DrawColor=sprintf('%.3F G',$r/255);
-	else
-		$this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
-	if($this->page>0)
-		$this->_out($this->DrawColor);
-}
-
-function SetFillColor($r, $g=null, $b=null)
-{
-	//Set color for all filling operations
-	if(($r==0 && $g==0 && $b==0) || $g===null)
-		$this->FillColor=sprintf('%.3F g',$r/255);
-	else
-		$this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
-	$this->ColorFlag=($this->FillColor!=$this->TextColor);
-	if($this->page>0)
-		$this->_out($this->FillColor);
-}
-
-function SetTextColor($r, $g=null, $b=null)
-{
-	//Set color for text
-	if(($r==0 && $g==0 && $b==0) || $g===null)
-		$this->TextColor=sprintf('%.3F g',$r/255);
-	else
-		$this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
-	$this->ColorFlag=($this->FillColor!=$this->TextColor);
-}
-
-function GetStringWidth($s)
-{
-	//Get width of a string in the current font
-	$s=(string)$s;
-	$cw=&$this->CurrentFont['cw'];
-	$w=0;
-	$l=strlen($s);
-	for($i=0;$i<$l;$i++)
-		$w+=$cw[$s[$i]];
-	return $w*$this->FontSize/1000;
-}
-
-function SetLineWidth($width)
-{
-	//Set line width
-	$this->LineWidth=$width;
-	if($this->page>0)
-		$this->_out(sprintf('%.2F w',$width*$this->k));
-}
-
-function Line($x1, $y1, $x2, $y2)
-{
-	//Draw a line
-	$this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
-}
-
-function Rect($x, $y, $w, $h, $style='')
-{
-	//Draw a rectangle
-	if($style=='F')
-		$op='f';
-	elseif($style=='FD' || $style=='DF')
-		$op='B';
-	else
-		$op='S';
-	$this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
-}
-
-function AddFont($family, $style='', $file='')
-{
-	//Add a TrueType or Type1 font
-	$family=strtolower($family);
-	if($file=='')
-		$file=str_replace(' ','',$family).strtolower($style).'.php';
-	if($family=='arial')
-		$family='helvetica';
-	$style=strtoupper($style);
-	if($style=='IB')
-		$style='BI';
-	$fontkey=$family.$style;
-	if(isset($this->fonts[$fontkey]))
-		return;
-	include($this->_getfontpath().$file);
-	if(!isset($name))
-		$this->Error('Could not include font definition file');
-	$i=count($this->fonts)+1;
-	$this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file);
-	if($diff)
-	{
-		//Search existing encodings
-		$d=0;
-		$nb=count($this->diffs);
-		for($i=1;$i<=$nb;$i++)
-		{
-			if($this->diffs[$i]==$diff)
-			{
-				$d=$i;
-				break;
-			}
-		}
-		if($d==0)
-		{
-			$d=$nb+1;
-			$this->diffs[$d]=$diff;
-		}
-		$this->fonts[$fontkey]['diff']=$d;
-	}
-	if($file)
-	{
-		if($type=='TrueType')
-			$this->FontFiles[$file]=array('length1'=>$originalsize);
-		else
-			$this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2);
-	}
-}
-
-function SetFont($family, $style='', $size=0)
-{
-	//Select a font; size given in points
-	global $fpdf_charwidths;
-
-	$family=strtolower($family);
-	if($family=='')
-		$family=$this->FontFamily;
-	if($family=='arial')
-		$family='helvetica';
-	elseif($family=='symbol' || $family=='zapfdingbats')
-		$style='';
-	$style=strtoupper($style);
-	if(strpos($style,'U')!==false)
-	{
-		$this->underline=true;
-		$style=str_replace('U','',$style);
-	}
-	else
-		$this->underline=false;
-	if($style=='IB')
-		$style='BI';
-	if($size==0)
-		$size=$this->FontSizePt;
-	//Test if font is already selected
-	if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
-		return;
-	//Test if used for the first time
-	$fontkey=$family.$style;
-	if(!isset($this->fonts[$fontkey]))
-	{
-		//Check if one of the standard fonts
-		if(isset($this->CoreFonts[$fontkey]))
-		{
-			if(!isset($fpdf_charwidths[$fontkey]))
-			{
-				//Load metric file
-				$file=$family;
-				if($family=='times' || $family=='helvetica')
-					$file.=strtolower($style);
-				include($this->_getfontpath().$file.'.php');
-				if(!isset($fpdf_charwidths[$fontkey]))
-					$this->Error('Could not include font metric file');
-			}
-			$i=count($this->fonts)+1;
-			$name=$this->CoreFonts[$fontkey];
-			$cw=$fpdf_charwidths[$fontkey];
-			$this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw);
-		}
-		else
-			$this->Error('Undefined font: '.$family.' '.$style);
-	}
-	//Select it
-	$this->FontFamily=$family;
-	$this->FontStyle=$style;
-	$this->FontSizePt=$size;
-	$this->FontSize=$size/$this->k;
-	$this->CurrentFont=&$this->fonts[$fontkey];
-	if($this->page>0)
-		$this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
-}
-
-function SetFontSize($size)
-{
-	//Set font size in points
-	if($this->FontSizePt==$size)
-		return;
-	$this->FontSizePt=$size;
-	$this->FontSize=$size/$this->k;
-	if($this->page>0)
-		$this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
-}
-
-function AddLink()
-{
-	//Create a new internal link
-	$n=count($this->links)+1;
-	$this->links[$n]=array(0, 0);
-	return $n;
-}
-
-function SetLink($link, $y=0, $page=-1)
-{
-	//Set destination of internal link
-	if($y==-1)
-		$y=$this->y;
-	if($page==-1)
-		$page=$this->page;
-	$this->links[$link]=array($page, $y);
-}
-
-function Link($x, $y, $w, $h, $link)
-{
-	//Put a link on the page
-	$this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link);
-}
-
-function Text($x, $y, $txt)
-{
-	//Output a string
-	$s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
-	if($this->underline && $txt!='')
-		$s.=' '.$this->_dounderline($x,$y,$txt);
-	if($this->ColorFlag)
-		$s='q '.$this->TextColor.' '.$s.' Q';
-	$this->_out($s);
-}
-
-function AcceptPageBreak()
-{
-	//Accept automatic page break or not
-	return $this->AutoPageBreak;
-}
-
-function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
-{
-	//Output a cell
-	$k=$this->k;
-	if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
-	{
-		//Automatic page break
-		$x=$this->x;
-		$ws=$this->ws;
-		if($ws>0)
-		{
-			$this->ws=0;
-			$this->_out('0 Tw');
-		}
-		$this->AddPage($this->CurOrientation,$this->CurPageFormat);
-		$this->x=$x;
-		if($ws>0)
-		{
-			$this->ws=$ws;
-			$this->_out(sprintf('%.3F Tw',$ws*$k));
-		}
-	}
-	if($w==0)
-		$w=$this->w-$this->rMargin-$this->x;
-	$s='';
-	if($fill || $border==1)
-	{
-		if($fill)
-			$op=($border==1) ? 'B' : 'f';
-		else
-			$op='S';
-		$s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
-	}
-	if(is_string($border))
-	{
-		$x=$this->x;
-		$y=$this->y;
-		if(strpos($border,'L')!==false)
-			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
-		if(strpos($border,'T')!==false)
-			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
-		if(strpos($border,'R')!==false)
-			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
-		if(strpos($border,'B')!==false)
-			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
-	}
-	if($txt!=='')
-	{
-		if($align=='R')
-			$dx=$w-$this->cMargin-$this->GetStringWidth($txt);
-		elseif($align=='C')
-			$dx=($w-$this->GetStringWidth($txt))/2;
-		else
-			$dx=$this->cMargin;
-		if($this->ColorFlag)
-			$s.='q '.$this->TextColor.' ';
-		$txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
-		$s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
-		if($this->underline)
-			$s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
-		if($this->ColorFlag)
-			$s.=' Q';
-		if($link)
-			$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
-	}
-	if($s)
-		$this->_out($s);
-	$this->lasth=$h;
-	if($ln>0)
-	{
-		//Go to next line
-		$this->y+=$h;
-		if($ln==1)
-			$this->x=$this->lMargin;
-	}
-	else
-		$this->x+=$w;
-}
-
-function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false)
-{
-	//Output text with automatic or explicit line breaks
-	$cw=&$this->CurrentFont['cw'];
-	if($w==0)
-		$w=$this->w-$this->rMargin-$this->x;
-	$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
-	$s=str_replace("\r",'',$txt);
-	$nb=strlen($s);
-	if($nb>0 && $s[$nb-1]=="\n")
-		$nb--;
-	$b=0;
-	if($border)
-	{
-		if($border==1)
-		{
-			$border='LTRB';
-			$b='LRT';
-			$b2='LR';
-		}
-		else
-		{
-			$b2='';
-			if(strpos($border,'L')!==false)
-				$b2.='L';
-			if(strpos($border,'R')!==false)
-				$b2.='R';
-			$b=(strpos($border,'T')!==false) ? $b2.'T' : $b2;
-		}
-	}
-	$sep=-1;
-	$i=0;
-	$j=0;
-	$l=0;
-	$ns=0;
-	$nl=1;
-	while($i<$nb)
-	{
-		//Get next character
-		$c=$s[$i];
-		if($c=="\n")
-		{
-			//Explicit line break
-			if($this->ws>0)
-			{
-				$this->ws=0;
-				$this->_out('0 Tw');
-			}
-			$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
-			$i++;
-			$sep=-1;
-			$j=$i;
-			$l=0;
-			$ns=0;
-			$nl++;
-			if($border && $nl==2)
-				$b=$b2;
-			continue;
-		}
-		if($c==' ')
-		{
-			$sep=$i;
-			$ls=$l;
-			$ns++;
-		}
-		$l+=$cw[$c];
-		if($l>$wmax)
-		{
-			//Automatic line break
-			if($sep==-1)
-			{
-				if($i==$j)
-					$i++;
-				if($this->ws>0)
-				{
-					$this->ws=0;
-					$this->_out('0 Tw');
-				}
-				$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
-			}
-			else
-			{
-				if($align=='J')
-				{
-					$this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
-					$this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
-				}
-				$this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
-				$i=$sep+1;
-			}
-			$sep=-1;
-			$j=$i;
-			$l=0;
-			$ns=0;
-			$nl++;
-			if($border && $nl==2)
-				$b=$b2;
-		}
-		else
-			$i++;
-	}
-	//Last chunk
-	if($this->ws>0)
-	{
-		$this->ws=0;
-		$this->_out('0 Tw');
-	}
-	if($border && strpos($border,'B')!==false)
-		$b.='B';
-	$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
-	$this->x=$this->lMargin;
-}
-
-function Write($h, $txt, $link='')
-{
-	//Output text in flowing mode
-	$cw=&$this->CurrentFont['cw'];
-	$w=$this->w-$this->rMargin-$this->x;
-	$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
-	$s=str_replace("\r",'',$txt);
-	$nb=strlen($s);
-	$sep=-1;
-	$i=0;
-	$j=0;
-	$l=0;
-	$nl=1;
-	while($i<$nb)
-	{
-		//Get next character
-		$c=$s[$i];
-		if($c=="\n")
-		{
-			//Explicit line break
-			$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
-			$i++;
-			$sep=-1;
-			$j=$i;
-			$l=0;
-			if($nl==1)
-			{
-				$this->x=$this->lMargin;
-				$w=$this->w-$this->rMargin-$this->x;
-				$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
-			}
-			$nl++;
-			continue;
-		}
-		if($c==' ')
-			$sep=$i;
-		$l+=$cw[$c];
-		if($l>$wmax)
-		{
-			//Automatic line break
-			if($sep==-1)
-			{
-				if($this->x>$this->lMargin)
-				{
-					//Move to next line
-					$this->x=$this->lMargin;
-					$this->y+=$h;
-					$w=$this->w-$this->rMargin-$this->x;
-					$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
-					$i++;
-					$nl++;
-					continue;
-				}
-				if($i==$j)
-					$i++;
-				$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
-			}
-			else
-			{
-				$this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
-				$i=$sep+1;
-			}
-			$sep=-1;
-			$j=$i;
-			$l=0;
-			if($nl==1)
-			{
-				$this->x=$this->lMargin;
-				$w=$this->w-$this->rMargin-$this->x;
-				$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
-			}
-			$nl++;
-		}
-		else
-			$i++;
-	}
-	//Last chunk
-	if($i!=$j)
-		$this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link);
-}
-
-function Ln($h=null)
-{
-	//Line feed; default value is last cell height
-	$this->x=$this->lMargin;
-	if($h===null)
-		$this->y+=$this->lasth;
-	else
-		$this->y+=$h;
-}
-
-function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='')
-{
-	//Put an image on the page
-	if(!isset($this->images[$file]))
-	{
-		//First use of this image, get info
-		if($type=='')
-		{
-			$pos=strrpos($file,'.');
-			if(!$pos)
-				$this->Error('Image file has no extension and no type was specified: '.$file);
-			$type=substr($file,$pos+1);
-		}
-		$type=strtolower($type);
-		if($type=='jpeg')
-			$type='jpg';
-		$mtd='_parse'.$type;
-		if(!method_exists($this,$mtd))
-			$this->Error('Unsupported image type: '.$type);
-		$info=$this->$mtd($file);
-		$info['i']=count($this->images)+1;
-		$this->images[$file]=$info;
-	}
-	else
-		$info=$this->images[$file];
-	//Automatic width and height calculation if needed
-	if($w==0 && $h==0)
-	{
-		//Put image at 72 dpi
-		$w=$info['w']/$this->k;
-		$h=$info['h']/$this->k;
-	}
-	elseif($w==0)
-		$w=$h*$info['w']/$info['h'];
-	elseif($h==0)
-		$h=$w*$info['h']/$info['w'];
-	//Flowing mode
-	if($y===null)
-	{
-		if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
-		{
-			//Automatic page break
-			$x2=$this->x;
-			$this->AddPage($this->CurOrientation,$this->CurPageFormat);
-			$this->x=$x2;
-		}
-		$y=$this->y;
-		$this->y+=$h;
-	}
-	if($x===null)
-		$x=$this->x;
-	$this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
-	if($link)
-		$this->Link($x,$y,$w,$h,$link);
-}
-
-function GetX()
-{
-	//Get x position
-	return $this->x;
-}
-
-function SetX($x)
-{
-	//Set x position
-	if($x>=0)
-		$this->x=$x;
-	else
-		$this->x=$this->w+$x;
-}
-
-function GetY()
-{
-	//Get y position
-	return $this->y;
-}
-
-function SetY($y)
-{
-	//Set y position and reset x
-	$this->x=$this->lMargin;
-	if($y>=0)
-		$this->y=$y;
-	else
-		$this->y=$this->h+$y;
-}
-
-function SetXY($x, $y)
-{
-	//Set x and y positions
-	$this->SetY($y);
-	$this->SetX($x);
-}
-
-function Output($name='', $dest='')
-{
-	//Output PDF to some destination
-	if($this->state<3)
-		$this->Close();
-	$dest=strtoupper($dest);
-	if($dest=='')
-	{
-		if($name=='')
-		{
-			$name='doc.pdf';
-			$dest='I';
-		}
-		else
-			$dest='F';
-	}
-	switch($dest)
-	{
-		case 'I':
-			//Send to standard output
-			if(ob_get_length())
-				$this->Error('Some data has already been output, can\'t send PDF file');
-			if(php_sapi_name()!='cli')
-			{
-				//We send to a browser
-				header('Content-Type: application/pdf');
-				if(headers_sent())
-					$this->Error('Some data has already been output, can\'t send PDF file');
-				header('Content-Length: '.strlen($this->buffer));
-				header('Content-Disposition: inline; filename="'.$name.'"');
-				header('Cache-Control: private, max-age=0, must-revalidate');
-				header('Pragma: public');
-				ini_set('zlib.output_compression','0');
-			}
-			echo $this->buffer;
-			break;
-		case 'D':
-			//Download file
-			if(ob_get_length())
-				$this->Error('Some data has already been output, can\'t send PDF file');
-			header('Content-Type: application/x-download');
-			if(headers_sent())
-				$this->Error('Some data has already been output, can\'t send PDF file');
-			header('Content-Length: '.strlen($this->buffer));
-			header('Content-Disposition: attachment; filename="'.$name.'"');
-			header('Cache-Control: private, max-age=0, must-revalidate');
-			header('Pragma: public');
-			ini_set('zlib.output_compression','0');
-			echo $this->buffer;
-			break;
-		case 'F':
-			//Save to local file
-			$f=fopen($name,'wb');
-			if(!$f)
-				$this->Error('Unable to create output file: '.$name);
-			fwrite($f,$this->buffer,strlen($this->buffer));
-			fclose($f);
-			break;
-		case 'S':
-			//Return as a string
-			return $this->buffer;
-		default:
-			$this->Error('Incorrect output destination: '.$dest);
-	}
-	return '';
-}
-
-/*******************************************************************************
-*                                                                              *
-*                              Protected methods                               *
-*                                                                              *
-*******************************************************************************/
-function _dochecks()
-{
-	//Check availability of %F
-	if(sprintf('%.1F',1.0)!='1.0')
-		$this->Error('This version of PHP is not supported');
-	//Check mbstring overloading
-	if(ini_get('mbstring.func_overload') & 2)
-		$this->Error('mbstring overloading must be disabled');
-	//Disable runtime magic quotes
-	if(get_magic_quotes_runtime())
-		@set_magic_quotes_runtime(0);
-}
-
-function _getpageformat($format)
-{
-	$format=strtolower($format);
-	if(!isset($this->PageFormats[$format]))
-		$this->Error('Unknown page format: '.$format);
-	$a=$this->PageFormats[$format];
-	return array($a[0]/$this->k, $a[1]/$this->k);
-}
-
-function _getfontpath()
-{
-	if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font'))
-		define('FPDF_FONTPATH',dirname(__FILE__).'/font/');
-	return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
-}
-
-function _beginpage($orientation, $format)
-{
-	$this->page++;
-	$this->pages[$this->page]='';
-	$this->state=2;
-	$this->x=$this->lMargin;
-	$this->y=$this->tMargin;
-	$this->FontFamily='';
-	//Check page size
-	if($orientation=='')
-		$orientation=$this->DefOrientation;
-	else
-		$orientation=strtoupper($orientation[0]);
-	if($format=='')
-		$format=$this->DefPageFormat;
-	else
-	{
-		if(is_string($format))
-			$format=$this->_getpageformat($format);
-	}
-	if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1])
-	{
-		//New size
-		if($orientation=='P')
-		{
-			$this->w=$format[0];
-			$this->h=$format[1];
-		}
-		else
-		{
-			$this->w=$format[1];
-			$this->h=$format[0];
-		}
-		$this->wPt=$this->w*$this->k;
-		$this->hPt=$this->h*$this->k;
-		$this->PageBreakTrigger=$this->h-$this->bMargin;
-		$this->CurOrientation=$orientation;
-		$this->CurPageFormat=$format;
-	}
-	if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1])
-		$this->PageSizes[$this->page]=array($this->wPt, $this->hPt);
-}
-
-function _endpage()
-{
-	$this->state=1;
-}
-
-function _escape($s)
-{
-	//Escape special characters in strings
-	$s=str_replace('\\','\\\\',$s);
-	$s=str_replace('(','\\(',$s);
-	$s=str_replace(')','\\)',$s);
-	$s=str_replace("\r",'\\r',$s);
-	return $s;
-}
-
-function _textstring($s)
-{
-	//Format a text string
-	return '('.$this->_escape($s).')';
-}
-
-function _UTF8toUTF16($s)
-{
-	//Convert UTF-8 to UTF-16BE with BOM
-	$res="\xFE\xFF";
-	$nb=strlen($s);
-	$i=0;
-	while($i<$nb)
-	{
-		$c1=ord($s[$i++]);
-		if($c1>=224)
-		{
-			//3-byte character
-			$c2=ord($s[$i++]);
-			$c3=ord($s[$i++]);
-			$res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
-			$res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
-		}
-		elseif($c1>=192)
-		{
-			//2-byte character
-			$c2=ord($s[$i++]);
-			$res.=chr(($c1 & 0x1C)>>2);
-			$res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
-		}
-		else
-		{
-			//Single-byte character
-			$res.="\0".chr($c1);
-		}
-	}
-	return $res;
-}
-
-function _dounderline($x, $y, $txt)
-{
-	//Underline text
-	$up=$this->CurrentFont['up'];
-	$ut=$this->CurrentFont['ut'];
-	$w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
-	return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
-}
-
-function _parsejpg($file)
-{
-	//Extract info from a JPEG file
-	$a=GetImageSize($file);
-	if(!$a)
-		$this->Error('Missing or incorrect image file: '.$file);
-	if($a[2]!=2)
-		$this->Error('Not a JPEG file: '.$file);
-	if(!isset($a['channels']) || $a['channels']==3)
-		$colspace='DeviceRGB';
-	elseif($a['channels']==4)
-		$colspace='DeviceCMYK';
-	else
-		$colspace='DeviceGray';
-	$bpc=isset($a['bits']) ? $a['bits'] : 8;
-	//Read whole file
-	$f=fopen($file,'rb');
-	$data='';
-	while(!feof($f))
-		$data.=fread($f,8192);
-	fclose($f);
-	return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
-}
-
-function _parsepng($file)
-{
-	//Extract info from a PNG file
-	$f=fopen($file,'rb');
-	if(!$f)
-		$this->Error('Can\'t open image file: '.$file);
-	//Check signature
-	if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
-		$this->Error('Not a PNG file: '.$file);
-	//Read header chunk
-	$this->_readstream($f,4);
-	if($this->_readstream($f,4)!='IHDR')
-		$this->Error('Incorrect PNG file: '.$file);
-	$w=$this->_readint($f);
-	$h=$this->_readint($f);
-	$bpc=ord($this->_readstream($f,1));
-	if($bpc>8)
-		$this->Error('16-bit depth not supported: '.$file);
-	$ct=ord($this->_readstream($f,1));
-	if($ct==0)
-		$colspace='DeviceGray';
-	elseif($ct==2)
-		$colspace='DeviceRGB';
-	elseif($ct==3)
-		$colspace='Indexed';
-	else
-		$this->Error('Alpha channel not supported: '.$file);
-	if(ord($this->_readstream($f,1))!=0)
-		$this->Error('Unknown compression method: '.$file);
-	if(ord($this->_readstream($f,1))!=0)
-		$this->Error('Unknown filter method: '.$file);
-	if(ord($this->_readstream($f,1))!=0)
-		$this->Error('Interlacing not supported: '.$file);
-	$this->_readstream($f,4);
-	$parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';
-	//Scan chunks looking for palette, transparency and image data
-	$pal='';
-	$trns='';
-	$data='';
-	do
-	{
-		$n=$this->_readint($f);
-		$type=$this->_readstream($f,4);
-		if($type=='PLTE')
-		{
-			//Read palette
-			$pal=$this->_readstream($f,$n);
-			$this->_readstream($f,4);
-		}
-		elseif($type=='tRNS')
-		{
-			//Read transparency info
-			$t=$this->_readstream($f,$n);
-			if($ct==0)
-				$trns=array(ord(substr($t,1,1)));
-			elseif($ct==2)
-				$trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1)));
-			else
-			{
-				$pos=strpos($t,chr(0));
-				if($pos!==false)
-					$trns=array($pos);
-			}
-			$this->_readstream($f,4);
-		}
-		elseif($type=='IDAT')
-		{
-			//Read image data block
-			$data.=$this->_readstream($f,$n);
-			$this->_readstream($f,4);
-		}
-		elseif($type=='IEND')
-			break;
-		else
-			$this->_readstream($f,$n+4);
-	}
-	while($n);
-	if($colspace=='Indexed' && empty($pal))
-		$this->Error('Missing palette in '.$file);
-	fclose($f);
-	return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
-}
-
-function _readstream($f, $n)
-{
-	//Read n bytes from stream
-	$res='';
-	while($n>0 && !feof($f))
-	{
-		$s=fread($f,$n);
-		if($s===false)
-			$this->Error('Error while reading stream');
-		$n-=strlen($s);
-		$res.=$s;
-	}
-	if($n>0)
-		$this->Error('Unexpected end of stream');
-	return $res;
-}
-
-function _readint($f)
-{
-	//Read a 4-byte integer from stream
-	$a=unpack('Ni',$this->_readstream($f,4));
-	return $a['i'];
-}
-
-function _parsegif($file)
-{
-	//Extract info from a GIF file (via PNG conversion)
-	if(!function_exists('imagepng'))
-		$this->Error('GD extension is required for GIF support');
-	if(!function_exists('imagecreatefromgif'))
-		$this->Error('GD has no GIF read support');
-	$im=imagecreatefromgif($file);
-	if(!$im)
-		$this->Error('Missing or incorrect image file: '.$file);
-	imageinterlace($im,0);
-	$tmp=tempnam('.','gif');
-	if(!$tmp)
-		$this->Error('Unable to create a temporary file');
-	if(!imagepng($im,$tmp))
-		$this->Error('Error while saving to temporary file');
-	imagedestroy($im);
-	$info=$this->_parsepng($tmp);
-	unlink($tmp);
-	return $info;
-}
-
-function _newobj()
-{
-	//Begin a new object
-	$this->n++;
-	$this->offsets[$this->n]=strlen($this->buffer);
-	$this->_out($this->n.' 0 obj');
-}
-
-function _putstream($s)
-{
-	$this->_out('stream');
-	$this->_out($s);
-	$this->_out('endstream');
-}
-
-function _out($s)
-{
-	//Add a line to the document
-	if($this->state==2)
-		$this->pages[$this->page].=$s."\n";
-	else
-		$this->buffer.=$s."\n";
-}
-
-function _putpages()
-{
-	$nb=$this->page;
-	if(!empty($this->AliasNbPages))
-	{
-		//Replace number of pages
-		for($n=1;$n<=$nb;$n++)
-			$this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]);
-	}
-	if($this->DefOrientation=='P')
-	{
-		$wPt=$this->DefPageFormat[0]*$this->k;
-		$hPt=$this->DefPageFormat[1]*$this->k;
-	}
-	else
-	{
-		$wPt=$this->DefPageFormat[1]*$this->k;
-		$hPt=$this->DefPageFormat[0]*$this->k;
-	}
-	$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
-	for($n=1;$n<=$nb;$n++)
-	{
-		//Page
-		$this->_newobj();
-		$this->_out('<</Type /Page');
-		$this->_out('/Parent 1 0 R');
-		if(isset($this->PageSizes[$n]))
-			$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1]));
-		$this->_out('/Resources 2 0 R');
-		if(isset($this->PageLinks[$n]))
-		{
-			//Links
-			$annots='/Annots [';
-			foreach($this->PageLinks[$n] as $pl)
-			{
-				$rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
-				$annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
-				if(is_string($pl[4]))
-					$annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
-				else
-				{
-					$l=$this->links[$pl[4]];
-					$h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
-					$annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k);
-				}
-			}
-			$this->_out($annots.']');
-		}
-		$this->_out('/Contents '.($this->n+1).' 0 R>>');
-		$this->_out('endobj');
-		//Page content
-		$p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
-		$this->_newobj();
-		$this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
-		$this->_putstream($p);
-		$this->_out('endobj');
-	}
-	//Pages root
-	$this->offsets[1]=strlen($this->buffer);
-	$this->_out('1 0 obj');
-	$this->_out('<</Type /Pages');
-	$kids='/Kids [';
-	for($i=0;$i<$nb;$i++)
-		$kids.=(3+2*$i).' 0 R ';
-	$this->_out($kids.']');
-	$this->_out('/Count '.$nb);
-	$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt));
-	$this->_out('>>');
-	$this->_out('endobj');
-}
-
-function _putfonts()
-{
-	$nf=$this->n;
-	foreach($this->diffs as $diff)
-	{
-		//Encodings
-		$this->_newobj();
-		$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
-		$this->_out('endobj');
-	}
-	foreach($this->FontFiles as $file=>$info)
-	{
-		//Font file embedding
-		$this->_newobj();
-		$this->FontFiles[$file]['n']=$this->n;
-		$font='';
-		$f=fopen($this->_getfontpath().$file,'rb',1);
-		if(!$f)
-			$this->Error('Font file not found');
-		while(!feof($f))
-			$font.=fread($f,8192);
-		fclose($f);
-		$compressed=(substr($file,-2)=='.z');
-		if(!$compressed && isset($info['length2']))
-		{
-			$header=(ord($font[0])==128);
-			if($header)
-			{
-				//Strip first binary header
-				$font=substr($font,6);
-			}
-			if($header && ord($font[$info['length1']])==128)
-			{
-				//Strip second binary header
-				$font=substr($font,0,$info['length1']).substr($font,$info['length1']+6);
-			}
-		}
-		$this->_out('<</Length '.strlen($font));
-		if($compressed)
-			$this->_out('/Filter /FlateDecode');
-		$this->_out('/Length1 '.$info['length1']);
-		if(isset($info['length2']))
-			$this->_out('/Length2 '.$info['length2'].' /Length3 0');
-		$this->_out('>>');
-		$this->_putstream($font);
-		$this->_out('endobj');
-	}
-	foreach($this->fonts as $k=>$font)
-	{
-		//Font objects
-		$this->fonts[$k]['n']=$this->n+1;
-		$type=$font['type'];
-		$name=$font['name'];
-		if($type=='core')
-		{
-			//Standard font
-			$this->_newobj();
-			$this->_out('<</Type /Font');
-			$this->_out('/BaseFont /'.$name);
-			$this->_out('/Subtype /Type1');
-			if($name!='Symbol' && $name!='ZapfDingbats')
-				$this->_out('/Encoding /WinAnsiEncoding');
-			$this->_out('>>');
-			$this->_out('endobj');
-		}
-		elseif($type=='Type1' || $type=='TrueType')
-		{
-			//Additional Type1 or TrueType font
-			$this->_newobj();
-			$this->_out('<</Type /Font');
-			$this->_out('/BaseFont /'.$name);
-			$this->_out('/Subtype /'.$type);
-			$this->_out('/FirstChar 32 /LastChar 255');
-			$this->_out('/Widths '.($this->n+1).' 0 R');
-			$this->_out('/FontDescriptor '.($this->n+2).' 0 R');
-			if($font['enc'])
-			{
-				if(isset($font['diff']))
-					$this->_out('/Encoding '.($nf+$font['diff']).' 0 R');
-				else
-					$this->_out('/Encoding /WinAnsiEncoding');
-			}
-			$this->_out('>>');
-			$this->_out('endobj');
-			//Widths
-			$this->_newobj();
-			$cw=&$font['cw'];
-			$s='[';
-			for($i=32;$i<=255;$i++)
-				$s.=$cw[chr($i)].' ';
-			$this->_out($s.']');
-			$this->_out('endobj');
-			//Descriptor
-			$this->_newobj();
-			$s='<</Type /FontDescriptor /FontName /'.$name;
-			foreach($font['desc'] as $k=>$v)
-				$s.=' /'.$k.' '.$v;
-			$file=$font['file'];
-			if($file)
-				$s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';
-			$this->_out($s.'>>');
-			$this->_out('endobj');
-		}
-		else
-		{
-			//Allow for additional types
-			$mtd='_put'.strtolower($type);
-			if(!method_exists($this,$mtd))
-				$this->Error('Unsupported font type: '.$type);
-			$this->$mtd($font);
-		}
-	}
-}
-
-function _putimages()
-{
-	$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
-	reset($this->images);
-	while(list($file,$info)=each($this->images))
-	{
-		$this->_newobj();
-		$this->images[$file]['n']=$this->n;
-		$this->_out('<</Type /XObject');
-		$this->_out('/Subtype /Image');
-		$this->_out('/Width '.$info['w']);
-		$this->_out('/Height '.$info['h']);
-		if($info['cs']=='Indexed')
-			$this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
-		else
-		{
-			$this->_out('/ColorSpace /'.$info['cs']);
-			if($info['cs']=='DeviceCMYK')
-				$this->_out('/Decode [1 0 1 0 1 0 1 0]');
-		}
-		$this->_out('/BitsPerComponent '.$info['bpc']);
-		if(isset($info['f']))
-			$this->_out('/Filter /'.$info['f']);
-		if(isset($info['parms']))
-			$this->_out($info['parms']);
-		if(isset($info['trns']) && is_array($info['trns']))
-		{
-			$trns='';
-			for($i=0;$i<count($info['trns']);$i++)
-				$trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
-			$this->_out('/Mask ['.$trns.']');
-		}
-		$this->_out('/Length '.strlen($info['data']).'>>');
-		$this->_putstream($info['data']);
-		unset($this->images[$file]['data']);
-		$this->_out('endobj');
-		//Palette
-		if($info['cs']=='Indexed')
-		{
-			$this->_newobj();
-			$pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
-			$this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
-			$this->_putstream($pal);
-			$this->_out('endobj');
-		}
-	}
-}
-
-function _putxobjectdict()
-{
-	foreach($this->images as $image)
-		$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
-}
-
-function _putresourcedict()
-{
-	$this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
-	$this->_out('/Font <<');
-	foreach($this->fonts as $font)
-		$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
-	$this->_out('>>');
-	$this->_out('/XObject <<');
-	$this->_putxobjectdict();
-	$this->_out('>>');
-}
-
-function _putresources()
-{
-	$this->_putfonts();
-	$this->_putimages();
-	//Resource dictionary
-	$this->offsets[2]=strlen($this->buffer);
-	$this->_out('2 0 obj');
-	$this->_out('<<');
-	$this->_putresourcedict();
-	$this->_out('>>');
-	$this->_out('endobj');
-}
-
-function _putinfo()
-{
-	$this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
-	if(!empty($this->title))
-		$this->_out('/Title '.$this->_textstring($this->title));
-	if(!empty($this->subject))
-		$this->_out('/Subject '.$this->_textstring($this->subject));
-	if(!empty($this->author))
-		$this->_out('/Author '.$this->_textstring($this->author));
-	if(!empty($this->keywords))
-		$this->_out('/Keywords '.$this->_textstring($this->keywords));
-	if(!empty($this->creator))
-		$this->_out('/Creator '.$this->_textstring($this->creator));
-	$this->_out('/CreationDate '.$this->_textstring('D:'. at date('YmdHis')));
-}
-
-function _putcatalog()
-{
-	$this->_out('/Type /Catalog');
-	$this->_out('/Pages 1 0 R');
-	if($this->ZoomMode=='fullpage')
-		$this->_out('/OpenAction [3 0 R /Fit]');
-	elseif($this->ZoomMode=='fullwidth')
-		$this->_out('/OpenAction [3 0 R /FitH null]');
-	elseif($this->ZoomMode=='real')
-		$this->_out('/OpenAction [3 0 R /XYZ null null 1]');
-	elseif(!is_string($this->ZoomMode))
-		$this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']');
-	if($this->LayoutMode=='single')
-		$this->_out('/PageLayout /SinglePage');
-	elseif($this->LayoutMode=='continuous')
-		$this->_out('/PageLayout /OneColumn');
-	elseif($this->LayoutMode=='two')
-		$this->_out('/PageLayout /TwoColumnLeft');
-}
-
-function _putheader()
-{
-	$this->_out('%PDF-'.$this->PDFVersion);
-}
-
-function _puttrailer()
-{
-	$this->_out('/Size '.($this->n+1));
-	$this->_out('/Root '.$this->n.' 0 R');
-	$this->_out('/Info '.($this->n-1).' 0 R');
-}
-
-function _enddoc()
-{
-	$this->_putheader();
-	$this->_putpages();
-	$this->_putresources();
-	//Info
-	$this->_newobj();
-	$this->_out('<<');
-	$this->_putinfo();
-	$this->_out('>>');
-	$this->_out('endobj');
-	//Catalog
-	$this->_newobj();
-	$this->_out('<<');
-	$this->_putcatalog();
-	$this->_out('>>');
-	$this->_out('endobj');
-	//Cross-ref
-	$o=strlen($this->buffer);
-	$this->_out('xref');
-	$this->_out('0 '.($this->n+1));
-	$this->_out('0000000000 65535 f ');
-	for($i=1;$i<=$this->n;$i++)
-		$this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
-	//Trailer
-	$this->_out('trailer');
-	$this->_out('<<');
-	$this->_puttrailer();
-	$this->_out('>>');
-	$this->_out('startxref');
-	$this->_out($o);
-	$this->_out('%%EOF');
-	$this->state=3;
-}
-//End of class
-}
-
-//Handle special IE contype request
-if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype')
-{
-	header('Content-Type: application/pdf');
-	exit;
-}
-
-?>
+<?php
+/*******************************************************************************
+* FPDF                                                                         *
+*                                                                              *
+* Version: 1.6                                                                 *
+* Date:    2008-08-03                                                          *
+* Author:  Olivier PLATHEY                                                     *
+*******************************************************************************/
+
+define('FPDF_VERSION','1.6');
+
+class FPDF
+{
+var $page;               //current page number
+var $n;                  //current object number
+var $offsets;            //array of object offsets
+var $buffer;             //buffer holding in-memory PDF
+var $pages;              //array containing pages
+var $state;              //current document state
+var $compress;           //compression flag
+var $k;                  //scale factor (number of points in user unit)
+var $DefOrientation;     //default orientation
+var $CurOrientation;     //current orientation
+var $PageFormats;        //available page formats
+var $DefPageFormat;      //default page format
+var $CurPageFormat;      //current page format
+var $PageSizes;          //array storing non-default page sizes
+var $wPt,$hPt;           //dimensions of current page in points
+var $w,$h;               //dimensions of current page in user unit
+var $lMargin;            //left margin
+var $tMargin;            //top margin
+var $rMargin;            //right margin
+var $bMargin;            //page break margin
+var $cMargin;            //cell margin
+var $x,$y;               //current position in user unit
+var $lasth;              //height of last printed cell
+var $LineWidth;          //line width in user unit
+var $CoreFonts;          //array of standard font names
+var $fonts;              //array of used fonts
+var $FontFiles;          //array of font files
+var $diffs;              //array of encoding differences
+var $FontFamily;         //current font family
+var $FontStyle;          //current font style
+var $underline;          //underlining flag
+var $CurrentFont;        //current font info
+var $FontSizePt;         //current font size in points
+var $FontSize;           //current font size in user unit
+var $DrawColor;          //commands for drawing color
+var $FillColor;          //commands for filling color
+var $TextColor;          //commands for text color
+var $ColorFlag;          //indicates whether fill and text colors are different
+var $ws;                 //word spacing
+var $images;             //array of used images
+var $PageLinks;          //array of links in pages
+var $links;              //array of internal links
+var $AutoPageBreak;      //automatic page breaking
+var $PageBreakTrigger;   //threshold used to trigger page breaks
+var $InHeader;           //flag set when processing header
+var $InFooter;           //flag set when processing footer
+var $ZoomMode;           //zoom display mode
+var $LayoutMode;         //layout display mode
+var $title;              //title
+var $subject;            //subject
+var $author;             //author
+var $keywords;           //keywords
+var $creator;            //creator
+var $AliasNbPages;       //alias for total number of pages
+var $PDFVersion;         //PDF version number
+
+/*******************************************************************************
+*                                                                              *
+*                               Public methods                                 *
+*                                                                              *
+*******************************************************************************/
+function FPDF($orientation='P', $unit='mm', $format='A4')
+{
+	//Some checks
+	$this->_dochecks();
+	//Initialization of properties
+	$this->page=0;
+	$this->n=2;
+	$this->buffer='';
+	$this->pages=array();
+	$this->PageSizes=array();
+	$this->state=0;
+	$this->fonts=array();
+	$this->FontFiles=array();
+	$this->diffs=array();
+	$this->images=array();
+	$this->links=array();
+	$this->InHeader=false;
+	$this->InFooter=false;
+	$this->lasth=0;
+	$this->FontFamily='';
+	$this->FontStyle='';
+	$this->FontSizePt=12;
+	$this->underline=false;
+	$this->DrawColor='0 G';
+	$this->FillColor='0 g';
+	$this->TextColor='0 g';
+	$this->ColorFlag=false;
+	$this->ws=0;
+	//Standard fonts
+	$this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique',
+		'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique',
+		'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic',
+		'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats');
+	//Scale factor
+	if($unit=='pt')
+		$this->k=1;
+	elseif($unit=='mm')
+		$this->k=72/25.4;
+	elseif($unit=='cm')
+		$this->k=72/2.54;
+	elseif($unit=='in')
+		$this->k=72;
+	else
+		$this->Error('Incorrect unit: '.$unit);
+	//Page format
+	$this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
+		'letter'=>array(612,792), 'legal'=>array(612,1008));
+	if(is_string($format))
+		$format=$this->_getpageformat($format);
+	$this->DefPageFormat=$format;
+	$this->CurPageFormat=$format;
+	//Page orientation
+	$orientation=strtolower($orientation);
+	if($orientation=='p' || $orientation=='portrait')
+	{
+		$this->DefOrientation='P';
+		$this->w=$this->DefPageFormat[0];
+		$this->h=$this->DefPageFormat[1];
+	}
+	elseif($orientation=='l' || $orientation=='landscape')
+	{
+		$this->DefOrientation='L';
+		$this->w=$this->DefPageFormat[1];
+		$this->h=$this->DefPageFormat[0];
+	}
+	else
+		$this->Error('Incorrect orientation: '.$orientation);
+	$this->CurOrientation=$this->DefOrientation;
+	$this->wPt=$this->w*$this->k;
+	$this->hPt=$this->h*$this->k;
+	//Page margins (1 cm)
+	$margin=28.35/$this->k;
+	$this->SetMargins($margin,$margin);
+	//Interior cell margin (1 mm)
+	$this->cMargin=$margin/10;
+	//Line width (0.2 mm)
+	$this->LineWidth=.567/$this->k;
+	//Automatic page break
+	$this->SetAutoPageBreak(true,2*$margin);
+	//Full width display mode
+	$this->SetDisplayMode('fullwidth');
+	//Enable compression
+	$this->SetCompression(true);
+	//Set default PDF version number
+	$this->PDFVersion='1.3';
+}
+
+function SetMargins($left, $top, $right=null)
+{
+	//Set left, top and right margins
+	$this->lMargin=$left;
+	$this->tMargin=$top;
+	if($right===null)
+		$right=$left;
+	$this->rMargin=$right;
+}
+
+function SetLeftMargin($margin)
+{
+	//Set left margin
+	$this->lMargin=$margin;
+	if($this->page>0 && $this->x<$margin)
+		$this->x=$margin;
+}
+
+function SetTopMargin($margin)
+{
+	//Set top margin
+	$this->tMargin=$margin;
+}
+
+function SetRightMargin($margin)
+{
+	//Set right margin
+	$this->rMargin=$margin;
+}
+
+function SetAutoPageBreak($auto, $margin=0)
+{
+	//Set auto page break mode and triggering margin
+	$this->AutoPageBreak=$auto;
+	$this->bMargin=$margin;
+	$this->PageBreakTrigger=$this->h-$margin;
+}
+
+function SetDisplayMode($zoom, $layout='continuous')
+{
+	//Set display mode in viewer
+	if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
+		$this->ZoomMode=$zoom;
+	else
+		$this->Error('Incorrect zoom display mode: '.$zoom);
+	if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
+		$this->LayoutMode=$layout;
+	else
+		$this->Error('Incorrect layout display mode: '.$layout);
+}
+
+function SetCompression($compress)
+{
+	//Set page compression
+	if(function_exists('gzcompress'))
+		$this->compress=$compress;
+	else
+		$this->compress=false;
+}
+
+function SetTitle($title, $isUTF8=false)
+{
+	//Title of document
+	if($isUTF8)
+		$title=$this->_UTF8toUTF16($title);
+	$this->title=$title;
+}
+
+function SetSubject($subject, $isUTF8=false)
+{
+	//Subject of document
+	if($isUTF8)
+		$subject=$this->_UTF8toUTF16($subject);
+	$this->subject=$subject;
+}
+
+function SetAuthor($author, $isUTF8=false)
+{
+	//Author of document
+	if($isUTF8)
+		$author=$this->_UTF8toUTF16($author);
+	$this->author=$author;
+}
+
+function SetKeywords($keywords, $isUTF8=false)
+{
+	//Keywords of document
+	if($isUTF8)
+		$keywords=$this->_UTF8toUTF16($keywords);
+	$this->keywords=$keywords;
+}
+
+function SetCreator($creator, $isUTF8=false)
+{
+	//Creator of document
+	if($isUTF8)
+		$creator=$this->_UTF8toUTF16($creator);
+	$this->creator=$creator;
+}
+
+function AliasNbPages($alias='{nb}')
+{
+	//Define an alias for total number of pages
+	$this->AliasNbPages=$alias;
+}
+
+function Error($msg)
+{
+	//Fatal error
+	die('<b>FPDF error:</b> '.$msg);
+}
+
+function Open()
+{
+	//Begin document
+	$this->state=1;
+}
+
+function Close()
+{
+	//Terminate document
+	if($this->state==3)
+		return;
+	if($this->page==0)
+		$this->AddPage();
+	//Page footer
+	$this->InFooter=true;
+	$this->Footer();
+	$this->InFooter=false;
+	//Close page
+	$this->_endpage();
+	//Close document
+	$this->_enddoc();
+}
+
+function AddPage($orientation='', $format='')
+{
+	//Start a new page
+	if($this->state==0)
+		$this->Open();
+	$family=$this->FontFamily;
+	$style=$this->FontStyle.($this->underline ? 'U' : '');
+	$size=$this->FontSizePt;
+	$lw=$this->LineWidth;
+	$dc=$this->DrawColor;
+	$fc=$this->FillColor;
+	$tc=$this->TextColor;
+	$cf=$this->ColorFlag;
+	if($this->page>0)
+	{
+		//Page footer
+		$this->InFooter=true;
+		$this->Footer();
+		$this->InFooter=false;
+		//Close page
+		$this->_endpage();
+	}
+	//Start new page
+	$this->_beginpage($orientation,$format);
+	//Set line cap style to square
+	$this->_out('2 J');
+	//Set line width
+	$this->LineWidth=$lw;
+	$this->_out(sprintf('%.2F w',$lw*$this->k));
+	//Set font
+	if($family)
+		$this->SetFont($family,$style,$size);
+	//Set colors
+	$this->DrawColor=$dc;
+	if($dc!='0 G')
+		$this->_out($dc);
+	$this->FillColor=$fc;
+	if($fc!='0 g')
+		$this->_out($fc);
+	$this->TextColor=$tc;
+	$this->ColorFlag=$cf;
+	//Page header
+	$this->InHeader=true;
+	$this->Header();
+	$this->InHeader=false;
+	//Restore line width
+	if($this->LineWidth!=$lw)
+	{
+		$this->LineWidth=$lw;
+		$this->_out(sprintf('%.2F w',$lw*$this->k));
+	}
+	//Restore font
+	if($family)
+		$this->SetFont($family,$style,$size);
+	//Restore colors
+	if($this->DrawColor!=$dc)
+	{
+		$this->DrawColor=$dc;
+		$this->_out($dc);
+	}
+	if($this->FillColor!=$fc)
+	{
+		$this->FillColor=$fc;
+		$this->_out($fc);
+	}
+	$this->TextColor=$tc;
+	$this->ColorFlag=$cf;
+}
+
+function Header()
+{
+	//To be implemented in your own inherited class
+}
+
+function Footer()
+{
+	//To be implemented in your own inherited class
+}
+
+function PageNo()
+{
+	//Get current page number
+	return $this->page;
+}
+
+function SetDrawColor($r, $g=null, $b=null)
+{
+	//Set color for all stroking operations
+	if(($r==0 && $g==0 && $b==0) || $g===null)
+		$this->DrawColor=sprintf('%.3F G',$r/255);
+	else
+		$this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
+	if($this->page>0)
+		$this->_out($this->DrawColor);
+}
+
+function SetFillColor($r, $g=null, $b=null)
+{
+	//Set color for all filling operations
+	if(($r==0 && $g==0 && $b==0) || $g===null)
+		$this->FillColor=sprintf('%.3F g',$r/255);
+	else
+		$this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
+	$this->ColorFlag=($this->FillColor!=$this->TextColor);
+	if($this->page>0)
+		$this->_out($this->FillColor);
+}
+
+function SetTextColor($r, $g=null, $b=null)
+{
+	//Set color for text
+	if(($r==0 && $g==0 && $b==0) || $g===null)
+		$this->TextColor=sprintf('%.3F g',$r/255);
+	else
+		$this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
+	$this->ColorFlag=($this->FillColor!=$this->TextColor);
+}
+
+function GetStringWidth($s)
+{
+	//Get width of a string in the current font
+	$s=(string)$s;
+	$cw=&$this->CurrentFont['cw'];
+	$w=0;
+	$l=strlen($s);
+	for($i=0;$i<$l;$i++)
+		$w+=$cw[$s[$i]];
+	return $w*$this->FontSize/1000;
+}
+
+function SetLineWidth($width)
+{
+	//Set line width
+	$this->LineWidth=$width;
+	if($this->page>0)
+		$this->_out(sprintf('%.2F w',$width*$this->k));
+}
+
+function Line($x1, $y1, $x2, $y2)
+{
+	//Draw a line
+	$this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
+}
+
+function Rect($x, $y, $w, $h, $style='')
+{
+	//Draw a rectangle
+	if($style=='F')
+		$op='f';
+	elseif($style=='FD' || $style=='DF')
+		$op='B';
+	else
+		$op='S';
+	$this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
+}
+
+function AddFont($family, $style='', $file='')
+{
+	//Add a TrueType or Type1 font
+	$family=strtolower($family);
+	if($file=='')
+		$file=str_replace(' ','',$family).strtolower($style).'.php';
+	if($family=='arial')
+		$family='helvetica';
+	$style=strtoupper($style);
+	if($style=='IB')
+		$style='BI';
+	$fontkey=$family.$style;
+	if(isset($this->fonts[$fontkey]))
+		return;
+	include($this->_getfontpath().$file);
+	if(!isset($name))
+		$this->Error('Could not include font definition file');
+	$i=count($this->fonts)+1;
+	$this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file);
+	if($diff)
+	{
+		//Search existing encodings
+		$d=0;
+		$nb=count($this->diffs);
+		for($i=1;$i<=$nb;$i++)
+		{
+			if($this->diffs[$i]==$diff)
+			{
+				$d=$i;
+				break;
+			}
+		}
+		if($d==0)
+		{
+			$d=$nb+1;
+			$this->diffs[$d]=$diff;
+		}
+		$this->fonts[$fontkey]['diff']=$d;
+	}
+	if($file)
+	{
+		if($type=='TrueType')
+			$this->FontFiles[$file]=array('length1'=>$originalsize);
+		else
+			$this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2);
+	}
+}
+
+function SetFont($family, $style='', $size=0)
+{
+	//Select a font; size given in points
+	global $fpdf_charwidths;
+
+	$family=strtolower($family);
+	if($family=='')
+		$family=$this->FontFamily;
+	if($family=='arial')
+		$family='helvetica';
+	elseif($family=='symbol' || $family=='zapfdingbats')
+		$style='';
+	$style=strtoupper($style);
+	if(strpos($style,'U')!==false)
+	{
+		$this->underline=true;
+		$style=str_replace('U','',$style);
+	}
+	else
+		$this->underline=false;
+	if($style=='IB')
+		$style='BI';
+	if($size==0)
+		$size=$this->FontSizePt;
+	//Test if font is already selected
+	if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
+		return;
+	//Test if used for the first time
+	$fontkey=$family.$style;
+	if(!isset($this->fonts[$fontkey]))
+	{
+		//Check if one of the standard fonts
+		if(isset($this->CoreFonts[$fontkey]))
+		{
+			if(!isset($fpdf_charwidths[$fontkey]))
+			{
+				//Load metric file
+				$file=$family;
+				if($family=='times' || $family=='helvetica')
+					$file.=strtolower($style);
+				include($this->_getfontpath().$file.'.php');
+				if(!isset($fpdf_charwidths[$fontkey]))
+					$this->Error('Could not include font metric file');
+			}
+			$i=count($this->fonts)+1;
+			$name=$this->CoreFonts[$fontkey];
+			$cw=$fpdf_charwidths[$fontkey];
+			$this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw);
+		}
+		else
+			$this->Error('Undefined font: '.$family.' '.$style);
+	}
+	//Select it
+	$this->FontFamily=$family;
+	$this->FontStyle=$style;
+	$this->FontSizePt=$size;
+	$this->FontSize=$size/$this->k;
+	$this->CurrentFont=&$this->fonts[$fontkey];
+	if($this->page>0)
+		$this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
+}
+
+function SetFontSize($size)
+{
+	//Set font size in points
+	if($this->FontSizePt==$size)
+		return;
+	$this->FontSizePt=$size;
+	$this->FontSize=$size/$this->k;
+	if($this->page>0)
+		$this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
+}
+
+function AddLink()
+{
+	//Create a new internal link
+	$n=count($this->links)+1;
+	$this->links[$n]=array(0, 0);
+	return $n;
+}
+
+function SetLink($link, $y=0, $page=-1)
+{
+	//Set destination of internal link
+	if($y==-1)
+		$y=$this->y;
+	if($page==-1)
+		$page=$this->page;
+	$this->links[$link]=array($page, $y);
+}
+
+function Link($x, $y, $w, $h, $link)
+{
+	//Put a link on the page
+	$this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link);
+}
+
+function Text($x, $y, $txt)
+{
+	//Output a string
+	$s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
+	if($this->underline && $txt!='')
+		$s.=' '.$this->_dounderline($x,$y,$txt);
+	if($this->ColorFlag)
+		$s='q '.$this->TextColor.' '.$s.' Q';
+	$this->_out($s);
+}
+
+function AcceptPageBreak()
+{
+	//Accept automatic page break or not
+	return $this->AutoPageBreak;
+}
+
+function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
+{
+	//Output a cell
+	$k=$this->k;
+	if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
+	{
+		//Automatic page break
+		$x=$this->x;
+		$ws=$this->ws;
+		if($ws>0)
+		{
+			$this->ws=0;
+			$this->_out('0 Tw');
+		}
+		$this->AddPage($this->CurOrientation,$this->CurPageFormat);
+		$this->x=$x;
+		if($ws>0)
+		{
+			$this->ws=$ws;
+			$this->_out(sprintf('%.3F Tw',$ws*$k));
+		}
+	}
+	if($w==0)
+		$w=$this->w-$this->rMargin-$this->x;
+	$s='';
+	if($fill || $border==1)
+	{
+		if($fill)
+			$op=($border==1) ? 'B' : 'f';
+		else
+			$op='S';
+		$s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
+	}
+	if(is_string($border))
+	{
+		$x=$this->x;
+		$y=$this->y;
+		if(strpos($border,'L')!==false)
+			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
+		if(strpos($border,'T')!==false)
+			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
+		if(strpos($border,'R')!==false)
+			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+		if(strpos($border,'B')!==false)
+			$s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+	}
+	if($txt!=='')
+	{
+		if($align=='R')
+			$dx=$w-$this->cMargin-$this->GetStringWidth($txt);
+		elseif($align=='C')
+			$dx=($w-$this->GetStringWidth($txt))/2;
+		else
+			$dx=$this->cMargin;
+		if($this->ColorFlag)
+			$s.='q '.$this->TextColor.' ';
+		$txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
+		$s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
+		if($this->underline)
+			$s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
+		if($this->ColorFlag)
+			$s.=' Q';
+		if($link)
+			$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
+	}
+	if($s)
+		$this->_out($s);
+	$this->lasth=$h;
+	if($ln>0)
+	{
+		//Go to next line
+		$this->y+=$h;
+		if($ln==1)
+			$this->x=$this->lMargin;
+	}
+	else
+		$this->x+=$w;
+}
+
+function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false)
+{
+	//Output text with automatic or explicit line breaks
+	$cw=&$this->CurrentFont['cw'];
+	if($w==0)
+		$w=$this->w-$this->rMargin-$this->x;
+	$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+	$s=str_replace("\r",'',$txt);
+	$nb=strlen($s);
+	if($nb>0 && $s[$nb-1]=="\n")
+		$nb--;
+	$b=0;
+	if($border)
+	{
+		if($border==1)
+		{
+			$border='LTRB';
+			$b='LRT';
+			$b2='LR';
+		}
+		else
+		{
+			$b2='';
+			if(strpos($border,'L')!==false)
+				$b2.='L';
+			if(strpos($border,'R')!==false)
+				$b2.='R';
+			$b=(strpos($border,'T')!==false) ? $b2.'T' : $b2;
+		}
+	}
+	$sep=-1;
+	$i=0;
+	$j=0;
+	$l=0;
+	$ns=0;
+	$nl=1;
+	while($i<$nb)
+	{
+		//Get next character
+		$c=$s[$i];
+		if($c=="\n")
+		{
+			//Explicit line break
+			if($this->ws>0)
+			{
+				$this->ws=0;
+				$this->_out('0 Tw');
+			}
+			$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+			$i++;
+			$sep=-1;
+			$j=$i;
+			$l=0;
+			$ns=0;
+			$nl++;
+			if($border && $nl==2)
+				$b=$b2;
+			continue;
+		}
+		if($c==' ')
+		{
+			$sep=$i;
+			$ls=$l;
+			$ns++;
+		}
+		$l+=$cw[$c];
+		if($l>$wmax)
+		{
+			//Automatic line break
+			if($sep==-1)
+			{
+				if($i==$j)
+					$i++;
+				if($this->ws>0)
+				{
+					$this->ws=0;
+					$this->_out('0 Tw');
+				}
+				$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+			}
+			else
+			{
+				if($align=='J')
+				{
+					$this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
+					$this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
+				}
+				$this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
+				$i=$sep+1;
+			}
+			$sep=-1;
+			$j=$i;
+			$l=0;
+			$ns=0;
+			$nl++;
+			if($border && $nl==2)
+				$b=$b2;
+		}
+		else
+			$i++;
+	}
+	//Last chunk
+	if($this->ws>0)
+	{
+		$this->ws=0;
+		$this->_out('0 Tw');
+	}
+	if($border && strpos($border,'B')!==false)
+		$b.='B';
+	$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+	$this->x=$this->lMargin;
+}
+
+function Write($h, $txt, $link='')
+{
+	//Output text in flowing mode
+	$cw=&$this->CurrentFont['cw'];
+	$w=$this->w-$this->rMargin-$this->x;
+	$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+	$s=str_replace("\r",'',$txt);
+	$nb=strlen($s);
+	$sep=-1;
+	$i=0;
+	$j=0;
+	$l=0;
+	$nl=1;
+	while($i<$nb)
+	{
+		//Get next character
+		$c=$s[$i];
+		if($c=="\n")
+		{
+			//Explicit line break
+			$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+			$i++;
+			$sep=-1;
+			$j=$i;
+			$l=0;
+			if($nl==1)
+			{
+				$this->x=$this->lMargin;
+				$w=$this->w-$this->rMargin-$this->x;
+				$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+			}
+			$nl++;
+			continue;
+		}
+		if($c==' ')
+			$sep=$i;
+		$l+=$cw[$c];
+		if($l>$wmax)
+		{
+			//Automatic line break
+			if($sep==-1)
+			{
+				if($this->x>$this->lMargin)
+				{
+					//Move to next line
+					$this->x=$this->lMargin;
+					$this->y+=$h;
+					$w=$this->w-$this->rMargin-$this->x;
+					$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+					$i++;
+					$nl++;
+					continue;
+				}
+				if($i==$j)
+					$i++;
+				$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+			}
+			else
+			{
+				$this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
+				$i=$sep+1;
+			}
+			$sep=-1;
+			$j=$i;
+			$l=0;
+			if($nl==1)
+			{
+				$this->x=$this->lMargin;
+				$w=$this->w-$this->rMargin-$this->x;
+				$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+			}
+			$nl++;
+		}
+		else
+			$i++;
+	}
+	//Last chunk
+	if($i!=$j)
+		$this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link);
+}
+
+function Ln($h=null)
+{
+	//Line feed; default value is last cell height
+	$this->x=$this->lMargin;
+	if($h===null)
+		$this->y+=$this->lasth;
+	else
+		$this->y+=$h;
+}
+
+function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='')
+{
+	//Put an image on the page
+	if(!isset($this->images[$file]))
+	{
+		//First use of this image, get info
+		if($type=='')
+		{
+			$pos=strrpos($file,'.');
+			if(!$pos)
+				$this->Error('Image file has no extension and no type was specified: '.$file);
+			$type=substr($file,$pos+1);
+		}
+		$type=strtolower($type);
+		if($type=='jpeg')
+			$type='jpg';
+		$mtd='_parse'.$type;
+		if(!method_exists($this,$mtd))
+			$this->Error('Unsupported image type: '.$type);
+		$info=$this->$mtd($file);
+		$info['i']=count($this->images)+1;
+		$this->images[$file]=$info;
+	}
+	else
+		$info=$this->images[$file];
+	//Automatic width and height calculation if needed
+	if($w==0 && $h==0)
+	{
+		//Put image at 72 dpi
+		$w=$info['w']/$this->k;
+		$h=$info['h']/$this->k;
+	}
+	elseif($w==0)
+		$w=$h*$info['w']/$info['h'];
+	elseif($h==0)
+		$h=$w*$info['h']/$info['w'];
+	//Flowing mode
+	if($y===null)
+	{
+		if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
+		{
+			//Automatic page break
+			$x2=$this->x;
+			$this->AddPage($this->CurOrientation,$this->CurPageFormat);
+			$this->x=$x2;
+		}
+		$y=$this->y;
+		$this->y+=$h;
+	}
+	if($x===null)
+		$x=$this->x;
+	$this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
+	if($link)
+		$this->Link($x,$y,$w,$h,$link);
+}
+
+function GetX()
+{
+	//Get x position
+	return $this->x;
+}
+
+function SetX($x)
+{
+	//Set x position
+	if($x>=0)
+		$this->x=$x;
+	else
+		$this->x=$this->w+$x;
+}
+
+function GetY()
+{
+	//Get y position
+	return $this->y;
+}
+
+function SetY($y)
+{
+	//Set y position and reset x
+	$this->x=$this->lMargin;
+	if($y>=0)
+		$this->y=$y;
+	else
+		$this->y=$this->h+$y;
+}
+
+function SetXY($x, $y)
+{
+	//Set x and y positions
+	$this->SetY($y);
+	$this->SetX($x);
+}
+
+function Output($name='', $dest='')
+{
+	//Output PDF to some destination
+	if($this->state<3)
+		$this->Close();
+	$dest=strtoupper($dest);
+	if($dest=='')
+	{
+		if($name=='')
+		{
+			$name='doc.pdf';
+			$dest='I';
+		}
+		else
+			$dest='F';
+	}
+	switch($dest)
+	{
+		case 'I':
+			//Send to standard output
+			if(ob_get_length())
+				$this->Error('Some data has already been output, can\'t send PDF file');
+			if(php_sapi_name()!='cli')
+			{
+				//We send to a browser
+				header('Content-Type: application/pdf');
+				if(headers_sent())
+					$this->Error('Some data has already been output, can\'t send PDF file');
+				header('Content-Length: '.strlen($this->buffer));
+				header('Content-Disposition: inline; filename="'.$name.'"');
+				header('Cache-Control: private, max-age=0, must-revalidate');
+				header('Pragma: public');
+				ini_set('zlib.output_compression','0');
+			}
+			echo $this->buffer;
+			break;
+		case 'D':
+			//Download file
+			if(ob_get_length())
+				$this->Error('Some data has already been output, can\'t send PDF file');
+			header('Content-Type: application/x-download');
+			if(headers_sent())
+				$this->Error('Some data has already been output, can\'t send PDF file');
+			header('Content-Length: '.strlen($this->buffer));
+			header('Content-Disposition: attachment; filename="'.$name.'"');
+			header('Cache-Control: private, max-age=0, must-revalidate');
+			header('Pragma: public');
+			ini_set('zlib.output_compression','0');
+			echo $this->buffer;
+			break;
+		case 'F':
+			//Save to local file
+			$f=fopen($name,'wb');
+			if(!$f)
+				$this->Error('Unable to create output file: '.$name);
+			fwrite($f,$this->buffer,strlen($this->buffer));
+			fclose($f);
+			break;
+		case 'S':
+			//Return as a string
+			return $this->buffer;
+		default:
+			$this->Error('Incorrect output destination: '.$dest);
+	}
+	return '';
+}
+
+/*******************************************************************************
+*                                                                              *
+*                              Protected methods                               *
+*                                                                              *
+*******************************************************************************/
+function _dochecks()
+{
+	//Check availability of %F
+	if(sprintf('%.1F',1.0)!='1.0')
+		$this->Error('This version of PHP is not supported');
+	//Check mbstring overloading
+	if(ini_get('mbstring.func_overload') & 2)
+		$this->Error('mbstring overloading must be disabled');
+	//Disable runtime magic quotes
+	if(get_magic_quotes_runtime())
+		@set_magic_quotes_runtime(0);
+}
+
+function _getpageformat($format)
+{
+	$format=strtolower($format);
+	if(!isset($this->PageFormats[$format]))
+		$this->Error('Unknown page format: '.$format);
+	$a=$this->PageFormats[$format];
+	return array($a[0]/$this->k, $a[1]/$this->k);
+}
+
+function _getfontpath()
+{
+	if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font'))
+		define('FPDF_FONTPATH',dirname(__FILE__).'/font/');
+	return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
+}
+
+function _beginpage($orientation, $format)
+{
+	$this->page++;
+	$this->pages[$this->page]='';
+	$this->state=2;
+	$this->x=$this->lMargin;
+	$this->y=$this->tMargin;
+	$this->FontFamily='';
+	//Check page size
+	if($orientation=='')
+		$orientation=$this->DefOrientation;
+	else
+		$orientation=strtoupper($orientation[0]);
+	if($format=='')
+		$format=$this->DefPageFormat;
+	else
+	{
+		if(is_string($format))
+			$format=$this->_getpageformat($format);
+	}
+	if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1])
+	{
+		//New size
+		if($orientation=='P')
+		{
+			$this->w=$format[0];
+			$this->h=$format[1];
+		}
+		else
+		{
+			$this->w=$format[1];
+			$this->h=$format[0];
+		}
+		$this->wPt=$this->w*$this->k;
+		$this->hPt=$this->h*$this->k;
+		$this->PageBreakTrigger=$this->h-$this->bMargin;
+		$this->CurOrientation=$orientation;
+		$this->CurPageFormat=$format;
+	}
+	if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1])
+		$this->PageSizes[$this->page]=array($this->wPt, $this->hPt);
+}
+
+function _endpage()
+{
+	$this->state=1;
+}
+
+function _escape($s)
+{
+	//Escape special characters in strings
+	$s=str_replace('\\','\\\\',$s);
+	$s=str_replace('(','\\(',$s);
+	$s=str_replace(')','\\)',$s);
+	$s=str_replace("\r",'\\r',$s);
+	return $s;
+}
+
+function _textstring($s)
+{
+	//Format a text string
+	return '('.$this->_escape($s).')';
+}
+
+function _UTF8toUTF16($s)
+{
+	//Convert UTF-8 to UTF-16BE with BOM
+	$res="\xFE\xFF";
+	$nb=strlen($s);
+	$i=0;
+	while($i<$nb)
+	{
+		$c1=ord($s[$i++]);
+		if($c1>=224)
+		{
+			//3-byte character
+			$c2=ord($s[$i++]);
+			$c3=ord($s[$i++]);
+			$res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
+			$res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
+		}
+		elseif($c1>=192)
+		{
+			//2-byte character
+			$c2=ord($s[$i++]);
+			$res.=chr(($c1 & 0x1C)>>2);
+			$res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
+		}
+		else
+		{
+			//Single-byte character
+			$res.="\0".chr($c1);
+		}
+	}
+	return $res;
+}
+
+function _dounderline($x, $y, $txt)
+{
+	//Underline text
+	$up=$this->CurrentFont['up'];
+	$ut=$this->CurrentFont['ut'];
+	$w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
+	return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
+}
+
+function _parsejpg($file)
+{
+	//Extract info from a JPEG file
+	$a=GetImageSize($file);
+	if(!$a)
+		$this->Error('Missing or incorrect image file: '.$file);
+	if($a[2]!=2)
+		$this->Error('Not a JPEG file: '.$file);
+	if(!isset($a['channels']) || $a['channels']==3)
+		$colspace='DeviceRGB';
+	elseif($a['channels']==4)
+		$colspace='DeviceCMYK';
+	else
+		$colspace='DeviceGray';
+	$bpc=isset($a['bits']) ? $a['bits'] : 8;
+	//Read whole file
+	$f=fopen($file,'rb');
+	$data='';
+	while(!feof($f))
+		$data.=fread($f,8192);
+	fclose($f);
+	return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
+}
+
+function _parsepng($file)
+{
+	//Extract info from a PNG file
+	$f=fopen($file,'rb');
+	if(!$f)
+		$this->Error('Can\'t open image file: '.$file);
+	//Check signature
+	if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
+		$this->Error('Not a PNG file: '.$file);
+	//Read header chunk
+	$this->_readstream($f,4);
+	if($this->_readstream($f,4)!='IHDR')
+		$this->Error('Incorrect PNG file: '.$file);
+	$w=$this->_readint($f);
+	$h=$this->_readint($f);
+	$bpc=ord($this->_readstream($f,1));
+	if($bpc>8)
+		$this->Error('16-bit depth not supported: '.$file);
+	$ct=ord($this->_readstream($f,1));
+	if($ct==0)
+		$colspace='DeviceGray';
+	elseif($ct==2)
+		$colspace='DeviceRGB';
+	elseif($ct==3)
+		$colspace='Indexed';
+	else
+		$this->Error('Alpha channel not supported: '.$file);
+	if(ord($this->_readstream($f,1))!=0)
+		$this->Error('Unknown compression method: '.$file);
+	if(ord($this->_readstream($f,1))!=0)
+		$this->Error('Unknown filter method: '.$file);
+	if(ord($this->_readstream($f,1))!=0)
+		$this->Error('Interlacing not supported: '.$file);
+	$this->_readstream($f,4);
+	$parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';
+	//Scan chunks looking for palette, transparency and image data
+	$pal='';
+	$trns='';
+	$data='';
+	do
+	{
+		$n=$this->_readint($f);
+		$type=$this->_readstream($f,4);
+		if($type=='PLTE')
+		{
+			//Read palette
+			$pal=$this->_readstream($f,$n);
+			$this->_readstream($f,4);
+		}
+		elseif($type=='tRNS')
+		{
+			//Read transparency info
+			$t=$this->_readstream($f,$n);
+			if($ct==0)
+				$trns=array(ord(substr($t,1,1)));
+			elseif($ct==2)
+				$trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1)));
+			else
+			{
+				$pos=strpos($t,chr(0));
+				if($pos!==false)
+					$trns=array($pos);
+			}
+			$this->_readstream($f,4);
+		}
+		elseif($type=='IDAT')
+		{
+			//Read image data block
+			$data.=$this->_readstream($f,$n);
+			$this->_readstream($f,4);
+		}
+		elseif($type=='IEND')
+			break;
+		else
+			$this->_readstream($f,$n+4);
+	}
+	while($n);
+	if($colspace=='Indexed' && empty($pal))
+		$this->Error('Missing palette in '.$file);
+	fclose($f);
+	return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
+}
+
+function _readstream($f, $n)
+{
+	//Read n bytes from stream
+	$res='';
+	while($n>0 && !feof($f))
+	{
+		$s=fread($f,$n);
+		if($s===false)
+			$this->Error('Error while reading stream');
+		$n-=strlen($s);
+		$res.=$s;
+	}
+	if($n>0)
+		$this->Error('Unexpected end of stream');
+	return $res;
+}
+
+function _readint($f)
+{
+	//Read a 4-byte integer from stream
+	$a=unpack('Ni',$this->_readstream($f,4));
+	return $a['i'];
+}
+
+function _parsegif($file)
+{
+	//Extract info from a GIF file (via PNG conversion)
+	if(!function_exists('imagepng'))
+		$this->Error('GD extension is required for GIF support');
+	if(!function_exists('imagecreatefromgif'))
+		$this->Error('GD has no GIF read support');
+	$im=imagecreatefromgif($file);
+	if(!$im)
+		$this->Error('Missing or incorrect image file: '.$file);
+	imageinterlace($im,0);
+	$tmp=tempnam('.','gif');
+	if(!$tmp)
+		$this->Error('Unable to create a temporary file');
+	if(!imagepng($im,$tmp))
+		$this->Error('Error while saving to temporary file');
+	imagedestroy($im);
+	$info=$this->_parsepng($tmp);
+	unlink($tmp);
+	return $info;
+}
+
+function _newobj()
+{
+	//Begin a new object
+	$this->n++;
+	$this->offsets[$this->n]=strlen($this->buffer);
+	$this->_out($this->n.' 0 obj');
+}
+
+function _putstream($s)
+{
+	$this->_out('stream');
+	$this->_out($s);
+	$this->_out('endstream');
+}
+
+function _out($s)
+{
+	//Add a line to the document
+	if($this->state==2)
+		$this->pages[$this->page].=$s."\n";
+	else
+		$this->buffer.=$s."\n";
+}
+
+function _putpages()
+{
+	$nb=$this->page;
+	if(!empty($this->AliasNbPages))
+	{
+		//Replace number of pages
+		for($n=1;$n<=$nb;$n++)
+			$this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]);
+	}
+	if($this->DefOrientation=='P')
+	{
+		$wPt=$this->DefPageFormat[0]*$this->k;
+		$hPt=$this->DefPageFormat[1]*$this->k;
+	}
+	else
+	{
+		$wPt=$this->DefPageFormat[1]*$this->k;
+		$hPt=$this->DefPageFormat[0]*$this->k;
+	}
+	$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+	for($n=1;$n<=$nb;$n++)
+	{
+		//Page
+		$this->_newobj();
+		$this->_out('<</Type /Page');
+		$this->_out('/Parent 1 0 R');
+		if(isset($this->PageSizes[$n]))
+			$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1]));
+		$this->_out('/Resources 2 0 R');
+		if(isset($this->PageLinks[$n]))
+		{
+			//Links
+			$annots='/Annots [';
+			foreach($this->PageLinks[$n] as $pl)
+			{
+				$rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
+				$annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
+				if(is_string($pl[4]))
+					$annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
+				else
+				{
+					$l=$this->links[$pl[4]];
+					$h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
+					$annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k);
+				}
+			}
+			$this->_out($annots.']');
+		}
+		$this->_out('/Contents '.($this->n+1).' 0 R>>');
+		$this->_out('endobj');
+		//Page content
+		$p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
+		$this->_newobj();
+		$this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
+		$this->_putstream($p);
+		$this->_out('endobj');
+	}
+	//Pages root
+	$this->offsets[1]=strlen($this->buffer);
+	$this->_out('1 0 obj');
+	$this->_out('<</Type /Pages');
+	$kids='/Kids [';
+	for($i=0;$i<$nb;$i++)
+		$kids.=(3+2*$i).' 0 R ';
+	$this->_out($kids.']');
+	$this->_out('/Count '.$nb);
+	$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt));
+	$this->_out('>>');
+	$this->_out('endobj');
+}
+
+function _putfonts()
+{
+	$nf=$this->n;
+	foreach($this->diffs as $diff)
+	{
+		//Encodings
+		$this->_newobj();
+		$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
+		$this->_out('endobj');
+	}
+	foreach($this->FontFiles as $file=>$info)
+	{
+		//Font file embedding
+		$this->_newobj();
+		$this->FontFiles[$file]['n']=$this->n;
+		$font='';
+		$f=fopen($this->_getfontpath().$file,'rb',1);
+		if(!$f)
+			$this->Error('Font file not found');
+		while(!feof($f))
+			$font.=fread($f,8192);
+		fclose($f);
+		$compressed=(substr($file,-2)=='.z');
+		if(!$compressed && isset($info['length2']))
+		{
+			$header=(ord($font[0])==128);
+			if($header)
+			{
+				//Strip first binary header
+				$font=substr($font,6);
+			}
+			if($header && ord($font[$info['length1']])==128)
+			{
+				//Strip second binary header
+				$font=substr($font,0,$info['length1']).substr($font,$info['length1']+6);
+			}
+		}
+		$this->_out('<</Length '.strlen($font));
+		if($compressed)
+			$this->_out('/Filter /FlateDecode');
+		$this->_out('/Length1 '.$info['length1']);
+		if(isset($info['length2']))
+			$this->_out('/Length2 '.$info['length2'].' /Length3 0');
+		$this->_out('>>');
+		$this->_putstream($font);
+		$this->_out('endobj');
+	}
+	foreach($this->fonts as $k=>$font)
+	{
+		//Font objects
+		$this->fonts[$k]['n']=$this->n+1;
+		$type=$font['type'];
+		$name=$font['name'];
+		if($type=='core')
+		{
+			//Standard font
+			$this->_newobj();
+			$this->_out('<</Type /Font');
+			$this->_out('/BaseFont /'.$name);
+			$this->_out('/Subtype /Type1');
+			if($name!='Symbol' && $name!='ZapfDingbats')
+				$this->_out('/Encoding /WinAnsiEncoding');
+			$this->_out('>>');
+			$this->_out('endobj');
+		}
+		elseif($type=='Type1' || $type=='TrueType')
+		{
+			//Additional Type1 or TrueType font
+			$this->_newobj();
+			$this->_out('<</Type /Font');
+			$this->_out('/BaseFont /'.$name);
+			$this->_out('/Subtype /'.$type);
+			$this->_out('/FirstChar 32 /LastChar 255');
+			$this->_out('/Widths '.($this->n+1).' 0 R');
+			$this->_out('/FontDescriptor '.($this->n+2).' 0 R');
+			if($font['enc'])
+			{
+				if(isset($font['diff']))
+					$this->_out('/Encoding '.($nf+$font['diff']).' 0 R');
+				else
+					$this->_out('/Encoding /WinAnsiEncoding');
+			}
+			$this->_out('>>');
+			$this->_out('endobj');
+			//Widths
+			$this->_newobj();
+			$cw=&$font['cw'];
+			$s='[';
+			for($i=32;$i<=255;$i++)
+				$s.=$cw[chr($i)].' ';
+			$this->_out($s.']');
+			$this->_out('endobj');
+			//Descriptor
+			$this->_newobj();
+			$s='<</Type /FontDescriptor /FontName /'.$name;
+			foreach($font['desc'] as $k=>$v)
+				$s.=' /'.$k.' '.$v;
+			$file=$font['file'];
+			if($file)
+				$s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';
+			$this->_out($s.'>>');
+			$this->_out('endobj');
+		}
+		else
+		{
+			//Allow for additional types
+			$mtd='_put'.strtolower($type);
+			if(!method_exists($this,$mtd))
+				$this->Error('Unsupported font type: '.$type);
+			$this->$mtd($font);
+		}
+	}
+}
+
+function _putimages()
+{
+	$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+	reset($this->images);
+	while(list($file,$info)=each($this->images))
+	{
+		$this->_newobj();
+		$this->images[$file]['n']=$this->n;
+		$this->_out('<</Type /XObject');
+		$this->_out('/Subtype /Image');
+		$this->_out('/Width '.$info['w']);
+		$this->_out('/Height '.$info['h']);
+		if($info['cs']=='Indexed')
+			$this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
+		else
+		{
+			$this->_out('/ColorSpace /'.$info['cs']);
+			if($info['cs']=='DeviceCMYK')
+				$this->_out('/Decode [1 0 1 0 1 0 1 0]');
+		}
+		$this->_out('/BitsPerComponent '.$info['bpc']);
+		if(isset($info['f']))
+			$this->_out('/Filter /'.$info['f']);
+		if(isset($info['parms']))
+			$this->_out($info['parms']);
+		if(isset($info['trns']) && is_array($info['trns']))
+		{
+			$trns='';
+			for($i=0;$i<count($info['trns']);$i++)
+				$trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
+			$this->_out('/Mask ['.$trns.']');
+		}
+		$this->_out('/Length '.strlen($info['data']).'>>');
+		$this->_putstream($info['data']);
+		unset($this->images[$file]['data']);
+		$this->_out('endobj');
+		//Palette
+		if($info['cs']=='Indexed')
+		{
+			$this->_newobj();
+			$pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
+			$this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
+			$this->_putstream($pal);
+			$this->_out('endobj');
+		}
+	}
+}
+
+function _putxobjectdict()
+{
+	foreach($this->images as $image)
+		$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
+}
+
+function _putresourcedict()
+{
+	$this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
+	$this->_out('/Font <<');
+	foreach($this->fonts as $font)
+		$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
+	$this->_out('>>');
+	$this->_out('/XObject <<');
+	$this->_putxobjectdict();
+	$this->_out('>>');
+}
+
+function _putresources()
+{
+	$this->_putfonts();
+	$this->_putimages();
+	//Resource dictionary
+	$this->offsets[2]=strlen($this->buffer);
+	$this->_out('2 0 obj');
+	$this->_out('<<');
+	$this->_putresourcedict();
+	$this->_out('>>');
+	$this->_out('endobj');
+}
+
+function _putinfo()
+{
+	$this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
+	if(!empty($this->title))
+		$this->_out('/Title '.$this->_textstring($this->title));
+	if(!empty($this->subject))
+		$this->_out('/Subject '.$this->_textstring($this->subject));
+	if(!empty($this->author))
+		$this->_out('/Author '.$this->_textstring($this->author));
+	if(!empty($this->keywords))
+		$this->_out('/Keywords '.$this->_textstring($this->keywords));
+	if(!empty($this->creator))
+		$this->_out('/Creator '.$this->_textstring($this->creator));
+	$this->_out('/CreationDate '.$this->_textstring('D:'. at date('YmdHis')));
+}
+
+function _putcatalog()
+{
+	$this->_out('/Type /Catalog');
+	$this->_out('/Pages 1 0 R');
+	if($this->ZoomMode=='fullpage')
+		$this->_out('/OpenAction [3 0 R /Fit]');
+	elseif($this->ZoomMode=='fullwidth')
+		$this->_out('/OpenAction [3 0 R /FitH null]');
+	elseif($this->ZoomMode=='real')
+		$this->_out('/OpenAction [3 0 R /XYZ null null 1]');
+	elseif(!is_string($this->ZoomMode))
+		$this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']');
+	if($this->LayoutMode=='single')
+		$this->_out('/PageLayout /SinglePage');
+	elseif($this->LayoutMode=='continuous')
+		$this->_out('/PageLayout /OneColumn');
+	elseif($this->LayoutMode=='two')
+		$this->_out('/PageLayout /TwoColumnLeft');
+}
+
+function _putheader()
+{
+	$this->_out('%PDF-'.$this->PDFVersion);
+}
+
+function _puttrailer()
+{
+	$this->_out('/Size '.($this->n+1));
+	$this->_out('/Root '.$this->n.' 0 R');
+	$this->_out('/Info '.($this->n-1).' 0 R');
+}
+
+function _enddoc()
+{
+	$this->_putheader();
+	$this->_putpages();
+	$this->_putresources();
+	//Info
+	$this->_newobj();
+	$this->_out('<<');
+	$this->_putinfo();
+	$this->_out('>>');
+	$this->_out('endobj');
+	//Catalog
+	$this->_newobj();
+	$this->_out('<<');
+	$this->_putcatalog();
+	$this->_out('>>');
+	$this->_out('endobj');
+	//Cross-ref
+	$o=strlen($this->buffer);
+	$this->_out('xref');
+	$this->_out('0 '.($this->n+1));
+	$this->_out('0000000000 65535 f ');
+	for($i=1;$i<=$this->n;$i++)
+		$this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
+	//Trailer
+	$this->_out('trailer');
+	$this->_out('<<');
+	$this->_puttrailer();
+	$this->_out('>>');
+	$this->_out('startxref');
+	$this->_out($o);
+	$this->_out('%%EOF');
+	$this->state=3;
+}
+//End of class
+}
+
+//Handle special IE contype request
+if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype')
+{
+	header('Content-Type: application/pdf');
+	exit;
+}
+
+?>

Modified: branches/print_dev/http/extensions/fpdf/fpdf_tpl.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/fpdf_tpl.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/fpdf_tpl.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,399 +1,399 @@
-<?php
-//
-//  FPDF_TPL - Version 1.1.2
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-require_once("fpdf.php");
-
-class FPDF_TPL extends FPDF {
-    /**
-     * Array of Tpl-Data
-     * @var array
-     */
-    var $tpls = array();
-
-    /**
-     * Current Template-ID
-     * @var int
-     */
-    var $tpl = 0;
-    
-    /**
-     * "In Template"-Flag
-     * @var boolean
-     */
-    var $_intpl = false;
-    
-    /**
-     * Nameprefix of Templates used in Resources-Dictonary
-     * @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
-     */
-    var $tplprefix = "/TPL";
-
-    /**
-     * Resources used By Templates and Pages
-     * @var array
-     */
-    var $_res = array();
-    
-    /**
-     * Start a Template
-     *
-     * This method starts a template. You can give own coordinates to build an own sized
-     * Template. Pay attention, that the margins are adapted to the new templatesize.
-     * If you want to write outside the template, for example to build a clipped Template,
-     * you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
-     *
-     * If no parameter is given, the template uses the current page-size.
-     * The Method returns an ID of the current Template. This ID is used later for using this template.
-     * Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
-     *
-     * @param int $x The x-coordinate given in user-unit
-     * @param int $y The y-coordinate given in user-unit
-     * @param int $w The width given in user-unit
-     * @param int $h The height given in user-unit
-     * @return int The ID of new created Template
-     */
-    function beginTemplate($x=null, $y=null, $w=null, $h=null) {
-        if ($this->page <= 0)
-            $this->error("You have to add a page to fpdf first!");
-
-        if ($x == null)
-            $x = 0;
-        if ($y == null)
-            $y = 0;
-        if ($w == null)
-            $w = $this->w;
-        if ($h == null)
-            $h = $this->h;
-
-        // Save settings
-        $this->tpl++;
-        $tpl =& $this->tpls[$this->tpl];
-        $tpl = array(
-            'o_x' => $this->x,
-            'o_y' => $this->y,
-            'o_AutoPageBreak' => $this->AutoPageBreak,
-            'o_bMargin' => $this->bMargin,
-            'o_tMargin' => $this->tMargin,
-            'o_lMargin' => $this->lMargin,
-            'o_rMargin' => $this->rMargin,
-            'o_h' => $this->h,
-            'o_w' => $this->w,
-            'buffer' => '',
-            'x' => $x,
-            'y' => $y,
-            'w' => $w,
-            'h' => $h
-        );
-
-        $this->SetAutoPageBreak(false);
-        
-        // Define own high and width to calculate possitions correct
-        $this->h = $h;
-        $this->w = $w;
-
-        $this->_intpl = true;
-        $this->SetXY($x+$this->lMargin, $y+$this->tMargin);
-        $this->SetRightMargin($this->w-$w+$this->rMargin);
-
-        return $this->tpl;
-    }
-    
-    /**
-     * End Template
-     *
-     * This method ends a template and reset initiated variables on beginTemplate.
-     *
-     * @return mixed If a template is opened, the ID is returned. If not a false is returned.
-     */
-    function endTemplate() {
-        if ($this->_intpl) {
-            $this->_intpl = false; 
-            $tpl =& $this->tpls[$this->tpl];
-            $this->SetXY($tpl['o_x'], $tpl['o_y']);
-            $this->tMargin = $tpl['o_tMargin'];
-            $this->lMargin = $tpl['o_lMargin'];
-            $this->rMargin = $tpl['o_rMargin'];
-            $this->h = $tpl['o_h'];
-            $this->w = $tpl['o_w'];
-            $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
-            
-            return $this->tpl;
-        } else {
-            return false;
-        }
-    }
-    
-    /**
-     * Use a Template in current Page or other Template
-     *
-     * You can use a template in a page or in another template.
-     * You can give the used template a new size like you use the Image()-method.
-     * All parameters are optional. The width or height is calculated automaticaly
-     * if one is given. If no parameter is given the origin size as defined in
-     * beginTemplate() is used.
-     * The calculated or used width and height are returned as an array.
-     *
-     * @param int $tplidx A valid template-Id
-     * @param int $_x The x-position
-     * @param int $_y The y-position
-     * @param int $_w The new width of the template
-     * @param int $_h The new height of the template
-     * @retrun array The height and width of the template
-     */
-    function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
-        if ($this->page <= 0)
-            $this->error("You have to add a page to fpdf first!");
-
-        if (!isset($this->tpls[$tplidx]))
-            $this->error("Template does not exist!");
-            
-        if ($this->_intpl) {
-            $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
-        }
-        
-        $tpl =& $this->tpls[$tplidx];
-        $x = $tpl['x'];
-        $y = $tpl['y'];
-        $w = $tpl['w'];
-        $h = $tpl['h'];
-        
-        if ($_x == null)
-            $_x = $x;
-        if ($_y == null)
-            $_y = $y;
-        $wh = $this->getTemplateSize($tplidx, $_w, $_h);
-        $_w = $wh['w'];
-        $_h = $wh['h'];
-    
-        $this->_out(sprintf("q %.4f 0 0 %.4f %.2f %.2f cm", ($_w/$w), ($_h/$h), $_x*$this->k, ($this->h-($_y+$_h))*$this->k)); // Translate 
-        $this->_out($this->tplprefix.$tplidx." Do Q");
-
-        return array("w" => $_w, "h" => $_h);
-    }
-    
-    /**
-     * Get The calculated Size of a Template
-     *
-     * If one size is given, this method calculates the other one.
-     *
-     * @param int $tplidx A valid template-Id
-     * @param int $_w The width of the template
-     * @param int $_h The height of the template
-     * @return array The height and width of the template
-     */
-    function getTemplateSize($tplidx, $_w=0, $_h=0) {
-        if (!$this->tpls[$tplidx])
-            return false;
-
-        $tpl =& $this->tpls[$tplidx];
-        $w = $tpl['w'];
-        $h = $tpl['h'];
-        
-        if ($_w == 0 and $_h == 0) {
-            $_w = $w;
-            $_h = $h;
-        }
-
-    	if($_w==0)
-    		$_w = $_h*$w/$h;
-    	if($_h==0)
-    		$_h = $_w*$h/$w;
-    		
-        return array("w" => $_w, "h" => $_h);
-    }
-    
-    /**
-     * See FPDF-Documentation ;-)
-     */
-    function SetFont($family, $style='', $size=0) {
-        /**
-         * force the resetting of font changes in a template
-         */
-        if ($this->_intpl)
-            $this->FontFamily = '';
-            
-        parent::SetFont($family, $style, $size);
-       
-        $fontkey = $this->FontFamily.$this->FontStyle;
-        
-        if ($this->_intpl) {
-            $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
-        } else {
-            $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
-        }
-    }
-    
-    /**
-     * See FPDF/TCPDF-Documentation ;-)
-     */
-    function Image($file, $x, $y, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300) {
-        if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 7) {
-            $this->Error('More than 7 arguments for the Image method are only available in TCPDF.');
-        }
-        
-        parent::Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi);
-        if ($this->_intpl) {
-            $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
-        } else {
-            $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
-        }
-    }
-    
-    /**
-     * See FPDF-Documentation ;-)
-     *
-     * AddPage is not available when you're "in" a template.
-     */
-    function AddPage($orientation='', $format='') {
-        if ($this->_intpl)
-            $this->Error('Adding pages in templates isn\'t possible!');
-        parent::AddPage($orientation, $format);
-    }
-
-    /**
-     * Preserve adding Links in Templates ...won't work
-     */
-    function Link($x, $y, $w, $h, $link) {
-        if ($this->_intpl)
-            $this->Error('Using links in templates aren\'t possible!');
-        parent::Link($x, $y, $w, $h, $link);
-    }
-    
-    function AddLink() {
-        if ($this->_intpl)
-            $this->Error('Adding links in templates aren\'t possible!');
-        return parent::AddLink();
-    }
-    
-    function SetLink($link, $y=0, $page=-1) {
-        if ($this->_intpl)
-            $this->Error('Setting links in templates aren\'t possible!');
-        parent::SetLink($link, $y, $page);
-    }
-    
-    /**
-     * Private Method that writes the form xobjects
-     */
-    function _putformxobjects() {
-        $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
-	    reset($this->tpls);
-        foreach($this->tpls AS $tplidx => $tpl) {
-
-            $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
-    		$this->_newobj();
-    		$this->tpls[$tplidx]['n'] = $this->n;
-    		$this->_out('<<'.$filter.'/Type /XObject');
-            $this->_out('/Subtype /Form');
-            $this->_out('/FormType 1');
-            $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k));
-            $this->_out('/Resources ');
-
-            $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
-        	if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
-            	$this->_out('/Font <<');
-                foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
-            		$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
-            	$this->_out('>>');
-            }
-        	if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || 
-        	   isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
-        	{
-                $this->_out('/XObject <<');
-                if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
-                    foreach($this->_res['tpl'][$tplidx]['images'] as $image)
-              			$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
-                }
-                if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
-                    foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
-                        $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
-                }
-                $this->_out('>>');
-        	}
-        	$this->_out('>>');
-        	
-        	$this->_out('/Length '.strlen($p).' >>');
-    		$this->_putstream($p);
-    		$this->_out('endobj');
-        }
-    }
-    
-    /**
-     * Private Method
-     */
-    function _putresources() {
-        if (!is_subclass_of($this, 'TCPDF')) {
-            $this->_putfonts();
-        	$this->_putimages();
-        	$this->_putformxobjects();
-            //Resource dictionary
-        	$this->offsets[2]=strlen($this->buffer);
-        	$this->_out('2 0 obj');
-        	$this->_out('<<');
-        	$this->_putresourcedict();
-        	$this->_out('>>');
-    	   $this->_out('endobj');
-        } else {
-        	$this->_putextgstates();
-    		$this->_putocg();
-    		$this->_putfonts();
-    		$this->_putimages();
-    	  	$this->_putshaders();
-			$this->_putformxobjects();
-            //Resource dictionary
-    		$this->offsets[2]=strlen($this->buffer);
-    		$this->_out('2 0 obj');
-    		$this->_out('<<');
-    		$this->_putresourcedict();
-    		$this->_out('>>');
-    		$this->_out('endobj');
-    		$this->_putjavascript();
-    		$this->_putbookmarks();
-    		// encryption
-    		if ($this->encrypted) {
-    			$this->_newobj();
-    			$this->enc_obj_id = $this->n;
-    			$this->_out('<<');
-    			$this->_putencryption();
-    			$this->_out('>>');
-    			$this->_out('endobj');
-    		}
-        }
-    }
-    
-    function _putxobjectdict() {
-        parent::_putxobjectdict();
-        
-        if (count($this->tpls)) {
-            foreach($this->tpls as $tplidx => $tpl) {
-                $this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R');
-            }
-        }
-    }
-
-    /**
-     * Private Method
-     */
-    function _out($s) {
-        if ($this->state==2 && $this->_intpl) {
-            $this->tpls[$this->tpl]['buffer'] .= $s."\n";
-        } else {
-            parent::_out($s);
-        }
-    }
-}
+<?php
+//
+//  FPDF_TPL - Version 1.1.2
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+require_once("fpdf.php");
+
+class FPDF_TPL extends FPDF {
+    /**
+     * Array of Tpl-Data
+     * @var array
+     */
+    var $tpls = array();
+
+    /**
+     * Current Template-ID
+     * @var int
+     */
+    var $tpl = 0;
+    
+    /**
+     * "In Template"-Flag
+     * @var boolean
+     */
+    var $_intpl = false;
+    
+    /**
+     * Nameprefix of Templates used in Resources-Dictonary
+     * @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
+     */
+    var $tplprefix = "/TPL";
+
+    /**
+     * Resources used By Templates and Pages
+     * @var array
+     */
+    var $_res = array();
+    
+    /**
+     * Start a Template
+     *
+     * This method starts a template. You can give own coordinates to build an own sized
+     * Template. Pay attention, that the margins are adapted to the new templatesize.
+     * If you want to write outside the template, for example to build a clipped Template,
+     * you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
+     *
+     * If no parameter is given, the template uses the current page-size.
+     * The Method returns an ID of the current Template. This ID is used later for using this template.
+     * Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
+     *
+     * @param int $x The x-coordinate given in user-unit
+     * @param int $y The y-coordinate given in user-unit
+     * @param int $w The width given in user-unit
+     * @param int $h The height given in user-unit
+     * @return int The ID of new created Template
+     */
+    function beginTemplate($x=null, $y=null, $w=null, $h=null) {
+        if ($this->page <= 0)
+            $this->error("You have to add a page to fpdf first!");
+
+        if ($x == null)
+            $x = 0;
+        if ($y == null)
+            $y = 0;
+        if ($w == null)
+            $w = $this->w;
+        if ($h == null)
+            $h = $this->h;
+
+        // Save settings
+        $this->tpl++;
+        $tpl =& $this->tpls[$this->tpl];
+        $tpl = array(
+            'o_x' => $this->x,
+            'o_y' => $this->y,
+            'o_AutoPageBreak' => $this->AutoPageBreak,
+            'o_bMargin' => $this->bMargin,
+            'o_tMargin' => $this->tMargin,
+            'o_lMargin' => $this->lMargin,
+            'o_rMargin' => $this->rMargin,
+            'o_h' => $this->h,
+            'o_w' => $this->w,
+            'buffer' => '',
+            'x' => $x,
+            'y' => $y,
+            'w' => $w,
+            'h' => $h
+        );
+
+        $this->SetAutoPageBreak(false);
+        
+        // Define own high and width to calculate possitions correct
+        $this->h = $h;
+        $this->w = $w;
+
+        $this->_intpl = true;
+        $this->SetXY($x+$this->lMargin, $y+$this->tMargin);
+        $this->SetRightMargin($this->w-$w+$this->rMargin);
+
+        return $this->tpl;
+    }
+    
+    /**
+     * End Template
+     *
+     * This method ends a template and reset initiated variables on beginTemplate.
+     *
+     * @return mixed If a template is opened, the ID is returned. If not a false is returned.
+     */
+    function endTemplate() {
+        if ($this->_intpl) {
+            $this->_intpl = false; 
+            $tpl =& $this->tpls[$this->tpl];
+            $this->SetXY($tpl['o_x'], $tpl['o_y']);
+            $this->tMargin = $tpl['o_tMargin'];
+            $this->lMargin = $tpl['o_lMargin'];
+            $this->rMargin = $tpl['o_rMargin'];
+            $this->h = $tpl['o_h'];
+            $this->w = $tpl['o_w'];
+            $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
+            
+            return $this->tpl;
+        } else {
+            return false;
+        }
+    }
+    
+    /**
+     * Use a Template in current Page or other Template
+     *
+     * You can use a template in a page or in another template.
+     * You can give the used template a new size like you use the Image()-method.
+     * All parameters are optional. The width or height is calculated automaticaly
+     * if one is given. If no parameter is given the origin size as defined in
+     * beginTemplate() is used.
+     * The calculated or used width and height are returned as an array.
+     *
+     * @param int $tplidx A valid template-Id
+     * @param int $_x The x-position
+     * @param int $_y The y-position
+     * @param int $_w The new width of the template
+     * @param int $_h The new height of the template
+     * @retrun array The height and width of the template
+     */
+    function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
+        if ($this->page <= 0)
+            $this->error("You have to add a page to fpdf first!");
+
+        if (!isset($this->tpls[$tplidx]))
+            $this->error("Template does not exist!");
+            
+        if ($this->_intpl) {
+            $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
+        }
+        
+        $tpl =& $this->tpls[$tplidx];
+        $x = $tpl['x'];
+        $y = $tpl['y'];
+        $w = $tpl['w'];
+        $h = $tpl['h'];
+        
+        if ($_x == null)
+            $_x = $x;
+        if ($_y == null)
+            $_y = $y;
+        $wh = $this->getTemplateSize($tplidx, $_w, $_h);
+        $_w = $wh['w'];
+        $_h = $wh['h'];
+    
+        $this->_out(sprintf("q %.4f 0 0 %.4f %.2f %.2f cm", ($_w/$w), ($_h/$h), $_x*$this->k, ($this->h-($_y+$_h))*$this->k)); // Translate 
+        $this->_out($this->tplprefix.$tplidx." Do Q");
+
+        return array("w" => $_w, "h" => $_h);
+    }
+    
+    /**
+     * Get The calculated Size of a Template
+     *
+     * If one size is given, this method calculates the other one.
+     *
+     * @param int $tplidx A valid template-Id
+     * @param int $_w The width of the template
+     * @param int $_h The height of the template
+     * @return array The height and width of the template
+     */
+    function getTemplateSize($tplidx, $_w=0, $_h=0) {
+        if (!$this->tpls[$tplidx])
+            return false;
+
+        $tpl =& $this->tpls[$tplidx];
+        $w = $tpl['w'];
+        $h = $tpl['h'];
+        
+        if ($_w == 0 and $_h == 0) {
+            $_w = $w;
+            $_h = $h;
+        }
+
+    	if($_w==0)
+    		$_w = $_h*$w/$h;
+    	if($_h==0)
+    		$_h = $_w*$h/$w;
+    		
+        return array("w" => $_w, "h" => $_h);
+    }
+    
+    /**
+     * See FPDF-Documentation ;-)
+     */
+    function SetFont($family, $style='', $size=0) {
+        /**
+         * force the resetting of font changes in a template
+         */
+        if ($this->_intpl)
+            $this->FontFamily = '';
+            
+        parent::SetFont($family, $style, $size);
+       
+        $fontkey = $this->FontFamily.$this->FontStyle;
+        
+        if ($this->_intpl) {
+            $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
+        } else {
+            $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
+        }
+    }
+    
+    /**
+     * See FPDF/TCPDF-Documentation ;-)
+     */
+    function Image($file, $x, $y, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300) {
+        if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 7) {
+            $this->Error('More than 7 arguments for the Image method are only available in TCPDF.');
+        }
+        
+        parent::Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi);
+        if ($this->_intpl) {
+            $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
+        } else {
+            $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
+        }
+    }
+    
+    /**
+     * See FPDF-Documentation ;-)
+     *
+     * AddPage is not available when you're "in" a template.
+     */
+    function AddPage($orientation='', $format='') {
+        if ($this->_intpl)
+            $this->Error('Adding pages in templates isn\'t possible!');
+        parent::AddPage($orientation, $format);
+    }
+
+    /**
+     * Preserve adding Links in Templates ...won't work
+     */
+    function Link($x, $y, $w, $h, $link) {
+        if ($this->_intpl)
+            $this->Error('Using links in templates aren\'t possible!');
+        parent::Link($x, $y, $w, $h, $link);
+    }
+    
+    function AddLink() {
+        if ($this->_intpl)
+            $this->Error('Adding links in templates aren\'t possible!');
+        return parent::AddLink();
+    }
+    
+    function SetLink($link, $y=0, $page=-1) {
+        if ($this->_intpl)
+            $this->Error('Setting links in templates aren\'t possible!');
+        parent::SetLink($link, $y, $page);
+    }
+    
+    /**
+     * Private Method that writes the form xobjects
+     */
+    function _putformxobjects() {
+        $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+	    reset($this->tpls);
+        foreach($this->tpls AS $tplidx => $tpl) {
+
+            $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
+    		$this->_newobj();
+    		$this->tpls[$tplidx]['n'] = $this->n;
+    		$this->_out('<<'.$filter.'/Type /XObject');
+            $this->_out('/Subtype /Form');
+            $this->_out('/FormType 1');
+            $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k));
+            $this->_out('/Resources ');
+
+            $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
+        	if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
+            	$this->_out('/Font <<');
+                foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
+            		$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
+            	$this->_out('>>');
+            }
+        	if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || 
+        	   isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
+        	{
+                $this->_out('/XObject <<');
+                if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
+                    foreach($this->_res['tpl'][$tplidx]['images'] as $image)
+              			$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
+                }
+                if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
+                    foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
+                        $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
+                }
+                $this->_out('>>');
+        	}
+        	$this->_out('>>');
+        	
+        	$this->_out('/Length '.strlen($p).' >>');
+    		$this->_putstream($p);
+    		$this->_out('endobj');
+        }
+    }
+    
+    /**
+     * Private Method
+     */
+    function _putresources() {
+        if (!is_subclass_of($this, 'TCPDF')) {
+            $this->_putfonts();
+        	$this->_putimages();
+        	$this->_putformxobjects();
+            //Resource dictionary
+        	$this->offsets[2]=strlen($this->buffer);
+        	$this->_out('2 0 obj');
+        	$this->_out('<<');
+        	$this->_putresourcedict();
+        	$this->_out('>>');
+    	   $this->_out('endobj');
+        } else {
+        	$this->_putextgstates();
+    		$this->_putocg();
+    		$this->_putfonts();
+    		$this->_putimages();
+    	  	$this->_putshaders();
+			$this->_putformxobjects();
+            //Resource dictionary
+    		$this->offsets[2]=strlen($this->buffer);
+    		$this->_out('2 0 obj');
+    		$this->_out('<<');
+    		$this->_putresourcedict();
+    		$this->_out('>>');
+    		$this->_out('endobj');
+    		$this->_putjavascript();
+    		$this->_putbookmarks();
+    		// encryption
+    		if ($this->encrypted) {
+    			$this->_newobj();
+    			$this->enc_obj_id = $this->n;
+    			$this->_out('<<');
+    			$this->_putencryption();
+    			$this->_out('>>');
+    			$this->_out('endobj');
+    		}
+        }
+    }
+    
+    function _putxobjectdict() {
+        parent::_putxobjectdict();
+        
+        if (count($this->tpls)) {
+            foreach($this->tpls as $tplidx => $tpl) {
+                $this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R');
+            }
+        }
+    }
+
+    /**
+     * Private Method
+     */
+    function _out($s) {
+        if ($this->state==2 && $this->_intpl) {
+            $this->tpls[$this->tpl]['buffer'] .= $s."\n";
+        } else {
+            parent::_out($s);
+        }
+    }
+}

Modified: branches/print_dev/http/extensions/fpdf/fpdi.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/fpdi.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/fpdi.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,500 +1,500 @@
-<?php
-//
-//  FPDI - Version 1.2.1
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-define('FPDI_VERSION','1.2.1');
-
-// Check for TCPDF and remap TCPDF to FPDF
-if (class_exists('TCPDF')) {
-    require_once('fpdi2tcpdf_bridge.php');
-}
-
-require_once("fpdf_tpl.php");
-require_once("fpdi_pdf_parser.php");
-
-
-class FPDI extends FPDF_TPL {
-    /**
-     * Actual filename
-     * @var string
-     */
-    var $current_filename;
-
-    /**
-     * Parser-Objects
-     * @var array
-     */
-    var $parsers;
-    
-    /**
-     * Current parser
-     * @var object
-     */
-    var $current_parser;
-    
-    /**
-     * object stack
-     * @var array
-     */
-    var $_obj_stack;
-    
-    /**
-     * done object stack
-     * @var array
-     */
-    var $_don_obj_stack;
-
-    /**
-     * Current Object Id.
-     * @var integer
-     */
-    var $_current_obj_id;
-    
-    /**
-     * The name of the last imported page box
-     * @var string
-     */
-    var $lastUsedPageBox;
-    
-    var $_importedPages = array();
-    
-    
-    /**
-     * Set a source-file
-     *
-     * @param string $filename a valid filename
-     * @return int number of available pages
-     */
-    function setSourceFile($filename) {
-        $this->current_filename = $filename;
-        $fn =& $this->current_filename;
-
-        if (!isset($this->parsers[$fn]))
-            $this->parsers[$fn] =& new fpdi_pdf_parser($fn,$this);
-        $this->current_parser =& $this->parsers[$fn];
-        
-        return $this->parsers[$fn]->getPageCount();
-    }
-    
-    /**
-     * Import a page
-     *
-     * @param int $pageno pagenumber
-     * @return int Index of imported page - to use with fpdf_tpl::useTemplate()
-     */
-    function importPage($pageno, $boxName='/CropBox') {
-        if ($this->_intpl) {
-            return $this->error("Please import the desired pages before creating a new template.");
-        }
-        
-        $fn =& $this->current_filename;
-        
-        // check if page already imported
-        $pageKey = $fn.((int)$pageno).$boxName;
-        if (isset($this->_importedPages[$pageKey]))
-            return $this->_importedPages[$pageKey];
-        
-        $parser =& $this->parsers[$fn];
-        $parser->setPageno($pageno);
-
-        $this->tpl++;
-        $this->tpls[$this->tpl] = array();
-        $tpl =& $this->tpls[$this->tpl];
-        $tpl['parser'] =& $parser;
-        $tpl['resources'] = $parser->getPageResources();
-        $tpl['buffer'] = $parser->getContent();
-        
-        if (!in_array($boxName, $parser->availableBoxes))
-            return $this->Error(sprintf("Unknown box: %s", $boxName));
-        $pageboxes = $parser->getPageBoxes($pageno);
-        
-        /**
-         * MediaBox
-         * CropBox: Default -> MediaBox
-         * BleedBox: Default -> CropBox
-         * TrimBox: Default -> CropBox
-         * ArtBox: Default -> CropBox
-         */
-        if (!isset($pageboxes[$boxName]) && ($boxName == "/BleedBox" || $boxName == "/TrimBox" || $boxName == "/ArtBox"))
-            $boxName = "/CropBox";
-        if (!isset($pageboxes[$boxName]) && $boxName == "/CropBox")
-            $boxName = "/MediaBox";
-        
-        if (!isset($pageboxes[$boxName]))
-            return false;
-        $this->lastUsedPageBox = $boxName;
-        
-        $box = $pageboxes[$boxName];
-        $tpl['box'] = $box;
-        
-        // To build an array that can be used by PDF_TPL::useTemplate()
-        $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl],$box);
-        // An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects()
-        $tpl['x'] = 0;
-        $tpl['y'] = 0;
-        
-        $page =& $parser->pages[$parser->pageno];
-        
-        // fix for rotated pages
-        $rotation = $parser->getPageRotation($pageno);
-        if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) {
-            $steps = $angle / 90;
-                
-            $_w = $tpl['w'];
-            $_h = $tpl['h'];
-            $tpl['w'] = $steps % 2 == 0 ? $_w : $_h;
-            $tpl['h'] = $steps % 2 == 0 ? $_h : $_w;
-            
-            if ($steps % 2 != 0) {
-                $x = $y = ($steps == 1 || $steps == -3) ? $tpl['h'] : $tpl['w'];
-            } else {
-                $x = $tpl['w'];
-                $y = $tpl['h'];
-            }
-            
-            $cx=($x/2+$tpl['box']['x'])*$this->k;
-            $cy=($y/2+$tpl['box']['y'])*$this->k;
-            
-            $angle*=-1; 
-            
-            $angle*=M_PI/180;
-            $c=cos($angle);
-            $s=sin($angle);
-            
-            $tpl['buffer'] = sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm %s Q',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy, $tpl['buffer']);
-        }
-        
-        $this->_importedPages[$pageKey] = $this->tpl;
-        
-        return $this->tpl;
-    }
-    
-    function getLastUsedPageBox() {
-        return $this->lastUsedPageBox;
-    }
-    
-    function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
-        $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values
-        $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
-        $this->_out('Q');
-        return $s;
-    }
-    
-    /**
-     * Private method, that rebuilds all needed objects of source files
-     */
-    function _putimportedobjects() {
-        if (is_array($this->parsers) && count($this->parsers) > 0) {
-            foreach($this->parsers AS $filename => $p) {
-                $this->current_parser =& $this->parsers[$filename];
-                if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) {
-                    while($n = key($this->_obj_stack[$filename])) {
-                        $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->_obj_stack[$filename][$n][1]);
-						
-                        $this->_newobj($this->_obj_stack[$filename][$n][0]);
-                        
-                        if ($nObj[0] == PDF_TYPE_STREAM) {
-							$this->pdf_write_value ($nObj);
-                        } else {
-                            $this->pdf_write_value ($nObj[1]);
-                        }
-                        
-                        $this->_out('endobj');
-                        $this->_obj_stack[$filename][$n] = null; // free memory
-                        unset($this->_obj_stack[$filename][$n]);
-                        reset($this->_obj_stack[$filename]);
-                    }
-                }
-            }
-        }
-    }
-    
-    /**
-     * Put resources
-     */
-    function _putresources() {
-        if (!is_subclass_of($this, 'TCPDF')) {
-            $this->_putfonts();
-        	$this->_putimages();
-        	$this->_putformxobjects();
-            $this->_putimportedobjects();
-            //Resource dictionary
-        	$this->offsets[2]=strlen($this->buffer);
-        	$this->_out('2 0 obj');
-        	$this->_out('<<');
-        	$this->_putresourcedict();
-        	$this->_out('>>');
-        	$this->_out('endobj');
-        	
-        } else { // TCPDF - Part
-            $this->_putextgstates();
-    		$this->_putocg();
-    		$this->_putfonts();
-    		$this->_putimages();
-    	  	$this->_putshaders();
-    	  	$this->_putformxobjects();
-            $this->_putimportedobjects();
-            //Resource dictionary
-    		$this->offsets[2]=strlen($this->buffer);
-    		$this->_out('2 0 obj');
-    		$this->_out('<<');
-    		$this->_putresourcedict();
-    		$this->_out('>>');
-    		$this->_out('endobj');
-    		$this->_putjavascript();
-    		$this->_putbookmarks();
-    		// encryption
-    		if ($this->encrypted) {
-    			$this->_newobj();
-    			$this->enc_obj_id = $this->n;
-    			$this->_out('<<');
-    			$this->_putencryption();
-    			$this->_out('>>');
-    			$this->_out('endobj');
-    		}
-        }
-    }
-    
-    /**
-     * Private Method that writes the form xobjects
-     */
-    function _putformxobjects() {
-        $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
-	    reset($this->tpls);
-        foreach($this->tpls AS $tplidx => $tpl) {
-            $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
-    		$this->_newobj();
-    		$cN = $this->n; // TCPDF/Protection: rem current "n"
-    		
-    		$this->tpls[$tplidx]['n'] = $this->n;
-    		$this->_out('<<'.$filter.'/Type /XObject');
-            $this->_out('/Subtype /Form');
-            $this->_out('/FormType 1');
-            
-            $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',
-                ($tpl['x'] + (isset($tpl['box']['x'])?$tpl['box']['x']:0))*$this->k,
-                ($tpl['h'] + (isset($tpl['box']['y'])?$tpl['box']['y']:0) - $tpl['y'])*$this->k,
-                ($tpl['w'] + (isset($tpl['box']['x'])?$tpl['box']['x']:0))*$this->k,
-                ($tpl['h'] + (isset($tpl['box']['y'])?$tpl['box']['y']:0) - $tpl['y']-$tpl['h'])*$this->k)
-            );
-            
-            if (isset($tpl['box']))
-                $this->_out(sprintf('/Matrix [1 0 0 1 %.5f %.5f]',-$tpl['box']['x']*$this->k, -$tpl['box']['y']*$this->k));
-            
-            $this->_out('/Resources ');
-
-            if (isset($tpl['resources'])) {
-                $this->current_parser =& $tpl['parser'];
-                $this->pdf_write_value($tpl['resources']); // "n" will be changed
-            } else {
-                $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
-            	if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
-                	$this->_out('/Font <<');
-                    foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
-                		$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
-                	$this->_out('>>');
-                }
-            	if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || 
-            	   isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
-            	{
-                    $this->_out('/XObject <<');
-                    if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
-                        foreach($this->_res['tpl'][$tplidx]['images'] as $image)
-                  			$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
-                    }
-                    if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
-                        foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
-                            $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
-                    }
-                    $this->_out('>>');
-            	}
-            	$this->_out('>>');
-            }
-
-            $nN = $this->n; // TCPDF: rem new "n"
-            $this->n = $cN; // TCPDF: reset to current "n"
-            $this->_out('/Length '.strlen($p).' >>');
-    		$this->_putstream($p);
-    		$this->_out('endobj');
-    		$this->n = $nN; // TCPDF: reset to new "n"
-        }
-    }
-
-    /**
-     * Rewritten to handle existing own defined objects
-     */
-    function _newobj($obj_id=false,$onlynewobj=false) {
-        if (!$obj_id) {
-            $obj_id = ++$this->n;
-        }
-
-    	//Begin a new object
-        if (!$onlynewobj) {
-            $this->offsets[$obj_id] = strlen($this->buffer);
-            $this->_out($obj_id.' 0 obj');
-            $this->_current_obj_id = $obj_id; // for later use with encryption
-        }
-    }
-
-    /**
-     * Writes a value
-     * Needed to rebuild the source document
-     *
-     * @param mixed $value A PDF-Value. Structure of values see cases in this method
-     */
-    function pdf_write_value(&$value)
-    {
-        if (is_subclass_of($this, 'TCPDF')) {
-            parent::pdf_write_value($value);
-        }
-        
-        switch ($value[0]) {
-
-    		case PDF_TYPE_NUMERIC :
-    		case PDF_TYPE_TOKEN :
-    		case PDF_TYPE_REAL :
-                // A numeric value or a token.
-    			// Simply output them
-                $this->_out($value[1]." ", false);
-    			break;
-
-    		case PDF_TYPE_ARRAY :
-
-    			// An array. Output the proper
-    			// structure and move on.
-
-    			$this->_out("[",false);
-                for ($i = 0; $i < count($value[1]); $i++) {
-    				$this->pdf_write_value($value[1][$i]);
-    			}
-
-    			$this->_out("]");
-    			break;
-
-    		case PDF_TYPE_DICTIONARY :
-
-    			// A dictionary.
-    			$this->_out("<<",false);
-
-    			reset ($value[1]);
-
-    			while (list($k, $v) = each($value[1])) {
-    				$this->_out($k . " ",false);
-    				$this->pdf_write_value($v);
-    			}
-
-    			$this->_out(">>");
-    			break;
-
-    		case PDF_TYPE_OBJREF :
-
-    			// An indirect object reference
-    			// Fill the object stack if needed
-    			$cpfn =& $this->current_parser->filename;
-    			if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) {
-                    $this->_newobj(false,true);
-                    $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
-                    $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!!
-                }
-                $objid = $this->_don_obj_stack[$cpfn][$value[1]][0];
-
-    			$this->_out("{$objid} 0 R");
-    			break;
-
-    		case PDF_TYPE_STRING :
-
-    			// A string.
-                $this->_out('('.$value[1].')');
-
-    			break;
-
-    		case PDF_TYPE_STREAM :
-
-    			// A stream. First, output the
-    			// stream dictionary, then the
-    			// stream data itself.
-                $this->pdf_write_value($value[1]);
-    			$this->_out("stream");
-    			$this->_out($value[2][1]);
-    			$this->_out("endstream");
-    			break;
-            case PDF_TYPE_HEX :
-            
-                $this->_out("<".$value[1].">");
-                break;
-
-            case PDF_TYPE_BOOLEAN :
-    		    $this->_out($value[1] ? 'true ' : 'false ', false);
-    		    break;
-            
-    		case PDF_TYPE_NULL :
-                // The null object.
-
-    			$this->_out("null");
-    			break;
-    	}
-    }
-    
-    
-    /**
-     * Modified so not each call will add a newline to the output.
-     */
-    function _out($s, $ln=true) {
-        //Add a line to the document
-        if ($this->state==2) {
-            if (!$this->_intpl) {
-                if (is_subclass_of($this, 'TCPDF') && isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
-					// puts data before page footer
-					$page = substr($this->pages[$this->page], 0, -$this->footerlen[$this->page]);
-					$footer = substr($this->pages[$this->page], -$this->footerlen[$this->page]);
-					$this->pages[$this->page] = $page." ".$s."\n".$footer;
-				} else {
-                    $this->pages[$this->page] .= $s.($ln == true ? "\n" : '');
-                }
-            } else
-                $this->tpls[$this->tpl]['buffer'] .= $s.($ln == true ? "\n" : '');
-        } else {
-	 	    $this->buffer.=$s.($ln == true ? "\n" : '');
-        }
-    }
-
-    /**
-     * rewritten to close opened parsers
-     *
-     */
-    function _enddoc() {
-        parent::_enddoc();
-        $this->_closeParsers();
-    }
-    
-    /**
-     * close all files opened by parsers
-     */
-    function _closeParsers() {
-        if ($this->state > 2 && count($this->parsers) > 0) {
-          	foreach ($this->parsers as $k => $_){
-            	$this->parsers[$k]->closeFile();
-            	$this->parsers[$k] = null;
-            	unset($this->parsers[$k]);
-            }
-            return true;
-        }
-        return false;
-    }
-
+<?php
+//
+//  FPDI - Version 1.2.1
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+define('FPDI_VERSION','1.2.1');
+
+// Check for TCPDF and remap TCPDF to FPDF
+if (class_exists('TCPDF')) {
+    require_once('fpdi2tcpdf_bridge.php');
+}
+
+require_once("fpdf_tpl.php");
+require_once("fpdi_pdf_parser.php");
+
+
+class FPDI extends FPDF_TPL {
+    /**
+     * Actual filename
+     * @var string
+     */
+    var $current_filename;
+
+    /**
+     * Parser-Objects
+     * @var array
+     */
+    var $parsers;
+    
+    /**
+     * Current parser
+     * @var object
+     */
+    var $current_parser;
+    
+    /**
+     * object stack
+     * @var array
+     */
+    var $_obj_stack;
+    
+    /**
+     * done object stack
+     * @var array
+     */
+    var $_don_obj_stack;
+
+    /**
+     * Current Object Id.
+     * @var integer
+     */
+    var $_current_obj_id;
+    
+    /**
+     * The name of the last imported page box
+     * @var string
+     */
+    var $lastUsedPageBox;
+    
+    var $_importedPages = array();
+    
+    
+    /**
+     * Set a source-file
+     *
+     * @param string $filename a valid filename
+     * @return int number of available pages
+     */
+    function setSourceFile($filename) {
+        $this->current_filename = $filename;
+        $fn =& $this->current_filename;
+
+        if (!isset($this->parsers[$fn]))
+            $this->parsers[$fn] =& new fpdi_pdf_parser($fn,$this);
+        $this->current_parser =& $this->parsers[$fn];
+        
+        return $this->parsers[$fn]->getPageCount();
+    }
+    
+    /**
+     * Import a page
+     *
+     * @param int $pageno pagenumber
+     * @return int Index of imported page - to use with fpdf_tpl::useTemplate()
+     */
+    function importPage($pageno, $boxName='/CropBox') {
+        if ($this->_intpl) {
+            return $this->error("Please import the desired pages before creating a new template.");
+        }
+        
+        $fn =& $this->current_filename;
+        
+        // check if page already imported
+        $pageKey = $fn.((int)$pageno).$boxName;
+        if (isset($this->_importedPages[$pageKey]))
+            return $this->_importedPages[$pageKey];
+        
+        $parser =& $this->parsers[$fn];
+        $parser->setPageno($pageno);
+
+        $this->tpl++;
+        $this->tpls[$this->tpl] = array();
+        $tpl =& $this->tpls[$this->tpl];
+        $tpl['parser'] =& $parser;
+        $tpl['resources'] = $parser->getPageResources();
+        $tpl['buffer'] = $parser->getContent();
+        
+        if (!in_array($boxName, $parser->availableBoxes))
+            return $this->Error(sprintf("Unknown box: %s", $boxName));
+        $pageboxes = $parser->getPageBoxes($pageno);
+        
+        /**
+         * MediaBox
+         * CropBox: Default -> MediaBox
+         * BleedBox: Default -> CropBox
+         * TrimBox: Default -> CropBox
+         * ArtBox: Default -> CropBox
+         */
+        if (!isset($pageboxes[$boxName]) && ($boxName == "/BleedBox" || $boxName == "/TrimBox" || $boxName == "/ArtBox"))
+            $boxName = "/CropBox";
+        if (!isset($pageboxes[$boxName]) && $boxName == "/CropBox")
+            $boxName = "/MediaBox";
+        
+        if (!isset($pageboxes[$boxName]))
+            return false;
+        $this->lastUsedPageBox = $boxName;
+        
+        $box = $pageboxes[$boxName];
+        $tpl['box'] = $box;
+        
+        // To build an array that can be used by PDF_TPL::useTemplate()
+        $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl],$box);
+        // An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects()
+        $tpl['x'] = 0;
+        $tpl['y'] = 0;
+        
+        $page =& $parser->pages[$parser->pageno];
+        
+        // fix for rotated pages
+        $rotation = $parser->getPageRotation($pageno);
+        if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) {
+            $steps = $angle / 90;
+                
+            $_w = $tpl['w'];
+            $_h = $tpl['h'];
+            $tpl['w'] = $steps % 2 == 0 ? $_w : $_h;
+            $tpl['h'] = $steps % 2 == 0 ? $_h : $_w;
+            
+            if ($steps % 2 != 0) {
+                $x = $y = ($steps == 1 || $steps == -3) ? $tpl['h'] : $tpl['w'];
+            } else {
+                $x = $tpl['w'];
+                $y = $tpl['h'];
+            }
+            
+            $cx=($x/2+$tpl['box']['x'])*$this->k;
+            $cy=($y/2+$tpl['box']['y'])*$this->k;
+            
+            $angle*=-1; 
+            
+            $angle*=M_PI/180;
+            $c=cos($angle);
+            $s=sin($angle);
+            
+            $tpl['buffer'] = sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm %s Q',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy, $tpl['buffer']);
+        }
+        
+        $this->_importedPages[$pageKey] = $this->tpl;
+        
+        return $this->tpl;
+    }
+    
+    function getLastUsedPageBox() {
+        return $this->lastUsedPageBox;
+    }
+    
+    function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
+        $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values
+        $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
+        $this->_out('Q');
+        return $s;
+    }
+    
+    /**
+     * Private method, that rebuilds all needed objects of source files
+     */
+    function _putimportedobjects() {
+        if (is_array($this->parsers) && count($this->parsers) > 0) {
+            foreach($this->parsers AS $filename => $p) {
+                $this->current_parser =& $this->parsers[$filename];
+                if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) {
+                    while($n = key($this->_obj_stack[$filename])) {
+                        $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->_obj_stack[$filename][$n][1]);
+						
+                        $this->_newobj($this->_obj_stack[$filename][$n][0]);
+                        
+                        if ($nObj[0] == PDF_TYPE_STREAM) {
+							$this->pdf_write_value ($nObj);
+                        } else {
+                            $this->pdf_write_value ($nObj[1]);
+                        }
+                        
+                        $this->_out('endobj');
+                        $this->_obj_stack[$filename][$n] = null; // free memory
+                        unset($this->_obj_stack[$filename][$n]);
+                        reset($this->_obj_stack[$filename]);
+                    }
+                }
+            }
+        }
+    }
+    
+    /**
+     * Put resources
+     */
+    function _putresources() {
+        if (!is_subclass_of($this, 'TCPDF')) {
+            $this->_putfonts();
+        	$this->_putimages();
+        	$this->_putformxobjects();
+            $this->_putimportedobjects();
+            //Resource dictionary
+        	$this->offsets[2]=strlen($this->buffer);
+        	$this->_out('2 0 obj');
+        	$this->_out('<<');
+        	$this->_putresourcedict();
+        	$this->_out('>>');
+        	$this->_out('endobj');
+        	
+        } else { // TCPDF - Part
+            $this->_putextgstates();
+    		$this->_putocg();
+    		$this->_putfonts();
+    		$this->_putimages();
+    	  	$this->_putshaders();
+    	  	$this->_putformxobjects();
+            $this->_putimportedobjects();
+            //Resource dictionary
+    		$this->offsets[2]=strlen($this->buffer);
+    		$this->_out('2 0 obj');
+    		$this->_out('<<');
+    		$this->_putresourcedict();
+    		$this->_out('>>');
+    		$this->_out('endobj');
+    		$this->_putjavascript();
+    		$this->_putbookmarks();
+    		// encryption
+    		if ($this->encrypted) {
+    			$this->_newobj();
+    			$this->enc_obj_id = $this->n;
+    			$this->_out('<<');
+    			$this->_putencryption();
+    			$this->_out('>>');
+    			$this->_out('endobj');
+    		}
+        }
+    }
+    
+    /**
+     * Private Method that writes the form xobjects
+     */
+    function _putformxobjects() {
+        $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+	    reset($this->tpls);
+        foreach($this->tpls AS $tplidx => $tpl) {
+            $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
+    		$this->_newobj();
+    		$cN = $this->n; // TCPDF/Protection: rem current "n"
+    		
+    		$this->tpls[$tplidx]['n'] = $this->n;
+    		$this->_out('<<'.$filter.'/Type /XObject');
+            $this->_out('/Subtype /Form');
+            $this->_out('/FormType 1');
+            
+            $this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',
+                ($tpl['x'] + (isset($tpl['box']['x'])?$tpl['box']['x']:0))*$this->k,
+                ($tpl['h'] + (isset($tpl['box']['y'])?$tpl['box']['y']:0) - $tpl['y'])*$this->k,
+                ($tpl['w'] + (isset($tpl['box']['x'])?$tpl['box']['x']:0))*$this->k,
+                ($tpl['h'] + (isset($tpl['box']['y'])?$tpl['box']['y']:0) - $tpl['y']-$tpl['h'])*$this->k)
+            );
+            
+            if (isset($tpl['box']))
+                $this->_out(sprintf('/Matrix [1 0 0 1 %.5f %.5f]',-$tpl['box']['x']*$this->k, -$tpl['box']['y']*$this->k));
+            
+            $this->_out('/Resources ');
+
+            if (isset($tpl['resources'])) {
+                $this->current_parser =& $tpl['parser'];
+                $this->pdf_write_value($tpl['resources']); // "n" will be changed
+            } else {
+                $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
+            	if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
+                	$this->_out('/Font <<');
+                    foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
+                		$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
+                	$this->_out('>>');
+                }
+            	if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || 
+            	   isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
+            	{
+                    $this->_out('/XObject <<');
+                    if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
+                        foreach($this->_res['tpl'][$tplidx]['images'] as $image)
+                  			$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
+                    }
+                    if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
+                        foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
+                            $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
+                    }
+                    $this->_out('>>');
+            	}
+            	$this->_out('>>');
+            }
+
+            $nN = $this->n; // TCPDF: rem new "n"
+            $this->n = $cN; // TCPDF: reset to current "n"
+            $this->_out('/Length '.strlen($p).' >>');
+    		$this->_putstream($p);
+    		$this->_out('endobj');
+    		$this->n = $nN; // TCPDF: reset to new "n"
+        }
+    }
+
+    /**
+     * Rewritten to handle existing own defined objects
+     */
+    function _newobj($obj_id=false,$onlynewobj=false) {
+        if (!$obj_id) {
+            $obj_id = ++$this->n;
+        }
+
+    	//Begin a new object
+        if (!$onlynewobj) {
+            $this->offsets[$obj_id] = strlen($this->buffer);
+            $this->_out($obj_id.' 0 obj');
+            $this->_current_obj_id = $obj_id; // for later use with encryption
+        }
+    }
+
+    /**
+     * Writes a value
+     * Needed to rebuild the source document
+     *
+     * @param mixed $value A PDF-Value. Structure of values see cases in this method
+     */
+    function pdf_write_value(&$value)
+    {
+        if (is_subclass_of($this, 'TCPDF')) {
+            parent::pdf_write_value($value);
+        }
+        
+        switch ($value[0]) {
+
+    		case PDF_TYPE_NUMERIC :
+    		case PDF_TYPE_TOKEN :
+    		case PDF_TYPE_REAL :
+                // A numeric value or a token.
+    			// Simply output them
+                $this->_out($value[1]." ", false);
+    			break;
+
+    		case PDF_TYPE_ARRAY :
+
+    			// An array. Output the proper
+    			// structure and move on.
+
+    			$this->_out("[",false);
+                for ($i = 0; $i < count($value[1]); $i++) {
+    				$this->pdf_write_value($value[1][$i]);
+    			}
+
+    			$this->_out("]");
+    			break;
+
+    		case PDF_TYPE_DICTIONARY :
+
+    			// A dictionary.
+    			$this->_out("<<",false);
+
+    			reset ($value[1]);
+
+    			while (list($k, $v) = each($value[1])) {
+    				$this->_out($k . " ",false);
+    				$this->pdf_write_value($v);
+    			}
+
+    			$this->_out(">>");
+    			break;
+
+    		case PDF_TYPE_OBJREF :
+
+    			// An indirect object reference
+    			// Fill the object stack if needed
+    			$cpfn =& $this->current_parser->filename;
+    			if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) {
+                    $this->_newobj(false,true);
+                    $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
+                    $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!!
+                }
+                $objid = $this->_don_obj_stack[$cpfn][$value[1]][0];
+
+    			$this->_out("{$objid} 0 R");
+    			break;
+
+    		case PDF_TYPE_STRING :
+
+    			// A string.
+                $this->_out('('.$value[1].')');
+
+    			break;
+
+    		case PDF_TYPE_STREAM :
+
+    			// A stream. First, output the
+    			// stream dictionary, then the
+    			// stream data itself.
+                $this->pdf_write_value($value[1]);
+    			$this->_out("stream");
+    			$this->_out($value[2][1]);
+    			$this->_out("endstream");
+    			break;
+            case PDF_TYPE_HEX :
+            
+                $this->_out("<".$value[1].">");
+                break;
+
+            case PDF_TYPE_BOOLEAN :
+    		    $this->_out($value[1] ? 'true ' : 'false ', false);
+    		    break;
+            
+    		case PDF_TYPE_NULL :
+                // The null object.
+
+    			$this->_out("null");
+    			break;
+    	}
+    }
+    
+    
+    /**
+     * Modified so not each call will add a newline to the output.
+     */
+    function _out($s, $ln=true) {
+        //Add a line to the document
+        if ($this->state==2) {
+            if (!$this->_intpl) {
+                if (is_subclass_of($this, 'TCPDF') && isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
+					// puts data before page footer
+					$page = substr($this->pages[$this->page], 0, -$this->footerlen[$this->page]);
+					$footer = substr($this->pages[$this->page], -$this->footerlen[$this->page]);
+					$this->pages[$this->page] = $page." ".$s."\n".$footer;
+				} else {
+                    $this->pages[$this->page] .= $s.($ln == true ? "\n" : '');
+                }
+            } else
+                $this->tpls[$this->tpl]['buffer'] .= $s.($ln == true ? "\n" : '');
+        } else {
+	 	    $this->buffer.=$s.($ln == true ? "\n" : '');
+        }
+    }
+
+    /**
+     * rewritten to close opened parsers
+     *
+     */
+    function _enddoc() {
+        parent::_enddoc();
+        $this->_closeParsers();
+    }
+    
+    /**
+     * close all files opened by parsers
+     */
+    function _closeParsers() {
+        if ($this->state > 2 && count($this->parsers) > 0) {
+          	foreach ($this->parsers as $k => $_){
+            	$this->parsers[$k]->closeFile();
+            	$this->parsers[$k] = null;
+            	unset($this->parsers[$k]);
+            }
+            return true;
+        }
+        return false;
+    }
+
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/fpdi_pdf_parser.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/fpdi_pdf_parser.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/fpdi_pdf_parser.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,380 +1,380 @@
-<?php
-//
-//  FPDI - Version 1.2.1
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-require_once("pdf_parser.php");
-
-class fpdi_pdf_parser extends pdf_parser {
-
-    /**
-     * Pages
-     * Index beginns at 0
-     *
-     * @var array
-     */
-    var $pages;
-    
-    /**
-     * Page count
-     * @var integer
-     */
-    var $page_count;
-    
-    /**
-     * actual page number
-     * @var integer
-     */
-    var $pageno;
-    
-    /**
-     * PDF Version of imported Document
-     * @var string
-     */
-    var $pdfVersion;
-    
-    /**
-     * FPDI Reference
-     * @var object
-     */
-    var $fpdi;
-    
-    /**
-     * Available BoxTypes
-     *
-     * @var array
-     */
-    var $availableBoxes = array("/MediaBox","/CropBox","/BleedBox","/TrimBox","/ArtBox");
-        
-    /**
-     * Constructor
-     *
-     * @param string $filename  Source-Filename
-     * @param object $fpdi      Object of type fpdi
-     */
-    function fpdi_pdf_parser($filename,&$fpdi) {
-        $this->fpdi =& $fpdi;
-		$this->filename = $filename;
-		
-        parent::pdf_parser($filename);
-
-        // resolve Pages-Dictonary
-        $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
-
-        // Read pages
-        $this->read_pages($this->c, $pages, $this->pages);
-        
-        // count pages;
-        $this->page_count = count($this->pages);
-    }
-    
-    /**
-     * Overwrite parent::error()
-     *
-     * @param string $msg  Error-Message
-     */
-    function error($msg) {
-    	$this->fpdi->error($msg);	
-    }
-    
-    /**
-     * Get pagecount from sourcefile
-     *
-     * @return int
-     */
-    function getPageCount() {
-        return $this->page_count;
-    }
-
-
-    /**
-     * Set pageno
-     *
-     * @param int $pageno Pagenumber to use
-     */
-    function setPageno($pageno) {
-        $pageno = ((int) $pageno) - 1;
-
-        if ($pageno < 0 || $pageno >= $this->getPageCount()) {
-            $this->fpdi->error("Pagenumber is wrong!");
-        }
-
-        $this->pageno = $pageno;
-    }
-    
-    /**
-     * Get page-resources from current page
-     *
-     * @return array
-     */
-    function getPageResources() {
-        return $this->_getPageResources($this->pages[$this->pageno]);
-    }
-    
-    /**
-     * Get page-resources from /Page
-     *
-     * @param array $obj Array of pdf-data
-     */
-    function _getPageResources ($obj) { // $obj = /Page
-    	$obj = $this->pdf_resolve_object($this->c, $obj);
-
-        // If the current object has a resources
-    	// dictionary associated with it, we use
-    	// it. Otherwise, we move back to its
-    	// parent object.
-        if (isset ($obj[1][1]['/Resources'])) {
-    		$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
-    		if ($res[0] == PDF_TYPE_OBJECT)
-                return $res[1];
-            return $res;
-    	} else {
-    		if (!isset ($obj[1][1]['/Parent'])) {
-    			return false;
-    		} else {
-                $res = $this->_getPageResources($obj[1][1]['/Parent']);
-                if ($res[0] == PDF_TYPE_OBJECT)
-                    return $res[1];
-                return $res;
-    		}
-    	}
-    }
-
-
-    /**
-     * Get content of current page
-     *
-     * If more /Contents is an array, the streams are concated
-     *
-     * @return string
-     */
-    function getContent() {
-        $buffer = "";
-        
-        if (isset($this->pages[$this->pageno][1][1]['/Contents'])) {
-            $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
-            foreach($contents AS $tmp_content) {
-                $buffer .= $this->_rebuildContentStream($tmp_content).' ';
-            }
-        }
-        
-        return $buffer;
-    }
-    
-    
-    /**
-     * Resolve all content-objects
-     *
-     * @param array $content_ref
-     * @return array
-     */
-    function _getPageContent($content_ref) {
-        $contents = array();
-        
-        if ($content_ref[0] == PDF_TYPE_OBJREF) {
-            $content = $this->pdf_resolve_object($this->c, $content_ref);
-            if ($content[1][0] == PDF_TYPE_ARRAY) {
-                $contents = $this->_getPageContent($content[1]);
-            } else {
-                $contents[] = $content;
-            }
-        } else if ($content_ref[0] == PDF_TYPE_ARRAY) {
-            foreach ($content_ref[1] AS $tmp_content_ref) {
-                $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref));
-            }
-        }
-
-        return $contents;
-    }
-
-
-    /**
-     * Rebuild content-streams
-     *
-     * @param array $obj
-     * @return string
-     */
-    function _rebuildContentStream($obj) {
-        $filters = array();
-        
-        if (isset($obj[1][1]['/Filter'])) {
-            $_filter = $obj[1][1]['/Filter'];
-
-            if ($_filter[0] == PDF_TYPE_TOKEN) {
-                $filters[] = $_filter;
-            } else if ($_filter[0] == PDF_TYPE_ARRAY) {
-                $filters = $_filter[1];
-            }
-        }
-
-        $stream = $obj[2][1];
-
-        foreach ($filters AS $_filter) {
-            switch ($_filter[1]) {
-                case "/FlateDecode":
-                    if (function_exists('gzuncompress')) {
-                        $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';                        
-                    } else {
-                        $this->fpdi->error(sprintf("To handle %s filter, please compile php with zlib support.",$_filter[1]));
-                    }
-                    if ($stream === false) {
-                        $this->fpdi->error("Error while decompressing stream.");
-                    }
-                break;
-                case null:
-                    $stream = $stream;
-                break;
-                default:
-                    if (preg_match("/^\/[a-z85]*$/i", $_filter[1], $filterName) && @include_once('decoders'.$_filter[1].'.php')) {
-                        $filterName = substr($_filter[1],1);
-                        if (class_exists($filterName)) {
-    	                	$decoder =& new $filterName($this->fpdi);
-    	                    $stream = $decoder->decode(trim($stream));
-                        } else {
-                        	$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
-                        }
-                    } else {
-                        $this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
-                    }
-            }
-        }
-        
-        return $stream;
-    }
-    
-    
-    /**
-     * Get a Box from a page
-     * Arrayformat is same as used by fpdf_tpl
-     *
-     * @param array $page a /Page
-     * @param string $box_index Type of Box @see $availableBoxes
-     * @return array
-     */
-    function getPageBox($page, $box_index) {
-        $page = $this->pdf_resolve_object($this->c,$page);
-        $box = null;
-        if (isset($page[1][1][$box_index]))
-            $box =& $page[1][1][$box_index];
-        
-        if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
-            $tmp_box = $this->pdf_resolve_object($this->c,$box);
-            $box = $tmp_box[1];
-        }
-            
-        if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
-            $b =& $box[1];
-            return array("x" => $b[0][1]/$this->fpdi->k,
-                         "y" => $b[1][1]/$this->fpdi->k,
-                         "w" => abs($b[0][1]-$b[2][1])/$this->fpdi->k,
-                         "h" => abs($b[1][1]-$b[3][1])/$this->fpdi->k);
-        } else if (!isset ($page[1][1]['/Parent'])) {
-            return false;
-        } else {
-            return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index);
-        }
-    }
-
-    function getPageBoxes($pageno) {
-        return $this->_getPageBoxes($this->pages[$pageno-1]);
-    }
-    
-    /**
-     * Get all Boxes from /Page
-     *
-     * @param array a /Page
-     * @return array
-     */
-    function _getPageBoxes($page) {
-        $boxes = array();
-
-        foreach($this->availableBoxes AS $box) {
-            if ($_box = $this->getPageBox($page,$box)) {
-                $boxes[$box] = $_box;
-            }
-        }
-
-        return $boxes;
-    }
-
-    /**
-     * Get the page rotation by pageno
-     *
-     * @param integer $pageno
-     * @return array
-     */
-    function getPageRotation($pageno) {
-        return $this->_getPageRotation($this->pages[$pageno-1]);
-    }
-    
-    function _getPageRotation ($obj) { // $obj = /Page
-    	$obj = $this->pdf_resolve_object($this->c, $obj);
-    	if (isset ($obj[1][1]['/Rotate'])) {
-    		$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']);
-    		if ($res[0] == PDF_TYPE_OBJECT)
-                return $res[1];
-            return $res;
-    	} else {
-    		if (!isset ($obj[1][1]['/Parent'])) {
-    			return false;
-    		} else {
-                $res = $this->_getPageRotation($obj[1][1]['/Parent']);
-                if ($res[0] == PDF_TYPE_OBJECT)
-                    return $res[1];
-                return $res;
-    		}
-    	}
-    }
-    
-    /**
-     * Read all /Page(es)
-     *
-     * @param object pdf_context
-     * @param array /Pages
-     * @param array the result-array
-     */
-    function read_pages (&$c, &$pages, &$result) {
-        // Get the kids dictionary
-    	$kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
-
-        if (!is_array($kids))
-            $this->fpdi->Error("Cannot find /Kids in current /Page-Dictionary");
-        foreach ($kids[1] as $v) {
-    		$pg = $this->pdf_resolve_object ($c, $v);
-            if ($pg[1][1]['/Type'][1] === '/Pages') {
-                // If one of the kids is an embedded
-    			// /Pages array, resolve it as well.
-                $this->read_pages ($c, $pg, $result);
-    		} else {
-    			$result[] = $pg;
-    		}
-    	}
-    }
-
-    
-    
-    /**
-     * Get PDF-Version
-     *
-     * And reset the PDF Version used in FPDI if needed
-     */
-    function getPDFVersion() {
-        parent::getPDFVersion();
-        $this->fpdi->PDFVersion = max($this->fpdi->PDFVersion, $this->pdfVersion);
-    }
-    
+<?php
+//
+//  FPDI - Version 1.2.1
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+require_once("pdf_parser.php");
+
+class fpdi_pdf_parser extends pdf_parser {
+
+    /**
+     * Pages
+     * Index beginns at 0
+     *
+     * @var array
+     */
+    var $pages;
+    
+    /**
+     * Page count
+     * @var integer
+     */
+    var $page_count;
+    
+    /**
+     * actual page number
+     * @var integer
+     */
+    var $pageno;
+    
+    /**
+     * PDF Version of imported Document
+     * @var string
+     */
+    var $pdfVersion;
+    
+    /**
+     * FPDI Reference
+     * @var object
+     */
+    var $fpdi;
+    
+    /**
+     * Available BoxTypes
+     *
+     * @var array
+     */
+    var $availableBoxes = array("/MediaBox","/CropBox","/BleedBox","/TrimBox","/ArtBox");
+        
+    /**
+     * Constructor
+     *
+     * @param string $filename  Source-Filename
+     * @param object $fpdi      Object of type fpdi
+     */
+    function fpdi_pdf_parser($filename,&$fpdi) {
+        $this->fpdi =& $fpdi;
+		$this->filename = $filename;
+		
+        parent::pdf_parser($filename);
+
+        // resolve Pages-Dictonary
+        $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
+
+        // Read pages
+        $this->read_pages($this->c, $pages, $this->pages);
+        
+        // count pages;
+        $this->page_count = count($this->pages);
+    }
+    
+    /**
+     * Overwrite parent::error()
+     *
+     * @param string $msg  Error-Message
+     */
+    function error($msg) {
+    	$this->fpdi->error($msg);	
+    }
+    
+    /**
+     * Get pagecount from sourcefile
+     *
+     * @return int
+     */
+    function getPageCount() {
+        return $this->page_count;
+    }
+
+
+    /**
+     * Set pageno
+     *
+     * @param int $pageno Pagenumber to use
+     */
+    function setPageno($pageno) {
+        $pageno = ((int) $pageno) - 1;
+
+        if ($pageno < 0 || $pageno >= $this->getPageCount()) {
+            $this->fpdi->error("Pagenumber is wrong!");
+        }
+
+        $this->pageno = $pageno;
+    }
+    
+    /**
+     * Get page-resources from current page
+     *
+     * @return array
+     */
+    function getPageResources() {
+        return $this->_getPageResources($this->pages[$this->pageno]);
+    }
+    
+    /**
+     * Get page-resources from /Page
+     *
+     * @param array $obj Array of pdf-data
+     */
+    function _getPageResources ($obj) { // $obj = /Page
+    	$obj = $this->pdf_resolve_object($this->c, $obj);
+
+        // If the current object has a resources
+    	// dictionary associated with it, we use
+    	// it. Otherwise, we move back to its
+    	// parent object.
+        if (isset ($obj[1][1]['/Resources'])) {
+    		$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
+    		if ($res[0] == PDF_TYPE_OBJECT)
+                return $res[1];
+            return $res;
+    	} else {
+    		if (!isset ($obj[1][1]['/Parent'])) {
+    			return false;
+    		} else {
+                $res = $this->_getPageResources($obj[1][1]['/Parent']);
+                if ($res[0] == PDF_TYPE_OBJECT)
+                    return $res[1];
+                return $res;
+    		}
+    	}
+    }
+
+
+    /**
+     * Get content of current page
+     *
+     * If more /Contents is an array, the streams are concated
+     *
+     * @return string
+     */
+    function getContent() {
+        $buffer = "";
+        
+        if (isset($this->pages[$this->pageno][1][1]['/Contents'])) {
+            $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
+            foreach($contents AS $tmp_content) {
+                $buffer .= $this->_rebuildContentStream($tmp_content).' ';
+            }
+        }
+        
+        return $buffer;
+    }
+    
+    
+    /**
+     * Resolve all content-objects
+     *
+     * @param array $content_ref
+     * @return array
+     */
+    function _getPageContent($content_ref) {
+        $contents = array();
+        
+        if ($content_ref[0] == PDF_TYPE_OBJREF) {
+            $content = $this->pdf_resolve_object($this->c, $content_ref);
+            if ($content[1][0] == PDF_TYPE_ARRAY) {
+                $contents = $this->_getPageContent($content[1]);
+            } else {
+                $contents[] = $content;
+            }
+        } else if ($content_ref[0] == PDF_TYPE_ARRAY) {
+            foreach ($content_ref[1] AS $tmp_content_ref) {
+                $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref));
+            }
+        }
+
+        return $contents;
+    }
+
+
+    /**
+     * Rebuild content-streams
+     *
+     * @param array $obj
+     * @return string
+     */
+    function _rebuildContentStream($obj) {
+        $filters = array();
+        
+        if (isset($obj[1][1]['/Filter'])) {
+            $_filter = $obj[1][1]['/Filter'];
+
+            if ($_filter[0] == PDF_TYPE_TOKEN) {
+                $filters[] = $_filter;
+            } else if ($_filter[0] == PDF_TYPE_ARRAY) {
+                $filters = $_filter[1];
+            }
+        }
+
+        $stream = $obj[2][1];
+
+        foreach ($filters AS $_filter) {
+            switch ($_filter[1]) {
+                case "/FlateDecode":
+                    if (function_exists('gzuncompress')) {
+                        $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';                        
+                    } else {
+                        $this->fpdi->error(sprintf("To handle %s filter, please compile php with zlib support.",$_filter[1]));
+                    }
+                    if ($stream === false) {
+                        $this->fpdi->error("Error while decompressing stream.");
+                    }
+                break;
+                case null:
+                    $stream = $stream;
+                break;
+                default:
+                    if (preg_match("/^\/[a-z85]*$/i", $_filter[1], $filterName) && @include_once('decoders'.$_filter[1].'.php')) {
+                        $filterName = substr($_filter[1],1);
+                        if (class_exists($filterName)) {
+    	                	$decoder =& new $filterName($this->fpdi);
+    	                    $stream = $decoder->decode(trim($stream));
+                        } else {
+                        	$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
+                        }
+                    } else {
+                        $this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
+                    }
+            }
+        }
+        
+        return $stream;
+    }
+    
+    
+    /**
+     * Get a Box from a page
+     * Arrayformat is same as used by fpdf_tpl
+     *
+     * @param array $page a /Page
+     * @param string $box_index Type of Box @see $availableBoxes
+     * @return array
+     */
+    function getPageBox($page, $box_index) {
+        $page = $this->pdf_resolve_object($this->c,$page);
+        $box = null;
+        if (isset($page[1][1][$box_index]))
+            $box =& $page[1][1][$box_index];
+        
+        if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
+            $tmp_box = $this->pdf_resolve_object($this->c,$box);
+            $box = $tmp_box[1];
+        }
+            
+        if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
+            $b =& $box[1];
+            return array("x" => $b[0][1]/$this->fpdi->k,
+                         "y" => $b[1][1]/$this->fpdi->k,
+                         "w" => abs($b[0][1]-$b[2][1])/$this->fpdi->k,
+                         "h" => abs($b[1][1]-$b[3][1])/$this->fpdi->k);
+        } else if (!isset ($page[1][1]['/Parent'])) {
+            return false;
+        } else {
+            return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index);
+        }
+    }
+
+    function getPageBoxes($pageno) {
+        return $this->_getPageBoxes($this->pages[$pageno-1]);
+    }
+    
+    /**
+     * Get all Boxes from /Page
+     *
+     * @param array a /Page
+     * @return array
+     */
+    function _getPageBoxes($page) {
+        $boxes = array();
+
+        foreach($this->availableBoxes AS $box) {
+            if ($_box = $this->getPageBox($page,$box)) {
+                $boxes[$box] = $_box;
+            }
+        }
+
+        return $boxes;
+    }
+
+    /**
+     * Get the page rotation by pageno
+     *
+     * @param integer $pageno
+     * @return array
+     */
+    function getPageRotation($pageno) {
+        return $this->_getPageRotation($this->pages[$pageno-1]);
+    }
+    
+    function _getPageRotation ($obj) { // $obj = /Page
+    	$obj = $this->pdf_resolve_object($this->c, $obj);
+    	if (isset ($obj[1][1]['/Rotate'])) {
+    		$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']);
+    		if ($res[0] == PDF_TYPE_OBJECT)
+                return $res[1];
+            return $res;
+    	} else {
+    		if (!isset ($obj[1][1]['/Parent'])) {
+    			return false;
+    		} else {
+                $res = $this->_getPageRotation($obj[1][1]['/Parent']);
+                if ($res[0] == PDF_TYPE_OBJECT)
+                    return $res[1];
+                return $res;
+    		}
+    	}
+    }
+    
+    /**
+     * Read all /Page(es)
+     *
+     * @param object pdf_context
+     * @param array /Pages
+     * @param array the result-array
+     */
+    function read_pages (&$c, &$pages, &$result) {
+        // Get the kids dictionary
+    	$kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
+
+        if (!is_array($kids))
+            $this->fpdi->Error("Cannot find /Kids in current /Page-Dictionary");
+        foreach ($kids[1] as $v) {
+    		$pg = $this->pdf_resolve_object ($c, $v);
+            if ($pg[1][1]['/Type'][1] === '/Pages') {
+                // If one of the kids is an embedded
+    			// /Pages array, resolve it as well.
+                $this->read_pages ($c, $pg, $result);
+    		} else {
+    			$result[] = $pg;
+    		}
+    	}
+    }
+
+    
+    
+    /**
+     * Get PDF-Version
+     *
+     * And reset the PDF Version used in FPDI if needed
+     */
+    function getPDFVersion() {
+        parent::getPDFVersion();
+        $this->fpdi->PDFVersion = max($this->fpdi->PDFVersion, $this->pdfVersion);
+    }
+    
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/license.txt
===================================================================
--- branches/print_dev/http/extensions/fpdf/license.txt	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/license.txt	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,6 +1,6 @@
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software to use, copy, modify, distribute, sublicense, and/or sell
-copies of the software, and to permit persons to whom the software is furnished
-to do so.
-
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software to use, copy, modify, distribute, sublicense, and/or sell
+copies of the software, and to permit persons to whom the software is furnished
+to do so.
+
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/mb_fpdi.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/mb_fpdi.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/mb_fpdi.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,529 +1,529 @@
 <?php
-
-require_once(dirname(__FILE__)."/fpdi.php");
-
-class mb_fpdi extends FPDI {
-
-    function mb_fpdi($orientation='L',$unit='mm',$format='A4') {
-        parent::FPDI($orientation,$unit,$format);
-    }	
-
-    // ====================================
-	// Image with png alpha extension
-	// ====================================
-    
-	//Private properties
-	var $tmpFiles = array();
-	
-	/*******************************************************************************
-	*                                                                              *
-	*                               Public methods                                 *
-	*                                                                              *
-	*******************************************************************************/
-	function Image($file,$x,$y,$w=0,$h=0,$type='',$link='', $isMask=false, $maskImg=0, $align='', $angle=0)
-	{
-	    //Put an image on the page
-	    if(!isset($this->images[$file]))
-	    {
-	        //First use of image, get info
-	        if($type=='')
-	        {
-	            $pos=strrpos($file,'.');
-	            if(!$pos)
-	                $this->Error('Image file has no extension and no type was specified: '.$file);
-	            $type=substr($file,$pos+1);
-	        }
-	        $type=strtolower($type);
-	        $mqr=get_magic_quotes_runtime();
-	        set_magic_quotes_runtime(0);
-	        if($type=='jpg' || $type=='jpeg')
-	            $info=$this->_parsejpg($file);
-	        elseif($type=='png'){
-	            $info=$this->_parsepng($file);
-	            if ($info=='alpha') return $this->ImagePngWithAlpha($file,$x,$y,$w,$h,$link);
-	        }
-	        else
-	        {
-	            //Allow for additional formats
-	            $mtd='_parse'.$type;
-	            if(!method_exists($this,$mtd))
-	                $this->Error('Unsupported image type: '.$type);
-	            $info=$this->$mtd($file);
-	        }
-	        set_magic_quotes_runtime($mqr);
-	        
-	        if ($isMask){
-	      $info['cs']="DeviceGray"; // try to force grayscale (instead of indexed)
-	    }
-	        $info['i']=count($this->images)+1;
-	        if ($maskImg>0) $info['masked'] = $maskImg;###
-	        $this->images[$file]=$info;
-	    }
-	    else
-	        $info=$this->images[$file];
-	    //Automatic width and height calculation if needed
-	    if($w==0 && $h==0)
-	    {
-	        //Put image at 72 dpi
-	        $w=$info['w']/$this->k;
-	        $h=$info['h']/$this->k;
-	    }
-	    if($w==0)
-	        $w=$h*$info['w']/$info['h'];
-	    if($h==0)
-	        $h=$w*$info['h']/$info['w'];
-	        
-	    $x_rot = $x;
-    	$y_rot = $y;    
-
-	    switch ($align) {
-			case 1:
-		        break;
-		    case 2:
-		        $x=$x-$w/2;
-		        break;
-		    case 3:
-		        $x=$x-$w;
-		        break;
-		    case 4:
-		        $y=$y-$h/2;
-		        break;
-		    case 5:
-		        $x=$x-$w/2;
-		        $y=$y-$h/2;
-		        break;
-		    case 6:
-		        $x=$x-$w;
-		        $y=$y-$h/2;
-		        break;
-		    case 7:
-		        $y=$y-$h;
-		        break;
-		    case 8:
-		        $x=$x-$w/2;
-		        $y=$y-$h;
-		        break;
-		    case 9:
-		        $x=$x-$w;
-		        $y=$y-$h;
-		        break;
-		    default:
-		        break;
-		}
-		    	
-	    if ($isMask) $x = $this->fwPt + 10; // embed hidden, ouside the canvas  
-
-    	if($angle!=0){ 
-      		$this->_out('q'); 
-      		$this->Rotation($angle, $x_rot, $y_rot);
-      		$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
-      		$this->_out('Q'); 
-    	}
-    	else {  $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));}
-	    
-	    #$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
-	    if($link)
-	        $this->Link($x,$y,$w,$h,$link);
-	        
-	    return $info['i'];
-	}
-	
-	// needs GD 2.x extension
-	// pixel-wise operation, not very fast
-	function ImagePngWithAlpha($file,$x,$y,$w=0,$h=0,$link='')
-	{
-	    $tmp_alpha = tempnam('.', 'mska');
-	    $this->tmpFiles[] = $tmp_alpha;
-	    $tmp_plain = tempnam('.', 'mskp');
-	    $this->tmpFiles[] = $tmp_plain;
-	    
-	    list($wpx, $hpx) = getimagesize($file);
-	    $img = imagecreatefrompng($file);
-	    $alpha_img = imagecreate( $wpx, $hpx );
-	    
-	    // generate gray scale pallete
-	    for($c=0;$c<256;$c++) ImageColorAllocate($alpha_img, $c, $c, $c);
-	    
-	    // extract alpha channel
-	    $xpx=0;
-	    while ($xpx<$wpx){
-	        $ypx = 0;
-	        while ($ypx<$hpx){
-	            $color_index = imagecolorat($img, $xpx, $ypx);
-	            $col = imagecolorsforindex($img, $color_index);
-	            imagesetpixel($alpha_img, $xpx, $ypx, $this->_gamma( (127-$col['alpha'])*255/127)  );
-	        ++$ypx;
-	        }
-	        ++$xpx;
-	    }
-	
-	    imagepng($alpha_img, $tmp_alpha);
-	    imagedestroy($alpha_img);
-	    
-	    // extract image without alpha channel
-	    $plain_img = imagecreatetruecolor ( $wpx, $hpx );
-	    imagecopy ($plain_img, $img, 0, 0, 0, 0, $wpx, $hpx );
-	    imagepng($plain_img, $tmp_plain);
-	    imagedestroy($plain_img);
-	    
-	    //first embed mask image (w, h, x, will be ignored)
-	    $maskImg = $this->Image($tmp_alpha, 0,0,0,0, 'PNG', '', true);
-	    
-	    //embed image, masked with previously embedded mask
-	    $this->Image($tmp_plain,$x,$y,$w,$h,'PNG',$link, false, $maskImg);
-	}
-	
-	function Close()
-	{
-	    parent::Close();
-	    // clean up tmp files
-	    foreach($this->tmpFiles as $tmp) @unlink($tmp);
-	}
-	
-	/*******************************************************************************
-	*                                                                              *
-	*                               Private methods                                *
-	*                                                                              *
-	*******************************************************************************/
-	function _putimages()
-	{
-	    $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
-	    reset($this->images);
-	    while(list($file,$info)=each($this->images))
-	    {
-	        $this->_newobj();
-	        $this->images[$file]['n']=$this->n;
-	        $this->_out('<</Type /XObject');
-	        $this->_out('/Subtype /Image');
-	        $this->_out('/Width '.$info['w']);
-	        $this->_out('/Height '.$info['h']);
-	        
-	        if (isset($info["masked"])) $this->_out('/SMask '.($this->n-1).' 0 R'); ###
-	        
-	        if($info['cs']=='Indexed')
-	            $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
-	        else
-	        {
-	            $this->_out('/ColorSpace /'.$info['cs']);
-	            if($info['cs']=='DeviceCMYK')
-	                $this->_out('/Decode [1 0 1 0 1 0 1 0]');
-	        }
-	        $this->_out('/BitsPerComponent '.$info['bpc']);
-	        if(isset($info['f']))
-	            $this->_out('/Filter /'.$info['f']);
-	        if(isset($info['parms']))
-	            $this->_out($info['parms']);
-	        if(isset($info['trns']) && is_array($info['trns']))
-	        {
-	            $trns='';
-	            for($i=0;$i<count($info['trns']);$i++)
-	                $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
-	            $this->_out('/Mask ['.$trns.']');
-	        }
-	        $this->_out('/Length '.strlen($info['data']).'>>');
-	        $this->_putstream($info['data']);
-	        unset($this->images[$file]['data']);
-	        $this->_out('endobj');
-	        //Palette
-	        if($info['cs']=='Indexed')
-	        {
-	            $this->_newobj();
-	            $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
-	            $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
-	            $this->_putstream($pal);
-	            $this->_out('endobj');
-	        }
-	    }
-	}
-	
-	// GD seems to use a different gamma, this method is used to correct it again
-	function _gamma($v){
-	    return pow ($v/255, 2.2) * 255;
-	}
-	
-     function _parsegif($file) 
-     { 
-	//Function by Jerome Fenal
-	require_once(BASECLASSES.'/fpdi/gif.php'); //GIF class in pure PHP from Yamasoft (formerly at http://www.yamasoft.com)
-
-	$h=0;
-	$w=0;
-	$gif=new CGIF();
-
-	if (!$gif->loadFile($file, 0))
-		$this->Error("GIF parser: unable to open file $file");
-
-	if($gif->m_img->m_gih->m_bLocalClr) {
-		$nColors = $gif->m_img->m_gih->m_nTableSize;
-		$pal = $gif->m_img->m_gih->m_colorTable->toString();
-		if($bgColor != -1) {
-			$bgColor = $gif->m_img->m_gih->m_colorTable->colorIndex($bgColor);
-		}
-		$colspace='Indexed';
-	} elseif($gif->m_gfh->m_bGlobalClr) {
-		$nColors = $gif->m_gfh->m_nTableSize;
-		$pal = $gif->m_gfh->m_colorTable->toString();
-		if($bgColor != -1) {
-			$bgColor = $gif->m_gfh->m_colorTable->colorIndex($bgColor);
-		}
-		$colspace='Indexed';
-	} else {
-		$nColors = 0;
-		$bgColor = -1;
-		$colspace='DeviceGray';
-		$pal='';
-	}
-
-	$trns='';
-	if($gif->m_img->m_bTrans && ($nColors > 0)) {
-		$trns=array($gif->m_img->m_nTrans);
-	}
-
-	$data=$gif->m_img->m_data;
-	$w=$gif->m_gfh->m_nWidth;
-	$h=$gif->m_gfh->m_nHeight;
-
-	if($colspace=='Indexed' and empty($pal))
-		$this->Error('Missing palette in '.$file);
-
-	if ($this->compress) {
-		$data=gzcompress($data);
-		return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>8, 'f'=>'FlateDecode', 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
-	} else {
-		return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>8, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
-	} 
-}
-
-	// this method overwriing the original version is only needed to make the Image method support PNGs with alpha channels.
-	// if you only use the ImagePngWithAlpha method for such PNGs, you can remove it from this script.
-	function _parsepng($file)
-	{
-	    //Extract info from a PNG file
-	    $f=fopen($file,'rb');
-	    if(!$f)
-	        $this->Error('Can\'t open image file: '.$file);
-	    //Check signature
-	    if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
-	        $this->Error('Not a PNG file: '.$file);
-	    //Read header chunk
-	    fread($f,4);
-	    if(fread($f,4)!='IHDR')
-	        $this->Error('Incorrect PNG file: '.$file);
-	    $w=$this->_readint($f);
-	    $h=$this->_readint($f);
-	    $bpc=ord(fread($f,1));
-	    if($bpc>8)
-	        $this->Error('16-bit depth not supported: '.$file);
-	    $ct=ord(fread($f,1));
-	    if($ct==0)
-	        $colspace='DeviceGray';
-	    elseif($ct==2)
-	        $colspace='DeviceRGB';
-	    elseif($ct==3)
-	        $colspace='Indexed';
-	    else {
-	        fclose($f);      // the only changes are
-	        return 'alpha';  // made in those 2 lines
-	    }
-	    if(ord(fread($f,1))!=0)
-	        $this->Error('Unknown compression method: '.$file);
-	    if(ord(fread($f,1))!=0)
-	        $this->Error('Unknown filter method: '.$file);
-	    if(ord(fread($f,1))!=0)
-	        $this->Error('Interlacing not supported: '.$file);
-	    fread($f,4);
-	    $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';
-	    //Scan chunks looking for palette, transparency and image data
-	    $pal='';
-	    $trns='';
-	    $data='';
-	    do
-	    {
-	        $n=$this->_readint($f);
-	        $type=fread($f,4);
-	        if($type=='PLTE')
-	        {
-	            //Read palette
-	            $pal=fread($f,$n);
-	            fread($f,4);
-	        }
-	        elseif($type=='tRNS')
-	        {
-	            //Read transparency info
-	            $t=fread($f,$n);
-	            if($ct==0)
-	                $trns=array(ord(substr($t,1,1)));
-	            elseif($ct==2)
-	                $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1)));
-	            else
-	            {
-	                $pos=strpos($t,chr(0));
-	                if($pos!==false)
-	                    $trns=array($pos);
-	            }
-	            fread($f,4);
-	        }
-	        elseif($type=='IDAT')
-	        {
-	            //Read image data block
-	            $data.=fread($f,$n);
-	            fread($f,4);
-	        }
-	        elseif($type=='IEND')
-	            break;
-	        else
-	            fread($f,$n+4);
-	    }
-	    while($n);
-	    if($colspace=='Indexed' && empty($pal))
-	        $this->Error('Missing palette in '.$file);
-	    fclose($f);
-	    return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data);
-	}
-
-	var $angle=0;
-	
-	function Rotate($angle, $x=-1, $y=-1)
-	{
-	    if($x==-1)
-	        $x=$this->x;
-	    if($y==-1)
-	        $y=$this->y;
-	    if($this->angle!=0)
-	        $this->_out('Q');
-	    $this->angle=$angle;
-	    if($angle!=0)
-	    {
-	        $angle*=M_PI/180;
-	        $c=cos($angle);
-	        $s=sin($angle);
-	        $cx=$x*$this->k;
-	        $cy=($this->h-$y)*$this->k;
-	        $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
-	    }
-	}
-	
-	function _endpage()
-	{
-	    if($this->angle!=0)
-	    {
-	        $this->angle=0;
-	        $this->_out('Q');
-	    }
-	    parent::_endpage();
-	}
-    
-	function RotatedText($x, $y, $txt, $angle)
-	{
-	    //Text rotated around its origin
-	    $this->Rotate($angle, $x, $y);
-	    $this->Text($x, $y, $txt);
-	    $this->Rotate(0);
-	}
-
-	function Polygon($points, $style='D')
-	{
-    	//Draw a polygon
-    	if($style=='F')
-    	    $op='f';
-    	elseif($style=='FD' or $style=='DF')
-        	$op='b';
-    	else
-        	$op='s';
-
-    	$h = $this->h;
-    	$k = $this->k;
-
-    	$points_string = '';
-    	for($i=0; $i<count($points); $i+=2){
-        	$points_string .= sprintf('%.2f %.2f', $points[$i]*$k, ($h-$points[$i+1])*$k);
-        	if($i==0)
-            	$points_string .= ' m ';
-        	else
-            	$points_string .= ' l ';
-    	}
-    	$this->_out($points_string . $op);
-	}	
-
-    function ClippingText($x, $y, $txt, $outline=false)
-    {
-        $op=$outline ? 5 : 7;
-        $this->_out(sprintf('q BT %.2f %.2f Td %d Tr (%s) Tj 0 Tr ET',
-            $x*$this->k,
-            ($this->h-$y)*$this->k,
-            $op,
-            $this->_escape($txt)));
-    }
-
-    function ClippingRect($x, $y, $w, $h, $outline=false)
-    {
-        $op=$outline ? 'S' : 'n';
-        $this->_out(sprintf('q %.2f %.2f %.2f %.2f re W %s',
-            $x*$this->k,
-            ($this->h-$y)*$this->k,
-            $w*$this->k, -$h*$this->k,
-            $op));
-    }
-
-    function ClippingEllipse($x, $y, $rx, $ry, $outline=false)
-    {
-        $op=$outline ? 'S' : 'n';
-        $lx=4/3*(M_SQRT2-1)*$rx;
-        $ly=4/3*(M_SQRT2-1)*$ry;
-        $k=$this->k;
-        $h=$this->h;
-        $this->_out(sprintf('q %.2f %.2f m %.2f %.2f %.2f %.2f %.2f %.2f c',
-            ($x+$rx)*$k, ($h-$y)*$k,
-            ($x+$rx)*$k, ($h-($y-$ly))*$k,
-            ($x+$lx)*$k, ($h-($y-$ry))*$k,
-            $x*$k, ($h-($y-$ry))*$k));
-        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',
-            ($x-$lx)*$k, ($h-($y-$ry))*$k,
-            ($x-$rx)*$k, ($h-($y-$ly))*$k,
-            ($x-$rx)*$k, ($h-$y)*$k));
-        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',
-            ($x-$rx)*$k, ($h-($y+$ly))*$k,
-            ($x-$lx)*$k, ($h-($y+$ry))*$k,
-            $x*$k, ($h-($y+$ry))*$k));
-        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c W %s',
-            ($x+$lx)*$k, ($h-($y+$ry))*$k,
-            ($x+$rx)*$k, ($h-($y+$ly))*$k,
-            ($x+$rx)*$k, ($h-$y)*$k,
-            $op));
-    }
-
-    function UnsetClipping()
-    {
-        $this->_out('Q');
-    }
-
-    function ClippedCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='')
-    {
-        if($border || $fill || $this->y+$h>$this->PageBreakTrigger)
-        {
-            $this->Cell($w, $h, '', $border, 0, '', $fill);
-            $this->x-=$w;
-        }
-        $this->ClippingRect($this->x, $this->y, $w, $h);
-        $this->Cell($w, $h, $txt, '', $ln, $align, 0, $link);
-        $this->UnsetClipping();
-    }	
-
-    function Rotation($grad, $x = '', $y = ''){
-      if ($x === '') $x = $this->x;
-      if ($y === '') $y = $this->y;
-      $y = ($this->h-$y) * $this->k;
-      $x *= $this->k;
-      $tm[0] = cos(deg2rad($grad));
-      $tm[1] = sin(deg2rad($grad));
-      $tm[2] = -$tm[1];
-      $tm[3] = $tm[0];
-      $tm[4] = $x+$tm[1]*$y-$tm[0]*$x;
-      $tm[5] = $y-$tm[0]*$y-$tm[1]*$x;
-      $this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', $tm[0],$tm[1],$tm[2],$tm[3],$tm[4],$tm[5]));
-      }
-    
-    
-}
 
+require_once(dirname(__FILE__)."/fpdi.php");
+
+class mb_fpdi extends FPDI {
+
+    function mb_fpdi($orientation='L',$unit='mm',$format='A4') {
+        parent::FPDI($orientation,$unit,$format);
+    }	
+
+    // ====================================
+	// Image with png alpha extension
+	// ====================================
+    
+	//Private properties
+	var $tmpFiles = array();
+	
+	/*******************************************************************************
+	*                                                                              *
+	*                               Public methods                                 *
+	*                                                                              *
+	*******************************************************************************/
+	function Image($file,$x,$y,$w=0,$h=0,$type='',$link='', $isMask=false, $maskImg=0, $align='', $angle=0)
+	{
+	    //Put an image on the page
+	    if(!isset($this->images[$file]))
+	    {
+	        //First use of image, get info
+	        if($type=='')
+	        {
+	            $pos=strrpos($file,'.');
+	            if(!$pos)
+	                $this->Error('Image file has no extension and no type was specified: '.$file);
+	            $type=substr($file,$pos+1);
+	        }
+	        $type=strtolower($type);
+	        $mqr=get_magic_quotes_runtime();
+	        set_magic_quotes_runtime(0);
+	        if($type=='jpg' || $type=='jpeg')
+	            $info=$this->_parsejpg($file);
+	        elseif($type=='png'){
+	            $info=$this->_parsepng($file);
+	            if ($info=='alpha') return $this->ImagePngWithAlpha($file,$x,$y,$w,$h,$link);
+	        }
+	        else
+	        {
+	            //Allow for additional formats
+	            $mtd='_parse'.$type;
+	            if(!method_exists($this,$mtd))
+	                $this->Error('Unsupported image type: '.$type);
+	            $info=$this->$mtd($file);
+	        }
+	        set_magic_quotes_runtime($mqr);
+	        
+	        if ($isMask){
+	      $info['cs']="DeviceGray"; // try to force grayscale (instead of indexed)
+	    }
+	        $info['i']=count($this->images)+1;
+	        if ($maskImg>0) $info['masked'] = $maskImg;###
+	        $this->images[$file]=$info;
+	    }
+	    else
+	        $info=$this->images[$file];
+	    //Automatic width and height calculation if needed
+	    if($w==0 && $h==0)
+	    {
+	        //Put image at 72 dpi
+	        $w=$info['w']/$this->k;
+	        $h=$info['h']/$this->k;
+	    }
+	    if($w==0)
+	        $w=$h*$info['w']/$info['h'];
+	    if($h==0)
+	        $h=$w*$info['h']/$info['w'];
+	        
+	    $x_rot = $x;
+    	$y_rot = $y;    
+
+	    switch ($align) {
+			case 1:
+		        break;
+		    case 2:
+		        $x=$x-$w/2;
+		        break;
+		    case 3:
+		        $x=$x-$w;
+		        break;
+		    case 4:
+		        $y=$y-$h/2;
+		        break;
+		    case 5:
+		        $x=$x-$w/2;
+		        $y=$y-$h/2;
+		        break;
+		    case 6:
+		        $x=$x-$w;
+		        $y=$y-$h/2;
+		        break;
+		    case 7:
+		        $y=$y-$h;
+		        break;
+		    case 8:
+		        $x=$x-$w/2;
+		        $y=$y-$h;
+		        break;
+		    case 9:
+		        $x=$x-$w;
+		        $y=$y-$h;
+		        break;
+		    default:
+		        break;
+		}
+		    	
+	    if ($isMask) $x = $this->fwPt + 10; // embed hidden, ouside the canvas  
+
+    	if($angle!=0){ 
+      		$this->_out('q'); 
+      		$this->Rotation($angle, $x_rot, $y_rot);
+      		$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
+      		$this->_out('Q'); 
+    	}
+    	else {  $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));}
+	    
+	    #$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
+	    if($link)
+	        $this->Link($x,$y,$w,$h,$link);
+	        
+	    return $info['i'];
+	}
+	
+	// needs GD 2.x extension
+	// pixel-wise operation, not very fast
+	function ImagePngWithAlpha($file,$x,$y,$w=0,$h=0,$link='')
+	{
+	    $tmp_alpha = tempnam('.', 'mska');
+	    $this->tmpFiles[] = $tmp_alpha;
+	    $tmp_plain = tempnam('.', 'mskp');
+	    $this->tmpFiles[] = $tmp_plain;
+	    
+	    list($wpx, $hpx) = getimagesize($file);
+	    $img = imagecreatefrompng($file);
+	    $alpha_img = imagecreate( $wpx, $hpx );
+	    
+	    // generate gray scale pallete
+	    for($c=0;$c<256;$c++) ImageColorAllocate($alpha_img, $c, $c, $c);
+	    
+	    // extract alpha channel
+	    $xpx=0;
+	    while ($xpx<$wpx){
+	        $ypx = 0;
+	        while ($ypx<$hpx){
+	            $color_index = imagecolorat($img, $xpx, $ypx);
+	            $col = imagecolorsforindex($img, $color_index);
+	            imagesetpixel($alpha_img, $xpx, $ypx, $this->_gamma( (127-$col['alpha'])*255/127)  );
+	        ++$ypx;
+	        }
+	        ++$xpx;
+	    }
+	
+	    imagepng($alpha_img, $tmp_alpha);
+	    imagedestroy($alpha_img);
+	    
+	    // extract image without alpha channel
+	    $plain_img = imagecreatetruecolor ( $wpx, $hpx );
+	    imagecopy ($plain_img, $img, 0, 0, 0, 0, $wpx, $hpx );
+	    imagepng($plain_img, $tmp_plain);
+	    imagedestroy($plain_img);
+	    
+	    //first embed mask image (w, h, x, will be ignored)
+	    $maskImg = $this->Image($tmp_alpha, 0,0,0,0, 'PNG', '', true);
+	    
+	    //embed image, masked with previously embedded mask
+	    $this->Image($tmp_plain,$x,$y,$w,$h,'PNG',$link, false, $maskImg);
+	}
+	
+	function Close()
+	{
+	    parent::Close();
+	    // clean up tmp files
+	    foreach($this->tmpFiles as $tmp) @unlink($tmp);
+	}
+	
+	/*******************************************************************************
+	*                                                                              *
+	*                               Private methods                                *
+	*                                                                              *
+	*******************************************************************************/
+	function _putimages()
+	{
+	    $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+	    reset($this->images);
+	    while(list($file,$info)=each($this->images))
+	    {
+	        $this->_newobj();
+	        $this->images[$file]['n']=$this->n;
+	        $this->_out('<</Type /XObject');
+	        $this->_out('/Subtype /Image');
+	        $this->_out('/Width '.$info['w']);
+	        $this->_out('/Height '.$info['h']);
+	        
+	        if (isset($info["masked"])) $this->_out('/SMask '.($this->n-1).' 0 R'); ###
+	        
+	        if($info['cs']=='Indexed')
+	            $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
+	        else
+	        {
+	            $this->_out('/ColorSpace /'.$info['cs']);
+	            if($info['cs']=='DeviceCMYK')
+	                $this->_out('/Decode [1 0 1 0 1 0 1 0]');
+	        }
+	        $this->_out('/BitsPerComponent '.$info['bpc']);
+	        if(isset($info['f']))
+	            $this->_out('/Filter /'.$info['f']);
+	        if(isset($info['parms']))
+	            $this->_out($info['parms']);
+	        if(isset($info['trns']) && is_array($info['trns']))
+	        {
+	            $trns='';
+	            for($i=0;$i<count($info['trns']);$i++)
+	                $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
+	            $this->_out('/Mask ['.$trns.']');
+	        }
+	        $this->_out('/Length '.strlen($info['data']).'>>');
+	        $this->_putstream($info['data']);
+	        unset($this->images[$file]['data']);
+	        $this->_out('endobj');
+	        //Palette
+	        if($info['cs']=='Indexed')
+	        {
+	            $this->_newobj();
+	            $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
+	            $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
+	            $this->_putstream($pal);
+	            $this->_out('endobj');
+	        }
+	    }
+	}
+	
+	// GD seems to use a different gamma, this method is used to correct it again
+	function _gamma($v){
+	    return pow ($v/255, 2.2) * 255;
+	}
+	
+     function _parsegif($file) 
+     { 
+	//Function by Jerome Fenal
+	require_once(BASECLASSES.'/fpdi/gif.php'); //GIF class in pure PHP from Yamasoft (formerly at http://www.yamasoft.com)
+
+	$h=0;
+	$w=0;
+	$gif=new CGIF();
+
+	if (!$gif->loadFile($file, 0))
+		$this->Error("GIF parser: unable to open file $file");
+
+	if($gif->m_img->m_gih->m_bLocalClr) {
+		$nColors = $gif->m_img->m_gih->m_nTableSize;
+		$pal = $gif->m_img->m_gih->m_colorTable->toString();
+		if($bgColor != -1) {
+			$bgColor = $gif->m_img->m_gih->m_colorTable->colorIndex($bgColor);
+		}
+		$colspace='Indexed';
+	} elseif($gif->m_gfh->m_bGlobalClr) {
+		$nColors = $gif->m_gfh->m_nTableSize;
+		$pal = $gif->m_gfh->m_colorTable->toString();
+		if($bgColor != -1) {
+			$bgColor = $gif->m_gfh->m_colorTable->colorIndex($bgColor);
+		}
+		$colspace='Indexed';
+	} else {
+		$nColors = 0;
+		$bgColor = -1;
+		$colspace='DeviceGray';
+		$pal='';
+	}
+
+	$trns='';
+	if($gif->m_img->m_bTrans && ($nColors > 0)) {
+		$trns=array($gif->m_img->m_nTrans);
+	}
+
+	$data=$gif->m_img->m_data;
+	$w=$gif->m_gfh->m_nWidth;
+	$h=$gif->m_gfh->m_nHeight;
+
+	if($colspace=='Indexed' and empty($pal))
+		$this->Error('Missing palette in '.$file);
+
+	if ($this->compress) {
+		$data=gzcompress($data);
+		return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>8, 'f'=>'FlateDecode', 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
+	} else {
+		return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>8, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
+	} 
+}
+
+	// this method overwriing the original version is only needed to make the Image method support PNGs with alpha channels.
+	// if you only use the ImagePngWithAlpha method for such PNGs, you can remove it from this script.
+	function _parsepng($file)
+	{
+	    //Extract info from a PNG file
+	    $f=fopen($file,'rb');
+	    if(!$f)
+	        $this->Error('Can\'t open image file: '.$file);
+	    //Check signature
+	    if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
+	        $this->Error('Not a PNG file: '.$file);
+	    //Read header chunk
+	    fread($f,4);
+	    if(fread($f,4)!='IHDR')
+	        $this->Error('Incorrect PNG file: '.$file);
+	    $w=$this->_readint($f);
+	    $h=$this->_readint($f);
+	    $bpc=ord(fread($f,1));
+	    if($bpc>8)
+	        $this->Error('16-bit depth not supported: '.$file);
+	    $ct=ord(fread($f,1));
+	    if($ct==0)
+	        $colspace='DeviceGray';
+	    elseif($ct==2)
+	        $colspace='DeviceRGB';
+	    elseif($ct==3)
+	        $colspace='Indexed';
+	    else {
+	        fclose($f);      // the only changes are
+	        return 'alpha';  // made in those 2 lines
+	    }
+	    if(ord(fread($f,1))!=0)
+	        $this->Error('Unknown compression method: '.$file);
+	    if(ord(fread($f,1))!=0)
+	        $this->Error('Unknown filter method: '.$file);
+	    if(ord(fread($f,1))!=0)
+	        $this->Error('Interlacing not supported: '.$file);
+	    fread($f,4);
+	    $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';
+	    //Scan chunks looking for palette, transparency and image data
+	    $pal='';
+	    $trns='';
+	    $data='';
+	    do
+	    {
+	        $n=$this->_readint($f);
+	        $type=fread($f,4);
+	        if($type=='PLTE')
+	        {
+	            //Read palette
+	            $pal=fread($f,$n);
+	            fread($f,4);
+	        }
+	        elseif($type=='tRNS')
+	        {
+	            //Read transparency info
+	            $t=fread($f,$n);
+	            if($ct==0)
+	                $trns=array(ord(substr($t,1,1)));
+	            elseif($ct==2)
+	                $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1)));
+	            else
+	            {
+	                $pos=strpos($t,chr(0));
+	                if($pos!==false)
+	                    $trns=array($pos);
+	            }
+	            fread($f,4);
+	        }
+	        elseif($type=='IDAT')
+	        {
+	            //Read image data block
+	            $data.=fread($f,$n);
+	            fread($f,4);
+	        }
+	        elseif($type=='IEND')
+	            break;
+	        else
+	            fread($f,$n+4);
+	    }
+	    while($n);
+	    if($colspace=='Indexed' && empty($pal))
+	        $this->Error('Missing palette in '.$file);
+	    fclose($f);
+	    return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data);
+	}
+
+	var $angle=0;
+	
+	function Rotate($angle, $x=-1, $y=-1)
+	{
+	    if($x==-1)
+	        $x=$this->x;
+	    if($y==-1)
+	        $y=$this->y;
+	    if($this->angle!=0)
+	        $this->_out('Q');
+	    $this->angle=$angle;
+	    if($angle!=0)
+	    {
+	        $angle*=M_PI/180;
+	        $c=cos($angle);
+	        $s=sin($angle);
+	        $cx=$x*$this->k;
+	        $cy=($this->h-$y)*$this->k;
+	        $this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
+	    }
+	}
+	
+	function _endpage()
+	{
+	    if($this->angle!=0)
+	    {
+	        $this->angle=0;
+	        $this->_out('Q');
+	    }
+	    parent::_endpage();
+	}
+    
+	function RotatedText($x, $y, $txt, $angle)
+	{
+	    //Text rotated around its origin
+	    $this->Rotate($angle, $x, $y);
+	    $this->Text($x, $y, $txt);
+	    $this->Rotate(0);
+	}
+
+	function Polygon($points, $style='D')
+	{
+    	//Draw a polygon
+    	if($style=='F')
+    	    $op='f';
+    	elseif($style=='FD' or $style=='DF')
+        	$op='b';
+    	else
+        	$op='s';
+
+    	$h = $this->h;
+    	$k = $this->k;
+
+    	$points_string = '';
+    	for($i=0; $i<count($points); $i+=2){
+        	$points_string .= sprintf('%.2f %.2f', $points[$i]*$k, ($h-$points[$i+1])*$k);
+        	if($i==0)
+            	$points_string .= ' m ';
+        	else
+            	$points_string .= ' l ';
+    	}
+    	$this->_out($points_string . $op);
+	}	
+
+    function ClippingText($x, $y, $txt, $outline=false)
+    {
+        $op=$outline ? 5 : 7;
+        $this->_out(sprintf('q BT %.2f %.2f Td %d Tr (%s) Tj 0 Tr ET',
+            $x*$this->k,
+            ($this->h-$y)*$this->k,
+            $op,
+            $this->_escape($txt)));
+    }
+
+    function ClippingRect($x, $y, $w, $h, $outline=false)
+    {
+        $op=$outline ? 'S' : 'n';
+        $this->_out(sprintf('q %.2f %.2f %.2f %.2f re W %s',
+            $x*$this->k,
+            ($this->h-$y)*$this->k,
+            $w*$this->k, -$h*$this->k,
+            $op));
+    }
+
+    function ClippingEllipse($x, $y, $rx, $ry, $outline=false)
+    {
+        $op=$outline ? 'S' : 'n';
+        $lx=4/3*(M_SQRT2-1)*$rx;
+        $ly=4/3*(M_SQRT2-1)*$ry;
+        $k=$this->k;
+        $h=$this->h;
+        $this->_out(sprintf('q %.2f %.2f m %.2f %.2f %.2f %.2f %.2f %.2f c',
+            ($x+$rx)*$k, ($h-$y)*$k,
+            ($x+$rx)*$k, ($h-($y-$ly))*$k,
+            ($x+$lx)*$k, ($h-($y-$ry))*$k,
+            $x*$k, ($h-($y-$ry))*$k));
+        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',
+            ($x-$lx)*$k, ($h-($y-$ry))*$k,
+            ($x-$rx)*$k, ($h-($y-$ly))*$k,
+            ($x-$rx)*$k, ($h-$y)*$k));
+        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',
+            ($x-$rx)*$k, ($h-($y+$ly))*$k,
+            ($x-$lx)*$k, ($h-($y+$ry))*$k,
+            $x*$k, ($h-($y+$ry))*$k));
+        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c W %s',
+            ($x+$lx)*$k, ($h-($y+$ry))*$k,
+            ($x+$rx)*$k, ($h-($y+$ly))*$k,
+            ($x+$rx)*$k, ($h-$y)*$k,
+            $op));
+    }
+
+    function UnsetClipping()
+    {
+        $this->_out('Q');
+    }
+
+    function ClippedCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='')
+    {
+        if($border || $fill || $this->y+$h>$this->PageBreakTrigger)
+        {
+            $this->Cell($w, $h, '', $border, 0, '', $fill);
+            $this->x-=$w;
+        }
+        $this->ClippingRect($this->x, $this->y, $w, $h);
+        $this->Cell($w, $h, $txt, '', $ln, $align, 0, $link);
+        $this->UnsetClipping();
+    }	
+
+    function Rotation($grad, $x = '', $y = ''){
+      if ($x === '') $x = $this->x;
+      if ($y === '') $y = $this->y;
+      $y = ($this->h-$y) * $this->k;
+      $x *= $this->k;
+      $tm[0] = cos(deg2rad($grad));
+      $tm[1] = sin(deg2rad($grad));
+      $tm[2] = -$tm[1];
+      $tm[3] = $tm[0];
+      $tm[4] = $x+$tm[1]*$y-$tm[0]*$x;
+      $tm[5] = $y-$tm[0]*$y-$tm[1]*$x;
+      $this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', $tm[0],$tm[1],$tm[2],$tm[3],$tm[4],$tm[5]));
+      }
+    
+    
+}
+
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/pdf_context.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/pdf_context.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/pdf_context.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,82 +1,82 @@
-<?php
-//
-//  FPDI - Version 1.2.1
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-class pdf_context {
-
-	var $file;
-	var $buffer;
-	var $offset;
-	var $length;
-
-	var $stack;
-
-	// Constructor
-
-	function pdf_context($f) {
-		$this->file = $f;
-		$this->reset();
-	}
-
-	// Optionally move the file
-	// pointer to a new location
-	// and reset the buffered data
-
-	function reset($pos = null, $l = 100) {
-		if (!is_null ($pos)) {
-			fseek ($this->file, $pos);
-		}
-
-		$this->buffer = $l > 0 ? fread($this->file, $l) : '';
-		$this->length = strlen($this->buffer);
-		if ($this->length < $l)
-            $this->increase_length($l - $this->length);
-		$this->offset = 0;
-		$this->stack = array();
-	}
-
-	// Make sure that there is at least one
-	// character beyond the current offset in
-	// the buffer to prevent the tokenizer
-	// from attempting to access data that does
-	// not exist
-
-	function ensure_content() {
-		if ($this->offset >= $this->length - 1) {
-			return $this->increase_length();
-		} else {
-			return true;
-		}
-	}
-
-	// Forcefully read more data into the buffer
-
-	function increase_length($l=100) {
-		if (feof($this->file)) {
-			return false;
-		} else {
-			$totalLength = $this->length + $l;
-		    do {
-                $this->buffer .= fread($this->file, $totalLength-$this->length);
-            } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
-			
-			return true;
-		}
-	}
-
+<?php
+//
+//  FPDI - Version 1.2.1
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+class pdf_context {
+
+	var $file;
+	var $buffer;
+	var $offset;
+	var $length;
+
+	var $stack;
+
+	// Constructor
+
+	function pdf_context($f) {
+		$this->file = $f;
+		$this->reset();
+	}
+
+	// Optionally move the file
+	// pointer to a new location
+	// and reset the buffered data
+
+	function reset($pos = null, $l = 100) {
+		if (!is_null ($pos)) {
+			fseek ($this->file, $pos);
+		}
+
+		$this->buffer = $l > 0 ? fread($this->file, $l) : '';
+		$this->length = strlen($this->buffer);
+		if ($this->length < $l)
+            $this->increase_length($l - $this->length);
+		$this->offset = 0;
+		$this->stack = array();
+	}
+
+	// Make sure that there is at least one
+	// character beyond the current offset in
+	// the buffer to prevent the tokenizer
+	// from attempting to access data that does
+	// not exist
+
+	function ensure_content() {
+		if ($this->offset >= $this->length - 1) {
+			return $this->increase_length();
+		} else {
+			return true;
+		}
+	}
+
+	// Forcefully read more data into the buffer
+
+	function increase_length($l=100) {
+		if (feof($this->file)) {
+			return false;
+		} else {
+			$totalLength = $this->length + $l;
+		    do {
+                $this->buffer .= fread($this->file, $totalLength-$this->length);
+            } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
+			
+			return true;
+		}
+	}
+
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/pdf_parser.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/pdf_parser.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/pdf_parser.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,690 +1,690 @@
-<?php
-//
-//  FPDI - Version 1.2.1
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-if (!defined ('PDF_TYPE_NULL'))
-    define ('PDF_TYPE_NULL', 0);
-if (!defined ('PDF_TYPE_NUMERIC'))
-    define ('PDF_TYPE_NUMERIC', 1);
-if (!defined ('PDF_TYPE_TOKEN'))
-    define ('PDF_TYPE_TOKEN', 2);
-if (!defined ('PDF_TYPE_HEX'))
-    define ('PDF_TYPE_HEX', 3);
-if (!defined ('PDF_TYPE_STRING'))
-    define ('PDF_TYPE_STRING', 4);
-if (!defined ('PDF_TYPE_DICTIONARY'))
-    define ('PDF_TYPE_DICTIONARY', 5);
-if (!defined ('PDF_TYPE_ARRAY'))
-    define ('PDF_TYPE_ARRAY', 6);
-if (!defined ('PDF_TYPE_OBJDEC'))
-    define ('PDF_TYPE_OBJDEC', 7);
-if (!defined ('PDF_TYPE_OBJREF'))
-    define ('PDF_TYPE_OBJREF', 8);
-if (!defined ('PDF_TYPE_OBJECT'))
-    define ('PDF_TYPE_OBJECT', 9);
-if (!defined ('PDF_TYPE_STREAM'))
-    define ('PDF_TYPE_STREAM', 10);
-if (!defined ('PDF_TYPE_BOOLEAN'))
-    define ('PDF_TYPE_BOOLEAN', 11);
-if (!defined ('PDF_TYPE_REAL'))
-    define ('PDF_TYPE_REAL', 12);
-    
-require_once("pdf_context.php");
-require_once("wrapper_functions.php");
-
-class pdf_parser {
-	
-	/**
-     * Filename
-     * @var string
-     */
-    var $filename;
-    
-    /**
-     * File resource
-     * @var resource
-     */
-    var $f;
-    
-    /**
-     * PDF Context
-     * @var object pdf_context-Instance
-     */
-    var $c;
-    
-    /**
-     * xref-Data
-     * @var array
-     */
-    var $xref;
-
-    /**
-     * root-Object
-     * @var array
-     */
-    var $root;
-	
-    /**
-     * PDF version of the loaded document
-     * @var string
-     */
-    var $pdfVersion;
-    
-    /**
-     * Constructor
-     *
-     * @param string $filename  Source-Filename
-     */
-	function pdf_parser($filename) {
-        $this->filename = $filename;
-        
-        $this->f = @fopen($this->filename, "rb");
-
-        if (!$this->f)
-            $this->error(sprintf("Cannot open %s !", $filename));
-
-        $this->getPDFVersion();
-
-        $this->c =& new pdf_context($this->f);
-        // Read xref-Data
-        $this->pdf_read_xref($this->xref, $this->pdf_find_xref());
-
-        // Check for Encryption
-        $this->getEncryption();
-
-        // Read root
-        $this->pdf_read_root();
-    }
-    
-    /**
-     * Close the opened file
-     */
-    function closeFile() {
-    	if (isset($this->f)) {
-    	    fclose($this->f);	
-    		unset($this->f);
-    	}	
-    }
-    
-    /**
-     * Print Error and die
-     *
-     * @param string $msg  Error-Message
-     */
-    function error($msg) {
-    	die("<b>PDF-Parser Error:</b> ".$msg);	
-    }
-    
-    /**
-     * Check Trailer for Encryption
-     */
-    function getEncryption() {
-        if (isset($this->xref['trailer'][1]['/Encrypt'])) {
-            $this->error("File is encrypted!");
-        }
-    }
-    
-	/**
-     * Find/Return /Root
-     *
-     * @return array
-     */
-    function pdf_find_root() {
-        if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) {
-            $this->error("Wrong Type of Root-Element! Must be an indirect reference");
-        }
-        return $this->xref['trailer'][1]['/Root'];
-    }
-
-    /**
-     * Read the /Root
-     */
-    function pdf_read_root() {
-        // read root
-        $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root());
-    }
-    
-    /**
-     * Get PDF-Version
-     *
-     * And reset the PDF Version used in FPDI if needed
-     */
-    function getPDFVersion() {
-        fseek($this->f, 0);
-        preg_match("/\d\.\d/",fread($this->f,16),$m);
-        if (isset($m[0]))
-            $this->pdfVersion = $m[0];
-        return $this->pdfVersion;
-    }
-    
-    /**
-     * Find the xref-Table
-     */
-    function pdf_find_xref() {
-       	$toRead = 1500;
-                
-        $stat = fseek ($this->f, -$toRead, SEEK_END);
-        if ($stat === -1) {
-            fseek ($this->f, 0);
-        }
-       	$data = fread($this->f, $toRead);
-        
-        $pos = strlen($data) - strpos(strrev($data), strrev('startxref')); 
-        $data = substr($data, $pos);
-        
-        if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) {
-            $this->error("Unable to find pointer to xref table");
-    	}
-
-    	return (int) $matches[1];
-    }
-
-    /**
-     * Read xref-table
-     *
-     * @param array $result Array of xref-table
-     * @param integer $offset of xref-table
-     */
-    function pdf_read_xref(&$result, $offset) {
-        fseek($this->f, $o_pos = $offset-20); // set some bytes backwards to fetch errorious docs
-            
-        $data = fread($this->f, 100);
-        
-        $xrefPos = strpos($data, 'xref');
-        
-        if ($xrefPos === false) {
-            $this->error('Unable to find xref table.');
-        }
-        
-        if (!isset($result['xref_location'])) {
-            $result['xref_location'] = $o_pos+$xrefPos;
-            $result['max_object'] = 0;
-    	}
-
-    	$cylces = -1;
-        $bytesPerCycle = 100;
-        
-    	fseek($this->f, $o_pos = $o_pos+$xrefPos+4); // set the handle directly after the "xref"-keyword
-        $data = fread($this->f, $bytesPerCycle);
-        
-        while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle*$cylces++, 0))) === false && !feof($this->f)) {
-            $data .= fread($this->f, $bytesPerCycle);
-        }
-        
-        if ($trailerPos === false) {
-            $this->error('Trailer keyword not found after xref table');
-        }
-        
-        $data = substr($data, 0, $trailerPos);
-        
-        // get Line-Ending
-        preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for linebreaks
-
-        $differentLineEndings = count(array_unique($m[0]));
-        if ($differentLineEndings > 1) {
-            $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY);
-        } else {
-            $lines = explode($m[0][1], $data);
-        }
-        
-        $data = $differentLineEndings = $m = null;
-        unset($data, $differentLineEndings, $m);
-        
-        $linesCount = count($lines);
-        
-        $start = 1;
-        
-        for ($i = 0; $i < $linesCount; $i++) {
-            $line = trim($lines[$i]);
-            if ($line) {
-                $pieces = explode(" ", $line);
-                $c = count($pieces);
-                switch($c) {
-                    case 2:
-                        $start = (int)$pieces[0];
-                        $end   = $start+(int)$pieces[1];
-                        if ($end > $result['max_object'])
-                            $result['max_object'] = $end;
-                        break;
-                    case 3:
-                        if (!isset($result['xref'][$start]))
-                            $result['xref'][$start] = array();
-                        
-                        if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) {
-                	        $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null;
-                	    }
-                        $start++;
-                        break;
-                    default:
-                        $this->error('Unexpected data in xref table');
-                }
-            }
-        }
-        
-        $lines = $pieces = $line = $start = $end = $gen = null;
-        unset($lines, $pieces, $line, $start, $end, $gen);
-        
-        fseek($this->f, $o_pos+$trailerPos+7);
-        
-        $c =&  new pdf_context($this->f);
-	    $trailer = $this->pdf_read_value($c);
-	    
-	    $c = null;
-	    unset($c);
-	    
-	    if (!isset($result['trailer'])) {
-            $result['trailer'] = $trailer;          
-	    }
-	    
-	    if (isset($trailer[1]['/Prev'])) {
-	    	$this->pdf_read_xref($result, $trailer[1]['/Prev'][1]);
-	    } 
-	    
-	    $trailer = null;
-	    unset($trailer);
-        
-        return true;
-    }
-    
-    /**
-     * Reads an Value
-     *
-     * @param object $c pdf_context
-     * @param string $token a Token
-     * @return mixed
-     */
-    function pdf_read_value(&$c, $token = null) {
-    	if (is_null($token)) {
-    	    $token = $this->pdf_read_token($c);
-    	}
-    	
-        if ($token === false) {
-    	    return false;
-    	}
-
-       	switch ($token) {
-            case	'<':
-    			// This is a hex string.
-    			// Read the value, then the terminator
-
-                $pos = $c->offset;
-
-    			while(1) {
-
-                    $match = strpos ($c->buffer, '>', $pos);
-				
-    				// If you can't find it, try
-    				// reading more data from the stream
-
-    				if ($match === false) {
-    					if (!$c->increase_length()) {
-    						return false;
-    					} else {
-                        	continue;
-                    	}
-    				}
-
-    				$result = substr ($c->buffer, $c->offset, $match - $c->offset);
-    				$c->offset = $match + 1;
-    				
-    				return array (PDF_TYPE_HEX, $result);
-                }
-                
-                break;
-    		case	'<<':
-    			// This is a dictionary.
-
-    			$result = array();
-
-    			// Recurse into this function until we reach
-    			// the end of the dictionary.
-    			while (($key = $this->pdf_read_token($c)) !== '>>') {
-    				if ($key === false) {
-    					return false;
-    				}
-					
-    				if (($value =   $this->pdf_read_value($c)) === false) {
-    					return false;
-    				}
-                    $result[$key] = $value;
-    			}
-				
-    			return array (PDF_TYPE_DICTIONARY, $result);
-
-    		case	'[':
-    			// This is an array.
-
-    			$result = array();
-
-    			// Recurse into this function until we reach
-    			// the end of the array.
-    			while (($token = $this->pdf_read_token($c)) !== ']') {
-                    if ($token === false) {
-    					return false;
-    				}
-					
-    				if (($value = $this->pdf_read_value($c, $token)) === false) {
-                        return false;
-    				}
-					
-    				$result[] = $value;
-    			}
-    			
-                return array (PDF_TYPE_ARRAY, $result);
-
-    		case	'('		:
-                // This is a string
-                $pos = $c->offset;
-                
-                $openBrackets = 1;
-    			do {
-                    for (; $openBrackets != 0 && $pos < $c->length; $pos++) {
-                        switch (ord($c->buffer[$pos])) {
-                            case 0x28: // '('
-                                $openBrackets++;
-                                break;
-                            case 0x29: // ')'
-                                $openBrackets--;
-                                break;
-                            case 0x5C: // backslash
-                                $pos++;
-                        }
-                    }
-    			} while($openBrackets != 0 && $c->increase_length());
-    			
-    			$result = substr($c->buffer, $c->offset, $pos - $c->offset - 1);
-    			$c->offset = $pos;
-    			
-    			return array (PDF_TYPE_STRING, $result);
-
-    			
-            case "stream":
-            	$o_pos = ftell($c->file)-strlen($c->buffer);
-		        $o_offset = $c->offset;
-		        
-		        $c->reset($startpos = $o_pos + $o_offset);
-		        
-		        $e = 0; // ensure line breaks in front of the stream
-		        if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13))
-		        	$e++;
-		        if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10))
-		        	$e++;
-		        
-		        if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) {
-		        	$tmp_c =& new pdf_context($this->f);
-		        	$tmp_length = $this->pdf_resolve_object($tmp_c,$this->actual_obj[1][1]['/Length']);
-		        	$length = $tmp_length[1][1];
-		        } else {
-		        	$length = $this->actual_obj[1][1]['/Length'][1];	
-		        }
-		        
-		        if ($length > 0) {
-    		        $c->reset($startpos+$e,$length);
-    		        $v = $c->buffer;
-		        } else {
-		            $v = '';   
-		        }
-		        $c->reset($startpos+$e+$length+9); // 9 = strlen("endstream")
-		        
-		        return array(PDF_TYPE_STREAM, $v);
-		        
-	        case '%':
-	            // this is a comment - just jump over it
-                $pos = $c->offset;
-    			while(1) {
-    			    // PHP 4.3.3 required
-                    #$match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos);
-                    // alternative
-                    $match = preg_match("/(\r\n|\r|\n)/", substr($c->buffer, $pos), $m);
-					if ($match === false) {
-    					if (!$c->increase_length()) {
-    						return false;
-    					} else {
-                        	continue;
-                    	}
-    				}
-
-    				// PHP 4.3.3 required
-                    #$c->offset = $m[0][1]+strlen($m[0][0]);
-    				// alternative
-                    $c->offset = strpos($c->buffer, $m[0], $pos)+strlen($m[0]);
-    				
-    				return $this->pdf_read_value($c);
-                }
-                
-    		default	:
-            	if (is_numeric ($token)) {
-                    // A numeric token. Make sure that
-    				// it is not part of something else.
-    				if (($tok2 = $this->pdf_read_token ($c)) !== false) {
-                        if (is_numeric ($tok2)) {
-
-    						// Two numeric tokens in a row.
-    						// In this case, we're probably in
-    						// front of either an object reference
-    						// or an object specification.
-    						// Determine the case and return the data
-    						if (($tok3 = $this->pdf_read_token ($c)) !== false) {
-                                switch ($tok3) {
-    								case	'obj'	:
-                                        return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2);
-    								case	'R'		:
-    									return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2);
-    							}
-    							// If we get to this point, that numeric value up
-    							// there was just a numeric value. Push the extra
-    							// tokens back into the stack and return the value.
-    							array_push ($c->stack, $tok3);
-    						}
-    					}
-
-    					array_push ($c->stack, $tok2);
-    				}
-
-    				if ($token === (string)((int)$token))
-        				return array (PDF_TYPE_NUMERIC, (int)$token);
-    				else 
-    					return array (PDF_TYPE_REAL, (float)$token);
-    			} else if ($token == 'true' || $token == 'false') {
-                    return array (PDF_TYPE_BOOLEAN, $token == 'true');
-    			} else {
-
-                    // Just a token. Return it.
-    				return array (PDF_TYPE_TOKEN, $token);
-    			}
-
-         }
-    }
-    
-    /**
-     * Resolve an object
-     *
-     * @param object $c pdf_context
-     * @param array $obj_spec The object-data
-     * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para
-     */
-    function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) {
-        // Exit if we get invalid data
-    	if (!is_array($obj_spec)) {
-            return false;
-    	}
-
-    	if ($obj_spec[0] == PDF_TYPE_OBJREF) {
-
-    		// This is a reference, resolve it
-    		if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) {
-
-    			// Save current file position
-    			// This is needed if you want to resolve
-    			// references while you're reading another object
-    			// (e.g.: if you need to determine the length
-    			// of a stream)
-
-    			$old_pos = ftell($c->file);
-
-    			// Reposition the file pointer and
-    			// load the object header.
-				
-    			$c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]);
-
-    			$header = $this->pdf_read_value($c,null,true);
-
-    			if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) {
-    				$this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location");
-    			}
-
-    			// If we're being asked to store all the information
-    			// about the object, we add the object ID and generation
-    			// number for later use
-				$this->actual_obj =& $result;
-    			if ($encapsulate) {
-    				$result = array (
-    					PDF_TYPE_OBJECT,
-    					'obj' => $obj_spec[1],
-    					'gen' => $obj_spec[2]
-    				);
-    			} else {
-    				$result = array();
-    			}
-
-    			// Now simply read the object data until
-    			// we encounter an end-of-object marker
-    			while(1) {
-                    $value = $this->pdf_read_value($c);
-					if ($value === false || count($result) > 4) {
-						// in this case the parser coudn't find an endobj so we break here
-						break;
-    				}
-
-    				if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') {
-    					break;
-    				}
-
-                    $result[] = $value;
-    			}
-
-    			$c->reset($old_pos);
-
-                if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) {
-                    $result[0] = PDF_TYPE_STREAM;
-                }
-
-    			return $result;
-    		}
-    	} else {
-    		return $obj_spec;
-    	}
-    }
-
-    
-    
-    /**
-     * Reads a token from the file
-     *
-     * @param object $c pdf_context
-     * @return mixed
-     */
-    function pdf_read_token(&$c)
-    {
-    	// If there is a token available
-    	// on the stack, pop it out and
-    	// return it.
-
-    	if (count($c->stack)) {
-    		return array_pop($c->stack);
-    	}
-
-    	// Strip away any whitespace
-
-    	do {
-    		if (!$c->ensure_content()) {
-    			return false;
-    		}
-    		$c->offset += _strspn($c->buffer, " \n\r\t", $c->offset);
-    	} while ($c->offset >= $c->length - 1);
-
-    	// Get the first character in the stream
-
-    	$char = $c->buffer[$c->offset++];
-
-    	switch ($char) {
-
-    		case '['	:
-    		case ']'	:
-    		case '('	:
-    		case ')'	:
-
-    			// This is either an array or literal string
-    			// delimiter, Return it
-
-    			return $char;
-
-    		case '<'	:
-    		case '>'	:
-
-    			// This could either be a hex string or
-    			// dictionary delimiter. Determine the
-    			// appropriate case and return the token
-
-    			if ($c->buffer[$c->offset] == $char) {
-    				if (!$c->ensure_content()) {
-    				    return false;
-    				}
-    				$c->offset++;
-    				return $char . $char;
-    			} else {
-    				return $char;
-    			}
-
-    		default		:
-
-    			// This is "another" type of token (probably
-    			// a dictionary entry or a numeric value)
-    			// Find the end and return it.
-
-    			if (!$c->ensure_content()) {
-    				return false;
-    			}
-
-    			while(1) {
-
-    				// Determine the length of the token
-
-    				$pos = _strcspn($c->buffer, " []<>()\r\n\t/", $c->offset);
-    				if ($c->offset + $pos <= $c->length - 1) {
-    					break;
-    				} else {
-    					// If the script reaches this point,
-    					// the token may span beyond the end
-    					// of the current buffer. Therefore,
-    					// we increase the size of the buffer
-    					// and try again--just to be safe.
-
-    					$c->increase_length();
-    				}
-    			}
-
-    			$result = substr($c->buffer, $c->offset - 1, $pos + 1);
-
-    			$c->offset += $pos;
-    			return $result;
-    	}
-    }
-
-	
+<?php
+//
+//  FPDI - Version 1.2.1
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+if (!defined ('PDF_TYPE_NULL'))
+    define ('PDF_TYPE_NULL', 0);
+if (!defined ('PDF_TYPE_NUMERIC'))
+    define ('PDF_TYPE_NUMERIC', 1);
+if (!defined ('PDF_TYPE_TOKEN'))
+    define ('PDF_TYPE_TOKEN', 2);
+if (!defined ('PDF_TYPE_HEX'))
+    define ('PDF_TYPE_HEX', 3);
+if (!defined ('PDF_TYPE_STRING'))
+    define ('PDF_TYPE_STRING', 4);
+if (!defined ('PDF_TYPE_DICTIONARY'))
+    define ('PDF_TYPE_DICTIONARY', 5);
+if (!defined ('PDF_TYPE_ARRAY'))
+    define ('PDF_TYPE_ARRAY', 6);
+if (!defined ('PDF_TYPE_OBJDEC'))
+    define ('PDF_TYPE_OBJDEC', 7);
+if (!defined ('PDF_TYPE_OBJREF'))
+    define ('PDF_TYPE_OBJREF', 8);
+if (!defined ('PDF_TYPE_OBJECT'))
+    define ('PDF_TYPE_OBJECT', 9);
+if (!defined ('PDF_TYPE_STREAM'))
+    define ('PDF_TYPE_STREAM', 10);
+if (!defined ('PDF_TYPE_BOOLEAN'))
+    define ('PDF_TYPE_BOOLEAN', 11);
+if (!defined ('PDF_TYPE_REAL'))
+    define ('PDF_TYPE_REAL', 12);
+    
+require_once("pdf_context.php");
+require_once("wrapper_functions.php");
+
+class pdf_parser {
+	
+	/**
+     * Filename
+     * @var string
+     */
+    var $filename;
+    
+    /**
+     * File resource
+     * @var resource
+     */
+    var $f;
+    
+    /**
+     * PDF Context
+     * @var object pdf_context-Instance
+     */
+    var $c;
+    
+    /**
+     * xref-Data
+     * @var array
+     */
+    var $xref;
+
+    /**
+     * root-Object
+     * @var array
+     */
+    var $root;
+	
+    /**
+     * PDF version of the loaded document
+     * @var string
+     */
+    var $pdfVersion;
+    
+    /**
+     * Constructor
+     *
+     * @param string $filename  Source-Filename
+     */
+	function pdf_parser($filename) {
+        $this->filename = $filename;
+        
+        $this->f = @fopen($this->filename, "rb");
+
+        if (!$this->f)
+            $this->error(sprintf("Cannot open %s !", $filename));
+
+        $this->getPDFVersion();
+
+        $this->c =& new pdf_context($this->f);
+        // Read xref-Data
+        $this->pdf_read_xref($this->xref, $this->pdf_find_xref());
+
+        // Check for Encryption
+        $this->getEncryption();
+
+        // Read root
+        $this->pdf_read_root();
+    }
+    
+    /**
+     * Close the opened file
+     */
+    function closeFile() {
+    	if (isset($this->f)) {
+    	    fclose($this->f);	
+    		unset($this->f);
+    	}	
+    }
+    
+    /**
+     * Print Error and die
+     *
+     * @param string $msg  Error-Message
+     */
+    function error($msg) {
+    	die("<b>PDF-Parser Error:</b> ".$msg);	
+    }
+    
+    /**
+     * Check Trailer for Encryption
+     */
+    function getEncryption() {
+        if (isset($this->xref['trailer'][1]['/Encrypt'])) {
+            $this->error("File is encrypted!");
+        }
+    }
+    
+	/**
+     * Find/Return /Root
+     *
+     * @return array
+     */
+    function pdf_find_root() {
+        if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) {
+            $this->error("Wrong Type of Root-Element! Must be an indirect reference");
+        }
+        return $this->xref['trailer'][1]['/Root'];
+    }
+
+    /**
+     * Read the /Root
+     */
+    function pdf_read_root() {
+        // read root
+        $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root());
+    }
+    
+    /**
+     * Get PDF-Version
+     *
+     * And reset the PDF Version used in FPDI if needed
+     */
+    function getPDFVersion() {
+        fseek($this->f, 0);
+        preg_match("/\d\.\d/",fread($this->f,16),$m);
+        if (isset($m[0]))
+            $this->pdfVersion = $m[0];
+        return $this->pdfVersion;
+    }
+    
+    /**
+     * Find the xref-Table
+     */
+    function pdf_find_xref() {
+       	$toRead = 1500;
+                
+        $stat = fseek ($this->f, -$toRead, SEEK_END);
+        if ($stat === -1) {
+            fseek ($this->f, 0);
+        }
+       	$data = fread($this->f, $toRead);
+        
+        $pos = strlen($data) - strpos(strrev($data), strrev('startxref')); 
+        $data = substr($data, $pos);
+        
+        if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) {
+            $this->error("Unable to find pointer to xref table");
+    	}
+
+    	return (int) $matches[1];
+    }
+
+    /**
+     * Read xref-table
+     *
+     * @param array $result Array of xref-table
+     * @param integer $offset of xref-table
+     */
+    function pdf_read_xref(&$result, $offset) {
+        fseek($this->f, $o_pos = $offset-20); // set some bytes backwards to fetch errorious docs
+            
+        $data = fread($this->f, 100);
+        
+        $xrefPos = strpos($data, 'xref');
+        
+        if ($xrefPos === false) {
+            $this->error('Unable to find xref table.');
+        }
+        
+        if (!isset($result['xref_location'])) {
+            $result['xref_location'] = $o_pos+$xrefPos;
+            $result['max_object'] = 0;
+    	}
+
+    	$cylces = -1;
+        $bytesPerCycle = 100;
+        
+    	fseek($this->f, $o_pos = $o_pos+$xrefPos+4); // set the handle directly after the "xref"-keyword
+        $data = fread($this->f, $bytesPerCycle);
+        
+        while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle*$cylces++, 0))) === false && !feof($this->f)) {
+            $data .= fread($this->f, $bytesPerCycle);
+        }
+        
+        if ($trailerPos === false) {
+            $this->error('Trailer keyword not found after xref table');
+        }
+        
+        $data = substr($data, 0, $trailerPos);
+        
+        // get Line-Ending
+        preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for linebreaks
+
+        $differentLineEndings = count(array_unique($m[0]));
+        if ($differentLineEndings > 1) {
+            $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY);
+        } else {
+            $lines = explode($m[0][1], $data);
+        }
+        
+        $data = $differentLineEndings = $m = null;
+        unset($data, $differentLineEndings, $m);
+        
+        $linesCount = count($lines);
+        
+        $start = 1;
+        
+        for ($i = 0; $i < $linesCount; $i++) {
+            $line = trim($lines[$i]);
+            if ($line) {
+                $pieces = explode(" ", $line);
+                $c = count($pieces);
+                switch($c) {
+                    case 2:
+                        $start = (int)$pieces[0];
+                        $end   = $start+(int)$pieces[1];
+                        if ($end > $result['max_object'])
+                            $result['max_object'] = $end;
+                        break;
+                    case 3:
+                        if (!isset($result['xref'][$start]))
+                            $result['xref'][$start] = array();
+                        
+                        if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) {
+                	        $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null;
+                	    }
+                        $start++;
+                        break;
+                    default:
+                        $this->error('Unexpected data in xref table');
+                }
+            }
+        }
+        
+        $lines = $pieces = $line = $start = $end = $gen = null;
+        unset($lines, $pieces, $line, $start, $end, $gen);
+        
+        fseek($this->f, $o_pos+$trailerPos+7);
+        
+        $c =&  new pdf_context($this->f);
+	    $trailer = $this->pdf_read_value($c);
+	    
+	    $c = null;
+	    unset($c);
+	    
+	    if (!isset($result['trailer'])) {
+            $result['trailer'] = $trailer;          
+	    }
+	    
+	    if (isset($trailer[1]['/Prev'])) {
+	    	$this->pdf_read_xref($result, $trailer[1]['/Prev'][1]);
+	    } 
+	    
+	    $trailer = null;
+	    unset($trailer);
+        
+        return true;
+    }
+    
+    /**
+     * Reads an Value
+     *
+     * @param object $c pdf_context
+     * @param string $token a Token
+     * @return mixed
+     */
+    function pdf_read_value(&$c, $token = null) {
+    	if (is_null($token)) {
+    	    $token = $this->pdf_read_token($c);
+    	}
+    	
+        if ($token === false) {
+    	    return false;
+    	}
+
+       	switch ($token) {
+            case	'<':
+    			// This is a hex string.
+    			// Read the value, then the terminator
+
+                $pos = $c->offset;
+
+    			while(1) {
+
+                    $match = strpos ($c->buffer, '>', $pos);
+				
+    				// If you can't find it, try
+    				// reading more data from the stream
+
+    				if ($match === false) {
+    					if (!$c->increase_length()) {
+    						return false;
+    					} else {
+                        	continue;
+                    	}
+    				}
+
+    				$result = substr ($c->buffer, $c->offset, $match - $c->offset);
+    				$c->offset = $match + 1;
+    				
+    				return array (PDF_TYPE_HEX, $result);
+                }
+                
+                break;
+    		case	'<<':
+    			// This is a dictionary.
+
+    			$result = array();
+
+    			// Recurse into this function until we reach
+    			// the end of the dictionary.
+    			while (($key = $this->pdf_read_token($c)) !== '>>') {
+    				if ($key === false) {
+    					return false;
+    				}
+					
+    				if (($value =   $this->pdf_read_value($c)) === false) {
+    					return false;
+    				}
+                    $result[$key] = $value;
+    			}
+				
+    			return array (PDF_TYPE_DICTIONARY, $result);
+
+    		case	'[':
+    			// This is an array.
+
+    			$result = array();
+
+    			// Recurse into this function until we reach
+    			// the end of the array.
+    			while (($token = $this->pdf_read_token($c)) !== ']') {
+                    if ($token === false) {
+    					return false;
+    				}
+					
+    				if (($value = $this->pdf_read_value($c, $token)) === false) {
+                        return false;
+    				}
+					
+    				$result[] = $value;
+    			}
+    			
+                return array (PDF_TYPE_ARRAY, $result);
+
+    		case	'('		:
+                // This is a string
+                $pos = $c->offset;
+                
+                $openBrackets = 1;
+    			do {
+                    for (; $openBrackets != 0 && $pos < $c->length; $pos++) {
+                        switch (ord($c->buffer[$pos])) {
+                            case 0x28: // '('
+                                $openBrackets++;
+                                break;
+                            case 0x29: // ')'
+                                $openBrackets--;
+                                break;
+                            case 0x5C: // backslash
+                                $pos++;
+                        }
+                    }
+    			} while($openBrackets != 0 && $c->increase_length());
+    			
+    			$result = substr($c->buffer, $c->offset, $pos - $c->offset - 1);
+    			$c->offset = $pos;
+    			
+    			return array (PDF_TYPE_STRING, $result);
+
+    			
+            case "stream":
+            	$o_pos = ftell($c->file)-strlen($c->buffer);
+		        $o_offset = $c->offset;
+		        
+		        $c->reset($startpos = $o_pos + $o_offset);
+		        
+		        $e = 0; // ensure line breaks in front of the stream
+		        if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13))
+		        	$e++;
+		        if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10))
+		        	$e++;
+		        
+		        if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) {
+		        	$tmp_c =& new pdf_context($this->f);
+		        	$tmp_length = $this->pdf_resolve_object($tmp_c,$this->actual_obj[1][1]['/Length']);
+		        	$length = $tmp_length[1][1];
+		        } else {
+		        	$length = $this->actual_obj[1][1]['/Length'][1];	
+		        }
+		        
+		        if ($length > 0) {
+    		        $c->reset($startpos+$e,$length);
+    		        $v = $c->buffer;
+		        } else {
+		            $v = '';   
+		        }
+		        $c->reset($startpos+$e+$length+9); // 9 = strlen("endstream")
+		        
+		        return array(PDF_TYPE_STREAM, $v);
+		        
+	        case '%':
+	            // this is a comment - just jump over it
+                $pos = $c->offset;
+    			while(1) {
+    			    // PHP 4.3.3 required
+                    #$match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos);
+                    // alternative
+                    $match = preg_match("/(\r\n|\r|\n)/", substr($c->buffer, $pos), $m);
+					if ($match === false) {
+    					if (!$c->increase_length()) {
+    						return false;
+    					} else {
+                        	continue;
+                    	}
+    				}
+
+    				// PHP 4.3.3 required
+                    #$c->offset = $m[0][1]+strlen($m[0][0]);
+    				// alternative
+                    $c->offset = strpos($c->buffer, $m[0], $pos)+strlen($m[0]);
+    				
+    				return $this->pdf_read_value($c);
+                }
+                
+    		default	:
+            	if (is_numeric ($token)) {
+                    // A numeric token. Make sure that
+    				// it is not part of something else.
+    				if (($tok2 = $this->pdf_read_token ($c)) !== false) {
+                        if (is_numeric ($tok2)) {
+
+    						// Two numeric tokens in a row.
+    						// In this case, we're probably in
+    						// front of either an object reference
+    						// or an object specification.
+    						// Determine the case and return the data
+    						if (($tok3 = $this->pdf_read_token ($c)) !== false) {
+                                switch ($tok3) {
+    								case	'obj'	:
+                                        return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2);
+    								case	'R'		:
+    									return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2);
+    							}
+    							// If we get to this point, that numeric value up
+    							// there was just a numeric value. Push the extra
+    							// tokens back into the stack and return the value.
+    							array_push ($c->stack, $tok3);
+    						}
+    					}
+
+    					array_push ($c->stack, $tok2);
+    				}
+
+    				if ($token === (string)((int)$token))
+        				return array (PDF_TYPE_NUMERIC, (int)$token);
+    				else 
+    					return array (PDF_TYPE_REAL, (float)$token);
+    			} else if ($token == 'true' || $token == 'false') {
+                    return array (PDF_TYPE_BOOLEAN, $token == 'true');
+    			} else {
+
+                    // Just a token. Return it.
+    				return array (PDF_TYPE_TOKEN, $token);
+    			}
+
+         }
+    }
+    
+    /**
+     * Resolve an object
+     *
+     * @param object $c pdf_context
+     * @param array $obj_spec The object-data
+     * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para
+     */
+    function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) {
+        // Exit if we get invalid data
+    	if (!is_array($obj_spec)) {
+            return false;
+    	}
+
+    	if ($obj_spec[0] == PDF_TYPE_OBJREF) {
+
+    		// This is a reference, resolve it
+    		if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) {
+
+    			// Save current file position
+    			// This is needed if you want to resolve
+    			// references while you're reading another object
+    			// (e.g.: if you need to determine the length
+    			// of a stream)
+
+    			$old_pos = ftell($c->file);
+
+    			// Reposition the file pointer and
+    			// load the object header.
+				
+    			$c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]);
+
+    			$header = $this->pdf_read_value($c,null,true);
+
+    			if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) {
+    				$this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location");
+    			}
+
+    			// If we're being asked to store all the information
+    			// about the object, we add the object ID and generation
+    			// number for later use
+				$this->actual_obj =& $result;
+    			if ($encapsulate) {
+    				$result = array (
+    					PDF_TYPE_OBJECT,
+    					'obj' => $obj_spec[1],
+    					'gen' => $obj_spec[2]
+    				);
+    			} else {
+    				$result = array();
+    			}
+
+    			// Now simply read the object data until
+    			// we encounter an end-of-object marker
+    			while(1) {
+                    $value = $this->pdf_read_value($c);
+					if ($value === false || count($result) > 4) {
+						// in this case the parser coudn't find an endobj so we break here
+						break;
+    				}
+
+    				if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') {
+    					break;
+    				}
+
+                    $result[] = $value;
+    			}
+
+    			$c->reset($old_pos);
+
+                if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) {
+                    $result[0] = PDF_TYPE_STREAM;
+                }
+
+    			return $result;
+    		}
+    	} else {
+    		return $obj_spec;
+    	}
+    }
+
+    
+    
+    /**
+     * Reads a token from the file
+     *
+     * @param object $c pdf_context
+     * @return mixed
+     */
+    function pdf_read_token(&$c)
+    {
+    	// If there is a token available
+    	// on the stack, pop it out and
+    	// return it.
+
+    	if (count($c->stack)) {
+    		return array_pop($c->stack);
+    	}
+
+    	// Strip away any whitespace
+
+    	do {
+    		if (!$c->ensure_content()) {
+    			return false;
+    		}
+    		$c->offset += _strspn($c->buffer, " \n\r\t", $c->offset);
+    	} while ($c->offset >= $c->length - 1);
+
+    	// Get the first character in the stream
+
+    	$char = $c->buffer[$c->offset++];
+
+    	switch ($char) {
+
+    		case '['	:
+    		case ']'	:
+    		case '('	:
+    		case ')'	:
+
+    			// This is either an array or literal string
+    			// delimiter, Return it
+
+    			return $char;
+
+    		case '<'	:
+    		case '>'	:
+
+    			// This could either be a hex string or
+    			// dictionary delimiter. Determine the
+    			// appropriate case and return the token
+
+    			if ($c->buffer[$c->offset] == $char) {
+    				if (!$c->ensure_content()) {
+    				    return false;
+    				}
+    				$c->offset++;
+    				return $char . $char;
+    			} else {
+    				return $char;
+    			}
+
+    		default		:
+
+    			// This is "another" type of token (probably
+    			// a dictionary entry or a numeric value)
+    			// Find the end and return it.
+
+    			if (!$c->ensure_content()) {
+    				return false;
+    			}
+
+    			while(1) {
+
+    				// Determine the length of the token
+
+    				$pos = _strcspn($c->buffer, " []<>()\r\n\t/", $c->offset);
+    				if ($c->offset + $pos <= $c->length - 1) {
+    					break;
+    				} else {
+    					// If the script reaches this point,
+    					// the token may span beyond the end
+    					// of the current buffer. Therefore,
+    					// we increase the size of the buffer
+    					// and try again--just to be safe.
+
+    					$c->increase_length();
+    				}
+    			}
+
+    			$result = substr($c->buffer, $c->offset - 1, $pos + 1);
+
+    			$c->offset += $pos;
+    			return $result;
+    	}
+    }
+
+	
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/fpdf/wrapper_functions.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/wrapper_functions.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/fpdf/wrapper_functions.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,70 +1,70 @@
-<?php
-//
-//  FPDI - Version 1.2.1
-//
-//    Copyright 2004-2008 Setasign - Jan Slabon
-//
-//  Licensed under the Apache License, Version 2.0 (the "License");
-//  you may not use this file except in compliance with the License.
-//  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-
-
-if (!defined("PHP_VER_LOWER43")) 
-	define("PHP_VER_LOWER43", version_compare(PHP_VERSION, "4.3", "<"));
-
-
-/**
- * ensure that strspn works correct if php-version < 4.3
- */
-function _strspn($str1, $str2, $start=null, $length=null) {
-    $numargs = func_num_args();
-
-    if (PHP_VER_LOWER43 == 1) {
-        if (isset($length)) {
-            $str1 = substr($str1, $start, $length);
-        } else {
-            $str1 = substr($str1, $start);
-        }
-    }
-
-    if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
-        return strspn($str1, $str2);
-    } else if ($numargs == 3) {
-        return strspn($str1, $str2, $start);
-    } else {
-        return strspn($str1, $str2, $start, $length);
-    }
-}
-
-
-/**
- * ensure that strcspn works correct if php-version < 4.3
- */
-function _strcspn($str1, $str2, $start=null, $length=null) {
-    $numargs = func_num_args();
-
-    if (PHP_VER_LOWER43 == 1) {
-        if (isset($length)) {
-            $str1 = substr($str1, $start, $length);
-        } else {
-            $str1 = substr($str1, $start);
-        }
-    }
-
-    if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
-        return strcspn($str1, $str2);
-    } else if ($numargs == 3) {
-        return strcspn($str1, $str2, $start);
-    } else {
-        return strcspn($str1, $str2, $start, $length);
-    }
+<?php
+//
+//  FPDI - Version 1.2.1
+//
+//    Copyright 2004-2008 Setasign - Jan Slabon
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+
+
+if (!defined("PHP_VER_LOWER43")) 
+	define("PHP_VER_LOWER43", version_compare(PHP_VERSION, "4.3", "<"));
+
+
+/**
+ * ensure that strspn works correct if php-version < 4.3
+ */
+function _strspn($str1, $str2, $start=null, $length=null) {
+    $numargs = func_num_args();
+
+    if (PHP_VER_LOWER43 == 1) {
+        if (isset($length)) {
+            $str1 = substr($str1, $start, $length);
+        } else {
+            $str1 = substr($str1, $start);
+        }
+    }
+
+    if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
+        return strspn($str1, $str2);
+    } else if ($numargs == 3) {
+        return strspn($str1, $str2, $start);
+    } else {
+        return strspn($str1, $str2, $start, $length);
+    }
+}
+
+
+/**
+ * ensure that strcspn works correct if php-version < 4.3
+ */
+function _strcspn($str1, $str2, $start=null, $length=null) {
+    $numargs = func_num_args();
+
+    if (PHP_VER_LOWER43 == 1) {
+        if (isset($length)) {
+            $str1 = substr($str1, $start, $length);
+        } else {
+            $str1 = substr($str1, $start);
+        }
+    }
+
+    if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
+        return strcspn($str1, $str2);
+    } else if ($numargs == 3) {
+        return strcspn($str1, $str2, $start);
+    } else {
+        return strcspn($str1, $str2, $start, $length);
+    }
 }
\ No newline at end of file

Modified: branches/print_dev/http/extensions/jquery.form.js
===================================================================
--- branches/print_dev/http/extensions/jquery.form.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/extensions/jquery.form.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,632 +1,632 @@
-/*
- * jQuery Form Plugin
- * version: 2.21 (08-FEB-2009)
- * @requires jQuery v1.2.2 or later
- *
- * Examples and documentation at: http://malsup.com/jquery/form/
- * Dual licensed under the MIT and GPL licenses:
- *   http://www.opensource.org/licenses/mit-license.php
- *   http://www.gnu.org/licenses/gpl.html
- */
-;(function($) {
-
-/*
-    Usage Note:  
-    -----------
-    Do not use both ajaxSubmit and ajaxForm on the same form.  These
-    functions are intended to be exclusive.  Use ajaxSubmit if you want
-    to bind your own submit handler to the form.  For example,
-
-    $(document).ready(function() {
-        $('#myForm').bind('submit', function() {
-            $(this).ajaxSubmit({
-                target: '#output'
-            });
-            return false; // <-- important!
-        });
-    });
-
-    Use ajaxForm when you want the plugin to manage all the event binding
-    for you.  For example,
-
-    $(document).ready(function() {
-        $('#myForm').ajaxForm({
-            target: '#output'
-        });
-    });
-        
-    When using ajaxForm, the ajaxSubmit function will be invoked for you
-    at the appropriate time.  
-*/
-
-/**
- * ajaxSubmit() provides a mechanism for immediately submitting 
- * an HTML form using AJAX.
- */
-$.fn.ajaxSubmit = function(options) {
-    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
-    if (!this.length) {
-        log('ajaxSubmit: skipping submit process - no element selected');
-        return this;
-    }
-
-    if (typeof options == 'function')
-        options = { success: options };
-
-    options = $.extend({
-        url:  this.attr('action') || window.location.toString(),
-        type: this.attr('method') || 'GET'
-    }, options || {});
-
-    // hook for manipulating the form data before it is extracted;
-    // convenient for use with rich editors like tinyMCE or FCKEditor
-    var veto = {};
-    this.trigger('form-pre-serialize', [this, options, veto]);
-    if (veto.veto) {
-        log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
-        return this;
-    }
-
-    // provide opportunity to alter form data before it is serialized
-    if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
-        log('ajaxSubmit: submit aborted via beforeSerialize callback');
-        return this;
-    }    
-   
-    var a = this.formToArray(options.semantic);
-    if (options.data) {
-        options.extraData = options.data;
-        for (var n in options.data) {
-          if(options.data[n] instanceof Array) {
-            for (var k in options.data[n])
-              a.push( { name: n, value: options.data[n][k] } )
-          }  
-          else
-             a.push( { name: n, value: options.data[n] } );
-        }
-    }
-
-    // give pre-submit callback an opportunity to abort the submit
-    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
-        log('ajaxSubmit: submit aborted via beforeSubmit callback');
-        return this;
-    }    
-
-    // fire vetoable 'validate' event
-    this.trigger('form-submit-validate', [a, this, options, veto]);
-    if (veto.veto) {
-        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
-        return this;
-    }    
-
-    var q = $.param(a);
-
-    if (options.type.toUpperCase() == 'GET') {
-        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
-        options.data = null;  // data is null for 'get'
-    }
-    else
-        options.data = q; // data is the query string for 'post'
-
-    var $form = this, callbacks = [];
-    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
-    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
-
-    // perform a load on the target only if dataType is not provided
-    if (!options.dataType && options.target) {
-        var oldSuccess = options.success || function(){};
-        callbacks.push(function(data) {
-            $(options.target).html(data).each(oldSuccess, arguments);
-        });
-    }
-    else if (options.success)
-        callbacks.push(options.success);
-
-    options.success = function(data, status) {
-        for (var i=0, max=callbacks.length; i < max; i++)
-            callbacks[i].apply(options, [data, status, $form]);
-    };
-
-    // are there files to upload?
-    var files = $('input:file', this).fieldValue();
-    var found = false;
-    for (var j=0; j < files.length; j++)
-        if (files[j])
-            found = true;
-
-    // options.iframe allows user to force iframe mode
-   if (options.iframe || found) { 
-       // hack to fix Safari hang (thanks to Tim Molendijk for this)
-       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
-       if (options.closeKeepAlive)
-           $.get(options.closeKeepAlive, fileUpload);
-       else
-           fileUpload();
-       }
-   else
-       $.ajax(options);
-
-    // fire 'notify' event
-    this.trigger('form-submit-notify', [this, options]);
-    return this;
-
-
-    // private function for handling file uploads (hat tip to YAHOO!)
-    function fileUpload() {
-        var form = $form[0];
-        
-        if ($(':input[name=submit]', form).length) {
-            alert('Error: Form elements must not be named "submit".');
-            return;
-        }
-        
-        var opts = $.extend({}, $.ajaxSettings, options);
-		var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
-
-        var id = 'jqFormIO' + (new Date().getTime());
-        var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
-        var io = $io[0];
-
-        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
-
-        var xhr = { // mock object
-            aborted: 0,
-            responseText: null,
-            responseXML: null,
-            status: 0,
-            statusText: 'n/a',
-            getAllResponseHeaders: function() {},
-            getResponseHeader: function() {},
-            setRequestHeader: function() {},
-            abort: function() { 
-                this.aborted = 1; 
-                $io.attr('src','about:blank'); // abort op in progress
-            }
-        };
-
-        var g = opts.global;
-        // trigger ajax global events so that activity/block indicators work like normal
-        if (g && ! $.active++) $.event.trigger("ajaxStart");
-        if (g) $.event.trigger("ajaxSend", [xhr, opts]);
-
-		if (s.beforeSend && s.beforeSend(xhr, s) === false) {
-			s.global && jQuery.active--;
-			return;
-        }
-        if (xhr.aborted)
-            return;
-        
-        var cbInvoked = 0;
-        var timedOut = 0;
-
-        // add submitting element to data if we know it
-        var sub = form.clk;
-        if (sub) {
-            var n = sub.name;
-            if (n && !sub.disabled) {
-                options.extraData = options.extraData || {};
-                options.extraData[n] = sub.value;
-                if (sub.type == "image") {
-                    options.extraData[name+'.x'] = form.clk_x;
-                    options.extraData[name+'.y'] = form.clk_y;
-                }
-            }
-        }
-
-        // take a breath so that pending repaints get some cpu time before the upload starts
-        setTimeout(function() {
-            // make sure form attrs are set
-            var t = $form.attr('target'), a = $form.attr('action');
-
-			// update form attrs in IE friendly way
-			form.setAttribute('target',id);
-			if (form.getAttribute('method') != 'POST')
-				form.setAttribute('method', 'POST');
-			if (form.getAttribute('action') != opts.url)
-				form.setAttribute('action', opts.url);
-							
-            // ie borks in some cases when setting encoding
-            if (! options.skipEncodingOverride) {
-                $form.attr({
-                    encoding: 'multipart/form-data',
-                    enctype:  'multipart/form-data'
-                });
-            }
-
-            // support timout
-            if (opts.timeout)
-                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
-
-            // add "extra" data to form if provided in options
-            var extraInputs = [];
-            try {
-                if (options.extraData)
-                    for (var n in options.extraData)
-                        extraInputs.push(
-                            $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
-                                .appendTo(form)[0]);
-            
-                // add iframe to doc and submit the form
-                $io.appendTo('body');
-                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
-                form.submit();
-            }
-            finally {
-                // reset attrs and remove "extra" input elements
-				form.setAttribute('action',a);
-                t ? form.setAttribute('target', t) : $form.removeAttr('target');
-                $(extraInputs).remove();
-            }
-        }, 10);
-
-        var nullCheckFlag = 0;
-		
-        function cb() {
-            if (cbInvoked++) return;
-            
-            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
-
-            var ok = true;
-            try {
-                if (timedOut) throw 'timeout';
-                // extract the server response from the iframe
-                var data, doc;
-
-                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
-                
-                if ((doc.body == null || doc.body.innerHTML == '') && !nullCheckFlag) {
-                    // in some browsers (cough, Opera 9.2.x) the iframe DOM is not always traversable when
-                    // the onload callback fires, so we give them a 2nd chance
-                    nullCheckFlag = 1;
-                    cbInvoked--;
-                    setTimeout(cb, 100);
-                    return;
-                }
-                
-                xhr.responseText = doc.body ? doc.body.innerHTML : null;
-                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
-                xhr.getResponseHeader = function(header){
-                    var headers = {'content-type': opts.dataType};
-                    return headers[header];
-                };
-
-                if (opts.dataType == 'json' || opts.dataType == 'script') {
-                    var ta = doc.getElementsByTagName('textarea')[0];
-                    xhr.responseText = ta ? ta.value : xhr.responseText;
-                }
-                else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
-                    xhr.responseXML = toXml(xhr.responseText);
-                }
-                data = $.httpData(xhr, opts.dataType);
-            }
-            catch(e){
-                ok = false;
-                $.handleError(opts, xhr, 'error', e);
-            }
-
-            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
-            if (ok) {
-                opts.success(data, 'success');
-                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
-            }
-            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
-            if (g && ! --$.active) $.event.trigger("ajaxStop");
-            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
-
-            // clean up
-            setTimeout(function() {
-                $io.remove();
-                xhr.responseXML = null;
-            }, 100);
-        };
-
-        function toXml(s, doc) {
-            if (window.ActiveXObject) {
-                doc = new ActiveXObject('Microsoft.XMLDOM');
-                doc.async = 'false';
-                doc.loadXML(s);
-            }
-            else
-                doc = (new DOMParser()).parseFromString(s, 'text/xml');
-            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
-        };
-    };
-};
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- *    is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- *    used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.
- */ 
-$.fn.ajaxForm = function(options) {
-    return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
-        $(this).ajaxSubmit(options);
-        return false;
-    }).each(function() {
-        // store options in hash
-        $(":submit,input:image", this).bind('click.form-plugin',function(e) {
-            var form = this.form;
-            form.clk = this;
-            if (this.type == 'image') {
-                if (e.offsetX != undefined) {
-                    form.clk_x = e.offsetX;
-                    form.clk_y = e.offsetY;
-                } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
-                    var offset = $(this).offset();
-                    form.clk_x = e.pageX - offset.left;
-                    form.clk_y = e.pageY - offset.top;
-                } else {
-                    form.clk_x = e.pageX - this.offsetLeft;
-                    form.clk_y = e.pageY - this.offsetTop;
-                }
-            }
-            // clear form vars
-            setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
-        });
-    });
-};
-
-// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
-$.fn.ajaxFormUnbind = function() {
-    this.unbind('submit.form-plugin');
-    return this.each(function() {
-        $(":submit,input:image", this).unbind('click.form-plugin');
-    });
-
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property.  An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- */
-$.fn.formToArray = function(semantic) {
-    var a = [];
-    if (this.length == 0) return a;
-
-    var form = this[0];
-    var els = semantic ? form.getElementsByTagName('*') : form.elements;
-    if (!els) return a;
-    for(var i=0, max=els.length; i < max; i++) {
-        var el = els[i];
-        var n = el.name;
-        if (!n) continue;
-
-        if (semantic && form.clk && el.type == "image") {
-            // handle image inputs on the fly when semantic == true
-            if(!el.disabled && form.clk == el)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-            continue;
-        }
-
-        var v = $.fieldValue(el, true);
-        if (v && v.constructor == Array) {
-            for(var j=0, jmax=v.length; j < jmax; j++)
-                a.push({name: n, value: v[j]});
-        }
-        else if (v !== null && typeof v != 'undefined')
-            a.push({name: n, value: v});
-    }
-
-    if (!semantic && form.clk) {
-        // input type=='image' are not found in elements array! handle them here
-        var inputs = form.getElementsByTagName("input");
-        for(var i=0, max=inputs.length; i < max; i++) {
-            var input = inputs[i];
-            var n = input.name;
-            if(n && !input.disabled && input.type == "image" && form.clk == input)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-        }
-    }
-    return a;
-};
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&amp;name2=value2
- */
-$.fn.formSerialize = function(semantic) {
-    //hand off to jQuery.param for proper encoding
-    return $.param(this.formToArray(semantic));
-};
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&amp;name2=value2
- */
-$.fn.fieldSerialize = function(successful) {
-    var a = [];
-    this.each(function() {
-        var n = this.name;
-        if (!n) return;
-        var v = $.fieldValue(this, successful);
-        if (v && v.constructor == Array) {
-            for (var i=0,max=v.length; i < max; i++)
-                a.push({name: n, value: v[i]});
-        }
-        else if (v !== null && typeof v != 'undefined')
-            a.push({name: this.name, value: v});
-    });
-    //hand off to jQuery.param for proper encoding
-    return $.param(a);
-};
-
-/**
- * Returns the value(s) of the element in the matched set.  For example, consider the following form:
- *
- *  <form><fieldset>
- *      <input name="A" type="text" />
- *      <input name="A" type="text" />
- *      <input name="B" type="checkbox" value="B1" />
- *      <input name="B" type="checkbox" value="B2"/>
- *      <input name="C" type="radio" value="C1" />
- *      <input name="C" type="radio" value="C2" />
- *  </fieldset></form>
- *
- *  var v = $(':text').fieldValue();
- *  // if no values are entered into the text inputs
- *  v == ['','']
- *  // if values entered into the text inputs are 'foo' and 'bar'
- *  v == ['foo','bar']
- *
- *  var v = $(':checkbox').fieldValue();
- *  // if neither checkbox is checked
- *  v === undefined
- *  // if both checkboxes are checked
- *  v == ['B1', 'B2']
- *
- *  var v = $(':radio').fieldValue();
- *  // if neither radio is checked
- *  v === undefined
- *  // if first radio is checked
- *  v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.  If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array.  If no valid value can be determined the
- *       array will be empty, otherwise it will contain one or more values.
- */
-$.fn.fieldValue = function(successful) {
-    for (var val=[], i=0, max=this.length; i < max; i++) {
-        var el = this[i];
-        var v = $.fieldValue(el, successful);
-        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
-            continue;
-        v.constructor == Array ? $.merge(val, v) : val.push(v);
-    }
-    return val;
-};
-
-/**
- * Returns the value of the field element.
- */
-$.fieldValue = function(el, successful) {
-    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
-    if (typeof successful == 'undefined') successful = true;
-
-    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
-        (t == 'checkbox' || t == 'radio') && !el.checked ||
-        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
-        tag == 'select' && el.selectedIndex == -1))
-            return null;
-
-    if (tag == 'select') {
-        var index = el.selectedIndex;
-        if (index < 0) return null;
-        var a = [], ops = el.options;
-        var one = (t == 'select-one');
-        var max = (one ? index+1 : ops.length);
-        for(var i=(one ? index : 0); i < max; i++) {
-            var op = ops[i];
-            if (op.selected) {
-				var v = op.value;
-				if (!v) // extra pain for IE...
-                	v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
-                if (one) return v;
-                a.push(v);
-            }
-        }
-        return a;
-    }
-    return el.value;
-};
-
-/**
- * Clears the form data.  Takes the following actions on the form's input fields:
- *  - input text fields will have their 'value' property set to the empty string
- *  - select elements will have their 'selectedIndex' property set to -1
- *  - checkbox and radio inputs will have their 'checked' property set to false
- *  - inputs of type submit, button, reset, and hidden will *not* be effected
- *  - button elements will *not* be effected
- */
-$.fn.clearForm = function() {
-    return this.each(function() {
-        $('input,select,textarea', this).clearFields();
-    });
-};
-
-/**
- * Clears the selected form elements.
- */
-$.fn.clearFields = $.fn.clearInputs = function() {
-    return this.each(function() {
-        var t = this.type, tag = this.tagName.toLowerCase();
-        if (t == 'text' || t == 'password' || tag == 'textarea')
-            this.value = '';
-        else if (t == 'checkbox' || t == 'radio')
-            this.checked = false;
-        else if (tag == 'select')
-            this.selectedIndex = -1;
-    });
-};
-
-/**
- * Resets the form data.  Causes all form elements to be reset to their original value.
- */
-$.fn.resetForm = function() {
-    return this.each(function() {
-        // guard against an input with the name of 'reset'
-        // note that IE reports the reset function as an 'object'
-        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
-            this.reset();
-    });
-};
-
-/**
- * Enables or disables any matching elements.
- */
-$.fn.enable = function(b) { 
-    if (b == undefined) b = true;
-    return this.each(function() { 
-        this.disabled = !b 
-    });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- */
-$.fn.selected = function(select) {
-    if (select == undefined) select = true;
-    return this.each(function() { 
-        var t = this.type;
-        if (t == 'checkbox' || t == 'radio')
-            this.checked = select;
-        else if (this.tagName.toLowerCase() == 'option') {
-            var $sel = $(this).parent('select');
-            if (select && $sel[0] && $sel[0].type == 'select-one') {
-                // deselect all other options
-                $sel.find('option').selected(false);
-            }
-            this.selected = select;
-        }
-    });
-};
-
-// helper fn for console logging
-// set $.fn.ajaxSubmit.debug to true to enable debug logging
-function log() {
-    if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
-        window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
-};
-
-})(jQuery);
+/*
+ * jQuery Form Plugin
+ * version: 2.21 (08-FEB-2009)
+ * @requires jQuery v1.2.2 or later
+ *
+ * Examples and documentation at: http://malsup.com/jquery/form/
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ */
+;(function($) {
+
+/*
+    Usage Note:  
+    -----------
+    Do not use both ajaxSubmit and ajaxForm on the same form.  These
+    functions are intended to be exclusive.  Use ajaxSubmit if you want
+    to bind your own submit handler to the form.  For example,
+
+    $(document).ready(function() {
+        $('#myForm').bind('submit', function() {
+            $(this).ajaxSubmit({
+                target: '#output'
+            });
+            return false; // <-- important!
+        });
+    });
+
+    Use ajaxForm when you want the plugin to manage all the event binding
+    for you.  For example,
+
+    $(document).ready(function() {
+        $('#myForm').ajaxForm({
+            target: '#output'
+        });
+    });
+        
+    When using ajaxForm, the ajaxSubmit function will be invoked for you
+    at the appropriate time.  
+*/
+
+/**
+ * ajaxSubmit() provides a mechanism for immediately submitting 
+ * an HTML form using AJAX.
+ */
+$.fn.ajaxSubmit = function(options) {
+    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
+    if (!this.length) {
+        log('ajaxSubmit: skipping submit process - no element selected');
+        return this;
+    }
+
+    if (typeof options == 'function')
+        options = { success: options };
+
+    options = $.extend({
+        url:  this.attr('action') || window.location.toString(),
+        type: this.attr('method') || 'GET'
+    }, options || {});
+
+    // hook for manipulating the form data before it is extracted;
+    // convenient for use with rich editors like tinyMCE or FCKEditor
+    var veto = {};
+    this.trigger('form-pre-serialize', [this, options, veto]);
+    if (veto.veto) {
+        log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
+        return this;
+    }
+
+    // provide opportunity to alter form data before it is serialized
+    if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
+        log('ajaxSubmit: submit aborted via beforeSerialize callback');
+        return this;
+    }    
+   
+    var a = this.formToArray(options.semantic);
+    if (options.data) {
+        options.extraData = options.data;
+        for (var n in options.data) {
+          if(options.data[n] instanceof Array) {
+            for (var k in options.data[n])
+              a.push( { name: n, value: options.data[n][k] } )
+          }  
+          else
+             a.push( { name: n, value: options.data[n] } );
+        }
+    }
+
+    // give pre-submit callback an opportunity to abort the submit
+    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
+        log('ajaxSubmit: submit aborted via beforeSubmit callback');
+        return this;
+    }    
+
+    // fire vetoable 'validate' event
+    this.trigger('form-submit-validate', [a, this, options, veto]);
+    if (veto.veto) {
+        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
+        return this;
+    }    
+
+    var q = $.param(a);
+
+    if (options.type.toUpperCase() == 'GET') {
+        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
+        options.data = null;  // data is null for 'get'
+    }
+    else
+        options.data = q; // data is the query string for 'post'
+
+    var $form = this, callbacks = [];
+    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
+    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
+
+    // perform a load on the target only if dataType is not provided
+    if (!options.dataType && options.target) {
+        var oldSuccess = options.success || function(){};
+        callbacks.push(function(data) {
+            $(options.target).html(data).each(oldSuccess, arguments);
+        });
+    }
+    else if (options.success)
+        callbacks.push(options.success);
+
+    options.success = function(data, status) {
+        for (var i=0, max=callbacks.length; i < max; i++)
+            callbacks[i].apply(options, [data, status, $form]);
+    };
+
+    // are there files to upload?
+    var files = $('input:file', this).fieldValue();
+    var found = false;
+    for (var j=0; j < files.length; j++)
+        if (files[j])
+            found = true;
+
+    // options.iframe allows user to force iframe mode
+   if (options.iframe || found) { 
+       // hack to fix Safari hang (thanks to Tim Molendijk for this)
+       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
+       if (options.closeKeepAlive)
+           $.get(options.closeKeepAlive, fileUpload);
+       else
+           fileUpload();
+       }
+   else
+       $.ajax(options);
+
+    // fire 'notify' event
+    this.trigger('form-submit-notify', [this, options]);
+    return this;
+
+
+    // private function for handling file uploads (hat tip to YAHOO!)
+    function fileUpload() {
+        var form = $form[0];
+        
+        if ($(':input[name=submit]', form).length) {
+            alert('Error: Form elements must not be named "submit".');
+            return;
+        }
+        
+        var opts = $.extend({}, $.ajaxSettings, options);
+		var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
+
+        var id = 'jqFormIO' + (new Date().getTime());
+        var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
+        var io = $io[0];
+
+        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
+
+        var xhr = { // mock object
+            aborted: 0,
+            responseText: null,
+            responseXML: null,
+            status: 0,
+            statusText: 'n/a',
+            getAllResponseHeaders: function() {},
+            getResponseHeader: function() {},
+            setRequestHeader: function() {},
+            abort: function() { 
+                this.aborted = 1; 
+                $io.attr('src','about:blank'); // abort op in progress
+            }
+        };
+
+        var g = opts.global;
+        // trigger ajax global events so that activity/block indicators work like normal
+        if (g && ! $.active++) $.event.trigger("ajaxStart");
+        if (g) $.event.trigger("ajaxSend", [xhr, opts]);
+
+		if (s.beforeSend && s.beforeSend(xhr, s) === false) {
+			s.global && jQuery.active--;
+			return;
+        }
+        if (xhr.aborted)
+            return;
+        
+        var cbInvoked = 0;
+        var timedOut = 0;
+
+        // add submitting element to data if we know it
+        var sub = form.clk;
+        if (sub) {
+            var n = sub.name;
+            if (n && !sub.disabled) {
+                options.extraData = options.extraData || {};
+                options.extraData[n] = sub.value;
+                if (sub.type == "image") {
+                    options.extraData[name+'.x'] = form.clk_x;
+                    options.extraData[name+'.y'] = form.clk_y;
+                }
+            }
+        }
+
+        // take a breath so that pending repaints get some cpu time before the upload starts
+        setTimeout(function() {
+            // make sure form attrs are set
+            var t = $form.attr('target'), a = $form.attr('action');
+
+			// update form attrs in IE friendly way
+			form.setAttribute('target',id);
+			if (form.getAttribute('method') != 'POST')
+				form.setAttribute('method', 'POST');
+			if (form.getAttribute('action') != opts.url)
+				form.setAttribute('action', opts.url);
+							
+            // ie borks in some cases when setting encoding
+            if (! options.skipEncodingOverride) {
+                $form.attr({
+                    encoding: 'multipart/form-data',
+                    enctype:  'multipart/form-data'
+                });
+            }
+
+            // support timout
+            if (opts.timeout)
+                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
+
+            // add "extra" data to form if provided in options
+            var extraInputs = [];
+            try {
+                if (options.extraData)
+                    for (var n in options.extraData)
+                        extraInputs.push(
+                            $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
+                                .appendTo(form)[0]);
+            
+                // add iframe to doc and submit the form
+                $io.appendTo('body');
+                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
+                form.submit();
+            }
+            finally {
+                // reset attrs and remove "extra" input elements
+				form.setAttribute('action',a);
+                t ? form.setAttribute('target', t) : $form.removeAttr('target');
+                $(extraInputs).remove();
+            }
+        }, 10);
+
+        var nullCheckFlag = 0;
+		
+        function cb() {
+            if (cbInvoked++) return;
+            
+            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
+
+            var ok = true;
+            try {
+                if (timedOut) throw 'timeout';
+                // extract the server response from the iframe
+                var data, doc;
+
+                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
+                
+                if ((doc.body == null || doc.body.innerHTML == '') && !nullCheckFlag) {
+                    // in some browsers (cough, Opera 9.2.x) the iframe DOM is not always traversable when
+                    // the onload callback fires, so we give them a 2nd chance
+                    nullCheckFlag = 1;
+                    cbInvoked--;
+                    setTimeout(cb, 100);
+                    return;
+                }
+                
+                xhr.responseText = doc.body ? doc.body.innerHTML : null;
+                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
+                xhr.getResponseHeader = function(header){
+                    var headers = {'content-type': opts.dataType};
+                    return headers[header];
+                };
+
+                if (opts.dataType == 'json' || opts.dataType == 'script') {
+                    var ta = doc.getElementsByTagName('textarea')[0];
+                    xhr.responseText = ta ? ta.value : xhr.responseText;
+                }
+                else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
+                    xhr.responseXML = toXml(xhr.responseText);
+                }
+                data = $.httpData(xhr, opts.dataType);
+            }
+            catch(e){
+                ok = false;
+                $.handleError(opts, xhr, 'error', e);
+            }
+
+            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
+            if (ok) {
+                opts.success(data, 'success');
+                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
+            }
+            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
+            if (g && ! --$.active) $.event.trigger("ajaxStop");
+            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
+
+            // clean up
+            setTimeout(function() {
+                $io.remove();
+                xhr.responseXML = null;
+            }, 100);
+        };
+
+        function toXml(s, doc) {
+            if (window.ActiveXObject) {
+                doc = new ActiveXObject('Microsoft.XMLDOM');
+                doc.async = 'false';
+                doc.loadXML(s);
+            }
+            else
+                doc = (new DOMParser()).parseFromString(s, 'text/xml');
+            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
+        };
+    };
+};
+
+/**
+ * ajaxForm() provides a mechanism for fully automating form submission.
+ *
+ * The advantages of using this method instead of ajaxSubmit() are:
+ *
+ * 1: This method will include coordinates for <input type="image" /> elements (if the element
+ *    is used to submit the form).
+ * 2. This method will include the submit element's name/value data (for the element that was
+ *    used to submit the form).
+ * 3. This method binds the submit() method to the form for you.
+ *
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
+ * passes the options argument along after properly binding events for submit elements and
+ * the form itself.
+ */ 
+$.fn.ajaxForm = function(options) {
+    return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
+        $(this).ajaxSubmit(options);
+        return false;
+    }).each(function() {
+        // store options in hash
+        $(":submit,input:image", this).bind('click.form-plugin',function(e) {
+            var form = this.form;
+            form.clk = this;
+            if (this.type == 'image') {
+                if (e.offsetX != undefined) {
+                    form.clk_x = e.offsetX;
+                    form.clk_y = e.offsetY;
+                } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
+                    var offset = $(this).offset();
+                    form.clk_x = e.pageX - offset.left;
+                    form.clk_y = e.pageY - offset.top;
+                } else {
+                    form.clk_x = e.pageX - this.offsetLeft;
+                    form.clk_y = e.pageY - this.offsetTop;
+                }
+            }
+            // clear form vars
+            setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
+        });
+    });
+};
+
+// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
+$.fn.ajaxFormUnbind = function() {
+    this.unbind('submit.form-plugin');
+    return this.each(function() {
+        $(":submit,input:image", this).unbind('click.form-plugin');
+    });
+
+};
+
+/**
+ * formToArray() gathers form element data into an array of objects that can
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
+ * Each object in the array has both a 'name' and 'value' property.  An example of
+ * an array for a simple login form might be:
+ *
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * It is this array that is passed to pre-submit callback functions provided to the
+ * ajaxSubmit() and ajaxForm() methods.
+ */
+$.fn.formToArray = function(semantic) {
+    var a = [];
+    if (this.length == 0) return a;
+
+    var form = this[0];
+    var els = semantic ? form.getElementsByTagName('*') : form.elements;
+    if (!els) return a;
+    for(var i=0, max=els.length; i < max; i++) {
+        var el = els[i];
+        var n = el.name;
+        if (!n) continue;
+
+        if (semantic && form.clk && el.type == "image") {
+            // handle image inputs on the fly when semantic == true
+            if(!el.disabled && form.clk == el)
+                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+            continue;
+        }
+
+        var v = $.fieldValue(el, true);
+        if (v && v.constructor == Array) {
+            for(var j=0, jmax=v.length; j < jmax; j++)
+                a.push({name: n, value: v[j]});
+        }
+        else if (v !== null && typeof v != 'undefined')
+            a.push({name: n, value: v});
+    }
+
+    if (!semantic && form.clk) {
+        // input type=='image' are not found in elements array! handle them here
+        var inputs = form.getElementsByTagName("input");
+        for(var i=0, max=inputs.length; i < max; i++) {
+            var input = inputs[i];
+            var n = input.name;
+            if(n && !input.disabled && input.type == "image" && form.clk == input)
+                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+        }
+    }
+    return a;
+};
+
+/**
+ * Serializes form data into a 'submittable' string. This method will return a string
+ * in the format: name1=value1&amp;name2=value2
+ */
+$.fn.formSerialize = function(semantic) {
+    //hand off to jQuery.param for proper encoding
+    return $.param(this.formToArray(semantic));
+};
+
+/**
+ * Serializes all field elements in the jQuery object into a query string.
+ * This method will return a string in the format: name1=value1&amp;name2=value2
+ */
+$.fn.fieldSerialize = function(successful) {
+    var a = [];
+    this.each(function() {
+        var n = this.name;
+        if (!n) return;
+        var v = $.fieldValue(this, successful);
+        if (v && v.constructor == Array) {
+            for (var i=0,max=v.length; i < max; i++)
+                a.push({name: n, value: v[i]});
+        }
+        else if (v !== null && typeof v != 'undefined')
+            a.push({name: this.name, value: v});
+    });
+    //hand off to jQuery.param for proper encoding
+    return $.param(a);
+};
+
+/**
+ * Returns the value(s) of the element in the matched set.  For example, consider the following form:
+ *
+ *  <form><fieldset>
+ *      <input name="A" type="text" />
+ *      <input name="A" type="text" />
+ *      <input name="B" type="checkbox" value="B1" />
+ *      <input name="B" type="checkbox" value="B2"/>
+ *      <input name="C" type="radio" value="C1" />
+ *      <input name="C" type="radio" value="C2" />
+ *  </fieldset></form>
+ *
+ *  var v = $(':text').fieldValue();
+ *  // if no values are entered into the text inputs
+ *  v == ['','']
+ *  // if values entered into the text inputs are 'foo' and 'bar'
+ *  v == ['foo','bar']
+ *
+ *  var v = $(':checkbox').fieldValue();
+ *  // if neither checkbox is checked
+ *  v === undefined
+ *  // if both checkboxes are checked
+ *  v == ['B1', 'B2']
+ *
+ *  var v = $(':radio').fieldValue();
+ *  // if neither radio is checked
+ *  v === undefined
+ *  // if first radio is checked
+ *  v == ['C1']
+ *
+ * The successful argument controls whether or not the field element must be 'successful'
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true.  If this value is false the value(s)
+ * for each element is returned.
+ *
+ * Note: This method *always* returns an array.  If no valid value can be determined the
+ *       array will be empty, otherwise it will contain one or more values.
+ */
+$.fn.fieldValue = function(successful) {
+    for (var val=[], i=0, max=this.length; i < max; i++) {
+        var el = this[i];
+        var v = $.fieldValue(el, successful);
+        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
+            continue;
+        v.constructor == Array ? $.merge(val, v) : val.push(v);
+    }
+    return val;
+};
+
+/**
+ * Returns the value of the field element.
+ */
+$.fieldValue = function(el, successful) {
+    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+    if (typeof successful == 'undefined') successful = true;
+
+    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
+        (t == 'checkbox' || t == 'radio') && !el.checked ||
+        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
+        tag == 'select' && el.selectedIndex == -1))
+            return null;
+
+    if (tag == 'select') {
+        var index = el.selectedIndex;
+        if (index < 0) return null;
+        var a = [], ops = el.options;
+        var one = (t == 'select-one');
+        var max = (one ? index+1 : ops.length);
+        for(var i=(one ? index : 0); i < max; i++) {
+            var op = ops[i];
+            if (op.selected) {
+				var v = op.value;
+				if (!v) // extra pain for IE...
+                	v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
+                if (one) return v;
+                a.push(v);
+            }
+        }
+        return a;
+    }
+    return el.value;
+};
+
+/**
+ * Clears the form data.  Takes the following actions on the form's input fields:
+ *  - input text fields will have their 'value' property set to the empty string
+ *  - select elements will have their 'selectedIndex' property set to -1
+ *  - checkbox and radio inputs will have their 'checked' property set to false
+ *  - inputs of type submit, button, reset, and hidden will *not* be effected
+ *  - button elements will *not* be effected
+ */
+$.fn.clearForm = function() {
+    return this.each(function() {
+        $('input,select,textarea', this).clearFields();
+    });
+};
+
+/**
+ * Clears the selected form elements.
+ */
+$.fn.clearFields = $.fn.clearInputs = function() {
+    return this.each(function() {
+        var t = this.type, tag = this.tagName.toLowerCase();
+        if (t == 'text' || t == 'password' || tag == 'textarea')
+            this.value = '';
+        else if (t == 'checkbox' || t == 'radio')
+            this.checked = false;
+        else if (tag == 'select')
+            this.selectedIndex = -1;
+    });
+};
+
+/**
+ * Resets the form data.  Causes all form elements to be reset to their original value.
+ */
+$.fn.resetForm = function() {
+    return this.each(function() {
+        // guard against an input with the name of 'reset'
+        // note that IE reports the reset function as an 'object'
+        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
+            this.reset();
+    });
+};
+
+/**
+ * Enables or disables any matching elements.
+ */
+$.fn.enable = function(b) { 
+    if (b == undefined) b = true;
+    return this.each(function() { 
+        this.disabled = !b 
+    });
+};
+
+/**
+ * Checks/unchecks any matching checkboxes or radio buttons and
+ * selects/deselects and matching option elements.
+ */
+$.fn.selected = function(select) {
+    if (select == undefined) select = true;
+    return this.each(function() { 
+        var t = this.type;
+        if (t == 'checkbox' || t == 'radio')
+            this.checked = select;
+        else if (this.tagName.toLowerCase() == 'option') {
+            var $sel = $(this).parent('select');
+            if (select && $sel[0] && $sel[0].type == 'select-one') {
+                // deselect all other options
+                $sel.find('option').selected(false);
+            }
+            this.selected = select;
+        }
+    });
+};
+
+// helper fn for console logging
+// set $.fn.ajaxSubmit.debug to true to enable debug logging
+function log() {
+    if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
+        window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
+};
+
+})(jQuery);

Modified: branches/print_dev/http/html/mod_treefolder.php
===================================================================
--- branches/print_dev/http/html/mod_treefolder.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/html/mod_treefolder.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,645 +1,645 @@
-<?php
-require("../php/mb_validateSession.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE>Treefolder</TITLE>
-<META NAME="Generator" CONTENT="Cosmo Create 1.0.3">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-include '../include/dyn_css.php';
-?>
-
-<script language='JavaScript'>
-function pop_up(name, einstellungen) {
-	window.open ('',name,einstellungen);
-}
-<?php
-   $sql = "SELECT e_target FROM gui_element WHERE e_id = $1 AND fkey_gui_id = $2";
-   $v = array($e_id,$gui_id);
-   $t = array('s','s');
-   $res = db_prep_query($sql,$v,$t);
-   $e_target = db_result($res,0,"e_target");   
-   echo "mod_treeGDE_map = '".$e_target."';";   
-?>
-</script>
-
-  <SCRIPT language="JavaScript1.2">
-  <!--  
-  /*
-   * sitemap.js 1.31 05/02/2000
-   *  - Opera 5
-   *
-   * sitemap.js 1.3 27/11/2000
-   *  - Netscape 6
-   *
-   * sitemap.js 1.2 20/05/2000
-   *  - split array tree into arrays for each element old tree
-   *  - no mory type flag, an folder is an entry which has sons
-   *  - a folder can have an link
-   *  - while initing an default layers is shown 
-   *
-   * sitemap.js 1.1 20/10/1999
-   *  - showTree only updates and init layers new which have been really changed
-   *  - add deep to knot entry
-   *  - substitute knotDeep[ id ] w/ tree[ id2treeIndex[ id ] ].deep
-   *  - add alignment to img and a &nbsp; at the beginning of eyery line
-   *  - add a fake img for bookmarks on top panel
-   *
-   * sitemap.js 1.02 14/10/1999
-   *  - fix bug in initStyles
-   *
-   * sitemap.js 1.01 06/10/1999
-   *  - fix bug in knotDeep for Netscape 4.00-4.0.5
-   *
-   * sitemap.js 1.0 20/09/1999
-   *
-   * Javascript function for displaying hierarchic directory structures with
-   * the ability to collapse and expand directories.
-   *
-   * Copyright (c) 1999 Polzin GmbH, Duesseldorf. All Rights Reserved.
-   * Author: Lutz Eymers <ixtab at polzin.com>
-   * Download: http://www.polzin.com/inet/fset_inet.phtml?w=goodies
-   *
-   * Permission to use, copy, modify, and distribute this software
-   * and its documentation for any purposes and without fee
-   * is hereby granted provided that this copyright notice
-   * appears in all copies. 
-   *
-   * Of course, this software is provided "as is" without express or implied
-   * warranty of any kind.
-   *
-   */
-
-//var myCategories = {"Stadt":0, "Land":1, "Fluss":4};
-var myCategories = {};
-
-
-// some defaults
-try{if (switchwms){}}catch(e){switchwms = 'false';}
-try{if (ficheckbox){}}catch(e){ficheckbox = 'true';}
-try{if (metadatalink){}}catch(e){metadatalink = 'false';}
-
-  
-  parent.mb_registerSubFunctions("window.frames['treeGDE'].mod_treeGDE();");
-  parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].deleteInputTags();");
-  parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].document.location.reload();");
-  
-
-function deleteInputTags() {
-	var max = document.getElementsByTagName("input").length;
-	for (var i=0; i<max; i++) {
-		var aNode = document.getElementsByTagName("input")[0];
-		var aNodeParent = aNode.parentNode;
-		aNodeParent.removeChild(aNode);
-	}
-}
-function handleSelectedLayer(mapObj,wms_id,layername,type,status){
-	var mywms = new Array();
-	mywms[0] = wms_id;
-	var mylayername = new Array();
-	mylayername[0] = layername;
-	parent.handleSelectedLayer_array(mapObj, mywms, mylayername, type, status);
-}
-function switchWMS(w,s){
-	for (var i=0; i < parent.mb_mapObj.length; i++) {
-		if (parent.mb_mapObj[i].frameName == mod_treeGDE_map) {
-			for (var ii=0; ii < parent.mb_mapObj[i].wms.length; ii++){
-				if (parent.mb_mapObj[i].wms[ii].wms_id == w){
-					for (var iii=1; iii < parent.mb_mapObj[i].wms[ii].objLayer.length; iii++) {
-						if (parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_selectable == '1') {
-							parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible = s;
-						}
-						if (parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_queryable == '1') {
-							//parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer = s;
-						}
-					}
-				}
-			}
-		}
-	}
-	parent.mb_restateLayers(mod_treeGDE_map,w);
-	parent.setSingleMapRequest(mod_treeGDE_map,w);
-}
-function mod_treeGDE(){
-  /**/
-	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
-	//if(ind == false){ alert("error, no mapobject specified");}
-	for(var i=0; i<document.getElementsByTagName("input").length; i++){
-		//layer_shortname,wms_id,{visible | querylayer}
-		var myID = document.getElementsByTagName("input")[i].id;
-		var arrayID = document.getElementsByTagName("input")[i].id.split("###");
-		var wms_ind = parent.getWMSIndexById(mod_treeGDE_map,arrayID[1]);
-		if(arrayID[2] == "visible" && typeof(wms_ind) != "undefined"){
-			var arrayLayer = parent.mb_mapObj[ind].layers[wms_ind].split(",");
-			var isOn = false;
-			for(var ii=0; ii<arrayLayer.length; ii++){
-				if(arrayID[0] == arrayLayer[ii]){
-					isOn = true;
-				}
-			}
-			if(isOn == true){ document.getElementById(myID).checked = true;}
-			if(isOn == false){ document.getElementById(myID).checked = false;}
-		}
-		if(arrayID[2] == "querylayer" && typeof(wms_ind) != "undefined"){
-			var arrayLayer = parent.mb_mapObj[ind].querylayers[wms_ind].split(",");
-			var isOn = false;
-			for(var ii=0; ii<arrayLayer.length; ii++){
-				if(arrayID[0] == arrayLayer[ii]){
-					isOn = true;
-				}
-			}
-			if(isOn == true){ document.getElementById(myID).checked = true;}
-			if(isOn == false){ document.getElementById(myID).checked = false;}
-		}
-	}
-    /*consider scalhints*/
-	for(var i=0; i<parent.mb_mapObj.length; i++){
-		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
-		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
-			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
-				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
-					if(document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id)){
-						if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){                    
-							document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id).style.color = '#999999';                
-						}
-						else if(scale > parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
-							document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id).style.color = '#999999';
-						}
-						else{
-							document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id).style.color = '#000000';
-						}
-					}                   
-				}
-			}
-		}
-	}
-} 
-  window.onError=null;
-
-  var idx=0
-  var treeId = new Array();
-  var treeP_id = new Array();
-  var treeIsOn = new Array();
-  var treeTyp = new Array();
-  var treeName = new Array();
-  var treeUrl = new Array();
-  var treeWasOn = new Array();
-  var treeDeep = new Array();
-  var treeLastY = new Array();
-  var treeIsShown = new Array();
-  var treeSelectable = new Array();
-  var treeVisible = new Array();
-  var treeQueryable = new Array();
-  var treeQuerylayer = new Array();
-  var treeWMS = new Array();
-  var treeShortname = new Array();
-
-
-  function Note( id,p_id,name,url,selectable,visible,queryable,querylayer,wms,shortname) {
-    treeId[ idx ] = id
-    treeP_id[ idx ] = p_id
-    treeIsOn[ idx ] = false
-    treeTyp[ idx ] = 'f'
-    treeName[ idx ] = name
-    treeUrl[ idx ] = url 
-    treeWasOn[ idx ] = false
-    treeDeep[ idx ] = 0
-    treeLastY[ idx ] = 0
-    treeIsShown[ idx ] = false
-    treeSelectable[ idx ] = selectable
-    treeVisible[ idx ] = visible
-    treeQueryable[ idx ] = queryable
-    treeQuerylayer[ idx ] = querylayer
-    treeWMS[ idx ] = wms
-    treeShortname[ idx ] = shortname
-
-    idx++
-  }
-
-  function openwindow(Adresse) {
-    Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
-    Fenster1.focus();
-  }
-
-  function initDiv ( )
-  {
-    if ( isDOM || isDomIE )
-    {
-      divPrefix='<DIV CLASS="sitemap" style="position:absolute; left:0; top:0; visibility:hidden;" ID="sitemap'
-      divInfo='<DIV CLASS="sitemap" style="position:absolute; visibility:visible" ID="sitemap'
-    }
-    else
-    {
-      divPrefix='<DIV CLASS="sitemap" ID="sitemap'
-      divInfo='<DIV CLASS="sitemap" ID="sitemap'
-    }
-    document.writeln( divInfo +  'info">Bitte haben Sie etwas Geduld.<BR>&nbsp;<BR>Es werden die Eintr&auml;ge aus<BR>&nbsp;<BR>der Datenbank initialisiert.</DIV> ' );
-    for ( var i=1; i<idx; i++ )
-    {
-      // linked Name ? 
-      if ( treeUrl[i] != null ) {
-
-        linkedName = "<input id='"+treeShortname[i]+"###"+treeWMS[i]+"###visible###' type='checkbox' ";
-         if(treeVisible[i] == '1'){ linkedName += "checked ";}
-         
-         if(treeSelectable[i] != '1'){ 
-         	linkedName += "disabled ";
-         }
-        linkedName += "onClick = 'if(this.checked){handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"visible\",1);";
-		if(ficheckbox == 'false'){
-			linkedName += "handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",1);";
-		}
-        linkedName += "}";
-        linkedName += "else{handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"visible\",0);";
-        if(ficheckbox == 'false'){
-			linkedName += "handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",0);";
-		}
-        linkedName += "}'";
-        linkedName += '>';
-        
-        if (ficheckbox == 'true'){
-            linkedName += "<input id='"+treeShortname[i]+"###"+treeWMS[i]+"###querylayer' type='checkbox' ";
-            if(treeQuerylayer[i] == '1'){ linkedName += "checked ";}
-            if(treeQueryable[i] != '1'){ linkedName += "disabled ";}
-            linkedName += "onClick = 'if(this.checked){handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",1);}";
-            linkedName += "else{handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",0);}'";
-            linkedName += '>';
-        }
-      
-        //linkedName += '<A id="'+treeWMS[i]+'_'+treeShortname[i]+'"  HREF="' + treeUrl[i] + '" TARGET="' + defaultTarget + '"><IMG SRC="'+imagedir+'/1w.gif" BORDER="0" WIDTH="3">' + treeName[i] + '</A>';
-        
-        linkedName += '<A id="'+treeShortname[i]+'_'+treeWMS[i];
-        
-        if (metadatalink == 'true'){
-        	if (treeUrl[i] !== false) {
-				linkedName += '"  HREF="' + treeUrl[i];
-        	}
-        }
-//        linkedName += '"  HREF="../php/mod_layerMetadata.php?id=' + ;
-
-
-        linkedName +='" TARGET="' + defaultTarget + '" onclick="openwindow(this.href); return false"><IMG SRC="'+imagedir+'/1w.gif" BORDER="0" WIDTH="3">' + treeName[i] + '</A>';
-       
-       
-      }  
-      else{
-      	linkedName = "";
-        linkedName =  '<IMG SRC="'+imagedir+'/1w.gif" BORDER="0" WIDTH="3">';
-        if(switchwms == 'true'){
-        	linkedName += '<input type="checkbox" onclick="if(this.checked){switchWMS(\''+treeWMS[i]+'\',1)}else{switchWMS(\''+treeWMS[i]+'\',0)}">';
-        }
-        linkedName += treeName[i];
-      }
-      // don't link folder icon if node has no sons
-      if ( i == idx-1 || treeP_id[i+1] != treeId[i] ) {
-        if ( treeDeep[ i ] == 0 )
-          folderImg = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_empty.gif" BORDER="0" HEIGHT="16" WIDTH="1" HSPACE="0">'
-        else
-          folderImg = ''
-      } else {
-        folderImg = '<A  HREF="javascript:sitemapClick(' + treeId[i] + ')"><IMG ALIGN="BOTTOM" SRC="'+imagedir+'/folder_off.gif" BORDER="0" NAME="folder' + treeId[i] + '" HEIGHT="16" WIDTH="30" HSPACE="0"></A>'
-      }
-      // which type of file icon should be displayed?
-      if ( treeP_id[i] != 0 )
-      {
-        if ( lastEntryInFolder( treeId[i] ) )
-          fileImg = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_last.gif" BORDER="0" NAME="file'
-            + treeId[i] + '" HEIGHT="16" WIDTH="30" HSPACE="0">'  
-        else    
-          fileImg = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file.gif" BORDER="0" NAME="file'
-            + treeId[i] + '" HEIGHT="16" WIDTH="30" HSPACE="0">'  
-      }
-      else
-        fileImg = ''
-      // traverse parents up to root and show vertical lines if parent 
-      // is not the last entry on this layer
-      verticales = ''
-      for( var act_id=treeId[i] ; treeDeep[ id2treeIndex[ act_id ] ] > 1;  )
-      {  
-        act_id = treeP_id[ id2treeIndex[ act_id ]]
-        if ( lastEntryInFolder( act_id ) )
-        {
-          verticales = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_empty.gif" BORDER="0" HEIGHT="16" WIDTH="30" HSPACE="0">' + verticales
-        }
-        else
-        {
-          verticales = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_vert.gif" BORDER="0" HEIGHT="16" WIDTH="30" HSPACE="0">' + verticales
-        }
-      }
-
-      
-      document.writeln( divPrefix + treeId[i] + '"><NOBR>&nbsp;' + verticales + fileImg + folderImg + linkedName + '</NOBR></DIV>'
-      )  
-    }
-  }
-
-  function initStyles ( )
-  {
-    document.writeln( '<STYLE TYPE="text/css">' + "\n" + '<!--' )
-    for ( var i=1,y=y0; i<idx; i++ )
-    {  
-      document.writeln( '#sitemap' + treeId[i] + ' {POSITION: absolute; VISIBILITY: hidden;}' )
-      if ( treeIsOn[ id2treeIndex[ treeP_id[i] ] ] )
-        y += deltaY
-    }
-    document.writeln( '#sitemapinfo {POSITION: absolute; VISIBILITY: visible;}' )
-    document.writeln( '//-->' + "\n" + '</STYLE>' )
-  }
-
-
-
-  function sitemapClick( id )
-  {
-    var i = id2treeIndex[ id ]
-
-    if ( treeIsOn[ i ] )
-    // close directory
-    {
-      // mark node as invisible
-      treeIsOn[ i ]=false
-      // mark all sons as invisible
-      actDeep = treeDeep[ i ]
-      for( var j=i+1; j<idx && treeDeep[j] > actDeep; j++ )
-      {
-        treeWasOn[ j ] = treeIsOn[ j ]
-        treeIsOn[ j ]=false
-      }
-      gif_off( id )
-    }
-    else
-    // open directory
-    { 
-      treeIsOn[ i ]=true
-      // remember and restore old status
-      actDeep = treeDeep[ i ]
-      for( var j=i+1; j<idx && treeDeep[j] > actDeep; j++ )
-      {
-        treeIsOn[ j ] = treeWasOn[ j ]
-      }
-      gif_on( id )
-    }
-    showTree()
-  }
-
-  function knotDeep( id )
-  {
-    var deep=0
-    while ( true )
-      if ( treeP_id[ id2treeIndex[id] ] == 0 )
-        return deep
-      else
-      {
-        ++deep
-        id = treeP_id[ id2treeIndex[id] ]
-      }
-    return deep  
-  }
-
-  function initTree( id )
-  {
-    treeIsOn[ id2treeIndex[id] ] = true
-    if ( treeTyp[ id2treeIndex[id] ] != 'b' )
-      gif_on( id ) 
-    while ( treeP_id[ id2treeIndex[id] ] != 0 )
-    {
-      id = treeP_id[ id2treeIndex[id] ]
-      treeIsOn[ id2treeIndex[id] ] = true
-      if ( treeTyp[ id2treeIndex[id] ] != 'b' )
-        gif_on( id ) 
-    }
-  }
-
-  function lastEntryInFolder( id )
-  {
-    var i = id2treeIndex[id]
-    if ( i == idx-1 )
-      return true
-    if ( treeTyp[i] == 'b' )
-    {
-      if ( treeP_id[i+1] != treeP_id[i] )
-        return true
-      else 
-        return false
-    }
-    else
-    {
-      var actDeep = treeDeep[i]
-      for( var j=i+1; j<idx && treeDeep[j] > actDeep ; j++ )
-      ;
-      if ( j<idx && treeDeep[j] == actDeep )
-        return false
-      else
-        return true
-    }
-  }
-
-  function showTree()
-  {
-    for( var i=1, y=y0, x=x0; i<idx; i++ )
-    {
-      if ( treeIsOn[ id2treeIndex[ treeP_id[i] ] ] )
-      {
-        // show current node
-        if ( !(y == treeLastY[i] && treeIsShown[i] ) )
-        {
-          showLayer( "sitemap"+ treeId[i] ) 
-          setyLayer( "sitemap"+ treeId[i], y )
-          treeIsShown[i] = true
-        } 
-        treeLastY[i] = y
-        y += deltaY
-      }
-      else
-      {
-        // hide current node and all sons
-        if ( treeIsShown[ i ] )
-        {
-          hideLayer( "sitemap"+ treeId[i] ) 
-          treeIsShown[i] = false
-        }
-      }
-    }
-  }
-
-  function initIndex() {
-    for( var i=0; i<idx; i++ )
-      id2treeIndex[ treeId[i] ] = i
-  }
-
-  function gif_name (name, width, height) {
-    this.on = new Image (width, height);
-    this.on.src = imagedir+ "/" +name + "_on.gif"
-    this.off = new Image (width, height);
-    this.off.src = imagedir+ "/"+name + "_off.gif"
-  }
-
-  function load_gif (name, width, height) {
-    gif_name [name] = new gif_name (name,width,height);
-  }
-
-  function load_all () {
-    load_gif ('folder',30,16)
-    file_last = new Image( 30,16 )
-    file_last.src = imagedir+ "/file_last.gif"
-    file_middle = new Image( 30,16 )
-    file_middle.src = imagedir+ "/file.gif"
-    file_vert = new Image( 30,16 )
-    file_vert.src = imagedir+ "/file_vert.gif"
-    file_empty = new Image( 30,16 )
-    file_empty = imagedir+ "/file_empty.gif"
-  }
-
-  function gif_on ( id ) {
-    eval("document['folder" + id + "'].src = gif_name['folder'].on.src")
-  }
-
-  function gif_off ( id ) {
-    eval("document['folder" + id + "'].src = gif_name['folder'].off.src")
-  }
- 
-  // global configuration
-  var deltaX = 30
-  var deltaY = 16
-  var x0 = 5
-  var y0 = 5
-  var defaultTarget = '_blank'
-
-  var browserName = navigator.appName;
-  var browserVersion = parseInt(navigator.appVersion);
-  var isIE = false;
-  var isNN = false;
-  var isDOM = false;
-  var isDomIE = false;
-  var isDomNN = false;
-  var layerok = false;
-
-  var isIE = browserName.indexOf("Microsoft Internet Explorer" )==-1?false:true;
-  var isNN = browserName.indexOf("Netscape")==-1?false:true;
-  var isOpera = browserName.indexOf("Opera")==-1?false:true;
-  var isDOM = document.getElementById?true:false;
-  var isDomNN = document.layers?true:false;
-  var isDomIE = document.all?true:false;
-
-  if ( isNN && browserVersion>=4 ) layerok=true;
-  if ( isIE && browserVersion>=4 ) layerok=true;
-  if ( isOpera && browserVersion>=5 ) layerok=true;
-
-    
-  function hideLayer(layerName) {
-    if (isDOM)
-      document.getElementById(layerName).style.visibility="hidden"
-    else if (isDomIE)
-      document.all[layerName].style.visibility="hidden";
-    else if (isDomNN) 
-      document.layers[layerName].visibility="hidden";
-  }
-
-  function showLayer(layerName) {
-    if (isDOM)
-      document.getElementById(layerName).style.visibility="visible"
-    else if (isDomIE)
-      document.all[layerName].style.visibility="visible";
-    else if (isDomNN)
-      document.layers[layerName].visibility="visible";
-  }
-
-  function setyLayer(layerName, y) {
-    if (isDOM)
-      document.getElementById(layerName).style.top=y
-    else if (isDomIE)
-      document.all[layerName].style.top=y;
-    else if (isDomNN)
-      document.layers[layerName].top=y;
-  }
-
-  var id2treeIndex = new Array()
-
-  // the structure is easy to understand with a simple example
-  // p_id is the id of the parent
-  // E0                                      ( id=0,p_id=-1 )
-  //          E11                            ( id=1,p_id=0)
-  //                     E111                ( id=2,p_id=1 )
-  //                     E112                ( id=3,p_id=1 )
-  //          E12                            ( id=4,p_id=0 )
-  //                     E121                ( id=5,p_id=4 ) 
-  //          E13                            ( id=6,p_id=0 ) 
-  //                     E131                ( id=7,p_id=6 ) 
-  //                                 E1311   ( id=8,p_id=7 ) 
-  //                     E132                ( id=9,p_id=6 ) 
-  // this is a multinary tree structure which is easy to
-  // populate with database data :)
-function initArray(){
-	var parentObj = 0;
-	if(parent.mb_mapObj.length == 0){ window.setTimeout("initArray()",100); }    
-	else if(parent.mb_mapObj.length > 0){
-		Note(0,-1,'','');
-		for(var i=0; i<parent.mb_mapObj.length; i++){
-			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
-				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
-					for (var attr in myCategories) {
-						if (typeof(myCategories[attr]) != 'function') {
-							if (myCategories[attr] == ii) {
-								Note(parseInt(Math.random()*10000),0,"<b>"+attr+"</b>",'','','','','','','');
-							}
-						}
-					}
-				
-					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
-						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){          
-							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];     
-							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){ 
-								//alert((parseInt(temp.layer_id)+1) + " , " +0 + " , " +temp.layer_title + " , " +" , "+temp.layer_metadataurl);
-								Note((parseInt(temp.layer_id)+1),0,temp.layer_title,null,'','','','',parent.mb_mapObj[i].wms[ii].wms_id,'');
-								parentObj = temp.layer_id+1;                  
-							}
-							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == "0"){
-								//alert((parseInt(temp.layer_id)+1) + " , " +parentObj + " , " +temp.layer_title + " , " +temp.layer_metadataurl);
-								if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
-									//alert((parseInt(temp.layer_id)+1) + " , " +parentObj + " , " +temp.layer_title + " , " +temp.layer_metadataurl + " , " +temp.gui_layer_selectable + " , " +temp.gui_layer_visible + " , " +temp.gui_layer_queryable + " , " +temp.gui_layer_querylayer);
-									if (temp.layer_uid) {
-										Note((parseInt(temp.layer_id)+1),parentObj,temp.layer_title,'../php/mod_layerMetadata.php?id='+temp.layer_uid,temp.gui_layer_selectable,temp.gui_layer_visible,temp.gui_layer_queryable,temp.gui_layer_querylayer,parent.mb_mapObj[i].wms[ii].wms_id,temp.layer_name);
-									}
-									else {
-										Note((parseInt(temp.layer_id)+1),parentObj,temp.layer_title,false,temp.gui_layer_selectable,temp.gui_layer_visible,temp.gui_layer_queryable,temp.gui_layer_querylayer,parent.mb_mapObj[i].wms[ii].wms_id,temp.layer_name);
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-		treeTyp[0] = 'f'
-		treeIsOn[0] = true
-		treeWasOn[0] = true
-	}       
-} 
-
-  var idx=0
-  initArray()
-  initIndex()
-  load_all()
-  for( i=1; i<idx; i++ )
-  {
-    treeDeep[i] = knotDeep( treeId[i] )
-    if ( treeDeep[i] == 0 )
-      treeIsShown[i] = true
-  }
-  if ( isDomNN )
-    initStyles();
-  //-->  
-  </SCRIPT>
-</HEAD>
-<BODY VLINK="#000000" ALINK="#000000" LINK="#000000" BGCOLOR="#ffffff" TEXT="#000000"
- onLoad="if (layerok) showTree();mod_treeGDE();"
- MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">
-<SCRIPT language="JavaScript1.2">
-<!--
-  initDiv()
-  hideLayer("sitemapinfo")
-//-->
-</SCRIPT>
-</BODY>
-</HTML>
+<?php
+require("../php/mb_validateSession.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<TITLE>Treefolder</TITLE>
+<META NAME="Generator" CONTENT="Cosmo Create 1.0.3">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+include '../include/dyn_css.php';
+?>
+
+<script language='JavaScript'>
+function pop_up(name, einstellungen) {
+	window.open ('',name,einstellungen);
+}
+<?php
+   $sql = "SELECT e_target FROM gui_element WHERE e_id = $1 AND fkey_gui_id = $2";
+   $v = array($e_id,$gui_id);
+   $t = array('s','s');
+   $res = db_prep_query($sql,$v,$t);
+   $e_target = db_result($res,0,"e_target");   
+   echo "mod_treeGDE_map = '".$e_target."';";   
+?>
+</script>
+
+  <SCRIPT language="JavaScript1.2">
+  <!--  
+  /*
+   * sitemap.js 1.31 05/02/2000
+   *  - Opera 5
+   *
+   * sitemap.js 1.3 27/11/2000
+   *  - Netscape 6
+   *
+   * sitemap.js 1.2 20/05/2000
+   *  - split array tree into arrays for each element old tree
+   *  - no mory type flag, an folder is an entry which has sons
+   *  - a folder can have an link
+   *  - while initing an default layers is shown 
+   *
+   * sitemap.js 1.1 20/10/1999
+   *  - showTree only updates and init layers new which have been really changed
+   *  - add deep to knot entry
+   *  - substitute knotDeep[ id ] w/ tree[ id2treeIndex[ id ] ].deep
+   *  - add alignment to img and a &nbsp; at the beginning of eyery line
+   *  - add a fake img for bookmarks on top panel
+   *
+   * sitemap.js 1.02 14/10/1999
+   *  - fix bug in initStyles
+   *
+   * sitemap.js 1.01 06/10/1999
+   *  - fix bug in knotDeep for Netscape 4.00-4.0.5
+   *
+   * sitemap.js 1.0 20/09/1999
+   *
+   * Javascript function for displaying hierarchic directory structures with
+   * the ability to collapse and expand directories.
+   *
+   * Copyright (c) 1999 Polzin GmbH, Duesseldorf. All Rights Reserved.
+   * Author: Lutz Eymers <ixtab at polzin.com>
+   * Download: http://www.polzin.com/inet/fset_inet.phtml?w=goodies
+   *
+   * Permission to use, copy, modify, and distribute this software
+   * and its documentation for any purposes and without fee
+   * is hereby granted provided that this copyright notice
+   * appears in all copies. 
+   *
+   * Of course, this software is provided "as is" without express or implied
+   * warranty of any kind.
+   *
+   */
+
+//var myCategories = {"Stadt":0, "Land":1, "Fluss":4};
+var myCategories = {};
+
+
+// some defaults
+try{if (switchwms){}}catch(e){switchwms = 'false';}
+try{if (ficheckbox){}}catch(e){ficheckbox = 'true';}
+try{if (metadatalink){}}catch(e){metadatalink = 'false';}
+
+  
+  parent.mb_registerSubFunctions("window.frames['treeGDE'].mod_treeGDE();");
+  parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].deleteInputTags();");
+  parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].document.location.reload();");
+  
+
+function deleteInputTags() {
+	var max = document.getElementsByTagName("input").length;
+	for (var i=0; i<max; i++) {
+		var aNode = document.getElementsByTagName("input")[0];
+		var aNodeParent = aNode.parentNode;
+		aNodeParent.removeChild(aNode);
+	}
+}
+function handleSelectedLayer(mapObj,wms_id,layername,type,status){
+	var mywms = new Array();
+	mywms[0] = wms_id;
+	var mylayername = new Array();
+	mylayername[0] = layername;
+	parent.handleSelectedLayer_array(mapObj, mywms, mylayername, type, status);
+}
+function switchWMS(w,s){
+	for (var i=0; i < parent.mb_mapObj.length; i++) {
+		if (parent.mb_mapObj[i].frameName == mod_treeGDE_map) {
+			for (var ii=0; ii < parent.mb_mapObj[i].wms.length; ii++){
+				if (parent.mb_mapObj[i].wms[ii].wms_id == w){
+					for (var iii=1; iii < parent.mb_mapObj[i].wms[ii].objLayer.length; iii++) {
+						if (parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_selectable == '1') {
+							parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible = s;
+						}
+						if (parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_queryable == '1') {
+							//parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer = s;
+						}
+					}
+				}
+			}
+		}
+	}
+	parent.mb_restateLayers(mod_treeGDE_map,w);
+	parent.setSingleMapRequest(mod_treeGDE_map,w);
+}
+function mod_treeGDE(){
+  /**/
+	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
+	//if(ind == false){ alert("error, no mapobject specified");}
+	for(var i=0; i<document.getElementsByTagName("input").length; i++){
+		//layer_shortname,wms_id,{visible | querylayer}
+		var myID = document.getElementsByTagName("input")[i].id;
+		var arrayID = document.getElementsByTagName("input")[i].id.split("###");
+		var wms_ind = parent.getWMSIndexById(mod_treeGDE_map,arrayID[1]);
+		if(arrayID[2] == "visible" && typeof(wms_ind) != "undefined"){
+			var arrayLayer = parent.mb_mapObj[ind].layers[wms_ind].split(",");
+			var isOn = false;
+			for(var ii=0; ii<arrayLayer.length; ii++){
+				if(arrayID[0] == arrayLayer[ii]){
+					isOn = true;
+				}
+			}
+			if(isOn == true){ document.getElementById(myID).checked = true;}
+			if(isOn == false){ document.getElementById(myID).checked = false;}
+		}
+		if(arrayID[2] == "querylayer" && typeof(wms_ind) != "undefined"){
+			var arrayLayer = parent.mb_mapObj[ind].querylayers[wms_ind].split(",");
+			var isOn = false;
+			for(var ii=0; ii<arrayLayer.length; ii++){
+				if(arrayID[0] == arrayLayer[ii]){
+					isOn = true;
+				}
+			}
+			if(isOn == true){ document.getElementById(myID).checked = true;}
+			if(isOn == false){ document.getElementById(myID).checked = false;}
+		}
+	}
+    /*consider scalhints*/
+	for(var i=0; i<parent.mb_mapObj.length; i++){
+		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
+		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+					if(document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id)){
+						if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){                    
+							document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id).style.color = '#999999';                
+						}
+						else if(scale > parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
+							document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id).style.color = '#999999';
+						}
+						else{
+							document.getElementById(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_name+"_"+parent.mb_mapObj[i].wms[ii].wms_id).style.color = '#000000';
+						}
+					}                   
+				}
+			}
+		}
+	}
+} 
+  window.onError=null;
+
+  var idx=0
+  var treeId = new Array();
+  var treeP_id = new Array();
+  var treeIsOn = new Array();
+  var treeTyp = new Array();
+  var treeName = new Array();
+  var treeUrl = new Array();
+  var treeWasOn = new Array();
+  var treeDeep = new Array();
+  var treeLastY = new Array();
+  var treeIsShown = new Array();
+  var treeSelectable = new Array();
+  var treeVisible = new Array();
+  var treeQueryable = new Array();
+  var treeQuerylayer = new Array();
+  var treeWMS = new Array();
+  var treeShortname = new Array();
+
+
+  function Note( id,p_id,name,url,selectable,visible,queryable,querylayer,wms,shortname) {
+    treeId[ idx ] = id
+    treeP_id[ idx ] = p_id
+    treeIsOn[ idx ] = false
+    treeTyp[ idx ] = 'f'
+    treeName[ idx ] = name
+    treeUrl[ idx ] = url 
+    treeWasOn[ idx ] = false
+    treeDeep[ idx ] = 0
+    treeLastY[ idx ] = 0
+    treeIsShown[ idx ] = false
+    treeSelectable[ idx ] = selectable
+    treeVisible[ idx ] = visible
+    treeQueryable[ idx ] = queryable
+    treeQuerylayer[ idx ] = querylayer
+    treeWMS[ idx ] = wms
+    treeShortname[ idx ] = shortname
+
+    idx++
+  }
+
+  function openwindow(Adresse) {
+    Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+    Fenster1.focus();
+  }
+
+  function initDiv ( )
+  {
+    if ( isDOM || isDomIE )
+    {
+      divPrefix='<DIV CLASS="sitemap" style="position:absolute; left:0; top:0; visibility:hidden;" ID="sitemap'
+      divInfo='<DIV CLASS="sitemap" style="position:absolute; visibility:visible" ID="sitemap'
+    }
+    else
+    {
+      divPrefix='<DIV CLASS="sitemap" ID="sitemap'
+      divInfo='<DIV CLASS="sitemap" ID="sitemap'
+    }
+    document.writeln( divInfo +  'info">Bitte haben Sie etwas Geduld.<BR>&nbsp;<BR>Es werden die Eintr&auml;ge aus<BR>&nbsp;<BR>der Datenbank initialisiert.</DIV> ' );
+    for ( var i=1; i<idx; i++ )
+    {
+      // linked Name ? 
+      if ( treeUrl[i] != null ) {
+
+        linkedName = "<input id='"+treeShortname[i]+"###"+treeWMS[i]+"###visible###' type='checkbox' ";
+         if(treeVisible[i] == '1'){ linkedName += "checked ";}
+         
+         if(treeSelectable[i] != '1'){ 
+         	linkedName += "disabled ";
+         }
+        linkedName += "onClick = 'if(this.checked){handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"visible\",1);";
+		if(ficheckbox == 'false'){
+			linkedName += "handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",1);";
+		}
+        linkedName += "}";
+        linkedName += "else{handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"visible\",0);";
+        if(ficheckbox == 'false'){
+			linkedName += "handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",0);";
+		}
+        linkedName += "}'";
+        linkedName += '>';
+        
+        if (ficheckbox == 'true'){
+            linkedName += "<input id='"+treeShortname[i]+"###"+treeWMS[i]+"###querylayer' type='checkbox' ";
+            if(treeQuerylayer[i] == '1'){ linkedName += "checked ";}
+            if(treeQueryable[i] != '1'){ linkedName += "disabled ";}
+            linkedName += "onClick = 'if(this.checked){handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",1);}";
+            linkedName += "else{handleSelectedLayer(\""+mod_treeGDE_map+"\",\""+treeWMS[i]+"\",\""+treeShortname[i]+"\",\"querylayer\",0);}'";
+            linkedName += '>';
+        }
+      
+        //linkedName += '<A id="'+treeWMS[i]+'_'+treeShortname[i]+'"  HREF="' + treeUrl[i] + '" TARGET="' + defaultTarget + '"><IMG SRC="'+imagedir+'/1w.gif" BORDER="0" WIDTH="3">' + treeName[i] + '</A>';
+        
+        linkedName += '<A id="'+treeShortname[i]+'_'+treeWMS[i];
+        
+        if (metadatalink == 'true'){
+        	if (treeUrl[i] !== false) {
+				linkedName += '"  HREF="' + treeUrl[i];
+        	}
+        }
+//        linkedName += '"  HREF="../php/mod_layerMetadata.php?id=' + ;
+
+
+        linkedName +='" TARGET="' + defaultTarget + '" onclick="openwindow(this.href); return false"><IMG SRC="'+imagedir+'/1w.gif" BORDER="0" WIDTH="3">' + treeName[i] + '</A>';
+       
+       
+      }  
+      else{
+      	linkedName = "";
+        linkedName =  '<IMG SRC="'+imagedir+'/1w.gif" BORDER="0" WIDTH="3">';
+        if(switchwms == 'true'){
+        	linkedName += '<input type="checkbox" onclick="if(this.checked){switchWMS(\''+treeWMS[i]+'\',1)}else{switchWMS(\''+treeWMS[i]+'\',0)}">';
+        }
+        linkedName += treeName[i];
+      }
+      // don't link folder icon if node has no sons
+      if ( i == idx-1 || treeP_id[i+1] != treeId[i] ) {
+        if ( treeDeep[ i ] == 0 )
+          folderImg = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_empty.gif" BORDER="0" HEIGHT="16" WIDTH="1" HSPACE="0">'
+        else
+          folderImg = ''
+      } else {
+        folderImg = '<A  HREF="javascript:sitemapClick(' + treeId[i] + ')"><IMG ALIGN="BOTTOM" SRC="'+imagedir+'/folder_off.gif" BORDER="0" NAME="folder' + treeId[i] + '" HEIGHT="16" WIDTH="30" HSPACE="0"></A>'
+      }
+      // which type of file icon should be displayed?
+      if ( treeP_id[i] != 0 )
+      {
+        if ( lastEntryInFolder( treeId[i] ) )
+          fileImg = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_last.gif" BORDER="0" NAME="file'
+            + treeId[i] + '" HEIGHT="16" WIDTH="30" HSPACE="0">'  
+        else    
+          fileImg = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file.gif" BORDER="0" NAME="file'
+            + treeId[i] + '" HEIGHT="16" WIDTH="30" HSPACE="0">'  
+      }
+      else
+        fileImg = ''
+      // traverse parents up to root and show vertical lines if parent 
+      // is not the last entry on this layer
+      verticales = ''
+      for( var act_id=treeId[i] ; treeDeep[ id2treeIndex[ act_id ] ] > 1;  )
+      {  
+        act_id = treeP_id[ id2treeIndex[ act_id ]]
+        if ( lastEntryInFolder( act_id ) )
+        {
+          verticales = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_empty.gif" BORDER="0" HEIGHT="16" WIDTH="30" HSPACE="0">' + verticales
+        }
+        else
+        {
+          verticales = '<IMG ALIGN="BOTTOM" SRC="'+imagedir+'/file_vert.gif" BORDER="0" HEIGHT="16" WIDTH="30" HSPACE="0">' + verticales
+        }
+      }
+
+      
+      document.writeln( divPrefix + treeId[i] + '"><NOBR>&nbsp;' + verticales + fileImg + folderImg + linkedName + '</NOBR></DIV>'
+      )  
+    }
+  }
+
+  function initStyles ( )
+  {
+    document.writeln( '<STYLE TYPE="text/css">' + "\n" + '<!--' )
+    for ( var i=1,y=y0; i<idx; i++ )
+    {  
+      document.writeln( '#sitemap' + treeId[i] + ' {POSITION: absolute; VISIBILITY: hidden;}' )
+      if ( treeIsOn[ id2treeIndex[ treeP_id[i] ] ] )
+        y += deltaY
+    }
+    document.writeln( '#sitemapinfo {POSITION: absolute; VISIBILITY: visible;}' )
+    document.writeln( '//-->' + "\n" + '</STYLE>' )
+  }
+
+
+
+  function sitemapClick( id )
+  {
+    var i = id2treeIndex[ id ]
+
+    if ( treeIsOn[ i ] )
+    // close directory
+    {
+      // mark node as invisible
+      treeIsOn[ i ]=false
+      // mark all sons as invisible
+      actDeep = treeDeep[ i ]
+      for( var j=i+1; j<idx && treeDeep[j] > actDeep; j++ )
+      {
+        treeWasOn[ j ] = treeIsOn[ j ]
+        treeIsOn[ j ]=false
+      }
+      gif_off( id )
+    }
+    else
+    // open directory
+    { 
+      treeIsOn[ i ]=true
+      // remember and restore old status
+      actDeep = treeDeep[ i ]
+      for( var j=i+1; j<idx && treeDeep[j] > actDeep; j++ )
+      {
+        treeIsOn[ j ] = treeWasOn[ j ]
+      }
+      gif_on( id )
+    }
+    showTree()
+  }
+
+  function knotDeep( id )
+  {
+    var deep=0
+    while ( true )
+      if ( treeP_id[ id2treeIndex[id] ] == 0 )
+        return deep
+      else
+      {
+        ++deep
+        id = treeP_id[ id2treeIndex[id] ]
+      }
+    return deep  
+  }
+
+  function initTree( id )
+  {
+    treeIsOn[ id2treeIndex[id] ] = true
+    if ( treeTyp[ id2treeIndex[id] ] != 'b' )
+      gif_on( id ) 
+    while ( treeP_id[ id2treeIndex[id] ] != 0 )
+    {
+      id = treeP_id[ id2treeIndex[id] ]
+      treeIsOn[ id2treeIndex[id] ] = true
+      if ( treeTyp[ id2treeIndex[id] ] != 'b' )
+        gif_on( id ) 
+    }
+  }
+
+  function lastEntryInFolder( id )
+  {
+    var i = id2treeIndex[id]
+    if ( i == idx-1 )
+      return true
+    if ( treeTyp[i] == 'b' )
+    {
+      if ( treeP_id[i+1] != treeP_id[i] )
+        return true
+      else 
+        return false
+    }
+    else
+    {
+      var actDeep = treeDeep[i]
+      for( var j=i+1; j<idx && treeDeep[j] > actDeep ; j++ )
+      ;
+      if ( j<idx && treeDeep[j] == actDeep )
+        return false
+      else
+        return true
+    }
+  }
+
+  function showTree()
+  {
+    for( var i=1, y=y0, x=x0; i<idx; i++ )
+    {
+      if ( treeIsOn[ id2treeIndex[ treeP_id[i] ] ] )
+      {
+        // show current node
+        if ( !(y == treeLastY[i] && treeIsShown[i] ) )
+        {
+          showLayer( "sitemap"+ treeId[i] ) 
+          setyLayer( "sitemap"+ treeId[i], y )
+          treeIsShown[i] = true
+        } 
+        treeLastY[i] = y
+        y += deltaY
+      }
+      else
+      {
+        // hide current node and all sons
+        if ( treeIsShown[ i ] )
+        {
+          hideLayer( "sitemap"+ treeId[i] ) 
+          treeIsShown[i] = false
+        }
+      }
+    }
+  }
+
+  function initIndex() {
+    for( var i=0; i<idx; i++ )
+      id2treeIndex[ treeId[i] ] = i
+  }
+
+  function gif_name (name, width, height) {
+    this.on = new Image (width, height);
+    this.on.src = imagedir+ "/" +name + "_on.gif"
+    this.off = new Image (width, height);
+    this.off.src = imagedir+ "/"+name + "_off.gif"
+  }
+
+  function load_gif (name, width, height) {
+    gif_name [name] = new gif_name (name,width,height);
+  }
+
+  function load_all () {
+    load_gif ('folder',30,16)
+    file_last = new Image( 30,16 )
+    file_last.src = imagedir+ "/file_last.gif"
+    file_middle = new Image( 30,16 )
+    file_middle.src = imagedir+ "/file.gif"
+    file_vert = new Image( 30,16 )
+    file_vert.src = imagedir+ "/file_vert.gif"
+    file_empty = new Image( 30,16 )
+    file_empty = imagedir+ "/file_empty.gif"
+  }
+
+  function gif_on ( id ) {
+    eval("document['folder" + id + "'].src = gif_name['folder'].on.src")
+  }
+
+  function gif_off ( id ) {
+    eval("document['folder" + id + "'].src = gif_name['folder'].off.src")
+  }
+ 
+  // global configuration
+  var deltaX = 30
+  var deltaY = 16
+  var x0 = 5
+  var y0 = 5
+  var defaultTarget = '_blank'
+
+  var browserName = navigator.appName;
+  var browserVersion = parseInt(navigator.appVersion);
+  var isIE = false;
+  var isNN = false;
+  var isDOM = false;
+  var isDomIE = false;
+  var isDomNN = false;
+  var layerok = false;
+
+  var isIE = browserName.indexOf("Microsoft Internet Explorer" )==-1?false:true;
+  var isNN = browserName.indexOf("Netscape")==-1?false:true;
+  var isOpera = browserName.indexOf("Opera")==-1?false:true;
+  var isDOM = document.getElementById?true:false;
+  var isDomNN = document.layers?true:false;
+  var isDomIE = document.all?true:false;
+
+  if ( isNN && browserVersion>=4 ) layerok=true;
+  if ( isIE && browserVersion>=4 ) layerok=true;
+  if ( isOpera && browserVersion>=5 ) layerok=true;
+
+    
+  function hideLayer(layerName) {
+    if (isDOM)
+      document.getElementById(layerName).style.visibility="hidden"
+    else if (isDomIE)
+      document.all[layerName].style.visibility="hidden";
+    else if (isDomNN) 
+      document.layers[layerName].visibility="hidden";
+  }
+
+  function showLayer(layerName) {
+    if (isDOM)
+      document.getElementById(layerName).style.visibility="visible"
+    else if (isDomIE)
+      document.all[layerName].style.visibility="visible";
+    else if (isDomNN)
+      document.layers[layerName].visibility="visible";
+  }
+
+  function setyLayer(layerName, y) {
+    if (isDOM)
+      document.getElementById(layerName).style.top=y
+    else if (isDomIE)
+      document.all[layerName].style.top=y;
+    else if (isDomNN)
+      document.layers[layerName].top=y;
+  }
+
+  var id2treeIndex = new Array()
+
+  // the structure is easy to understand with a simple example
+  // p_id is the id of the parent
+  // E0                                      ( id=0,p_id=-1 )
+  //          E11                            ( id=1,p_id=0)
+  //                     E111                ( id=2,p_id=1 )
+  //                     E112                ( id=3,p_id=1 )
+  //          E12                            ( id=4,p_id=0 )
+  //                     E121                ( id=5,p_id=4 ) 
+  //          E13                            ( id=6,p_id=0 ) 
+  //                     E131                ( id=7,p_id=6 ) 
+  //                                 E1311   ( id=8,p_id=7 ) 
+  //                     E132                ( id=9,p_id=6 ) 
+  // this is a multinary tree structure which is easy to
+  // populate with database data :)
+function initArray(){
+	var parentObj = 0;
+	if(parent.mb_mapObj.length == 0){ window.setTimeout("initArray()",100); }    
+	else if(parent.mb_mapObj.length > 0){
+		Note(0,-1,'','');
+		for(var i=0; i<parent.mb_mapObj.length; i++){
+			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){ 
+				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+					for (var attr in myCategories) {
+						if (typeof(myCategories[attr]) != 'function') {
+							if (myCategories[attr] == ii) {
+								Note(parseInt(Math.random()*10000),0,"<b>"+attr+"</b>",'','','','','','','');
+							}
+						}
+					}
+				
+					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){          
+							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];     
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){ 
+								//alert((parseInt(temp.layer_id)+1) + " , " +0 + " , " +temp.layer_title + " , " +" , "+temp.layer_metadataurl);
+								Note((parseInt(temp.layer_id)+1),0,temp.layer_title,null,'','','','',parent.mb_mapObj[i].wms[ii].wms_id,'');
+								parentObj = temp.layer_id+1;                  
+							}
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == "0"){
+								//alert((parseInt(temp.layer_id)+1) + " , " +parentObj + " , " +temp.layer_title + " , " +temp.layer_metadataurl);
+								if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
+									//alert((parseInt(temp.layer_id)+1) + " , " +parentObj + " , " +temp.layer_title + " , " +temp.layer_metadataurl + " , " +temp.gui_layer_selectable + " , " +temp.gui_layer_visible + " , " +temp.gui_layer_queryable + " , " +temp.gui_layer_querylayer);
+									if (temp.layer_uid) {
+										Note((parseInt(temp.layer_id)+1),parentObj,temp.layer_title,'../php/mod_layerMetadata.php?id='+temp.layer_uid,temp.gui_layer_selectable,temp.gui_layer_visible,temp.gui_layer_queryable,temp.gui_layer_querylayer,parent.mb_mapObj[i].wms[ii].wms_id,temp.layer_name);
+									}
+									else {
+										Note((parseInt(temp.layer_id)+1),parentObj,temp.layer_title,false,temp.gui_layer_selectable,temp.gui_layer_visible,temp.gui_layer_queryable,temp.gui_layer_querylayer,parent.mb_mapObj[i].wms[ii].wms_id,temp.layer_name);
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		treeTyp[0] = 'f'
+		treeIsOn[0] = true
+		treeWasOn[0] = true
+	}       
+} 
+
+  var idx=0
+  initArray()
+  initIndex()
+  load_all()
+  for( i=1; i<idx; i++ )
+  {
+    treeDeep[i] = knotDeep( treeId[i] )
+    if ( treeDeep[i] == 0 )
+      treeIsShown[i] = true
+  }
+  if ( isDomNN )
+    initStyles();
+  //-->  
+  </SCRIPT>
+</HEAD>
+<BODY VLINK="#000000" ALINK="#000000" LINK="#000000" BGCOLOR="#ffffff" TEXT="#000000"
+ onLoad="if (layerok) showTree();mod_treeGDE();"
+ MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">
+<SCRIPT language="JavaScript1.2">
+<!--
+  initDiv()
+  hideLayer("sitemapinfo")
+//-->
+</SCRIPT>
+</BODY>
+</HTML>

Modified: branches/print_dev/http/html/mod_treefolder2.php
===================================================================
--- branches/print_dev/http/html/mod_treefolder2.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/html/mod_treefolder2.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -604,7 +604,7 @@
 										if(temp.gui_layer_queryable!='1')
 											controls.push('disabled ');
 										controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
-										controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
+										controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
 									}
 									if(wmsbuttons == 'true'&&metadatalink == 'true'){
 										controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img src="'+imagedir+'/info.png" /></a>');

Modified: branches/print_dev/http/html/mod_treefolderPlain.php
===================================================================
--- branches/print_dev/http/html/mod_treefolderPlain.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/html/mod_treefolderPlain.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -651,7 +651,7 @@
 										if(temp.gui_layer_queryable!='1')
 											controls.push('disabled ');
 										controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+ mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
-										controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
+										controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
 									}
 									if(wmsbuttons == 'true'&&metadatalink == 'true'){
 										controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img src="'+imagedir+'/info.png" /></a>');

Modified: branches/print_dev/http/img/button_blue/README.TXT
===================================================================
--- branches/print_dev/http/img/button_blue/README.TXT	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/img/button_blue/README.TXT	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,31 +1,31 @@
-________oo Mapbender Icon Theme____________
-
-compiled by: Lars-Hendrik Schneider 
-contact: (schneider at terrestris.de)
-date: Bonn (Germany) November 2005
-
-
-This is a KDE style icon theme for Mapbender. It is based on the
-oo.o icon theme made by Nuno Pinheiro (nf.pinheiro at gmail.com) and others. This can
-be downloaded from here: 'http://kde-look.org/content/show.php?content=30987'
-As these icons are free to use I created a set of icons for the Mapbender toolbars as my input
-for this great piece of software.
-
-It contains all necessary icons for the default mapbender GUI. Furthermore icons will be released
-as resources pack.
-
-Additionally a sandclock with four wandering stars and a tree in kde look is available.
-
-The default size of the icons is 28x28 pixels.
-Measure icons (for getArea... and so on) are 24x24 pixels.
-All icons were created with a transparency (which might not work in the buggy IE, sorry).
-
-CREDITS:
-Special thnx to the artists sharing their artwork.
-To the guys and girls programming, testing and improving Mapbender (especially to all who know whom I mean...).
-To my company - which payed for this ;-).
-
-LICENSE:
-I put nothing more on it than it was intended by the creator of the icon set originally - so feel free to 
-use this set as you like. If you want to - donate (time or money) to an OSS project.
-
+________oo Mapbender Icon Theme____________
+
+compiled by: Lars-Hendrik Schneider 
+contact: (schneider at terrestris.de)
+date: Bonn (Germany) November 2005
+
+
+This is a KDE style icon theme for Mapbender. It is based on the
+oo.o icon theme made by Nuno Pinheiro (nf.pinheiro at gmail.com) and others. This can
+be downloaded from here: 'http://kde-look.org/content/show.php?content=30987'
+As these icons are free to use I created a set of icons for the Mapbender toolbars as my input
+for this great piece of software.
+
+It contains all necessary icons for the default mapbender GUI. Furthermore icons will be released
+as resources pack.
+
+Additionally a sandclock with four wandering stars and a tree in kde look is available.
+
+The default size of the icons is 28x28 pixels.
+Measure icons (for getArea... and so on) are 24x24 pixels.
+All icons were created with a transparency (which might not work in the buggy IE, sorry).
+
+CREDITS:
+Special thnx to the artists sharing their artwork.
+To the guys and girls programming, testing and improving Mapbender (especially to all who know whom I mean...).
+To my company - which payed for this ;-).
+
+LICENSE:
+I put nothing more on it than it was intended by the creator of the icon set originally - so feel free to 
+use this set as you like. If you want to - donate (time or money) to an OSS project.
+

Modified: branches/print_dev/http/include/gui1_splash.php
===================================================================
--- branches/print_dev/http/include/gui1_splash.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/include/gui1_splash.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,6 +1,6 @@
-<?php
-echo "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
-	"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
-	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
-	"loading application '" . $gui_id . "'";
-?>
+<?php
+echo "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
+	"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
+	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
+	"loading application '" . $gui_id . "'";
+?>

Modified: branches/print_dev/http/include/template_splash.php
===================================================================
--- branches/print_dev/http/include/template_splash.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/include/template_splash.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,6 +1,6 @@
-<?php
-echo "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
-	"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
-	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
-	"loading application '" . $gui_id . "'";
-?>
+<?php
+echo "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
+	"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
+	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
+	"loading application '" . $gui_id . "'";
+?>

Modified: branches/print_dev/http/javascripts/geometry.js
===================================================================
--- branches/print_dev/http/javascripts/geometry.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/geometry.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,2177 +1,2177 @@
-/* 
-* $Id$
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
-*/
-// http://www.mapbender.org/index.php/GeometryArray.js
-
-
-var nameGeometryArray = "GeometryArray";
-var nameMultiGeometry = "MultiGeometry";
-var nameGeometry = "Geometry";
-
-/**
- * @class A class representing geometry types "polygon", "line" and "point".
- *
- * @constructor
- */
-function GeomType(){
-	/**
-	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
-	 * or {@link Geometry} is a polygon, write
-	 * if (someGeometry.geomType == geomType.polygon
-	 * 
-	 * @type String
-	 */
-	this.polygon = "polygon";
-
-	/**
-	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
-	 * or {@link Geometry} is a line, write
-	 * if (someGeometry.geomType == geomType.line
-	 * 
-	 * @type String
-	 */
-	this.line = "line";
-
-	/**
-	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
-	 * or {@link Geometry} is a point, write
-	 * if (someGeometry.geomType == geomType.point
-	 * 
-	 * @type String
-	 */
-	this.point = "point";
-}
-var geomType = new GeomType();
-
-
-/**
- * @class a {@link GeometryArray} is a {@link List} of {@link MultiGeometry} objects
- *
- * @ extends List
- * @ requires MultiGeometry 
- * @ requires Geometry
- * @ requires Point
- * @ constructor
- */
-function GeometryArray(){
-
-	/*
-	 * creates a new, empty Multigeometry and adds it to this GeometryArray
-	 *
-	 * @param {String} geomType a {@link GeomType}
-	 */
-	this.addMember = function(geomType){
-		this.add(new MultiGeometry(geomType));
-	};
-	
-	/**
-	 * @ignore
-	 */
-	this.name = nameGeometryArray;
-	
-	/**
-	 * A {@link List} of {@link MultiGeometry} objects.
-	 * 
-	 * @type List
-	 */
-	this.list = [];
-}
-
-GeometryArray.prototype = new List();
-	
-/**
- * gets the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- * @type Geometry 
- */
-GeometryArray.prototype.getGeometry = function(i,j){
-	var tmp = this.get(i);
-	return tmp.get(j);
-};
-
-/**
- * gets the k-th Point of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- * @param {Integer} k index of the Point
- * @type Point
- * @returns the Point object at the given indices
- */
-GeometryArray.prototype.getPoint = function(i, j, k, l){
-	if (l == undefined) {
-		return this.get(i).get(j).get(k);
-	}
-	return this.get(i).get(j).innerRings.get(k).get(l);
-};
-
-/**
- * gets an Array of indices; the {@link MultiGeometry} objects at these indices are equal to geom
- *
- * @type Integer[]
- * @param {MultiGeometry} geom 
- * @returns an Array of indices
- */
-GeometryArray.prototype.findMultiGeometry = function(geom) {
-	var a = [];
-	for (var i=0; i < this.count(); i++) {
-		if (this.get(i).equals(geom)) {a.push(i);}
-	}
-	return a;
-};
-	
-/**
- * deletes the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- */
-GeometryArray.prototype.delGeometry = function(i,j){
-	if (this.get(i).del(j) === false) {
-		this.del(i);
-	}
-};
-	
-/**
- * deletes the k-th {@link Point} of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
- *
- * @param {Integer} i index of the MultiGeometry
- * @param {Integer} j index of the Geometry
- * @param {Integer} k index of the Point
- */
-GeometryArray.prototype.delPoint = function (i, j, k, l) {
-	var res = this.get(i).delPoint(j, k, l);
-	if (res === false) {
-		this.del(i);
-	}
-};
-	
-/**
- * closes the current {@link MultiGeometry}. Calls method close of the {@link Geometry} class.
- *
- */
-GeometryArray.prototype.close = function(){
-	if (!this.get(-1).get(-1).close()) {
-		this.delGeometry(-1, -1);
-	}
-	else {
-		if (this.get(-1).get(-1).count() === 0) {
-			this.get(-1).del(-1);
-		}
-		if (this.get(-1).count() === 0) {
-			this.del(-1);
-		}
-	}
-	
-};
-
-/**
- * deletes all {@link Point} objects of this {@link GeometryArray} that equal point
- *
- * @param {Point} point
- */
-GeometryArray.prototype.delAllPointsLike = function(point){
-	var finished = false;
-	while (finished === false){
-		finished = true;
-		for (var i = 0 ; finished === true && i < this.count() ; i++){
-			for (var j = 0 ; finished === true && j < this.get(i).count() ; j++){
-
-				var currentGeometry = this.get(i).get(j);
-				if (currentGeometry.geomType == geomType.polygon && currentGeometry.innerRings) {
-					for (var k = 0; finished === true && k < currentGeometry.innerRings.count(); k++) {
-						for (var l = 0; finished === true && l < currentGeometry.innerRings.get(k).count(); l++) {
-							if (this.getPoint(i, j, k, l).equals(point)) {
-								this.delPoint(i, j, k, l);
-								finished = false;
-							}
-						}
-					}
-				}
-				if (!finished) {
-					break;
-				}
-
-				for (var k = 0 ; finished === true && k < this.get(i).get(j).count() ; k++){
-					if (this.getPoint(i,j,k).equals(point)){
-						this.delPoint(i,j,k);
-						finished = false;
-					}
-				}
-			} 
-		}
-	}
-};
-	
-/**
- * updates all {@link Point} objects of this {@link GeometryArray} that equal oldP to newP
- *
- * @param {Point} oldP
- * @param {Point} newP
- */
-GeometryArray.prototype.updateAllPointsLike = function(oldP, newP){
-	for (var i = 0; i < this.count(); i++){
-		this.get(i).updateAllPointsLike(oldP, newP);
-	}
-};
-
-GeometryArray.prototype.placemarkToString = function (placemarkId) {
-	var str = "{\"type\": \"Feature\", \"geometry\": ";
-
-	// get geometries with placemarkId
-	var geometriesFromPlacemark = [];
-	for (var i = 0, len = this.count(); i < len; i++) {
-		if (this.get(i).isFromKml() && this.get(i).e.getElementValueByName("Mapbender:placemarkId") == placemarkId) {
-			geometriesFromPlacemark.push(i);
-		}
-	}	
-
-	if (geometriesFromPlacemark.length > 1) {
-		str += "{\"type\": \"GeometryCollection\", \"geometries\": [";
-		for (var i = 0; i < geometriesFromPlacemark.length; i++) {
-			if (i > 0) {
-				str += ",";
-			}	
-			str += this.get(geometriesFromPlacemark[i]).placemarkToString();
-		}
-		str += "]}";
-
-		// metadata is the same for all indices...get from index 0
-		var propString = this.get(geometriesFromPlacemark[0]).e.toString();
-		if (propString) {
-			str += "," + propString;
-		}
-	}
-	else if (geometriesFromPlacemark.length === 1) {
-		str += this.get(geometriesFromPlacemark[0]).placemarkToString();
-	}
-
-	str += "}";
-	return str;
-};
-
-GeometryArray.prototype.getBBox = function(){
-	var q = this.get(0).get(0).get(0);
-	var min = cloneObject(q);
-	var max = cloneObject(q);
-	for(var i=0; i < this.count();i++){
-		var pos = this.get(i).getBBox();
-		if (pos[0].x < min.x) {min.x = pos[0].x;}
-		if (pos[1].x > max.x) {max.x = pos[1].x;}
-		if (pos[1].y > max.y) {max.y = pos[1].y;}
-		if (pos[0].y < min.y) {min.y = pos[0].y;}
-	}
-	return [min, max];
-};
-
-GeometryArray.prototype.importGeometryFromText = function (text) {
-
-	var tmpArray = text.split("(");
-	var geometryType = tmpArray[0];
-
-	switch (geometryType) {
-		case "MULTIPOLYGON":
-			var text = text.replace(/\)/g, "");
-			var sepArray = text.split("(((");
-			var polyArray = sepArray[1].split(",((");
-			
-			this.addMember(geomType.polygon);
-			for (var i = 0; i < polyArray.length; i++) {
-				var ringArray = polyArray[i].split(",(");
-				for (var j = 0; j < ringArray.length; j++) {
-					var coordinatesArray = ringArray[j].split(",");
-					if (j === 0) {
-						// add outer ring
-						this.get(-1).addGeometry();
-						for (var m = 0; m < -1 + coordinatesArray.length; m++) {
-							var currentPoint = coordinatesArray[m].split(" ");
-							this.getGeometry(-1, -1).addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
-						}
-						this.close();
-					}		
-					else {
-						// add inner ring
-						var ring = new Geometry(geomType.polygon);
-						for (var m = 0; m < -1 + coordinatesArray.length; m++) {
-							var currentPoint = coordinatesArray[m].split(" ");
-							ring.addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
-						}
-						ring.close();
-						this.getGeometry(-1,-1).addInnerRing(ring);				
-					}
-				}
-			}
-			break;
-	}
-};
-
-GeometryArray.prototype.importGeoJSON = function (geoJSON) {
-	// you can pass either geoJSON or the evaluated geoJSON string
-	// for backwards compatibility
-	if (typeof(geoJSON) == 'string') {
-		var geoJSON = eval('(' + geoJSON + ')');
-	}
-
-	//
-	// FEATURE COLLECTION
-	//
-	var isFeatureCollection = (geoJSON.type == "FeatureCollection") ? true : false;
-	if (isFeatureCollection) {
-		//
-		// FEATURE
-		//
-		var featureArray = geoJSON.features;
-		for (var j = 0; j < featureArray.length; j++) {
-			var currentFeature = featureArray[j];
-			var isFeature = (currentFeature.type == "Feature") ? true : false;
-	
-			// add geometry ...
-			if (currentFeature.geometry && isFeature) {
-				var featureEpsg = "EPSG:4326";
-				if (!currentFeature.crs || currentFeature.crs.type !== "name" || !currentFeature.crs.properties.name) {
-					var e = new Mb_warning("SRS not set or unknown in GeoJSON. Using 'EPSG:4326'.");
-				}
-				else {
-					featureEpsg = currentFeature.crs.properties.name;
-				}
-
-				//
-				// GEOMETRY
-				//
-				var currentGeometry = currentFeature.geometry;
-				var geometrytype = currentGeometry.type;
-				var coordinates = currentGeometry.coordinates;
-				switch (geometrytype) {
-					case "Point":
-						//
-						// POINT
-						//
-						this.addMember(geomType.point);
-						
-						this.get(-1).addGeometry();
-						this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1], coordinates[2]);
-						this.getGeometry(-1,-1).setEpsg(featureEpsg);
-						this.close();
-						break;
-					
-					case "LineString":
-						//
-						// LINESTRING
-						//
-						this.addMember(geomType.line);
-						this.get(-1).addGeometry();
-						for (var m = 0; m < coordinates.length; m++) {
-							var currentPoint = coordinates[m];
-							this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-						}
-						this.getGeometry(-1,-1).setEpsg(featureEpsg);
-						this.close();
-						break;
-						
-					case "MultiLineString":
-						//
-						// MULTILINESTRING
-						//
-						this.addMember(geomType.line);
-						for (var m = 0; m < coordinates.length; m++) {
-							this.get(-1).addGeometry();
-							var currentLine = coordinates[m];
-							for (var n = 0; n < currentLine.length; n++) {
-								var currentPoint = currentLine[n];
-								this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-							}
-							this.getGeometry(-1,-1).setEpsg(featureEpsg);
-						}
-						this.close();
-						break;
-					
-					case "Polygon":
-						//
-						// POLYGON
-						//
-						this.addMember(geomType.polygon);
-						for (var m = 0; m < coordinates.length; m++) {
-							this.get(-1).addGeometry();
-							var currentPolygon = coordinates[m];
-							for (var n = 0; n < currentPolygon.length; n++) {
-								var currentPoint = currentPolygon[n];
-								this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-							}
-							this.getGeometry(-1,-1).setEpsg(featureEpsg);
-						}
-						this.close();
-						break;
-						
-					case "MultiPolygon":
-						//
-						// MULTIPOLYGON
-						//
-						this.addMember(geomType.polygon);
-						for (var m = 0; m < coordinates.length; m++) {
-							this.get(-1).addGeometry();
-							var currentPolygon = coordinates[m];
-							for (var n = 0; n < currentPolygon.length; n++) {
-								var currentRing = currentPolygon[n];
-								if (n == 0) {
-									for (var p = 0; p < currentRing.length; p++) {
-										var currentPoint = currentRing[p];
-										this.getGeometry(-1, -1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-									}
-								}
-								else {
-									var ring = new Geometry(geomType.polygon);
-									for (var p = 0; p < currentRing.length; p++) {
-										var currentPoint = currentRing[p];
-										ring.addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
-									}
-									ring.close();
-									this.getGeometry(-1,-1).addInnerRing(ring);				
-								}
-							}
-							this.getGeometry(-1,-1).setEpsg(featureEpsg);
-						}
-						this.close();
-						break;
-	
-					case "GeometryCollection":
-						var exc = new Mb_exception("Geometry: GeometryCollections are not yet supported");
-						break;
-				}
-			}
-			
-			if (currentFeature.properties) {
-				var properties = currentFeature.properties;
-				// GeometryCollections are NOT YET IMPLEMENTED
-				if (geometrytype != "GeometryCollection") {
-					for (var l in properties) {
-						if (typeof(properties[l]) != "function") {
-							this.get(-1).e.setElement(l, properties[l]);
-						}
-					}
-					this.get(-1).e.setElement("fid", currentFeature.id);
-				}
-			}
-		}
-	}
-	return true;
-}
-
-GeometryArray.prototype.featureToString = function (i) {
-	var str = "{\"type\": \"FeatureCollection\", \"features\": [";
-	str += this.get(i).toString();
-	str += "]}";
-	return str;
-};
-
-
-GeometryArray.prototype.toString = function () {
-	var str = "{\"type\": \"FeatureCollection\", \"features\": [";
-
-	// separate: geometries that are from a KML and those which are not
-	var multiGeometriesFromKml = [];
-	var multiGeometriesNotFromKml = [];
-	for (var i = 0, len = this.count(); i < len; i++) {
-		if (this.get(i).isFromKml()) {
-			var placemarkId = this.get(i).e.getElementValueByName("Mapbender:placemarkId");
-
-			// only add placemark ids once!
-			var isFound = false;
-			for (var j = 0; j < multiGeometriesFromKml && isFound === false; j++) {
-				if (multiGeometriesFromKml == placemarkId) {
-					isFound = true;
-				}
-			}
-			if (!isFound) {
-				multiGeometriesFromKml.push(placemarkId);
-			}
-		}
-		else {
-			multiGeometriesNotFromKml.push(i);
-		}
-	}
-
-	// add geometries not from KML
-	for (var i = 0, len = multiGeometriesNotFromKml.length; i < len; i++) {
-		if (i > 0) {
-			str += ",";
-		}		
-		str += this.get(multiGeometriesNotFromKml[i]).toString();
-	}
-	
-	// add geometries from KML
-	if (multiGeometriesNotFromKml.length > 0 && multiGeometriesFromKml.length > 0) {
-		str += ",";
-	}
-
-	for (var i=0; i < multiGeometriesFromKml.length; i++) {
-		if (i > 0) {
-			str += ",";
-		}	
-		str += this.placemarkToString();
-	}
-
-	str += "]}";
-	return str;
-};
-	
-/**
- * @class a MultiGeometry is a List of Geometry objects
- *
- * @ extends List
- * @ requires Geometry
- * @ requires Point
- * @ constructor
- * @ param {String} geomType a geomType
- */
-function MultiGeometry(geomType){
-
-	/*
-	 * creates a new, empty {@link Geometry} object and adds it to this {@link MultiGeometry}
-	 *
-	 */
-	this.addGeometry = function(){
-		this.add(new Geometry(this.geomType));
-	};
-	
-	/**
-	 * deletes the {@link Geometry} object at index i; -1 refers to the last {@link Geometry object in the list
-	 * overwrites the del function of {@link List}.
-	 *
-	 * @param {Integer} i index
-	 */
-	this.del = function(i){
-		i = this.getIndex(i);
-		if (i !== false){
-			var tmpLength = this.count() - 1;
-			for (var z = i; z < tmpLength ; z ++){
-				this.list[z] = this.list[z+1];
-			}
-			this.list.length -= 1;
-			if (this.list.length === 0) {return false;}
-		}
-		return true;
-	};
-
-	this.list = [];
-	this.e = new Wfs_element();
-	this.geomType = geomType;
-	this.name = nameMultiGeometry;
-}
-
-MultiGeometry.prototype = new List();
-
-/**
- * updates all {@link Point} objects of this {@link MultiGeometry} that equal oldP to newP
- *
- * @param {Point} oldP
- * @param {Point} newP
- */
-MultiGeometry.prototype.updateAllPointsLike = function(oldP, newP){
-	for (var i = 0; i < this.count(); i++) {
-		this.get(i).updateAllPointsLike(oldP, newP);
-	}
-};
-
-/**
- * gets the bounding box of this {@link MultiGeometry} as an Array of 2 points
- *
- * @return the bounding box
- * @type Array of two Point objects
- */
-MultiGeometry.prototype.getBBox = function(){
-	var q = this.get(0).get(0);
-	var min = cloneObject(q);
-	var max = cloneObject(q);
-	for(var i=0; i<this.count();i++){
-		var pos = this.get(i).getBBox();
-		if (pos[0].x < min.x) {min.x = pos[0].x;}
-		if (pos[1].x > max.x) {max.x = pos[1].x;}
-		if (pos[1].y > max.y) {max.y = pos[1].y;}
-		if (pos[0].y < min.y) {min.y = pos[0].y;}
-	}
-	return [min, max];
-};
-
-/**
- * gets the bounding box of this {@link MultiGeometry} as a polygon of four points
- *  
- * @return the bounding box
- * @type MultiGeometry
- */
-MultiGeometry.prototype.getBBox4 = function() {
-	var bbox = this.getBBox();
-	var realBox = new MultiGeometry(geomType.polygon);
-	realBox.addGeometry(geomType.polygon);
-	realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[0].y);
-	realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[1].y);
-	realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[1].y);
-	realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[0].y);
-	realBox.get(-1).close();
-	return realBox;
-};
-
-/**
- * gets the center of the bounding box of this {@link MultiGeometry}.
- *
- * @return the center of the bounding box
- * @type Point
- */
-MultiGeometry.prototype.getCenter = function(){
-	var tmp = this.getBBox();
-	var x = parseFloat(tmp[0].x) + parseFloat((tmp[1].x - tmp[0].x)/2);
-	var y = parseFloat(tmp[0].y) + parseFloat((tmp[1].y - tmp[0].y)/2);
-	return new Point(x,y);
-};
-
-/**
- * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
- *
- * @return number of points
- * @type Integer
- */
-MultiGeometry.prototype.getTotalPointCount = function(){ 
-	var c = 0;
-	for (var i = 0 ; i < this.count(); i++)	{
-		c += this.get(i).count();
-	}
-	return c;
-};
-
-/**
- * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
- *
- * @return number of points
- * @type Integer
- */
-MultiGeometry.prototype.getPoint = function(j,k){
-	return this.get(j).get(k);
-};
-
-/**
- * compares this {@link MultiGeometry} object with the {@link MultiGeometry} object multigeom.
- *
- * @param {MultiGeometry} multigeom another multigeometry
- * @return true if he multigeometries match; else false 
- * @type Boolean
- */
-MultiGeometry.prototype.equals = function(multigeom) {
-	if (this.geomType != multigeom.geomType) {return false;}
-	if (this.count() != multigeom.count()) {return false;}
-	if (this.getTotalPointCount() != multigeom.getTotalPointCount()) {return false;}
-	for (var i=0; i<this.count(); i++) {
-		if (!this.get(i).equals(multigeom.get(i))) {return false;}
-	}
-	return true;
-};
-
-/**
- * deletes the j-th {@link Point} object of the i-th {@link Geometry} object of this {@link MultiGeometry} object.
- *
- * @param {Integer} i geometry index
- * @param {Integer} j point index
- * @return true if the deletion succeded; else false.
- * @type Boolean
- */
-MultiGeometry.prototype.delPoint = function(i, j, k){
-	var res;
-	if (k == undefined) {
-		res = this.get(i).del(j);
-		if (res === false) {
-			return this.del(i);
-		}
-	}
-	else {
-		res = this.get(i).innerRings.get(j).del(k);
-		if (res === false) {
-			this.get(i).innerRings.del(j);
-		}
-	}
-	return true;
-};
-
-MultiGeometry.prototype.isFromKml = function () {
-	if (this.e.getElementValueByName("Mapbender:kml")) {
-		return true;
-	}
-	return false;
-};
-
-MultiGeometry.prototype.toText = function () {
-	var text = "";
-	var numOfGeom = this.count();
-	if (numOfGeom >= 1) {
-		if (this.geomType == geomType.polygon) {
-			if (numOfGeom > 1) {
-				text += "MULTIPOLYGON (";
-				for (var i = 0; i < numOfGeom; i++) {
-					if (i > 0) {
-						text += ", ";
-					}
-					var currentPolygon = this.get(i);
-					text += "(" + currentPolygon.toText() + ")";
-				}
-				text += ")";
-			}
-			else {
-				text += "POLYGON (" + this.get(0).toText() + ")";
-			}
-		}
-		else if (this.geomType == geomType.line) {
-			text += "LINESTRING (";
-
-			var currentLine = this.get(0);
-			for (var j = 0; j < currentLine.count(); j++) {
-				if (j > 0) {
-					text += ", ";
-				}
-
-				var currentPoint = currentLine.get(j);
-				text += currentPoint.x + " " + currentPoint.y
-			}
-
-			text += ")";
-		}
-		
-	}
-	return text;		
-};
-
-MultiGeometry.prototype.toString = function () {
-	var str = this.toStringWithoutProperties();
-	
-	// properties
-	var propString = this.e.toString();
-	if (propString) {
-		str += "," + propString;
-	}
-
-	str += "}";
-	
-	return str;
-};
-
-MultiGeometry.prototype.placemarkToString = function () {
-	var str = "";
-	// geometries
-	for (var i = 0, len = this.count(); i < len; i++) {
-		if (i > 0) {
-			str += ",";
-		}		
-		str += this.get(i).toString();
-	}
-	return str;
-};
-
-MultiGeometry.prototype.toStringWithoutProperties = function () {
-	var str = "{\"type\": \"Feature\", ";
-
-	var epsg = this.getEpsg();
-	if (epsg) {
-		str += "\"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"" + epsg + "\"}}, ";
-	}
-	str += "\"geometry\": {";
-
-	var len = this.count(); 
-	
-	switch (this.geomType) {
-		case geomType.polygon:
-			if (len > 1) {
-				str += "\"type\": \"MultiPolygon\", ";
-			}
-			else {
-				str += "\"type\": \"Polygon\", ";
-			}
-			break;
-		case geomType.line:
-			if (len > 1) {
-				str += "\"type\": \"MultiLineString\", ";
-			}
-			else {
-				str += "\"type\": \"LineString\", ";
-			}
-			break;
-		case geomType.point:
-			if (len > 1) {
-				str += "\"type\": \"MultiPoint\", ";
-			}
-			else {
-				str += "\"type\": \"Point\", ";
-			}
-			break;
-	}
-
-	str += "\"coordinates\": "
-	// geometries
-	if (len > 1) {
-		str += "[";
-		for (var i = 0; i < len; i++) {
-			if (i > 0) {
-				str += ",";
-			}		
-			str += this.get(i).toString();
-		}
-		str += "]";
-	}
-	else {
-		str += this.get(0).toString();
-	}
-
-	str += "}";
-
-// this closing curly bracket is added in toString()
-//	str += "}";
-	
-	return str;
-};
-
-/**
- * @return the EPSG code of this geometry.
- * @type integer
- */
-MultiGeometry.prototype.getEpsg = function () {
-	if (this.count() > 0) {
-		return this.get(0).getEpsg();
-	}
-	return false;
-};
-
-
-function InnerRings () {
-	this.list = [];	
-};
-
-InnerRings.prototype = new List();
-
-/**
- * @class a Geometry is a List of Point objects. If it is a polygon, the last point has 
- * to equal the first point.
- *
- * @extends List
- * @requires Point
- * @constructor
- * @param {String} a string representing a geometry type, see @see GeomType.
- */
-function Geometry(aGeomtype){
-
-	/**
-	 * deletes the {@link Point} object at index i; -1 refers to the last 
-	 * {@link Point} object in the list. Overwrites the del function of 
-	 * {@link List}.
-	 *
-	 * @param {Integer} i index
-	 * @return false if deletion is not yet finished. It is cascaded to 
-	 *         {@link MultiGeometry}. True if the deletion is finished.
-	 */
-	this.del = function(i){
-		i = this.getIndex(i);
-		if (i !== false) {
-			var tmpLength = this.count()-1;
-			
-			for (var z = i; z < tmpLength ; z ++){
-				this.list[z] = this.list[z+1];
-			}
-			this.list.length -= 1;
-		
-			if (this.geomType == geomType.polygon){
-				if (i == tmpLength) {this.list[0] = this.list[tmpLength-1];}
-				else if (i === 0) {this.list[tmpLength-1] = this.list[0];}
-				if (this.list.length == 1){return false;}
-			}
-			updateDist();
-			if(this.list.length === 0) {return false;}
-			return true;
-		}
-		return false;
-	};
-
-	/**
-	 * adds a {@link Point} object to this {@link Geometry} object.
-	 *
-	 * @param {Float} x x value of the point
-	 * @param {Float} y y value of the point
-	 */	
-	this.addPointByCoordinates = function(x,y,z){
-		var newPoint = new Point(x,y,z);
-		this.add(newPoint);
-//		updateDist();
-	};
-
-	/**
-	 * adds a {@link Point} object to this {@link Geometry} object.
-	 *
-	 * @param {Point} aPoint another point
-	 */	
-	this.addPoint = function(aPoint){
-		this.add(new Point(aPoint.x, aPoint.y, aPoint.z));
-		updateDist();
-	};
-
-	/**
-	 * inserts a {@link Point} object at index i of this {@link Geometry} object.
-	 *
-	 * @param {Point} p another point
-	 * @param {Integer} i index
-	 */	
-	this.addPointAtIndex = function(p,i){
-		i = this.getIndex(i);
-		if (i !== false){
-			for(var z = this.count(); z > i; z--){
-				this.list[z] = this.list[z-1];
-			}
-			this.list[i] = new Point(p.x, p.y, p.z);
-			updateDist();
-		}
-	};
-	
-	/**
-	 * Overwrites the {@link Point) object at index i with the {@link Point} object p.
-	 *
-	 * @private
-	 * @param {Point} p another point
-	 * @param {Integer} i index
-	 */	
-	this.updatePointAtIndex = function(p, i){
-		i = this.getIndex(i);
-		if ((i === 0 || i == this.count()-1) && this.geomType == geomType.polygon){
-			this.list[0] = p;
-			this.list[this.count()-1] = p;
-		}
-		else {this.list[i] = p;}
-		updateDist();
-	};
-	
-	/**
-	 * Updates the {@link Geometry#dist} and {@link Geometry#totaldist}
-	 *
-	 * @private
-	 */	
-	var updateDist = function(){
-/*
- * DISABLED BECAUSE IT IS TOO SLOW
-		dist[0] = 0;		
-		totaldist[0] = 0;		
-		for (var i = 1 ; i < that.count(); i++){
-			dist[i] = that.get(i-1).dist(that.get(i));
-			totaldist[i] = totaldist[i-1] + dist[i];
-		}
-*/
-	};
-	/**
-	 * gets the distance between the last and last but one point of this {@link Geometry}.
-	 *
-	 * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
-	 * @return the distance
-	 * @type Float
-	 */	
-	this.getCurrentDist = function(numberOfDigits) {
-		if (typeof(numberOfDigits) == "number") {
-			return roundToDigits(dist[this.count()-1], numberOfDigits);
-		}
-		return dist[this.count()-1];
-		
-	};
-	/**
-	 * gets the length of the outer rim of this {@link Geometry}.
-	 *
-	 * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
-	 * @return the distance
-	 * @type Float
-	 */	
-	this.getTotalDist = function(numberOfDigits) {
-		if (typeof(numberOfDigits) == "number") {
-			return roundToDigits(totaldist[this.count()-1], numberOfDigits);
-		}
-		return totaldist[this.count()-1];
-	};
-	/**
-	 * closes this {@link Geometry}. 
-	 *
-	 * @return true if the geometry could be closed; otherwise false
-	 * @type Boolean
-	 */	
-	this.close = function(){
-		complete = true;
-		if (this.geomType == geomType.polygon){
-			if (this.count() > 2){
-				if (!this.get(0).equals(this.get(-1))) {
-					this.addPoint(this.get(0));
-				}
-			}
-			else {return false;}
-		}
-		if (this.geomType == geomType.line){
-			if (this.count() < 2){return false;}
-		}
-		return true;
-	};
-	/**
-	 * checks if this {@link Geometry} has been closed. 
-	 *
-	 * @return true if the geometry is closed; otherwise false
-	 * @type Boolean
-	 */	
-	this.isComplete = function() { 
-		return complete;
-	};
-	
-	/**
-	 * Sets the EPSG of this geometry.
-	 * 
-	 * @param {Integer} someEpsg the EPSG of this geometry.
-	 * @return true if the EPSG could be set; else false
-	 * @type boolean
-	 */
-	this.setEpsg = function (someEpsg) {
-		// TODO: how to check if EPSG code is correct?
-		epsg = someEpsg;
-		return true;
-
-		var e = new Mb_exception("EPSG code not valid ("+someEpsg+")");
-		return false;
-	};
-	
-	/**
-	 * @return the EPSG code of this geometry.
-	 * @type integer
-	 */
-	this.getEpsg = function () {
-		return epsg;
-	};
-	
-	this.list = [];
-	var dist = [];
-	var totaldist = [];
-	var complete = false;
-
-	var epsg;
-
-	var that = this;
-
-	this.geomType = aGeomtype;
-	this.name = nameGeometry;
-
-	// add these members if the geometry is a polygon
-	if (this.geomType == geomType.polygon) {
-		this.innerRings = new InnerRings();
-		this.addInnerRing = function (somePolygon) {
-			this.innerRings.add(somePolygon);
-		};
-		this.delInnerRing = function (index) {
-			this.innerRings.del(index);
-		};
-	}
-}
-
-Geometry.prototype = new List();
-
-Geometry.prototype.toText = function () {
-	var text = "";
-	switch (this.geomType) {
-		case geomType.polygon:
-			text += "(";
-			for (var j = 0; j < this.count(); j++) {
-				if (j > 0) {
-					text += ", ";
-				}
-				var currentPoint = this.get(j);
-				text += currentPoint.x + " " + currentPoint.y
-			}
-			text += ")";
-			if (this.innerRings && this.innerRings.count() > 0) {
-				for (var k = 0; k < this.innerRings.count(); k++) {
-					text += ", ";
-					text += this.innerRings.get(k).toText();
-				}				
-			}
-			break;
-	}
-	return text;
-};
-/**
- * gets the bounding box of this {@link Geometry}
- *
- * @return the bounding box (array of two Point objects)
- * @type Point[]
- */
-Geometry.prototype.getBBox = function(){
-	var q = this.get(0);
-	var min = cloneObject(q);
-	var max = cloneObject(q);
-	
-	for (var j=0; j<this.count(); j++){
-		var pos = this.get(j);
-		if (pos.x < min.x) {min.x = pos.x;}
-		else if (pos.x > max.x) {max.x = pos.x;}
-		if (pos.y < min.y) {min.y = pos.y;}
-		else if (pos.y > max.y) {max.y = pos.y;}
-	}
-	if (this.geomType == geomType.polygon) {
-		for (var i = 0; i < this.innerRings.count(); i++) {
-			var currentRing = this.innerRings.get(i);
-			for (var j=0; j<currentRing.count(); j++){
-				var pos = currentRing.get(j);
-				if (pos.x < min.x) {min.x = pos.x;}
-				else if (pos.x > max.x) {max.x = pos.x;}
-				if (pos.y < min.y) {min.y = pos.y;}
-				else if (pos.y > max.y) {max.y = pos.y;}
-			}
-		}
-	}
-	
-	return [min, max];
-};
-
-/**
- * updates all {@link Point} objects of this {@link Geometry} that equal oldP to newP
- *
- * @param {Point} oldP
- * @param {Point} newP
- */
-Geometry.prototype.updateAllPointsLike = function(oldP, newP){
-	var len = this.count();
-	for (var i = 0; i < len ; i++){
-		if (oldP.equals(this.get(i))){
-			if (i>0 && newP.equals(this.get(i-1))){
-				this.del(i);
-				len--;
-				i--;
-			}
-			else {this.updatePointAtIndex(newP, i);}
-		}
-	}
-	if (this.geomType == geomType.polygon) {
-		for (var j = 0; j < this.innerRings.count(); j++) {
-			var len = this.innerRings.get(j).count();
-			for (var i = 0; i < len ; i++){
-				if (oldP.equals(this.innerRings.get(j).get(i))){
-					if (i>0 && newP.equals(this.innerRings.get(j).get(i-1))){
-						this.innerRings.get(j).del(i);
-						len--;
-						i--;
-					}
-					else {this.innerRings.get(j).updatePointAtIndex(newP, i);}
-				}
-			}
-			
-		}
-	}
-};
-
-/**
- * compares this {@link Geometry} object with the {@link Geometry} object geom point by point.
- *
- * @param {Geometry} geom another geometry
- * @return true if he geometries match; else false 
- * @type Boolean
- */
-Geometry.prototype.equals = function(geom) {
-	if (this.geomType != geom.geomType) {return false;}
-	if (this.count() != geom.count()) {return false;}
-	for (var i=0; i < this.count(); i++) {
-		if (!this.get(i).equals(geom.get(i))) {return false;}
-	}
-	if (!this.innerRings && !geom.innerRings) {
-		// no inner rings; fine
-	}
-	else if (this.innerRings && geom.innerRings) {
-		if (this.innerRings.count() != geom.innerRings.count()) {
-			return false;
-		}
-		for (var j = 0; j < this.innerRings.count(); j++) {
-			if (!this.innerRings.get(j).equals(geom.innerRings.get(j))) {
-				return false;
-			}
-		}
-	}
-	else {
-		// inner ring mismatch
-		return false;
-	}	
-	return true;
-};
-
-/**
- * creates a polygon geometry object which form a buffer around the line geometry
- * 
- * @param {float} real world units to buffer around the line
- * @param {float} (optional) units to buffer around the line in Y direction
- * 
- * @return linebuffer polygon
- * @type Geometry
- */
-Geometry.prototype.bufferLine = function(bufferX, bufferY){
-	if(typeof(bufferY)=='undefined')
-		bufferY = bufferX;
-	if(this.geomType!=geomType.line || this.count()<2)
-		return false;
-	
-	var ret = new Geometry(geomType.polygon)
-	
-	//get vector from point 0 to point 1
-	last_vec = this.get(1).minus(this.get(0));
-
-	//get 90° rotated vector
-	last_vec_o = new Point(-last_vec.y, last_vec.x);
-
-	//resize vectors with apropriate linebuffer length
-	last_vec_o = last_vec_o.dividedBy(last_vec_o.dist(new Point(0,0)));
-	last_vec_o.x*=bufferX; last_vec_o.y*=bufferY;
-	last_vec = last_vec.dividedBy(last_vec.dist(new Point(0,0)));
-	last_vec.x*=bufferX; last_vec.y*=bufferY;
-		
-	//add first pointsets
-	ret.list.unshift(this.get(0).plus(last_vec_o).minus(last_vec));
-	ret.list.push(this.get(0).minus(last_vec_o).minus(last_vec));
-		
-	for(var i=1;i<this.count()-1;i++){
-		//get vector from point n to point n+1
-		vec = this.get(i+1).minus(this.get(i));
-		//get orthogonal (90° rotated) vector		
-		vec_o = new Point(-vec.y, vec.x);
-
-		//resize vectors to linebuffer length
-		vec_o = vec_o.dividedBy(vec_o.dist(new Point(0,0)));
-		vec_o.x*=bufferX; vec_o.y*=bufferY;
-		vec = vec.dividedBy(vec.dist(new Point(0,0)));
-		vec.x*=bufferX; vec.y*=bufferY;
-			
-		//if direction is the same continue
-		if(vec.equals(last_vec))
-			continue;
-			
-		// calculate directed angle between the two vectors by 
-		// calculating the argument diffenrences between complex numbers
-		// arg(x + i*y) (because law of cosine can onlycalculate undirected angle)
-		var angle = (Math.atan2(vec.x,vec.y)-Math.atan2(last_vec.x,last_vec.y))
-		//ensure that angle is -180<=angle<=180
-		if(angle<-Math.PI)angle=2*Math.PI+angle;
-		if(angle>+Math.PI)angle=2*Math.PI-angle;
-		
-		//calculate the distance between the next points on boundary
-		//and the line point
-		//the point will be in the direction of angle/2 relative to last_vec_o
-		//since cosine is adjacent side / hypothenuse and we know that 
-		//the adjacent side is lineBuffer the hypothenus (our distance) is
-		var ndist = 1/(Math.cos(angle/2))
-		//direction of next points on boundary
-		var int_vec = vec_o.plus(last_vec_o);
-		//resize direction vector to our distance
-		int_vec = int_vec.times(ndist/int_vec.dist(new Point(0,0)));
-		int_vec.x*=bufferX; int_vec.y*=bufferY;
-		
-		//look if we have an outer sharp corner (>90°)
-		if(angle>Math.PI/2){
-			//push cutted edge points
-			ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
-			ret.list.unshift(this.get(i).plus(vec_o).minus(vec));
-		}
-		else{
-			//push inner/light edge
-			ret.list.unshift(this.get(i).plus(int_vec));
-		}
-
-		//look if we have an inner sharp corner (<-90°)
-		if(angle<-Math.PI/2){
-			//push cutted edge points
-			ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
-			ret.list.push(this.get(i).minus(vec_o).minus(vec));
-		}
-		else{
-			//push inner/light edge
-			ret.list.push(this.get(i).minus(int_vec));
-		}
-			
-		//copy for next point
-		last_vec = vec;
-		last_vec_o = vec_o;
-	}
-	//add last pointsets
-	ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
-	ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
-	
-	ret.close();
-
-	return ret;	
-}
-
-Geometry.prototype.toString = function () {
-	var str = "";
-	if (this.geomType == geomType.polygon) {
-		str += "[[";
-		for (var i = 0; i < this.count(); i++) {
-			if (i > 0) {
-				str += ", ";
-			}
-			str += this.get(i).toString();
-		}
-
-		if (typeof(this.innerRings) == "object" && this.innerRings.count() > 0) {
-			for (var j = 0; j < this.innerRings.count(); j++) {
-				var currentRing = this.innerRings.get(j);
-
-				str += "],[";
-				for (var i = 0; i < currentRing.count(); i++) {
-					if (i > 0) {
-						str += ", ";
-					}
-					str += currentRing.get(i).toString();
-				}
-			}
-		}
-		str += "]]";
-	}
-	else if (this.geomType == geomType.line) {
-		str += "[";
-		for (var i = 0; i < this.count(); i++) {
-			if (i > 0) {
-				str += ", ";
-			}
-			str += this.get(i).toString();
-		}
-		str += "]";
-	}
-	else if (this.geomType == geomType.point) {
-		str += this.get(0).toString();
-	}
-	
-	return str;
-};
-
-
-
-/**
- * @class an array of elements, each consisting of a name/value pair
- *
- * @ constructor
- */
-function Wfs_element(){
-
-	/**
-	 * returns the number of elements of this {@link Wfs_element} object.
-	 *
-	 * @return the number of elements
-	 * @type Integer
-	 */
-	this.count = function(){
-		return name.length;
-	};
-
-	/**
-	 * returns the name of the element at index i.
-	 *
-	 * @param {Integer} i index
-	 * @return the name
-	 * @type String
-	 */
-	this.getName = function(i){ 
-		if (isValidElementIndex(i)) {return name[i];}
-		return false;
-	};
-	
-	/**
-	 * returns the value of the element at index i.
-	 *
-	 * @param {Integer} i index
-	 * @return the value
-	 */
-	this.getValue = function(i){ 
-		if (isValidElementIndex(i)) {return value[i];}
-		return false;
-	};
-
-	/**
-	 * appends a new element with a given name. If an element with this name exists, it is overwritten.
-	 *
-	 * @param {String} aName the name of the new element
-	 * @param {String} aValue the value of the new element
-	 */
-	this.setElement = function(aName, aValue){ 
-		var i = this.getElementIndexByName(aName);
-		if (i === false) {i = this.count();}
-		name[i] = aName;
-		value[i] = aValue;
-	};
-
-	/**
-	 * removes an element with a given name. If an element with this name exists, it is removed.
-	 *
-	 * @param {String} aName the name of the element to delete
-	 */
-	this.delElement = function(aName){
-		var i = this.getElementIndexByName(aName);
-		if (i !== false) {
-			name.splice(i, 1);
-			value.splice(i, 1);
-		}
-	}
-	
-	/**
-	 * checks if an index is valid
-	 *
-	 * @private
-	 * @param {Integer} i an index
-	 * @return true if the index is valid; otherwise false
-	 * @type Boolean
-	 */
-	var isValidElementIndex = function(i){ 
-		if (i>=0 && i<name.length) {return true;}
-		var e = new Mb_exception("class Wfs_element: function isValidElementIndex: illegal element index");
-		return false;
-	};
-	
-	var name  = [];
-	var value = [];
-}
-
-/**
- * gets the index of the element with a given name.
- *
- * @param {String} elementName a name
- * @return the index of the element; if no element with this name exists, false
- * @type Integer, Boolean
- */
-Wfs_element.prototype.getElementIndexByName = function(elementName){
-	for (var j = 0, len = this.count() ; j < len ; j++){
-		if (this.getName(j) == elementName) {return j;}
-	}
-	return false;
-};
-
-/**
- * gets the value of the element with a given name.
- *
- * @param {String} elementName a name
- * @return the value of the element; if no element with this name exists, false
- * @type String, Boolean
- */
-Wfs_element.prototype.getElementValueByName = function(elementName){
-	var i = this.getElementIndexByName(elementName);
-	if (i === false) {return false;}
-	return this.getValue(i);
-};
-
-Wfs_element.prototype.toString = function () {
-	var str = "";
-	if (this.count() > 0) {
-		str += "\"properties\": {";
-		
-		for (i = 0, len = this.count(); i < len; i++) {
-			if (i > 0) {
-				str += ",";
-			}		
-			var key = this.getName(i);
-			var value = this.getValue(i);
-			str += "\"" + key + "\":\"" + value + "\"";
-		}
-		str += "}";
-	}
-	return str;
-};
-
-/**
- * @class a {@link Canvas} contains a {@link DivTag} that holds graphics rendered by {@link jsGraphics}
- *
- * @constructor
- * @requires DivTag
- * @requires jsGraphics
- * @requires GeometryArray
- * @requires MultiGeometry
- * @requires Geometry
- * @param {String} aMapFrame name of the target mapframe
- * @param {String} aTagName name of the target div tag
- * @param {String} aStyle style of the div tag
- * @param {Integer} aLineWidth the line width of the jsGraphics output
- */
-function Canvas(aMapframe, aTagName, aStyle, aLineWidth) {
-	
-	/**
-	 * draws the geometry of the canvas
-	 *
-	 * @param {String} t geometry type (@see GeomType)
-	 * @param {MultiGeometry} g a MultiGeometry object
-	 * @param {String} col a color
-	 * @private
-	 */
- 	this.drawGeometry = function(t,g,col){
-		if(t == geomType.point) {
-			var poiIcon = g.e.getElementValueByName("Mapbender:icon");
-			for(var i=0, ilen = g.count(); i < ilen; i++){
-				var currentGeom = g.get(i);
-				var p = realToMap(mapframe, currentGeom.get(0));
-				var px = p.x;
-				var py = p.y;
-				var radius = diameter/2;
-				if ((px - radius < mapframeWidth && px + radius > 0 &&
-					py - radius < mapframeHeight && py + radius > 0) ||
-					(p.dist(new Point(0,0)) < radius || 
-					 p.dist(new Point(mapframeWidth, mapframeHeight)) < radius ||
-					 p.dist(new Point(0,mapframeHeight)) < radius || 
-					 p.dist(new Point(mapframeWidth, 0)) < radius
-					)
-				) {
-					// if the point contains a link to an icon, display the icon
-					if (poiIcon) {
-						displayIcon(poiIcon, px, py);
-					}
-					else {
-						drawCircle(px-1, py-1, diameter,col);
-					}
-				}
-			}
-		}
-		else if(t == geomType.line || t==geomType.polygon) {
-			for(var i=0, ilen = g.count(); i < ilen; i++){
-				var currentGeom = g.get(i);
-				// paint inner rings
-				if (t==geomType.polygon && currentGeom.innerRings.count() > 0) {
-					for (var k = 0; k < currentGeom.innerRings.count(); k++) {
-						var currentRing = currentGeom.innerRings.get(k);
-						var previousPoint = realToMap(mapframe, currentRing.get(0));
-						for (var j=1, jlen = currentRing.count(); j < jlen; j++) {
-							(function () {
-								var currentPoint = realToMap(mapframe, currentRing.get(j));
-								
-								var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
-								if (pq) {
-									drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
-								}
-								previousPoint = currentPoint;
-							})();
-						}
-						
-					}					
-				}
-				// paint line or outer ring
-				var previousPoint = realToMap(mapframe, currentGeom.get(0));
-				for (var j=1, jlen = currentGeom.count(); j < jlen; j++) {
-					(function () {
-						var currentPoint = realToMap(mapframe, currentGeom.get(j));
-						
-						var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
-						if (pq) {
-							drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
-						}
-						previousPoint = currentPoint;
-					})();
-				}
-			}
-		}
-		else {
-			var e = new Mb_exception("class Canvas: function drawGeometry: unknown geomType " + t);
-		}
-	};
-
-	/**
-	 * checks if the MultiGeometry's bounding box width and height is smaller than minWidth
-	 *
-	 * @private
-	 * @param {MultiGeometry} g a MultiGeometry object
-	 */
-	this.isTooSmall = function(g){
-		// TODO switch between dot, original, circle
-//		return false;
-
-		var tmp = g.getBBox();
-		var min = realToMap(mapframe,tmp[0]);
-		var max = realToMap(mapframe,tmp[1]);
-		if((Math.abs(max.x - min.x) < minWidth) && (Math.abs(max.y - min.y) < minWidth)) {
-			return true;
-		}
-		return false;
-	};
-	
-	/**
-	 * gets the jsGraphics.
-	 *
-	 * @private
-	 * @return the jsGraphics
-	 * @type jsGraphics
-	 */
-	this.getCanvas = function(){
-		return canvas;
-	};
-	
-	this.setDiameter = function (px) {
-		diameter = px;
-	};
-	
-	/**
-	 * draws a circle with {@link jsGraphics}.
-	 *
-	 * @private
-	 * @param {Float} x x value of the center
-	 * @param {Float} y y value of the center
-	 * @param {Float} diameter diameter of the circle
-	 * @param {String} color the color of the circle in hex format
-	 */
-	var drawCircle = function(x, y, diameter, color) {
-		canvas.setColor(color);
-		canvas.drawEllipse(x-diameter/2,y-diameter/2,diameter,diameter);
-	};
-
-	/**
-	 * draws a polyline with {@link jsGraphics}.
-	 *
-	 * @private
-	 * @param {Array} x_array array of x values
-	 * @param {Array} y_array array of y values
-	 * @param {String} color the color of the polyline in hex format
-	 */
-	var drawLine = function(x_array, y_array, color) {
-		canvas.setColor(color);
-		canvas.drawPolyline(x_array, y_array);
-	};
-
-	/**
-	 * Displays an icon in the mapframe
-	 * 
-	 * @private
-	 * @param {String} url link to the image
-	 * @param {Float} x x coordinate within the map frame
-	 * @param {Float} y y coordinate within the map frame
-	 */
-	var displayIcon = function (url, x, y) {
-		if(ie){
-			var newImg = document.createElement("img");
-			var newImgTop = y - Math.round(80/2);
-			var newImgLeft = x - Math.round(80/2);
-			that.canvasDivTag.getTag().innerHTML = "<img src='" + url + "' style='position:absolute;top:"+newImgTop+";left:"+newImgLeft+";z-index:100'/>";
-		}
-		else{
-			var newImg = document.createElement("img");
-			newImg.src = url;
-			that.canvasDivTag.getTag().appendChild(newImg);	
-			//newImg.className = "mapsymbol";
-			//newImg.style.cursor = "help";
-			newImg.style.position = "absolute";
-			
-			// center the image at x, y
-			newImg.style.top = y - Math.round(80/2);
-			newImg.style.left = x - Math.round(80/2);
-	//		newImg.style.top = y - Math.round(80);
-	//		newImg.style.left = x;
-			newImg.style.zIndex = 100;
-		}
-	};
-	
-	/**
-	 * This is the {@link DivTag} that contains the output by {@link jsGraphics}.
-	 * 
-	 * @type DivTag
-	 */
-	var mapframe = aMapframe;
-	var mapObjInd = getMapObjIndexByName(mapframe);
-
-	if (mb_mapObj[mapObjInd].getDomElement().frameName) {
-		this.canvasDivTag = new DivTag(aTagName, mapName, aStyle);
-	}
-	else {
-		this.canvasDivTag = new DivTag(aTagName, "", aStyle, mb_mapObj[mapObjInd].getDomElement());
-	}
-
-	var that = this;
-
-	var diameter = 8;
-	var minWidth = 8;
-	var lineWidth = aLineWidth || 2;
-	var mapframeWidth = mb_mapObj[mapObjInd].width;
-	var mapframeHeight = mb_mapObj[mapObjInd].height;
-	eventResizeMap.register(function () {
-		mapframeWidth = mb_mapObj[mapObjInd].width;
-		mapframeHeight = mb_mapObj[mapObjInd].height;
-	});
-	var style = aStyle;
-	var canvas = new jsGraphics(aTagName, mb_mapObj[mapObjInd].getDomElement().frameName ? window.frames[mapframe] : window);
-	canvas.setStroke(lineWidth);
-	mb_registerPanSubElement(aTagName);
-}
-
-/**
- * cleans the canvas by emptying the canvas {@link DivTag}.
- */
-Canvas.prototype.clean = function () {
-	this.canvasDivTag.clean();
-};
-
-/**
- * paints all geometries.
- *
- * @param {GeometryArray} gA the geometries that will be drawn
- */
-Canvas.prototype.paint = function(gA) {
-	for (var q = 0; q < gA.count(); q++) {
-		var m = gA.get(q);
-		var t = m.geomType;
-		var col = m.color;
-		if (t == geomType.point) {
-			this.drawGeometry(t,m,col);
-		}
-		else {
-			if (this.isTooSmall(m)){
-				var newMember = new MultiGeometry(geomType.point);
-				newMember.addGeometry();
-				newMember.get(-1).addPoint(m.getCenter());
-				this.drawGeometry(geomType.point,newMember,col);
-			}
-			else{
-				if(t == geomType.line) {this.drawGeometry(t,m, col);}
-				else if(t == geomType.polygon) {this.drawGeometry(t,m,col);}
-				else {
-					var e = new Mb_exception("class Canvas: function paint: unknown geomType" + t);				
-				}
-			}
-		}
-	}
-	this.getCanvas().paint();
-};
-
-/**
- * @class a {@link Highlight} object is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
- *
- * @constructor
- * @requires Canvas
- * @requires GeometryArray
- * @param {Array} aTargetArray an array of Strings referring to mapframes
- * @param {String} aTagName the name of the div tags
- * @param {Object} aStyle the style of the div tags
- * @param {Integer} the line width of the jsGraphics lines
- */
-function Highlight(aTargetArray, aTagName, aStyle, aLineWidth) {
-	/**
-	 * removes a {@link MultiGeometry} object from the geometry Array
-	 *
-	 * @param {MultiGeometry} m a MultiGeometry
-	 * @param {String} color a color
-	 */	
-	this.del = function(m, color) {
-		var newMultiGeom;
-		if (m.name == nameMultiGeometry) {
-			newMultiGeom = m;
-		}
-		else if (m.name == nameGeometry) {
-			var newMultiGeom = new MultiGeometry(m.geomType);
-			newMultiGeom.add(m);
-		}
-
-		var a = gA.findMultiGeometry(newMultiGeom);
-		var del = false;
-		for (var i=0; i<a.length && del === false; i++) {
-			if (gA.get(a[i]).color == color) {
-				gA.del(a[i]);
-				del = true;
-			}
-		}
-	};
-
-	/**
-	 * adds a {@link MultiGeometry} object to the geometry Array
-	 *
-	 * @param {MultiGeometry} m a MultiGeometry
-	 * @param {String} color the color of the highlight
-	 */	
-	this.add = function(m, color) {
-
-		if (m.name == nameMultiGeometry) {
-			gA.addCopy(m);
-		}
-		else if (m.name == nameGeometry) {
-			var newMultiGeom = new MultiGeometry(m.geomType);
-			newMultiGeom.add(m);
-			gA.addCopy(newMultiGeom);
-		}
-		if (typeof(color) != 'undefined') {gA.get(-1).color = color;} 
-		else {gA.get(-1).color = lineColor;}
-	};
-	
-	this.hide = function () {
-		for (var i=0; i < canvas.length; i++) {
-			if (typeof(canvas[i]) == "object") {canvas[i].clean();}
-		}
-	};
-
-	/**
-	 * removes all MultiGeometries.
-	 *
-	 */	
-	this.clean = function() {
-		if (gA.count() > 0) {
-			gA = new GeometryArray();
-			this.paint();
-		}
-	};
-
-	/**
-	 * displays the highlight
-	 *
-	 */	
-	this.paint = function() {
-		this.hide();
-		for (var i=0; i < canvas.length; i++) {
-			if (typeof(canvas[i]) == "object") {canvas[i].clean();}
-		}
-		for (var i=0; i<targets.length; i++){
-			if (typeof(canvas[i]) == 'undefined') {
-				canvas[i] = new Canvas(targets[i], tagname + i, style, lineWidth);
-			}
-			canvas[i].paint(gA);
-		}
-	};
-
-	this.setDiameter = function (radius) {
-		for (var i = 0; i < targets.length; i++) {
-			if (typeof(canvas[i]) != "undefined") {
-				canvas[i].setDiameter(radius);
-			}
-		}
-	}
-
-	this.setMouseOver = function (callback) {
-		for (var i=0; i<targets.length; i++){
-			if (typeof(canvas[i]) !== 'undefined') {
-				canvas[i].canvasDivTag.getTag().onmouseover = function (e) {
-					callback(e);
-				};
-			}
-		}
-	};
-	
-	this.setMouseOut = function (callback) {
-		for (var i=0; i<targets.length; i++){
-			if (typeof(canvas[i]) !== 'undefined') {
-				canvas[i].canvasDivTag.getTag().onmouseout = function (e) {
-					callback(e);
-				};
-			}
-		}
-	};
-	
-	this.setMouseClick = function (callback) {
-		for (var i=0; i<targets.length; i++){
-			if (typeof(canvas[i]) !== 'undefined') {
-				canvas[i].canvasDivTag.getTag().onclick = function (e) {
-					callback(e);
-				};
-			}
-		}
-	};
-	
-	var lineWidth = aLineWidth;
-	var tagname = 'mod_gaz_draw'+aTagName;
-	var style = aStyle;
-	var targets = aTargetArray; 
-	var canvas = []; 
-	var gA = new GeometryArray(); 
-	var lineColor = "#ff0000";
-	this.paint();
-}
-
-// ----------------------------------------------------------------------------------------------------
-// Snapping
-// ----------------------------------------------------------------------------------------------------
-/**
- * @class a {@link Snapping} object stores is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
- *
- * @constructor
- * @requires GeometryArray
- * @requires Highlight
- * @param {String} aTarget name of the mapframe where snapping occurs
- * @param {String} aTolerance Snapping is activated if the mouse is 
- *                 within aTolerance pixel distance to the reference point.
- * @param {String} aColor apparently deprecated?
- * @param {Integer} aZIndex the z-Index of the {@link jsGraphics} generated by {@link Highlight}.
- */
-function Snapping(aTarget, aTolerance, aColor, aZIndex){
-
-	/**
-	 * draws a circle to highlight the snapped point.
-	 * 
-	 * @param {Point} center the snapped point.
-	 * @param {Integer} radius radius of the circular highlight.
-	 */
-	this.draw = function(center,radius){ 
-		mG = new MultiGeometry(geomType.point);
-		mG.addGeometry();
-		mG.get(-1).addPoint(center);
-		highlight.add(mG,snappingColor);
-		highlight.paint();
-	};
-	this.getTolerance = function() {
-		return tolerance;
-	};
-	this.getTarget = function() {
-		return target;
-	};
-	this.cleanHighlight = function() {
-		return highlight.clean();
-	};
-	this.addPoint = function(aPoint) {
-		coord.push(aPoint);
-	};
-	this.getPointCount = function() {
-		return coord.length;
-	};
-	this.getPoint = function(i) {
-		return coord[i];
-	};
-	this.resetPoints = function() {
-		coord = [];
-	};
-	this.getNearestNeighbour = function(){
-		if (min_i != -1) {return this.getPoint(min_i);}
-		return false;
-	};
-	this.setIndexOfNearestNeighbour = function(i){
-		min_i = i;
-	};
-	this.resetIndexOfNearestNeighbour = function(){
-		min_i = -1;
-	};
-	
-	/**
-	 * @private
-	 */
-	var tolerance = (typeof(aTolerance) == 'undefined') ? 10 : aTolerance;
-
-	/**
-	 * @private
-	 */
-	var zIndex = (typeof(aZIndex) == 'undefined') ? 50 : aZIndex;
-
-	/**
-	 * @private
-	 */
-	var coord = []; 
-
-	/**
-	 * @private
-	 */
-	var min_i = -1;
-
-	/**
-	 * @private
-	 */
-	var target = aTarget;
-
-	/**
-	 * @private
-	 */
-	var snappingColor = aColor;
-	
-	/**
-	 * @private
-	 */
-	var lineWidth = 2;
-
-	/**
-	 * @private
-	 */
-	var style = {"position":"absolute", "top":"0px", "left":"0px", "z-index":zIndex};
-
-	/**
-	 * @private
-	 */
-	var highlight = new Highlight([target], "snapping"+Math.round(Math.random()*Math.pow(10,10)), style, lineWidth);
-}
-
-Snapping.prototype.check = function(currPoint){
-	var minDist = false;
-	
-	for (var i = 0 ; i < this.getPointCount() ; i++) {
-
-		var currDist = currPoint.dist(realToMap(this.getTarget(), this.getPoint(i)));
-		if (minDist === false || currDist < minDist) {
-			minDist = currDist;
-			if (minDist < this.getTolerance()) {this.setIndexOfNearestNeighbour(i);}
-		}
-	}
-	if (this.getPointCount() > 0 && minDist > this.getTolerance()) {
-		this.resetIndexOfNearestNeighbour();
-	}
-	this.cleanHighlight();
-	if (this.isSnapped()) {
-		this.draw(this.getNearestNeighbour(), this.getTolerance());
-	}
-};
-
-/**
- * Stores the points which will have the snapping property. 
- * 
- * @param {GeometryArray} geom all points of geom will be stored. May also be a 
- *                             {@link MultiGeometry} or {@link Geometry}.
- * @param {Point} point this point is excluded. Useful when moving a point of a 
- *                      geometry; you don't want to snap against the point you
- *                      move. Optional.
- */
-Snapping.prototype.store = function(geom, point){
-	this.resetPoints();
-	this.resetIndexOfNearestNeighbour();
-
-	for (var i = 0 ; i < geom.count(); i++){
-		if (geom.name == nameGeometryArray || geom.name == nameMultiGeometry){
-			for (var j = 0 ; j < geom.get(i).count() ; j++){
-				if (geom.get(i).name == nameMultiGeometry){
-					// inner rings
-					if (geom.get(i).get(j).geomType == geomType.polygon && geom.get(i).get(j).innerRings && geom.get(i).get(j).innerRings.count() > 0) {
-						for (var l = 0; l < geom.get(i).get(j).innerRings.count(); l++) {
-							var currentRing = geom.get(i).get(j).innerRings.get(l);
-							for (var k = 0 ; k < currentRing.count() ; k++){
-								if ((currentRing.isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !currentRing.get(k).equals(point))){
-									this.add(currentRing.get(k));
-								}
-							}
-							
-						}
-					}
-					// lines, points, outer rings
-					for (var k = 0 ; k < geom.get(i).get(j).count() ; k++){
-						if ((geom.get(i).get(j).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
-							this.add(geom.getPoint(i, j, k));
-						}
-					}
-				}
-				else {
-					if ((geom.get(i).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
-						this.add(geom.getPoint(i, j));
-					}
-				}
-			}
-		}
-		else {
-			if (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point)){
-				this.add(geom.get(i));
-			}
-		}
-	}
-};
-
-/**
- * Determines whether a point is within snapping distance to the mouse cursor
- * 
- * @return true if a point is within snapping distance; else false
- * @type Boolean
- */
-Snapping.prototype.isSnapped = function(){ 
-	if (this.getNearestNeighbour() !== false) {return true;}
-	return false;
-};
-
-/**
- * Returns the point that is within snapping distance and closest to the mouse cursor.
- * 
- * @return the point (if there is any); else false
- * @type Point
- */
-Snapping.prototype.getSnappedPoint = function(){
-	return this.getNearestNeighbour();
-};
-
-/**
- * Adds the point to the stored points with snapping property.
- * 
- * @param {Point} point which receives snapping property.
- */
-Snapping.prototype.add = function(aPoint){ 
-	this.addPoint(aPoint);
-};
-
-/**
- * Removes the highlight.
- */
-Snapping.prototype.clean = function(){
-	this.cleanHighlight();
-};
-
-
-
-// ----------------------------------------------------------------------------------------------------
-// misc. functions
-// ----------------------------------------------------------------------------------------------------
-
-/**
- * @ignore
- */
-function calculateVisibleDash (p0, p1, width, height) {
-	if (p0.x > p1.x) {var p_temp = p0; p0 = p1; p1 = p_temp; p_temp = null;}
-	var p = p0; var q = p1; var m; var ix; var iy;
-	if (p1.x != p0.x) {
-		m = -(p1.y-p0.y)/(p1.x-p0.x); 
-		if (p0.x < width && p1.x > 0 && !(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height) ) {
-			if (p0.x < 0) {
-				iy = p0.y - m*(0-p0.x);
-				if (iy > 0 && iy < height) {p = new Point(0, iy);}
-				else if (iy > height) {
-				    ix = p0.x+((p0.y - height)/m);
-				    if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
-				}
-				else if (iy < 0) {
-				    ix = p0.x+(p0.y/m);
-				    if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
-				}
-				else {return false;}
-			}
-			else if (p0.y >= 0 && p0.y <= height) {p = p0;}
-			else if (p0.y < 0) {
-			    ix = p0.x+(p0.y/m);
-			    if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
-			}
-			else if (p0.y > height && m > 0) {
-			    ix = p0.x+((p0.y - height)/m);
-			    if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
-			}
-			else {return false;}
-			if (p1.x > width) {
-				iy = p1.y - m*(width-p1.x);
-				if (iy > 0 && iy < height) {q = new Point(width, iy);}
-				else if (iy < 0) {
-				    ix = p0.x+(p0.y/m);
-				    if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
-				}
-				else if (iy > height) {
-				    ix = p0.x+((p0.y - height)/m);
-				    if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
-				}
-				else {return false;}
-			}
-			else if (p1.y >= 0 && p1.y <= height) {q = p1;}
-			else if (p1.y < 0) {
-			    ix = p1.x+(p1.y/m);
-			    if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
-			}
-			else if (p1.y > height) {
-			    ix = p1.x+((p1.y- height)/m);
-			    if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
-			}
-		}
-		else {return false;}
-	}
-	else {
-		if (!(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height)) {
-			if (p0.y < 0) {p = new Point(p0.x, 0);}
-			else if (p0.y > height) {p = new Point(p0.x, height);}
-			else {p = p0;}
-			if (p1.y < 0) {q = new Point(p0.x, 0);}
-			else if (p1.y > height) {q = new Point(p0.x, height);}
-			else {q = p1;}
-		}
-		else {return false;}
-	}
-	return [new Point(Math.round(q.x), Math.round(q.y)), new Point(Math.round(p.x), Math.round(p.y))];
-}
-
-/**
- * @ignore
- */
-function objString (a){
-	var z = "";
-	
-	for (attr in a) {
-		var b = a[attr];
-		if (typeof(b) == "object") {z += objString(b);}
-		else {z += attr + " " + b + "\n";}
-	}	
-	return z;
-}
+/* 
+* $Id$
+* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
+*/
+// http://www.mapbender.org/index.php/GeometryArray.js
+
+
+var nameGeometryArray = "GeometryArray";
+var nameMultiGeometry = "MultiGeometry";
+var nameGeometry = "Geometry";
+
+/**
+ * @class A class representing geometry types "polygon", "line" and "point".
+ *
+ * @constructor
+ */
+function GeomType(){
+	/**
+	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+	 * or {@link Geometry} is a polygon, write
+	 * if (someGeometry.geomType == geomType.polygon
+	 * 
+	 * @type String
+	 */
+	this.polygon = "polygon";
+
+	/**
+	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+	 * or {@link Geometry} is a line, write
+	 * if (someGeometry.geomType == geomType.line
+	 * 
+	 * @type String
+	 */
+	this.line = "line";
+
+	/**
+	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+	 * or {@link Geometry} is a point, write
+	 * if (someGeometry.geomType == geomType.point
+	 * 
+	 * @type String
+	 */
+	this.point = "point";
+}
+var geomType = new GeomType();
+
+
+/**
+ * @class a {@link GeometryArray} is a {@link List} of {@link MultiGeometry} objects
+ *
+ * @ extends List
+ * @ requires MultiGeometry 
+ * @ requires Geometry
+ * @ requires Point
+ * @ constructor
+ */
+function GeometryArray(){
+
+	/*
+	 * creates a new, empty Multigeometry and adds it to this GeometryArray
+	 *
+	 * @param {String} geomType a {@link GeomType}
+	 */
+	this.addMember = function(geomType){
+		this.add(new MultiGeometry(geomType));
+	};
+	
+	/**
+	 * @ignore
+	 */
+	this.name = nameGeometryArray;
+	
+	/**
+	 * A {@link List} of {@link MultiGeometry} objects.
+	 * 
+	 * @type List
+	 */
+	this.list = [];
+}
+
+GeometryArray.prototype = new List();
+	
+/**
+ * gets the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ * @type Geometry 
+ */
+GeometryArray.prototype.getGeometry = function(i,j){
+	var tmp = this.get(i);
+	return tmp.get(j);
+};
+
+/**
+ * gets the k-th Point of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ * @param {Integer} k index of the Point
+ * @type Point
+ * @returns the Point object at the given indices
+ */
+GeometryArray.prototype.getPoint = function(i, j, k, l){
+	if (l == undefined) {
+		return this.get(i).get(j).get(k);
+	}
+	return this.get(i).get(j).innerRings.get(k).get(l);
+};
+
+/**
+ * gets an Array of indices; the {@link MultiGeometry} objects at these indices are equal to geom
+ *
+ * @type Integer[]
+ * @param {MultiGeometry} geom 
+ * @returns an Array of indices
+ */
+GeometryArray.prototype.findMultiGeometry = function(geom) {
+	var a = [];
+	for (var i=0; i < this.count(); i++) {
+		if (this.get(i).equals(geom)) {a.push(i);}
+	}
+	return a;
+};
+	
+/**
+ * deletes the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ */
+GeometryArray.prototype.delGeometry = function(i,j){
+	if (this.get(i).del(j) === false) {
+		this.del(i);
+	}
+};
+	
+/**
+ * deletes the k-th {@link Point} of the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
+ *
+ * @param {Integer} i index of the MultiGeometry
+ * @param {Integer} j index of the Geometry
+ * @param {Integer} k index of the Point
+ */
+GeometryArray.prototype.delPoint = function (i, j, k, l) {
+	var res = this.get(i).delPoint(j, k, l);
+	if (res === false) {
+		this.del(i);
+	}
+};
+	
+/**
+ * closes the current {@link MultiGeometry}. Calls method close of the {@link Geometry} class.
+ *
+ */
+GeometryArray.prototype.close = function(){
+	if (!this.get(-1).get(-1).close()) {
+		this.delGeometry(-1, -1);
+	}
+	else {
+		if (this.get(-1).get(-1).count() === 0) {
+			this.get(-1).del(-1);
+		}
+		if (this.get(-1).count() === 0) {
+			this.del(-1);
+		}
+	}
+	
+};
+
+/**
+ * deletes all {@link Point} objects of this {@link GeometryArray} that equal point
+ *
+ * @param {Point} point
+ */
+GeometryArray.prototype.delAllPointsLike = function(point){
+	var finished = false;
+	while (finished === false){
+		finished = true;
+		for (var i = 0 ; finished === true && i < this.count() ; i++){
+			for (var j = 0 ; finished === true && j < this.get(i).count() ; j++){
+
+				var currentGeometry = this.get(i).get(j);
+				if (currentGeometry.geomType == geomType.polygon && currentGeometry.innerRings) {
+					for (var k = 0; finished === true && k < currentGeometry.innerRings.count(); k++) {
+						for (var l = 0; finished === true && l < currentGeometry.innerRings.get(k).count(); l++) {
+							if (this.getPoint(i, j, k, l).equals(point)) {
+								this.delPoint(i, j, k, l);
+								finished = false;
+							}
+						}
+					}
+				}
+				if (!finished) {
+					break;
+				}
+
+				for (var k = 0 ; finished === true && k < this.get(i).get(j).count() ; k++){
+					if (this.getPoint(i,j,k).equals(point)){
+						this.delPoint(i,j,k);
+						finished = false;
+					}
+				}
+			} 
+		}
+	}
+};
+	
+/**
+ * updates all {@link Point} objects of this {@link GeometryArray} that equal oldP to newP
+ *
+ * @param {Point} oldP
+ * @param {Point} newP
+ */
+GeometryArray.prototype.updateAllPointsLike = function(oldP, newP){
+	for (var i = 0; i < this.count(); i++){
+		this.get(i).updateAllPointsLike(oldP, newP);
+	}
+};
+
+GeometryArray.prototype.placemarkToString = function (placemarkId) {
+	var str = "{\"type\": \"Feature\", \"geometry\": ";
+
+	// get geometries with placemarkId
+	var geometriesFromPlacemark = [];
+	for (var i = 0, len = this.count(); i < len; i++) {
+		if (this.get(i).isFromKml() && this.get(i).e.getElementValueByName("Mapbender:placemarkId") == placemarkId) {
+			geometriesFromPlacemark.push(i);
+		}
+	}	
+
+	if (geometriesFromPlacemark.length > 1) {
+		str += "{\"type\": \"GeometryCollection\", \"geometries\": [";
+		for (var i = 0; i < geometriesFromPlacemark.length; i++) {
+			if (i > 0) {
+				str += ",";
+			}	
+			str += this.get(geometriesFromPlacemark[i]).placemarkToString();
+		}
+		str += "]}";
+
+		// metadata is the same for all indices...get from index 0
+		var propString = this.get(geometriesFromPlacemark[0]).e.toString();
+		if (propString) {
+			str += "," + propString;
+		}
+	}
+	else if (geometriesFromPlacemark.length === 1) {
+		str += this.get(geometriesFromPlacemark[0]).placemarkToString();
+	}
+
+	str += "}";
+	return str;
+};
+
+GeometryArray.prototype.getBBox = function(){
+	var q = this.get(0).get(0).get(0);
+	var min = cloneObject(q);
+	var max = cloneObject(q);
+	for(var i=0; i < this.count();i++){
+		var pos = this.get(i).getBBox();
+		if (pos[0].x < min.x) {min.x = pos[0].x;}
+		if (pos[1].x > max.x) {max.x = pos[1].x;}
+		if (pos[1].y > max.y) {max.y = pos[1].y;}
+		if (pos[0].y < min.y) {min.y = pos[0].y;}
+	}
+	return [min, max];
+};
+
+GeometryArray.prototype.importGeometryFromText = function (text) {
+
+	var tmpArray = text.split("(");
+	var geometryType = tmpArray[0];
+
+	switch (geometryType) {
+		case "MULTIPOLYGON":
+			var text = text.replace(/\)/g, "");
+			var sepArray = text.split("(((");
+			var polyArray = sepArray[1].split(",((");
+			
+			this.addMember(geomType.polygon);
+			for (var i = 0; i < polyArray.length; i++) {
+				var ringArray = polyArray[i].split(",(");
+				for (var j = 0; j < ringArray.length; j++) {
+					var coordinatesArray = ringArray[j].split(",");
+					if (j === 0) {
+						// add outer ring
+						this.get(-1).addGeometry();
+						for (var m = 0; m < -1 + coordinatesArray.length; m++) {
+							var currentPoint = coordinatesArray[m].split(" ");
+							this.getGeometry(-1, -1).addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
+						}
+						this.close();
+					}		
+					else {
+						// add inner ring
+						var ring = new Geometry(geomType.polygon);
+						for (var m = 0; m < -1 + coordinatesArray.length; m++) {
+							var currentPoint = coordinatesArray[m].split(" ");
+							ring.addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
+						}
+						ring.close();
+						this.getGeometry(-1,-1).addInnerRing(ring);				
+					}
+				}
+			}
+			break;
+	}
+};
+
+GeometryArray.prototype.importGeoJSON = function (geoJSON) {
+	// you can pass either geoJSON or the evaluated geoJSON string
+	// for backwards compatibility
+	if (typeof(geoJSON) == 'string') {
+		var geoJSON = eval('(' + geoJSON + ')');
+	}
+
+	//
+	// FEATURE COLLECTION
+	//
+	var isFeatureCollection = (geoJSON.type == "FeatureCollection") ? true : false;
+	if (isFeatureCollection) {
+		//
+		// FEATURE
+		//
+		var featureArray = geoJSON.features;
+		for (var j = 0; j < featureArray.length; j++) {
+			var currentFeature = featureArray[j];
+			var isFeature = (currentFeature.type == "Feature") ? true : false;
+	
+			// add geometry ...
+			if (currentFeature.geometry && isFeature) {
+				var featureEpsg = "EPSG:4326";
+				if (!currentFeature.crs || currentFeature.crs.type !== "name" || !currentFeature.crs.properties.name) {
+					var e = new Mb_warning("SRS not set or unknown in GeoJSON. Using 'EPSG:4326'.");
+				}
+				else {
+					featureEpsg = currentFeature.crs.properties.name;
+				}
+
+				//
+				// GEOMETRY
+				//
+				var currentGeometry = currentFeature.geometry;
+				var geometrytype = currentGeometry.type;
+				var coordinates = currentGeometry.coordinates;
+				switch (geometrytype) {
+					case "Point":
+						//
+						// POINT
+						//
+						this.addMember(geomType.point);
+						
+						this.get(-1).addGeometry();
+						this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1], coordinates[2]);
+						this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						this.close();
+						break;
+					
+					case "LineString":
+						//
+						// LINESTRING
+						//
+						this.addMember(geomType.line);
+						this.get(-1).addGeometry();
+						for (var m = 0; m < coordinates.length; m++) {
+							var currentPoint = coordinates[m];
+							this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+						}
+						this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						this.close();
+						break;
+						
+					case "MultiLineString":
+						//
+						// MULTILINESTRING
+						//
+						this.addMember(geomType.line);
+						for (var m = 0; m < coordinates.length; m++) {
+							this.get(-1).addGeometry();
+							var currentLine = coordinates[m];
+							for (var n = 0; n < currentLine.length; n++) {
+								var currentPoint = currentLine[n];
+								this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+							}
+							this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						}
+						this.close();
+						break;
+					
+					case "Polygon":
+						//
+						// POLYGON
+						//
+						this.addMember(geomType.polygon);
+						for (var m = 0; m < coordinates.length; m++) {
+							this.get(-1).addGeometry();
+							var currentPolygon = coordinates[m];
+							for (var n = 0; n < currentPolygon.length; n++) {
+								var currentPoint = currentPolygon[n];
+								this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+							}
+							this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						}
+						this.close();
+						break;
+						
+					case "MultiPolygon":
+						//
+						// MULTIPOLYGON
+						//
+						this.addMember(geomType.polygon);
+						for (var m = 0; m < coordinates.length; m++) {
+							this.get(-1).addGeometry();
+							var currentPolygon = coordinates[m];
+							for (var n = 0; n < currentPolygon.length; n++) {
+								var currentRing = currentPolygon[n];
+								if (n == 0) {
+									for (var p = 0; p < currentRing.length; p++) {
+										var currentPoint = currentRing[p];
+										this.getGeometry(-1, -1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+									}
+								}
+								else {
+									var ring = new Geometry(geomType.polygon);
+									for (var p = 0; p < currentRing.length; p++) {
+										var currentPoint = currentRing[p];
+										ring.addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+									}
+									ring.close();
+									this.getGeometry(-1,-1).addInnerRing(ring);				
+								}
+							}
+							this.getGeometry(-1,-1).setEpsg(featureEpsg);
+						}
+						this.close();
+						break;
+	
+					case "GeometryCollection":
+						var exc = new Mb_exception("Geometry: GeometryCollections are not yet supported");
+						break;
+				}
+			}
+			
+			if (currentFeature.properties) {
+				var properties = currentFeature.properties;
+				// GeometryCollections are NOT YET IMPLEMENTED
+				if (geometrytype != "GeometryCollection") {
+					for (var l in properties) {
+						if (typeof(properties[l]) != "function") {
+							this.get(-1).e.setElement(l, properties[l]);
+						}
+					}
+					this.get(-1).e.setElement("fid", currentFeature.id);
+				}
+			}
+		}
+	}
+	return true;
+}
+
+GeometryArray.prototype.featureToString = function (i) {
+	var str = "{\"type\": \"FeatureCollection\", \"features\": [";
+	str += this.get(i).toString();
+	str += "]}";
+	return str;
+};
+
+
+GeometryArray.prototype.toString = function () {
+	var str = "{\"type\": \"FeatureCollection\", \"features\": [";
+
+	// separate: geometries that are from a KML and those which are not
+	var multiGeometriesFromKml = [];
+	var multiGeometriesNotFromKml = [];
+	for (var i = 0, len = this.count(); i < len; i++) {
+		if (this.get(i).isFromKml()) {
+			var placemarkId = this.get(i).e.getElementValueByName("Mapbender:placemarkId");
+
+			// only add placemark ids once!
+			var isFound = false;
+			for (var j = 0; j < multiGeometriesFromKml && isFound === false; j++) {
+				if (multiGeometriesFromKml == placemarkId) {
+					isFound = true;
+				}
+			}
+			if (!isFound) {
+				multiGeometriesFromKml.push(placemarkId);
+			}
+		}
+		else {
+			multiGeometriesNotFromKml.push(i);
+		}
+	}
+
+	// add geometries not from KML
+	for (var i = 0, len = multiGeometriesNotFromKml.length; i < len; i++) {
+		if (i > 0) {
+			str += ",";
+		}		
+		str += this.get(multiGeometriesNotFromKml[i]).toString();
+	}
+	
+	// add geometries from KML
+	if (multiGeometriesNotFromKml.length > 0 && multiGeometriesFromKml.length > 0) {
+		str += ",";
+	}
+
+	for (var i=0; i < multiGeometriesFromKml.length; i++) {
+		if (i > 0) {
+			str += ",";
+		}	
+		str += this.placemarkToString();
+	}
+
+	str += "]}";
+	return str;
+};
+	
+/**
+ * @class a MultiGeometry is a List of Geometry objects
+ *
+ * @ extends List
+ * @ requires Geometry
+ * @ requires Point
+ * @ constructor
+ * @ param {String} geomType a geomType
+ */
+function MultiGeometry(geomType){
+
+	/*
+	 * creates a new, empty {@link Geometry} object and adds it to this {@link MultiGeometry}
+	 *
+	 */
+	this.addGeometry = function(){
+		this.add(new Geometry(this.geomType));
+	};
+	
+	/**
+	 * deletes the {@link Geometry} object at index i; -1 refers to the last {@link Geometry object in the list
+	 * overwrites the del function of {@link List}.
+	 *
+	 * @param {Integer} i index
+	 */
+	this.del = function(i){
+		i = this.getIndex(i);
+		if (i !== false){
+			var tmpLength = this.count() - 1;
+			for (var z = i; z < tmpLength ; z ++){
+				this.list[z] = this.list[z+1];
+			}
+			this.list.length -= 1;
+			if (this.list.length === 0) {return false;}
+		}
+		return true;
+	};
+
+	this.list = [];
+	this.e = new Wfs_element();
+	this.geomType = geomType;
+	this.name = nameMultiGeometry;
+}
+
+MultiGeometry.prototype = new List();
+
+/**
+ * updates all {@link Point} objects of this {@link MultiGeometry} that equal oldP to newP
+ *
+ * @param {Point} oldP
+ * @param {Point} newP
+ */
+MultiGeometry.prototype.updateAllPointsLike = function(oldP, newP){
+	for (var i = 0; i < this.count(); i++) {
+		this.get(i).updateAllPointsLike(oldP, newP);
+	}
+};
+
+/**
+ * gets the bounding box of this {@link MultiGeometry} as an Array of 2 points
+ *
+ * @return the bounding box
+ * @type Array of two Point objects
+ */
+MultiGeometry.prototype.getBBox = function(){
+	var q = this.get(0).get(0);
+	var min = cloneObject(q);
+	var max = cloneObject(q);
+	for(var i=0; i<this.count();i++){
+		var pos = this.get(i).getBBox();
+		if (pos[0].x < min.x) {min.x = pos[0].x;}
+		if (pos[1].x > max.x) {max.x = pos[1].x;}
+		if (pos[1].y > max.y) {max.y = pos[1].y;}
+		if (pos[0].y < min.y) {min.y = pos[0].y;}
+	}
+	return [min, max];
+};
+
+/**
+ * gets the bounding box of this {@link MultiGeometry} as a polygon of four points
+ *  
+ * @return the bounding box
+ * @type MultiGeometry
+ */
+MultiGeometry.prototype.getBBox4 = function() {
+	var bbox = this.getBBox();
+	var realBox = new MultiGeometry(geomType.polygon);
+	realBox.addGeometry(geomType.polygon);
+	realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[0].y);
+	realBox.get(-1).addPointByCoordinates(bbox[0].x, bbox[1].y);
+	realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[1].y);
+	realBox.get(-1).addPointByCoordinates(bbox[1].x, bbox[0].y);
+	realBox.get(-1).close();
+	return realBox;
+};
+
+/**
+ * gets the center of the bounding box of this {@link MultiGeometry}.
+ *
+ * @return the center of the bounding box
+ * @type Point
+ */
+MultiGeometry.prototype.getCenter = function(){
+	var tmp = this.getBBox();
+	var x = parseFloat(tmp[0].x) + parseFloat((tmp[1].x - tmp[0].x)/2);
+	var y = parseFloat(tmp[0].y) + parseFloat((tmp[1].y - tmp[0].y)/2);
+	return new Point(x,y);
+};
+
+/**
+ * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
+ *
+ * @return number of points
+ * @type Integer
+ */
+MultiGeometry.prototype.getTotalPointCount = function(){ 
+	var c = 0;
+	for (var i = 0 ; i < this.count(); i++)	{
+		c += this.get(i).count();
+	}
+	return c;
+};
+
+/**
+ * gets the total number of {@link Point} objects of this {@link MultiGeometry}.
+ *
+ * @return number of points
+ * @type Integer
+ */
+MultiGeometry.prototype.getPoint = function(j,k){
+	return this.get(j).get(k);
+};
+
+/**
+ * compares this {@link MultiGeometry} object with the {@link MultiGeometry} object multigeom.
+ *
+ * @param {MultiGeometry} multigeom another multigeometry
+ * @return true if he multigeometries match; else false 
+ * @type Boolean
+ */
+MultiGeometry.prototype.equals = function(multigeom) {
+	if (this.geomType != multigeom.geomType) {return false;}
+	if (this.count() != multigeom.count()) {return false;}
+	if (this.getTotalPointCount() != multigeom.getTotalPointCount()) {return false;}
+	for (var i=0; i<this.count(); i++) {
+		if (!this.get(i).equals(multigeom.get(i))) {return false;}
+	}
+	return true;
+};
+
+/**
+ * deletes the j-th {@link Point} object of the i-th {@link Geometry} object of this {@link MultiGeometry} object.
+ *
+ * @param {Integer} i geometry index
+ * @param {Integer} j point index
+ * @return true if the deletion succeded; else false.
+ * @type Boolean
+ */
+MultiGeometry.prototype.delPoint = function(i, j, k){
+	var res;
+	if (k == undefined) {
+		res = this.get(i).del(j);
+		if (res === false) {
+			return this.del(i);
+		}
+	}
+	else {
+		res = this.get(i).innerRings.get(j).del(k);
+		if (res === false) {
+			this.get(i).innerRings.del(j);
+		}
+	}
+	return true;
+};
+
+MultiGeometry.prototype.isFromKml = function () {
+	if (this.e.getElementValueByName("Mapbender:kml")) {
+		return true;
+	}
+	return false;
+};
+
+MultiGeometry.prototype.toText = function () {
+	var text = "";
+	var numOfGeom = this.count();
+	if (numOfGeom >= 1) {
+		if (this.geomType == geomType.polygon) {
+			if (numOfGeom > 1) {
+				text += "MULTIPOLYGON (";
+				for (var i = 0; i < numOfGeom; i++) {
+					if (i > 0) {
+						text += ", ";
+					}
+					var currentPolygon = this.get(i);
+					text += "(" + currentPolygon.toText() + ")";
+				}
+				text += ")";
+			}
+			else {
+				text += "POLYGON (" + this.get(0).toText() + ")";
+			}
+		}
+		else if (this.geomType == geomType.line) {
+			text += "LINESTRING (";
+
+			var currentLine = this.get(0);
+			for (var j = 0; j < currentLine.count(); j++) {
+				if (j > 0) {
+					text += ", ";
+				}
+
+				var currentPoint = currentLine.get(j);
+				text += currentPoint.x + " " + currentPoint.y
+			}
+
+			text += ")";
+		}
+		
+	}
+	return text;		
+};
+
+MultiGeometry.prototype.toString = function () {
+	var str = this.toStringWithoutProperties();
+	
+	// properties
+	var propString = this.e.toString();
+	if (propString) {
+		str += "," + propString;
+	}
+
+	str += "}";
+	
+	return str;
+};
+
+MultiGeometry.prototype.placemarkToString = function () {
+	var str = "";
+	// geometries
+	for (var i = 0, len = this.count(); i < len; i++) {
+		if (i > 0) {
+			str += ",";
+		}		
+		str += this.get(i).toString();
+	}
+	return str;
+};
+
+MultiGeometry.prototype.toStringWithoutProperties = function () {
+	var str = "{\"type\": \"Feature\", ";
+
+	var epsg = this.getEpsg();
+	if (epsg) {
+		str += "\"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"" + epsg + "\"}}, ";
+	}
+	str += "\"geometry\": {";
+
+	var len = this.count(); 
+	
+	switch (this.geomType) {
+		case geomType.polygon:
+			if (len > 1) {
+				str += "\"type\": \"MultiPolygon\", ";
+			}
+			else {
+				str += "\"type\": \"Polygon\", ";
+			}
+			break;
+		case geomType.line:
+			if (len > 1) {
+				str += "\"type\": \"MultiLineString\", ";
+			}
+			else {
+				str += "\"type\": \"LineString\", ";
+			}
+			break;
+		case geomType.point:
+			if (len > 1) {
+				str += "\"type\": \"MultiPoint\", ";
+			}
+			else {
+				str += "\"type\": \"Point\", ";
+			}
+			break;
+	}
+
+	str += "\"coordinates\": "
+	// geometries
+	if (len > 1) {
+		str += "[";
+		for (var i = 0; i < len; i++) {
+			if (i > 0) {
+				str += ",";
+			}		
+			str += this.get(i).toString();
+		}
+		str += "]";
+	}
+	else {
+		str += this.get(0).toString();
+	}
+
+	str += "}";
+
+// this closing curly bracket is added in toString()
+//	str += "}";
+	
+	return str;
+};
+
+/**
+ * @return the EPSG code of this geometry.
+ * @type integer
+ */
+MultiGeometry.prototype.getEpsg = function () {
+	if (this.count() > 0) {
+		return this.get(0).getEpsg();
+	}
+	return false;
+};
+
+
+function InnerRings () {
+	this.list = [];	
+};
+
+InnerRings.prototype = new List();
+
+/**
+ * @class a Geometry is a List of Point objects. If it is a polygon, the last point has 
+ * to equal the first point.
+ *
+ * @extends List
+ * @requires Point
+ * @constructor
+ * @param {String} a string representing a geometry type, see @see GeomType.
+ */
+function Geometry(aGeomtype){
+
+	/**
+	 * deletes the {@link Point} object at index i; -1 refers to the last 
+	 * {@link Point} object in the list. Overwrites the del function of 
+	 * {@link List}.
+	 *
+	 * @param {Integer} i index
+	 * @return false if deletion is not yet finished. It is cascaded to 
+	 *         {@link MultiGeometry}. True if the deletion is finished.
+	 */
+	this.del = function(i){
+		i = this.getIndex(i);
+		if (i !== false) {
+			var tmpLength = this.count()-1;
+			
+			for (var z = i; z < tmpLength ; z ++){
+				this.list[z] = this.list[z+1];
+			}
+			this.list.length -= 1;
+		
+			if (this.geomType == geomType.polygon){
+				if (i == tmpLength) {this.list[0] = this.list[tmpLength-1];}
+				else if (i === 0) {this.list[tmpLength-1] = this.list[0];}
+				if (this.list.length == 1){return false;}
+			}
+			updateDist();
+			if(this.list.length === 0) {return false;}
+			return true;
+		}
+		return false;
+	};
+
+	/**
+	 * adds a {@link Point} object to this {@link Geometry} object.
+	 *
+	 * @param {Float} x x value of the point
+	 * @param {Float} y y value of the point
+	 */	
+	this.addPointByCoordinates = function(x,y,z){
+		var newPoint = new Point(x,y,z);
+		this.add(newPoint);
+//		updateDist();
+	};
+
+	/**
+	 * adds a {@link Point} object to this {@link Geometry} object.
+	 *
+	 * @param {Point} aPoint another point
+	 */	
+	this.addPoint = function(aPoint){
+		this.add(new Point(aPoint.x, aPoint.y, aPoint.z));
+		updateDist();
+	};
+
+	/**
+	 * inserts a {@link Point} object at index i of this {@link Geometry} object.
+	 *
+	 * @param {Point} p another point
+	 * @param {Integer} i index
+	 */	
+	this.addPointAtIndex = function(p,i){
+		i = this.getIndex(i);
+		if (i !== false){
+			for(var z = this.count(); z > i; z--){
+				this.list[z] = this.list[z-1];
+			}
+			this.list[i] = new Point(p.x, p.y, p.z);
+			updateDist();
+		}
+	};
+	
+	/**
+	 * Overwrites the {@link Point) object at index i with the {@link Point} object p.
+	 *
+	 * @private
+	 * @param {Point} p another point
+	 * @param {Integer} i index
+	 */	
+	this.updatePointAtIndex = function(p, i){
+		i = this.getIndex(i);
+		if ((i === 0 || i == this.count()-1) && this.geomType == geomType.polygon){
+			this.list[0] = p;
+			this.list[this.count()-1] = p;
+		}
+		else {this.list[i] = p;}
+		updateDist();
+	};
+	
+	/**
+	 * Updates the {@link Geometry#dist} and {@link Geometry#totaldist}
+	 *
+	 * @private
+	 */	
+	var updateDist = function(){
+/*
+ * DISABLED BECAUSE IT IS TOO SLOW
+		dist[0] = 0;		
+		totaldist[0] = 0;		
+		for (var i = 1 ; i < that.count(); i++){
+			dist[i] = that.get(i-1).dist(that.get(i));
+			totaldist[i] = totaldist[i-1] + dist[i];
+		}
+*/
+	};
+	/**
+	 * gets the distance between the last and last but one point of this {@link Geometry}.
+	 *
+	 * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
+	 * @return the distance
+	 * @type Float
+	 */	
+	this.getCurrentDist = function(numberOfDigits) {
+		if (typeof(numberOfDigits) == "number") {
+			return roundToDigits(dist[this.count()-1], numberOfDigits);
+		}
+		return dist[this.count()-1];
+		
+	};
+	/**
+	 * gets the length of the outer rim of this {@link Geometry}.
+	 *
+	 * @param {Integer} numberOfDigitis round to numberOfDigits (optional)
+	 * @return the distance
+	 * @type Float
+	 */	
+	this.getTotalDist = function(numberOfDigits) {
+		if (typeof(numberOfDigits) == "number") {
+			return roundToDigits(totaldist[this.count()-1], numberOfDigits);
+		}
+		return totaldist[this.count()-1];
+	};
+	/**
+	 * closes this {@link Geometry}. 
+	 *
+	 * @return true if the geometry could be closed; otherwise false
+	 * @type Boolean
+	 */	
+	this.close = function(){
+		complete = true;
+		if (this.geomType == geomType.polygon){
+			if (this.count() > 2){
+				if (!this.get(0).equals(this.get(-1))) {
+					this.addPoint(this.get(0));
+				}
+			}
+			else {return false;}
+		}
+		if (this.geomType == geomType.line){
+			if (this.count() < 2){return false;}
+		}
+		return true;
+	};
+	/**
+	 * checks if this {@link Geometry} has been closed. 
+	 *
+	 * @return true if the geometry is closed; otherwise false
+	 * @type Boolean
+	 */	
+	this.isComplete = function() { 
+		return complete;
+	};
+	
+	/**
+	 * Sets the EPSG of this geometry.
+	 * 
+	 * @param {Integer} someEpsg the EPSG of this geometry.
+	 * @return true if the EPSG could be set; else false
+	 * @type boolean
+	 */
+	this.setEpsg = function (someEpsg) {
+		// TODO: how to check if EPSG code is correct?
+		epsg = someEpsg;
+		return true;
+
+		var e = new Mb_exception("EPSG code not valid ("+someEpsg+")");
+		return false;
+	};
+	
+	/**
+	 * @return the EPSG code of this geometry.
+	 * @type integer
+	 */
+	this.getEpsg = function () {
+		return epsg;
+	};
+	
+	this.list = [];
+	var dist = [];
+	var totaldist = [];
+	var complete = false;
+
+	var epsg;
+
+	var that = this;
+
+	this.geomType = aGeomtype;
+	this.name = nameGeometry;
+
+	// add these members if the geometry is a polygon
+	if (this.geomType == geomType.polygon) {
+		this.innerRings = new InnerRings();
+		this.addInnerRing = function (somePolygon) {
+			this.innerRings.add(somePolygon);
+		};
+		this.delInnerRing = function (index) {
+			this.innerRings.del(index);
+		};
+	}
+}
+
+Geometry.prototype = new List();
+
+Geometry.prototype.toText = function () {
+	var text = "";
+	switch (this.geomType) {
+		case geomType.polygon:
+			text += "(";
+			for (var j = 0; j < this.count(); j++) {
+				if (j > 0) {
+					text += ", ";
+				}
+				var currentPoint = this.get(j);
+				text += currentPoint.x + " " + currentPoint.y
+			}
+			text += ")";
+			if (this.innerRings && this.innerRings.count() > 0) {
+				for (var k = 0; k < this.innerRings.count(); k++) {
+					text += ", ";
+					text += this.innerRings.get(k).toText();
+				}				
+			}
+			break;
+	}
+	return text;
+};
+/**
+ * gets the bounding box of this {@link Geometry}
+ *
+ * @return the bounding box (array of two Point objects)
+ * @type Point[]
+ */
+Geometry.prototype.getBBox = function(){
+	var q = this.get(0);
+	var min = cloneObject(q);
+	var max = cloneObject(q);
+	
+	for (var j=0; j<this.count(); j++){
+		var pos = this.get(j);
+		if (pos.x < min.x) {min.x = pos.x;}
+		else if (pos.x > max.x) {max.x = pos.x;}
+		if (pos.y < min.y) {min.y = pos.y;}
+		else if (pos.y > max.y) {max.y = pos.y;}
+	}
+	if (this.geomType == geomType.polygon) {
+		for (var i = 0; i < this.innerRings.count(); i++) {
+			var currentRing = this.innerRings.get(i);
+			for (var j=0; j<currentRing.count(); j++){
+				var pos = currentRing.get(j);
+				if (pos.x < min.x) {min.x = pos.x;}
+				else if (pos.x > max.x) {max.x = pos.x;}
+				if (pos.y < min.y) {min.y = pos.y;}
+				else if (pos.y > max.y) {max.y = pos.y;}
+			}
+		}
+	}
+	
+	return [min, max];
+};
+
+/**
+ * updates all {@link Point} objects of this {@link Geometry} that equal oldP to newP
+ *
+ * @param {Point} oldP
+ * @param {Point} newP
+ */
+Geometry.prototype.updateAllPointsLike = function(oldP, newP){
+	var len = this.count();
+	for (var i = 0; i < len ; i++){
+		if (oldP.equals(this.get(i))){
+			if (i>0 && newP.equals(this.get(i-1))){
+				this.del(i);
+				len--;
+				i--;
+			}
+			else {this.updatePointAtIndex(newP, i);}
+		}
+	}
+	if (this.geomType == geomType.polygon) {
+		for (var j = 0; j < this.innerRings.count(); j++) {
+			var len = this.innerRings.get(j).count();
+			for (var i = 0; i < len ; i++){
+				if (oldP.equals(this.innerRings.get(j).get(i))){
+					if (i>0 && newP.equals(this.innerRings.get(j).get(i-1))){
+						this.innerRings.get(j).del(i);
+						len--;
+						i--;
+					}
+					else {this.innerRings.get(j).updatePointAtIndex(newP, i);}
+				}
+			}
+			
+		}
+	}
+};
+
+/**
+ * compares this {@link Geometry} object with the {@link Geometry} object geom point by point.
+ *
+ * @param {Geometry} geom another geometry
+ * @return true if he geometries match; else false 
+ * @type Boolean
+ */
+Geometry.prototype.equals = function(geom) {
+	if (this.geomType != geom.geomType) {return false;}
+	if (this.count() != geom.count()) {return false;}
+	for (var i=0; i < this.count(); i++) {
+		if (!this.get(i).equals(geom.get(i))) {return false;}
+	}
+	if (!this.innerRings && !geom.innerRings) {
+		// no inner rings; fine
+	}
+	else if (this.innerRings && geom.innerRings) {
+		if (this.innerRings.count() != geom.innerRings.count()) {
+			return false;
+		}
+		for (var j = 0; j < this.innerRings.count(); j++) {
+			if (!this.innerRings.get(j).equals(geom.innerRings.get(j))) {
+				return false;
+			}
+		}
+	}
+	else {
+		// inner ring mismatch
+		return false;
+	}	
+	return true;
+};
+
+/**
+ * creates a polygon geometry object which form a buffer around the line geometry
+ * 
+ * @param {float} real world units to buffer around the line
+ * @param {float} (optional) units to buffer around the line in Y direction
+ * 
+ * @return linebuffer polygon
+ * @type Geometry
+ */
+Geometry.prototype.bufferLine = function(bufferX, bufferY){
+	if(typeof(bufferY)=='undefined')
+		bufferY = bufferX;
+	if(this.geomType!=geomType.line || this.count()<2)
+		return false;
+	
+	var ret = new Geometry(geomType.polygon)
+	
+	//get vector from point 0 to point 1
+	last_vec = this.get(1).minus(this.get(0));
+
+	//get 90° rotated vector
+	last_vec_o = new Point(-last_vec.y, last_vec.x);
+
+	//resize vectors with apropriate linebuffer length
+	last_vec_o = last_vec_o.dividedBy(last_vec_o.dist(new Point(0,0)));
+	last_vec_o.x*=bufferX; last_vec_o.y*=bufferY;
+	last_vec = last_vec.dividedBy(last_vec.dist(new Point(0,0)));
+	last_vec.x*=bufferX; last_vec.y*=bufferY;
+		
+	//add first pointsets
+	ret.list.unshift(this.get(0).plus(last_vec_o).minus(last_vec));
+	ret.list.push(this.get(0).minus(last_vec_o).minus(last_vec));
+		
+	for(var i=1;i<this.count()-1;i++){
+		//get vector from point n to point n+1
+		vec = this.get(i+1).minus(this.get(i));
+		//get orthogonal (90° rotated) vector		
+		vec_o = new Point(-vec.y, vec.x);
+
+		//resize vectors to linebuffer length
+		vec_o = vec_o.dividedBy(vec_o.dist(new Point(0,0)));
+		vec_o.x*=bufferX; vec_o.y*=bufferY;
+		vec = vec.dividedBy(vec.dist(new Point(0,0)));
+		vec.x*=bufferX; vec.y*=bufferY;
+			
+		//if direction is the same continue
+		if(vec.equals(last_vec))
+			continue;
+			
+		// calculate directed angle between the two vectors by 
+		// calculating the argument diffenrences between complex numbers
+		// arg(x + i*y) (because law of cosine can onlycalculate undirected angle)
+		var angle = (Math.atan2(vec.x,vec.y)-Math.atan2(last_vec.x,last_vec.y))
+		//ensure that angle is -180<=angle<=180
+		if(angle<-Math.PI)angle=2*Math.PI+angle;
+		if(angle>+Math.PI)angle=2*Math.PI-angle;
+		
+		//calculate the distance between the next points on boundary
+		//and the line point
+		//the point will be in the direction of angle/2 relative to last_vec_o
+		//since cosine is adjacent side / hypothenuse and we know that 
+		//the adjacent side is lineBuffer the hypothenus (our distance) is
+		var ndist = 1/(Math.cos(angle/2))
+		//direction of next points on boundary
+		var int_vec = vec_o.plus(last_vec_o);
+		//resize direction vector to our distance
+		int_vec = int_vec.times(ndist/int_vec.dist(new Point(0,0)));
+		int_vec.x*=bufferX; int_vec.y*=bufferY;
+		
+		//look if we have an outer sharp corner (>90°)
+		if(angle>Math.PI/2){
+			//push cutted edge points
+			ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
+			ret.list.unshift(this.get(i).plus(vec_o).minus(vec));
+		}
+		else{
+			//push inner/light edge
+			ret.list.unshift(this.get(i).plus(int_vec));
+		}
+
+		//look if we have an inner sharp corner (<-90°)
+		if(angle<-Math.PI/2){
+			//push cutted edge points
+			ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
+			ret.list.push(this.get(i).minus(vec_o).minus(vec));
+		}
+		else{
+			//push inner/light edge
+			ret.list.push(this.get(i).minus(int_vec));
+		}
+			
+		//copy for next point
+		last_vec = vec;
+		last_vec_o = vec_o;
+	}
+	//add last pointsets
+	ret.list.unshift(this.get(i).plus(last_vec_o).plus(last_vec));
+	ret.list.push(this.get(i).minus(last_vec_o).plus(last_vec));
+	
+	ret.close();
+
+	return ret;	
+}
+
+Geometry.prototype.toString = function () {
+	var str = "";
+	if (this.geomType == geomType.polygon) {
+		str += "[[";
+		for (var i = 0; i < this.count(); i++) {
+			if (i > 0) {
+				str += ", ";
+			}
+			str += this.get(i).toString();
+		}
+
+		if (typeof(this.innerRings) == "object" && this.innerRings.count() > 0) {
+			for (var j = 0; j < this.innerRings.count(); j++) {
+				var currentRing = this.innerRings.get(j);
+
+				str += "],[";
+				for (var i = 0; i < currentRing.count(); i++) {
+					if (i > 0) {
+						str += ", ";
+					}
+					str += currentRing.get(i).toString();
+				}
+			}
+		}
+		str += "]]";
+	}
+	else if (this.geomType == geomType.line) {
+		str += "[";
+		for (var i = 0; i < this.count(); i++) {
+			if (i > 0) {
+				str += ", ";
+			}
+			str += this.get(i).toString();
+		}
+		str += "]";
+	}
+	else if (this.geomType == geomType.point) {
+		str += this.get(0).toString();
+	}
+	
+	return str;
+};
+
+
+
+/**
+ * @class an array of elements, each consisting of a name/value pair
+ *
+ * @ constructor
+ */
+function Wfs_element(){
+
+	/**
+	 * returns the number of elements of this {@link Wfs_element} object.
+	 *
+	 * @return the number of elements
+	 * @type Integer
+	 */
+	this.count = function(){
+		return name.length;
+	};
+
+	/**
+	 * returns the name of the element at index i.
+	 *
+	 * @param {Integer} i index
+	 * @return the name
+	 * @type String
+	 */
+	this.getName = function(i){ 
+		if (isValidElementIndex(i)) {return name[i];}
+		return false;
+	};
+	
+	/**
+	 * returns the value of the element at index i.
+	 *
+	 * @param {Integer} i index
+	 * @return the value
+	 */
+	this.getValue = function(i){ 
+		if (isValidElementIndex(i)) {return value[i];}
+		return false;
+	};
+
+	/**
+	 * appends a new element with a given name. If an element with this name exists, it is overwritten.
+	 *
+	 * @param {String} aName the name of the new element
+	 * @param {String} aValue the value of the new element
+	 */
+	this.setElement = function(aName, aValue){ 
+		var i = this.getElementIndexByName(aName);
+		if (i === false) {i = this.count();}
+		name[i] = aName;
+		value[i] = aValue;
+	};
+
+	/**
+	 * removes an element with a given name. If an element with this name exists, it is removed.
+	 *
+	 * @param {String} aName the name of the element to delete
+	 */
+	this.delElement = function(aName){
+		var i = this.getElementIndexByName(aName);
+		if (i !== false) {
+			name.splice(i, 1);
+			value.splice(i, 1);
+		}
+	}
+	
+	/**
+	 * checks if an index is valid
+	 *
+	 * @private
+	 * @param {Integer} i an index
+	 * @return true if the index is valid; otherwise false
+	 * @type Boolean
+	 */
+	var isValidElementIndex = function(i){ 
+		if (i>=0 && i<name.length) {return true;}
+		var e = new Mb_exception("class Wfs_element: function isValidElementIndex: illegal element index");
+		return false;
+	};
+	
+	var name  = [];
+	var value = [];
+}
+
+/**
+ * gets the index of the element with a given name.
+ *
+ * @param {String} elementName a name
+ * @return the index of the element; if no element with this name exists, false
+ * @type Integer, Boolean
+ */
+Wfs_element.prototype.getElementIndexByName = function(elementName){
+	for (var j = 0, len = this.count() ; j < len ; j++){
+		if (this.getName(j) == elementName) {return j;}
+	}
+	return false;
+};
+
+/**
+ * gets the value of the element with a given name.
+ *
+ * @param {String} elementName a name
+ * @return the value of the element; if no element with this name exists, false
+ * @type String, Boolean
+ */
+Wfs_element.prototype.getElementValueByName = function(elementName){
+	var i = this.getElementIndexByName(elementName);
+	if (i === false) {return false;}
+	return this.getValue(i);
+};
+
+Wfs_element.prototype.toString = function () {
+	var str = "";
+	if (this.count() > 0) {
+		str += "\"properties\": {";
+		
+		for (i = 0, len = this.count(); i < len; i++) {
+			if (i > 0) {
+				str += ",";
+			}		
+			var key = this.getName(i);
+			var value = this.getValue(i);
+			str += "\"" + key + "\":\"" + value + "\"";
+		}
+		str += "}";
+	}
+	return str;
+};
+
+/**
+ * @class a {@link Canvas} contains a {@link DivTag} that holds graphics rendered by {@link jsGraphics}
+ *
+ * @constructor
+ * @requires DivTag
+ * @requires jsGraphics
+ * @requires GeometryArray
+ * @requires MultiGeometry
+ * @requires Geometry
+ * @param {String} aMapFrame name of the target mapframe
+ * @param {String} aTagName name of the target div tag
+ * @param {String} aStyle style of the div tag
+ * @param {Integer} aLineWidth the line width of the jsGraphics output
+ */
+function Canvas(aMapframe, aTagName, aStyle, aLineWidth) {
+	
+	/**
+	 * draws the geometry of the canvas
+	 *
+	 * @param {String} t geometry type (@see GeomType)
+	 * @param {MultiGeometry} g a MultiGeometry object
+	 * @param {String} col a color
+	 * @private
+	 */
+ 	this.drawGeometry = function(t,g,col){
+		if(t == geomType.point) {
+			var poiIcon = g.e.getElementValueByName("Mapbender:icon");
+			for(var i=0, ilen = g.count(); i < ilen; i++){
+				var currentGeom = g.get(i);
+				var p = realToMap(mapframe, currentGeom.get(0));
+				var px = p.x;
+				var py = p.y;
+				var radius = diameter/2;
+				if ((px - radius < mapframeWidth && px + radius > 0 &&
+					py - radius < mapframeHeight && py + radius > 0) ||
+					(p.dist(new Point(0,0)) < radius || 
+					 p.dist(new Point(mapframeWidth, mapframeHeight)) < radius ||
+					 p.dist(new Point(0,mapframeHeight)) < radius || 
+					 p.dist(new Point(mapframeWidth, 0)) < radius
+					)
+				) {
+					// if the point contains a link to an icon, display the icon
+					if (poiIcon) {
+						displayIcon(poiIcon, px, py);
+					}
+					else {
+						drawCircle(px-1, py-1, diameter,col);
+					}
+				}
+			}
+		}
+		else if(t == geomType.line || t==geomType.polygon) {
+			for(var i=0, ilen = g.count(); i < ilen; i++){
+				var currentGeom = g.get(i);
+				// paint inner rings
+				if (t==geomType.polygon && currentGeom.innerRings.count() > 0) {
+					for (var k = 0; k < currentGeom.innerRings.count(); k++) {
+						var currentRing = currentGeom.innerRings.get(k);
+						var previousPoint = realToMap(mapframe, currentRing.get(0));
+						for (var j=1, jlen = currentRing.count(); j < jlen; j++) {
+							(function () {
+								var currentPoint = realToMap(mapframe, currentRing.get(j));
+								
+								var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
+								if (pq) {
+									drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
+								}
+								previousPoint = currentPoint;
+							})();
+						}
+						
+					}					
+				}
+				// paint line or outer ring
+				var previousPoint = realToMap(mapframe, currentGeom.get(0));
+				for (var j=1, jlen = currentGeom.count(); j < jlen; j++) {
+					(function () {
+						var currentPoint = realToMap(mapframe, currentGeom.get(j));
+						
+						var pq = calculateVisibleDash(previousPoint, currentPoint, mapframeWidth, mapframeHeight);
+						if (pq) {
+							drawLine([pq[0].x-1, pq[1].x-1], [pq[0].y-1, pq[1].y-1], col);
+						}
+						previousPoint = currentPoint;
+					})();
+				}
+			}
+		}
+		else {
+			var e = new Mb_exception("class Canvas: function drawGeometry: unknown geomType " + t);
+		}
+	};
+
+	/**
+	 * checks if the MultiGeometry's bounding box width and height is smaller than minWidth
+	 *
+	 * @private
+	 * @param {MultiGeometry} g a MultiGeometry object
+	 */
+	this.isTooSmall = function(g){
+		// TODO switch between dot, original, circle
+//		return false;
+
+		var tmp = g.getBBox();
+		var min = realToMap(mapframe,tmp[0]);
+		var max = realToMap(mapframe,tmp[1]);
+		if((Math.abs(max.x - min.x) < minWidth) && (Math.abs(max.y - min.y) < minWidth)) {
+			return true;
+		}
+		return false;
+	};
+	
+	/**
+	 * gets the jsGraphics.
+	 *
+	 * @private
+	 * @return the jsGraphics
+	 * @type jsGraphics
+	 */
+	this.getCanvas = function(){
+		return canvas;
+	};
+	
+	this.setDiameter = function (px) {
+		diameter = px;
+	};
+	
+	/**
+	 * draws a circle with {@link jsGraphics}.
+	 *
+	 * @private
+	 * @param {Float} x x value of the center
+	 * @param {Float} y y value of the center
+	 * @param {Float} diameter diameter of the circle
+	 * @param {String} color the color of the circle in hex format
+	 */
+	var drawCircle = function(x, y, diameter, color) {
+		canvas.setColor(color);
+		canvas.drawEllipse(x-diameter/2,y-diameter/2,diameter,diameter);
+	};
+
+	/**
+	 * draws a polyline with {@link jsGraphics}.
+	 *
+	 * @private
+	 * @param {Array} x_array array of x values
+	 * @param {Array} y_array array of y values
+	 * @param {String} color the color of the polyline in hex format
+	 */
+	var drawLine = function(x_array, y_array, color) {
+		canvas.setColor(color);
+		canvas.drawPolyline(x_array, y_array);
+	};
+
+	/**
+	 * Displays an icon in the mapframe
+	 * 
+	 * @private
+	 * @param {String} url link to the image
+	 * @param {Float} x x coordinate within the map frame
+	 * @param {Float} y y coordinate within the map frame
+	 */
+	var displayIcon = function (url, x, y) {
+		if(ie){
+			var newImg = document.createElement("img");
+			var newImgTop = y - Math.round(80/2);
+			var newImgLeft = x - Math.round(80/2);
+			that.canvasDivTag.getTag().innerHTML = "<img src='" + url + "' style='position:absolute;top:"+newImgTop+";left:"+newImgLeft+";z-index:100'/>";
+		}
+		else{
+			var newImg = document.createElement("img");
+			newImg.src = url;
+			that.canvasDivTag.getTag().appendChild(newImg);	
+			//newImg.className = "mapsymbol";
+			//newImg.style.cursor = "help";
+			newImg.style.position = "absolute";
+			
+			// center the image at x, y
+			newImg.style.top = y - Math.round(80/2);
+			newImg.style.left = x - Math.round(80/2);
+	//		newImg.style.top = y - Math.round(80);
+	//		newImg.style.left = x;
+			newImg.style.zIndex = 100;
+		}
+	};
+	
+	/**
+	 * This is the {@link DivTag} that contains the output by {@link jsGraphics}.
+	 * 
+	 * @type DivTag
+	 */
+	var mapframe = aMapframe;
+	var mapObjInd = getMapObjIndexByName(mapframe);
+
+	if (mb_mapObj[mapObjInd].getDomElement().frameName) {
+		this.canvasDivTag = new DivTag(aTagName, mapName, aStyle);
+	}
+	else {
+		this.canvasDivTag = new DivTag(aTagName, "", aStyle, mb_mapObj[mapObjInd].getDomElement());
+	}
+
+	var that = this;
+
+	var diameter = 8;
+	var minWidth = 8;
+	var lineWidth = aLineWidth || 2;
+	var mapframeWidth = mb_mapObj[mapObjInd].width;
+	var mapframeHeight = mb_mapObj[mapObjInd].height;
+	eventResizeMap.register(function () {
+		mapframeWidth = mb_mapObj[mapObjInd].width;
+		mapframeHeight = mb_mapObj[mapObjInd].height;
+	});
+	var style = aStyle;
+	var canvas = new jsGraphics(aTagName, mb_mapObj[mapObjInd].getDomElement().frameName ? window.frames[mapframe] : window);
+	canvas.setStroke(lineWidth);
+	mb_registerPanSubElement(aTagName);
+}
+
+/**
+ * cleans the canvas by emptying the canvas {@link DivTag}.
+ */
+Canvas.prototype.clean = function () {
+	this.canvasDivTag.clean();
+};
+
+/**
+ * paints all geometries.
+ *
+ * @param {GeometryArray} gA the geometries that will be drawn
+ */
+Canvas.prototype.paint = function(gA) {
+	for (var q = 0; q < gA.count(); q++) {
+		var m = gA.get(q);
+		var t = m.geomType;
+		var col = m.color;
+		if (t == geomType.point) {
+			this.drawGeometry(t,m,col);
+		}
+		else {
+			if (this.isTooSmall(m)){
+				var newMember = new MultiGeometry(geomType.point);
+				newMember.addGeometry();
+				newMember.get(-1).addPoint(m.getCenter());
+				this.drawGeometry(geomType.point,newMember,col);
+			}
+			else{
+				if(t == geomType.line) {this.drawGeometry(t,m, col);}
+				else if(t == geomType.polygon) {this.drawGeometry(t,m,col);}
+				else {
+					var e = new Mb_exception("class Canvas: function paint: unknown geomType" + t);				
+				}
+			}
+		}
+	}
+	this.getCanvas().paint();
+};
+
+/**
+ * @class a {@link Highlight} object is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
+ *
+ * @constructor
+ * @requires Canvas
+ * @requires GeometryArray
+ * @param {Array} aTargetArray an array of Strings referring to mapframes
+ * @param {String} aTagName the name of the div tags
+ * @param {Object} aStyle the style of the div tags
+ * @param {Integer} the line width of the jsGraphics lines
+ */
+function Highlight(aTargetArray, aTagName, aStyle, aLineWidth) {
+	/**
+	 * removes a {@link MultiGeometry} object from the geometry Array
+	 *
+	 * @param {MultiGeometry} m a MultiGeometry
+	 * @param {String} color a color
+	 */	
+	this.del = function(m, color) {
+		var newMultiGeom;
+		if (m.name == nameMultiGeometry) {
+			newMultiGeom = m;
+		}
+		else if (m.name == nameGeometry) {
+			var newMultiGeom = new MultiGeometry(m.geomType);
+			newMultiGeom.add(m);
+		}
+
+		var a = gA.findMultiGeometry(newMultiGeom);
+		var del = false;
+		for (var i=0; i<a.length && del === false; i++) {
+			if (gA.get(a[i]).color == color) {
+				gA.del(a[i]);
+				del = true;
+			}
+		}
+	};
+
+	/**
+	 * adds a {@link MultiGeometry} object to the geometry Array
+	 *
+	 * @param {MultiGeometry} m a MultiGeometry
+	 * @param {String} color the color of the highlight
+	 */	
+	this.add = function(m, color) {
+
+		if (m.name == nameMultiGeometry) {
+			gA.addCopy(m);
+		}
+		else if (m.name == nameGeometry) {
+			var newMultiGeom = new MultiGeometry(m.geomType);
+			newMultiGeom.add(m);
+			gA.addCopy(newMultiGeom);
+		}
+		if (typeof(color) != 'undefined') {gA.get(-1).color = color;} 
+		else {gA.get(-1).color = lineColor;}
+	};
+	
+	this.hide = function () {
+		for (var i=0; i < canvas.length; i++) {
+			if (typeof(canvas[i]) == "object") {canvas[i].clean();}
+		}
+	};
+
+	/**
+	 * removes all MultiGeometries.
+	 *
+	 */	
+	this.clean = function() {
+		if (gA.count() > 0) {
+			gA = new GeometryArray();
+			this.paint();
+		}
+	};
+
+	/**
+	 * displays the highlight
+	 *
+	 */	
+	this.paint = function() {
+		this.hide();
+		for (var i=0; i < canvas.length; i++) {
+			if (typeof(canvas[i]) == "object") {canvas[i].clean();}
+		}
+		for (var i=0; i<targets.length; i++){
+			if (typeof(canvas[i]) == 'undefined') {
+				canvas[i] = new Canvas(targets[i], tagname + i, style, lineWidth);
+			}
+			canvas[i].paint(gA);
+		}
+	};
+
+	this.setDiameter = function (radius) {
+		for (var i = 0; i < targets.length; i++) {
+			if (typeof(canvas[i]) != "undefined") {
+				canvas[i].setDiameter(radius);
+			}
+		}
+	}
+
+	this.setMouseOver = function (callback) {
+		for (var i=0; i<targets.length; i++){
+			if (typeof(canvas[i]) !== 'undefined') {
+				canvas[i].canvasDivTag.getTag().onmouseover = function (e) {
+					callback(e);
+				};
+			}
+		}
+	};
+	
+	this.setMouseOut = function (callback) {
+		for (var i=0; i<targets.length; i++){
+			if (typeof(canvas[i]) !== 'undefined') {
+				canvas[i].canvasDivTag.getTag().onmouseout = function (e) {
+					callback(e);
+				};
+			}
+		}
+	};
+	
+	this.setMouseClick = function (callback) {
+		for (var i=0; i<targets.length; i++){
+			if (typeof(canvas[i]) !== 'undefined') {
+				canvas[i].canvasDivTag.getTag().onclick = function (e) {
+					callback(e);
+				};
+			}
+		}
+	};
+	
+	var lineWidth = aLineWidth;
+	var tagname = 'mod_gaz_draw'+aTagName;
+	var style = aStyle;
+	var targets = aTargetArray; 
+	var canvas = []; 
+	var gA = new GeometryArray(); 
+	var lineColor = "#ff0000";
+	this.paint();
+}
+
+// ----------------------------------------------------------------------------------------------------
+// Snapping
+// ----------------------------------------------------------------------------------------------------
+/**
+ * @class a {@link Snapping} object stores is {@link jsGraphics} rendering of a {@link GeometryArray} in various mapframes.
+ *
+ * @constructor
+ * @requires GeometryArray
+ * @requires Highlight
+ * @param {String} aTarget name of the mapframe where snapping occurs
+ * @param {String} aTolerance Snapping is activated if the mouse is 
+ *                 within aTolerance pixel distance to the reference point.
+ * @param {String} aColor apparently deprecated?
+ * @param {Integer} aZIndex the z-Index of the {@link jsGraphics} generated by {@link Highlight}.
+ */
+function Snapping(aTarget, aTolerance, aColor, aZIndex){
+
+	/**
+	 * draws a circle to highlight the snapped point.
+	 * 
+	 * @param {Point} center the snapped point.
+	 * @param {Integer} radius radius of the circular highlight.
+	 */
+	this.draw = function(center,radius){ 
+		mG = new MultiGeometry(geomType.point);
+		mG.addGeometry();
+		mG.get(-1).addPoint(center);
+		highlight.add(mG,snappingColor);
+		highlight.paint();
+	};
+	this.getTolerance = function() {
+		return tolerance;
+	};
+	this.getTarget = function() {
+		return target;
+	};
+	this.cleanHighlight = function() {
+		return highlight.clean();
+	};
+	this.addPoint = function(aPoint) {
+		coord.push(aPoint);
+	};
+	this.getPointCount = function() {
+		return coord.length;
+	};
+	this.getPoint = function(i) {
+		return coord[i];
+	};
+	this.resetPoints = function() {
+		coord = [];
+	};
+	this.getNearestNeighbour = function(){
+		if (min_i != -1) {return this.getPoint(min_i);}
+		return false;
+	};
+	this.setIndexOfNearestNeighbour = function(i){
+		min_i = i;
+	};
+	this.resetIndexOfNearestNeighbour = function(){
+		min_i = -1;
+	};
+	
+	/**
+	 * @private
+	 */
+	var tolerance = (typeof(aTolerance) == 'undefined') ? 10 : aTolerance;
+
+	/**
+	 * @private
+	 */
+	var zIndex = (typeof(aZIndex) == 'undefined') ? 50 : aZIndex;
+
+	/**
+	 * @private
+	 */
+	var coord = []; 
+
+	/**
+	 * @private
+	 */
+	var min_i = -1;
+
+	/**
+	 * @private
+	 */
+	var target = aTarget;
+
+	/**
+	 * @private
+	 */
+	var snappingColor = aColor;
+	
+	/**
+	 * @private
+	 */
+	var lineWidth = 2;
+
+	/**
+	 * @private
+	 */
+	var style = {"position":"absolute", "top":"0px", "left":"0px", "z-index":zIndex};
+
+	/**
+	 * @private
+	 */
+	var highlight = new Highlight([target], "snapping"+Math.round(Math.random()*Math.pow(10,10)), style, lineWidth);
+}
+
+Snapping.prototype.check = function(currPoint){
+	var minDist = false;
+	
+	for (var i = 0 ; i < this.getPointCount() ; i++) {
+
+		var currDist = currPoint.dist(realToMap(this.getTarget(), this.getPoint(i)));
+		if (minDist === false || currDist < minDist) {
+			minDist = currDist;
+			if (minDist < this.getTolerance()) {this.setIndexOfNearestNeighbour(i);}
+		}
+	}
+	if (this.getPointCount() > 0 && minDist > this.getTolerance()) {
+		this.resetIndexOfNearestNeighbour();
+	}
+	this.cleanHighlight();
+	if (this.isSnapped()) {
+		this.draw(this.getNearestNeighbour(), this.getTolerance());
+	}
+};
+
+/**
+ * Stores the points which will have the snapping property. 
+ * 
+ * @param {GeometryArray} geom all points of geom will be stored. May also be a 
+ *                             {@link MultiGeometry} or {@link Geometry}.
+ * @param {Point} point this point is excluded. Useful when moving a point of a 
+ *                      geometry; you don't want to snap against the point you
+ *                      move. Optional.
+ */
+Snapping.prototype.store = function(geom, point){
+	this.resetPoints();
+	this.resetIndexOfNearestNeighbour();
+
+	for (var i = 0 ; i < geom.count(); i++){
+		if (geom.name == nameGeometryArray || geom.name == nameMultiGeometry){
+			for (var j = 0 ; j < geom.get(i).count() ; j++){
+				if (geom.get(i).name == nameMultiGeometry){
+					// inner rings
+					if (geom.get(i).get(j).geomType == geomType.polygon && geom.get(i).get(j).innerRings && geom.get(i).get(j).innerRings.count() > 0) {
+						for (var l = 0; l < geom.get(i).get(j).innerRings.count(); l++) {
+							var currentRing = geom.get(i).get(j).innerRings.get(l);
+							for (var k = 0 ; k < currentRing.count() ; k++){
+								if ((currentRing.isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !currentRing.get(k).equals(point))){
+									this.add(currentRing.get(k));
+								}
+							}
+							
+						}
+					}
+					// lines, points, outer rings
+					for (var k = 0 ; k < geom.get(i).get(j).count() ; k++){
+						if ((geom.get(i).get(j).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
+							this.add(geom.getPoint(i, j, k));
+						}
+					}
+				}
+				else {
+					if ((geom.get(i).isComplete() === true && typeof(point) == 'undefined') || (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point))){
+						this.add(geom.getPoint(i, j));
+					}
+				}
+			}
+		}
+		else {
+			if (typeof(point) != 'undefined' && !geom.get(i).get(j).get(k).equals(point)){
+				this.add(geom.get(i));
+			}
+		}
+	}
+};
+
+/**
+ * Determines whether a point is within snapping distance to the mouse cursor
+ * 
+ * @return true if a point is within snapping distance; else false
+ * @type Boolean
+ */
+Snapping.prototype.isSnapped = function(){ 
+	if (this.getNearestNeighbour() !== false) {return true;}
+	return false;
+};
+
+/**
+ * Returns the point that is within snapping distance and closest to the mouse cursor.
+ * 
+ * @return the point (if there is any); else false
+ * @type Point
+ */
+Snapping.prototype.getSnappedPoint = function(){
+	return this.getNearestNeighbour();
+};
+
+/**
+ * Adds the point to the stored points with snapping property.
+ * 
+ * @param {Point} point which receives snapping property.
+ */
+Snapping.prototype.add = function(aPoint){ 
+	this.addPoint(aPoint);
+};
+
+/**
+ * Removes the highlight.
+ */
+Snapping.prototype.clean = function(){
+	this.cleanHighlight();
+};
+
+
+
+// ----------------------------------------------------------------------------------------------------
+// misc. functions
+// ----------------------------------------------------------------------------------------------------
+
+/**
+ * @ignore
+ */
+function calculateVisibleDash (p0, p1, width, height) {
+	if (p0.x > p1.x) {var p_temp = p0; p0 = p1; p1 = p_temp; p_temp = null;}
+	var p = p0; var q = p1; var m; var ix; var iy;
+	if (p1.x != p0.x) {
+		m = -(p1.y-p0.y)/(p1.x-p0.x); 
+		if (p0.x < width && p1.x > 0 && !(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height) ) {
+			if (p0.x < 0) {
+				iy = p0.y - m*(0-p0.x);
+				if (iy > 0 && iy < height) {p = new Point(0, iy);}
+				else if (iy > height) {
+				    ix = p0.x+((p0.y - height)/m);
+				    if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
+				}
+				else if (iy < 0) {
+				    ix = p0.x+(p0.y/m);
+				    if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
+				}
+				else {return false;}
+			}
+			else if (p0.y >= 0 && p0.y <= height) {p = p0;}
+			else if (p0.y < 0) {
+			    ix = p0.x+(p0.y/m);
+			    if (ix > 0 && ix < width) {p = new Point(ix, 0);} else {return false;}
+			}
+			else if (p0.y > height && m > 0) {
+			    ix = p0.x+((p0.y - height)/m);
+			    if (ix > 0 && ix < width) {p = new Point(ix, height);} else {return false;}
+			}
+			else {return false;}
+			if (p1.x > width) {
+				iy = p1.y - m*(width-p1.x);
+				if (iy > 0 && iy < height) {q = new Point(width, iy);}
+				else if (iy < 0) {
+				    ix = p0.x+(p0.y/m);
+				    if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
+				}
+				else if (iy > height) {
+				    ix = p0.x+((p0.y - height)/m);
+				    if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
+				}
+				else {return false;}
+			}
+			else if (p1.y >= 0 && p1.y <= height) {q = p1;}
+			else if (p1.y < 0) {
+			    ix = p1.x+(p1.y/m);
+			    if (ix > 0 && ix < width) {q = new Point(ix, 0);} else {return false;}
+			}
+			else if (p1.y > height) {
+			    ix = p1.x+((p1.y- height)/m);
+			    if (ix > 0 && ix < width) {q = new Point(ix, height);} else {return false;}
+			}
+		}
+		else {return false;}
+	}
+	else {
+		if (!(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height)) {
+			if (p0.y < 0) {p = new Point(p0.x, 0);}
+			else if (p0.y > height) {p = new Point(p0.x, height);}
+			else {p = p0;}
+			if (p1.y < 0) {q = new Point(p0.x, 0);}
+			else if (p1.y > height) {q = new Point(p0.x, height);}
+			else {q = p1;}
+		}
+		else {return false;}
+	}
+	return [new Point(Math.round(q.x), Math.round(q.y)), new Point(Math.round(p.x), Math.round(p.y))];
+}
+
+/**
+ * @ignore
+ */
+function objString (a){
+	var z = "";
+	
+	for (attr in a) {
+		var b = a[attr];
+		if (typeof(b) == "object") {z += objString(b);}
+		else {z += attr + " " + b + "\n";}
+	}	
+	return z;
+}

Modified: branches/print_dev/http/javascripts/jsTree.js
===================================================================
--- branches/print_dev/http/javascripts/jsTree.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/jsTree.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,103 +1,103 @@
-/***************************************************************
-# $Id$
-*  http://www.mapbender.org/index.php/Mod_treefolder2.php
-*
-*  Copyright notice
-*  (c) 2003-2004 Tobias Bender (tobias at phpXplorer.org)
-*  All rights reserved
-*
-*  This script is part of the jsTree project. The jsTree project 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 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt distributed with these scripts.
-*
-*  This script 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.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-var jst_cm
-var jst_cmT
-var jst_activeNode
-var jst_reload_strData = ""
-var jst_reload_ctlImage
-var jst_reload_halt = false
-var jst_any_expanded
-var jst_expandAll_int
-var jst_loaded = false
-var jst_state_paths = new Array()
-
-var jst_delimiter = ["|", "<|>"]
-var jst_id = "jsTree"
-var jst_container = "document.body"
-var jst_data = "arrNodes"
-var jst_expandAll_warning = "Expanding all nodes can take a while depending on your hardware! Continue?"
-var jst_target
+/***************************************************************
+# $Id$
+*  http://www.mapbender.org/index.php/Mod_treefolder2.php
+*
+*  Copyright notice
+*  (c) 2003-2004 Tobias Bender (tobias at phpXplorer.org)
+*  All rights reserved
+*
+*  This script is part of the jsTree project. The jsTree project 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 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt distributed with these scripts.
+*
+*  This script 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.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+var jst_cm
+var jst_cmT
+var jst_activeNode
+var jst_reload_strData = ""
+var jst_reload_ctlImage
+var jst_reload_halt = false
+var jst_any_expanded
+var jst_expandAll_int
+var jst_loaded = false
+var jst_state_paths = new Array()
+
+var jst_delimiter = ["|", "<|>"]
+var jst_id = "jsTree"
+var jst_container = "document.body"
+var jst_data = "arrNodes"
+var jst_expandAll_warning = "Expanding all nodes can take a while depending on your hardware! Continue?"
+var jst_target
 var jst_context_menu
-var jst_display_root = true
-var jst_highlight = true
-var jst_highlight_color = "white"
-var jst_highlight_bg = "navy"
-var jst_highlight_padding = "1px"
-var jst_image_folder = "./images"
-var jst_reloading = false
-var jst_reload_frame = "reLoader"
-var jst_reload_script = "tree_jsTree_reload.php"
-var jst_reloading_status = "loading tree nodes ..."
-
-function absTop(nd){
-	return nd.offsetParent ? nd.offsetTop + absTop(nd.offsetParent) : nd.offsetTop
-}
-
-function nodeClick(nd){
-	if(jst_highlight){
-		if(jst_activeNode){
-			jst_activeNode.style.color = ""
-			jst_activeNode.style.backgroundColor = ""
-			nd.style.padding = ""
-		}
-		nd.style.color = jst_highlight_color
-		nd.style.backgroundColor = jst_highlight_bg
-		nd.style.padding = jst_highlight_padding
-		jst_activeNode = nd
-	}
-//	if(childExists(nd.parentNode.parentNode))
-//		window.scrollTo(0, absTop(nd) - 5)
-}
-
-function _getDefinition(data, depth){
-
-	var d = new Array()
-
-	if(!data)
-		return ""
-
-	var sD = ""
-	for(var i = 0; i < depth; i++)
-		sD += '\t'
-
-	if(data != eval(jst_data))
-		d.push(",")
-
-	d.push("\n" + sD + "[")
-
-	var nodes = new Array()
-
-	for(var n1 in data){
-
-		var infos = new Array()
-
-		for(var i = 0; i < 5; i++)
-			infos.push(data[n1][1][i] ? "'" + data[n1][1][i].replace(/\n/g, '\\' + 'n') + "'" : null)
+var jst_display_root = true
+var jst_highlight = true
+var jst_highlight_color = "white"
+var jst_highlight_bg = "navy"
+var jst_highlight_padding = "1px"
+var jst_image_folder = "./images"
+var jst_reloading = false
+var jst_reload_frame = "reLoader"
+var jst_reload_script = "tree_jsTree_reload.php"
+var jst_reloading_status = "loading tree nodes ..."
 
+function absTop(nd){
+	return nd.offsetParent ? nd.offsetTop + absTop(nd.offsetParent) : nd.offsetTop
+}
+
+function nodeClick(nd){
+	if(jst_highlight){
+		if(jst_activeNode){
+			jst_activeNode.style.color = ""
+			jst_activeNode.style.backgroundColor = ""
+			nd.style.padding = ""
+		}
+		nd.style.color = jst_highlight_color
+		nd.style.backgroundColor = jst_highlight_bg
+		nd.style.padding = jst_highlight_padding
+		jst_activeNode = nd
+	}
+//	if(childExists(nd.parentNode.parentNode))
+//		window.scrollTo(0, absTop(nd) - 5)
+}
+
+function _getDefinition(data, depth){
+
+	var d = new Array()
+
+	if(!data)
+		return ""
+
+	var sD = ""
+	for(var i = 0; i < depth; i++)
+		sD += '\t'
+
+	if(data != eval(jst_data))
+		d.push(",")
+
+	d.push("\n" + sD + "[")
+
+	var nodes = new Array()
+
+	for(var n1 in data){
+
+		var infos = new Array()
+
+		for(var i = 0; i < 5; i++)
+			infos.push(data[n1][1][i] ? "'" + data[n1][1][i].replace(/\n/g, '\\' + 'n') + "'" : null)
+
 		infos.push(null);
 		
 		if(data[n1][1][6]){
@@ -106,194 +106,194 @@
 		}else{
 			infos.push(null);
 		}
-
-		for(var i = 6; i > 0; i--)
-			if(!infos[i]){
-				infos.pop()
-			}else{
-				break
-			}
-
-		nodes.push("\n" + sD + "\t['" + data[n1][0].replace(/\'/g, '\\' + "'") + "', [" + infos.join(",") + "]" + _getDefinition(data[n1][2], depth + 1) + "]")
-	}
-	
-	d.push(nodes.join(",") + "\n" + sD + "]")
-
-	return d.join("")
-}
-
-function getDefinition(){
-	return jst_data + "=" + _getDefinition(eval(jst_data), 0)
-}
-
-function getDomNode(path){
+
+		for(var i = 6; i > 0; i--)
+			if(!infos[i]){
+				infos.pop()
+			}else{
+				break
+			}
+
+		nodes.push("\n" + sD + "\t['" + data[n1][0].replace(/\'/g, '\\' + "'") + "', [" + infos.join(",") + "]" + _getDefinition(data[n1][2], depth + 1) + "]")
+	}
+	
+	d.push(nodes.join(",") + "\n" + sD + "]")
+
+	return d.join("")
+}
+
+function getDefinition(){
+	return jst_data + "=" + _getDefinition(eval(jst_data), 0)
+}
+
+function getDomNode(path){
 	var parts = path.split(jst_delimiter[0]);
 	var tr = document.getElementById(parts[parts.length-1]);	
 	if(tr)
-		return tr;
-	var tBody = get1stTBody()
-	for(var p = 0; p < parts.length; p++){
-		for(var c = 0; c < tBody.childNodes.length; c++){
-			var tr = tBody.childNodes[c]
+		return tr;
+	var tBody = get1stTBody()
+	for(var p = 0; p < parts.length; p++){
+		for(var c = 0; c < tBody.childNodes.length; c++){
+			var tr = tBody.childNodes[c]
 			if(tr.id == parts[p]){
-				if(p == parts.length - 1){
-					return tr
-				}else{
-					if(!childExists(tr))
-						return null;
-					tBody = tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild
+				if(p == parts.length - 1){
+					return tr
+				}else{
+					if(!childExists(tr))
+						return null;
+					tBody = tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild
 
-					if(!tBody)
-						return null
-				}
-				break
+					if(!tBody)
+						return null
+				}
+				break
 			}
-		}
-	}
-	return null
+		}
+	}
+	return null
 }
 
-function delArrItem(a, p){
-	var b = a.slice(0, p)
-	var e = a.slice(p + 1)
-	return b.concat(e)
-}
-function addArrItem(a, p, v){
-	var b = a.slice(0, p)
-	var e=a.slice(p)
-	b[b.length] = v
-	return b.concat(e)
-}
-
+function delArrItem(a, p){
+	var b = a.slice(0, p)
+	var e = a.slice(p + 1)
+	return b.concat(e)
+}
+function addArrItem(a, p, v){
+	var b = a.slice(0, p)
+	var e=a.slice(p)
+	b[b.length] = v
+	return b.concat(e)
+}
+
 function _editDataNode(action, path, nd){
-	var ps = jst_data
-	var parts = path.split(jst_delimiter[0])
-
-	for(var p = 0; p < parts.length; p++){
-		var arrData = eval(ps)
-		
-	  for(var d = 0; d < arrData.length; d++)
-			if(parts[p] == arrData[d][0]){
-
-				if(p == parts.length - 1){
-
-					switch(action){
-						case "d":
-							if(ps != jst_data)
-								eval(ps + "=delArrItem(" + ps + "," + d + ")")
-						break;
+	var ps = jst_data
+	var parts = path.split(jst_delimiter[0])
+
+	for(var p = 0; p < parts.length; p++){
+		var arrData = eval(ps)
+		
+	  for(var d = 0; d < arrData.length; d++)
+			if(parts[p] == arrData[d][0]){
+
+				if(p == parts.length - 1){
+
+					switch(action){
+						case "d":
+							if(ps != jst_data)
+								eval(ps + "=delArrItem(" + ps + "," + d + ")")
+						break;
 						case "a":
-							if(!eval(ps)[d][2])
-								eval(ps)[d].push(new Array())
-							eval(ps)[d][2].push(nd)
-						break;
-						case "u":
-							if(!eval(ps)[d][2])
-								eval(ps)[d].push(new Array())
-							eval(ps)[d][2].unshift(nd)
-						break;
-					}
-					return true
-					
-					
-				}else{
-					ps = ps + "[" + d + "][2]"
-				}
-				break
-
-			}
-	}
-	return false
-}
-
-function addNode(path, nd, sel, refresh, begining){
-	if(_editDataNode((begining?"u":"a"), path, nd)){
+							if(!eval(ps)[d][2])
+								eval(ps)[d].push(new Array())
+							eval(ps)[d][2].push(nd)
+						break;
+						case "u":
+							if(!eval(ps)[d][2])
+								eval(ps)[d].push(new Array())
+							eval(ps)[d][2].unshift(nd)
+						break;
+					}
+					return true
+					
+					
+				}else{
+					ps = ps + "[" + d + "][2]"
+				}
+				break
+
+			}
+	}
+	return false
+}
+
+function addNode(path, nd, sel, refresh, begining){
+	if(_editDataNode((begining?"u":"a"), path, nd)){
 		if(refresh){	
-			rebuildNode(path, true)
+			rebuildNode(path, true)
 			rebuildNode(path)
-		}
-
-		if(sel)
-			nodeClick(getDomNode(path + jst_delimiter[0] + nd[0]).childNodes[1].childNodes[1])
-	}
-}
+		}
 
-
-function deleteNode(path){
-	if(_editDataNode("d", path))
-		rebuildNode(path, true)
-}
-
-function _getState(tBody, path){
-	var hasSub = false
-	
-	for(var c = 0; tBody!=null  && c < tBody.childNodes.length; c++){
-		var tr = tBody.childNodes[c]
-		if(childExists(tr) && isExpanded(tr)){
-			_getState(tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild, path + (path != "" ? jst_delimiter[0] : "") + tr.id)
-			hasSub = true
-		}
-	}
-	if(!hasSub)
-		jst_state_paths.push(path)
-}
-
-function getState(){
-	jst_state_paths = new Array()
-	_getState(get1stTBody(), "")
-	return jst_state_paths.join(jst_delimiter[1])
-}
-
-function setState(data){
-	jst_state_paths = data.split(jst_delimiter[1])
-	for(var p in jst_state_paths){
-		var path="";
-		var pathElements = jst_state_paths[p].split(jst_delimiter[0]);
-		for(i in pathElements){
-			path += pathElements[i];
-			var tr = getDomNode(path)
-			
-			if(tr){
-				var f1 = tr.firstChild
-				if(f1){
-					var f2 = f1.firstChild
-					if(!isExpanded(tr) && f2)
-						if(f2.onclick)
-							f2.onclick()
-				}
-			}
-			path+=jst_delimiter[0];
-		}
-	}
-}
-
-function rebuildNode(path, parent){
-	if(parent){
-		var arrPath = path.split(jst_delimiter[0])
-		arrPath.pop()
-		path = arrPath.join(jst_delimiter[0])
-	}
-	
-	if(path.split(jst_delimiter[0]).length<=1){
-		renderTree()
-	}else{
-	
-		var nd = getDomNode(path)
-	
-		if(nd){
-			var nn = nd.nextSibling
-
-			if(nn){
-				var nCh = nn.childNodes[1].firstChild
-				if(nCh.nodeName == "TABLE")
-					nd.parentNode.parentNode.deleteRow(nn.rowIndex)
-			}
-			if(nd.firstChild.firstChild.onclick)
-				nd.firstChild.firstChild.onclick()
-		}
-	}
-}
+		if(sel)
+			nodeClick(getDomNode(path + jst_delimiter[0] + nd[0]).childNodes[1].childNodes[1])
+	}
+}
 
+
+function deleteNode(path){
+	if(_editDataNode("d", path))
+		rebuildNode(path, true)
+}
+
+function _getState(tBody, path){
+	var hasSub = false
+	
+	for(var c = 0; tBody!=null  && c < tBody.childNodes.length; c++){
+		var tr = tBody.childNodes[c]
+		if(childExists(tr) && isExpanded(tr)){
+			_getState(tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild, path + (path != "" ? jst_delimiter[0] : "") + tr.id)
+			hasSub = true
+		}
+	}
+	if(!hasSub)
+		jst_state_paths.push(path)
+}
+
+function getState(){
+	jst_state_paths = new Array()
+	_getState(get1stTBody(), "")
+	return jst_state_paths.join(jst_delimiter[1])
+}
+
+function setState(data){
+	jst_state_paths = data.split(jst_delimiter[1])
+	for(var p in jst_state_paths){
+		var path="";
+		var pathElements = jst_state_paths[p].split(jst_delimiter[0]);
+		for(i in pathElements){
+			path += pathElements[i];
+			var tr = getDomNode(path)
+			
+			if(tr){
+				var f1 = tr.firstChild
+				if(f1){
+					var f2 = f1.firstChild
+					if(!isExpanded(tr) && f2)
+						if(f2.onclick)
+							f2.onclick()
+				}
+			}
+			path+=jst_delimiter[0];
+		}
+	}
+}
+
+function rebuildNode(path, parent){
+	if(parent){
+		var arrPath = path.split(jst_delimiter[0])
+		arrPath.pop()
+		path = arrPath.join(jst_delimiter[0])
+	}
+	
+	if(path.split(jst_delimiter[0]).length<=1){
+		renderTree()
+	}else{
+	
+		var nd = getDomNode(path)
+	
+		if(nd){
+			var nn = nd.nextSibling
+
+			if(nn){
+				var nCh = nn.childNodes[1].firstChild
+				if(nCh.nodeName == "TABLE")
+					nd.parentNode.parentNode.deleteRow(nn.rowIndex)
+			}
+			if(nd.firstChild.firstChild.onclick)
+				nd.firstChild.firstChild.onclick()
+		}
+	}
+}
+
 function setNodeColor(path, color){
 	var nd = getDomNode(path)
 	if(nd){
@@ -302,44 +302,44 @@
 }
 
 function setNodeImage(path, Img){
-	var ps = jst_data;
-	var parts = path.split(jst_delimiter[0])
-	var arrData = null;
-
-	var nd = getDomNode(path);
-	if(nd){
-		var cb = nd.childNodes[1].childNodes[0];
-		if(cb && cb.nodeName=="IMG"){
-			if(Img)
-				cb.src=jst_image_folder+"/"+Img;
-			else if(childExists(nd)){
-				var s = nd.nextSibling.style
-				if(s.display == ""){
-					cb.src = jst_image_folder + "/expanded_folder.png";
-				}else{
-					cb.src = jst_image_folder + "/closed_folder.png";
-				}
-			}
-		}
-	}
-	return true
+	var ps = jst_data;
+	var parts = path.split(jst_delimiter[0])
+	var arrData = null;
+
+	var nd = getDomNode(path);
+	if(nd){
+		var cb = nd.childNodes[1].childNodes[0];
+		if(cb && cb.nodeName=="IMG"){
+			if(Img)
+				cb.src=jst_image_folder+"/"+Img;
+			else if(childExists(nd)){
+				var s = nd.nextSibling.style
+				if(s.display == ""){
+					cb.src = jst_image_folder + "/expanded_folder.png";
+				}else{
+					cb.src = jst_image_folder + "/closed_folder.png";
+				}
+			}
+		}
+	}
+	return true
 }
-
-function selectNode(path){
-	var nd = getDomNode(path)
-	if(nd){
-		nodeClick(nd.childNodes[1].childNodes[nd.childNodes[1].childNodes.length-1])
-		return true
-	}else{
-		return false
-	}
+
+function selectNode(path){
+	var nd = getDomNode(path)
+	if(nd){
+		nodeClick(nd.childNodes[1].childNodes[nd.childNodes[1].childNodes.length-1])
+		return true
+	}else{
+		return false
+	}
 }
 
 function IsChecked(path, ctrlNr){
 	var nd = getDomNode(path)
 	if(nd){
-		var fc = nd.childNodes[1].firstChild;
-		if(fc && fc.nodeName=="IMG")ctrlNr++;
+		var fc = nd.childNodes[1].firstChild;
+		if(fc && fc.nodeName=="IMG")ctrlNr++;
 		var cb = nd.childNodes[1].childNodes[ctrlNr];
 		if(cb && cb.nodeName=="INPUT"){
 			return cb.checked;
@@ -353,7 +353,7 @@
 //	0:if none is checked
 // -1:if states are different or ctrlNr is no checkbox or any other error
 function getChildrenCheckState(path, ctrlNr){
-	var state = -1;
+	var state = -1;
 	var plus=0;
 	var nd = getDomNode(path);
 
@@ -361,10 +361,10 @@
 	if(!childExists(nd))return -1;
 	var tBody = nd.nextSibling.childNodes[1].firstChild.firstChild;
 	if(!tBody)return -1;
-	for(var i = 0;i < tBody.childNodes.length; i++){
-		var fc = tBody.childNodes[i].childNodes[1].firstChild;
-		plus=0;
-		if(fc && fc.nodeName=="IMG")plus++;
+	for(var i = 0;i < tBody.childNodes.length; i++){
+		var fc = tBody.childNodes[i].childNodes[1].firstChild;
+		plus=0;
+		if(fc && fc.nodeName=="IMG")plus++;
 		var cb = tBody.childNodes[i].childNodes[1].childNodes[ctrlNr+plus];
 		if(cb && cb.nodeName=="INPUT"){
 			if(state == -1) 
@@ -377,24 +377,24 @@
 		}		
 	}
 	return state;
-}
+}
 
 function checkChildren(path, ctrlNr, bChk){
 	var nd = getDomNode(path);
-	var plus;
+	var plus;
 	
 	if(!nd)return false;
 	if(!childExists(nd))return false;
 	var tBody = nd.nextSibling.childNodes[1].firstChild.firstChild;
 	if(!tBody)return false;
 	for(var i = 0;i < tBody.childNodes.length; i++){
-		var fc = tBody.childNodes[i].childNodes[1].firstChild;
-		plus=0;
-		if(fc && fc.nodeName=="IMG")plus++;
+		var fc = tBody.childNodes[i].childNodes[1].firstChild;
+		plus=0;
+		if(fc && fc.nodeName=="IMG")plus++;
 		var cb = tBody.childNodes[i].childNodes[1].childNodes[ctrlNr+plus];
 		if(cb && cb.nodeName=="INPUT"&&!cb.disabled){
-			cb.checked = bChk;	
-			if(cb.onclick){cb.onclick();}
+			cb.checked = bChk;	
+			if(cb.onclick){cb.onclick();}
 		}		
 	}
 	return true;
@@ -402,11 +402,11 @@
 
 function checkNode(path, ctrlNr, bChk, triggerOnclick){
 	var nd = getDomNode(path)
-	if(typeof(triggerOnclick)=='undefined')
+	if(typeof(triggerOnclick)=='undefined')
 		triggerOnclick = true;
 	if(nd){
-		var fc = nd.childNodes[1].firstChild;
-		if(fc && fc.nodeName=="IMG")ctrlNr++;
+		var fc = nd.childNodes[1].firstChild;
+		if(fc && fc.nodeName=="IMG")ctrlNr++;
 		var cb = nd.childNodes[1].childNodes[ctrlNr];
 		if(cb && cb.nodeName=="INPUT"){
 			cb.checked = bChk;
@@ -420,11 +420,11 @@
 function enableCheckbox(path, ctrlNr, pEnabled){
 	var nd = getDomNode(path)
 	if(nd){
-		var fc = nd.childNodes[1].firstChild;
-		if(fc && fc.nodeName=="IMG")ctrlNr++;
+		var fc = nd.childNodes[1].firstChild;
+		if(fc && fc.nodeName=="IMG")ctrlNr++;
 		var cb = nd.childNodes[1].childNodes[ctrlNr];
 		if(cb && cb.nodeName=="INPUT"){
-			cb.disabled = !pEnabled;
+			cb.disabled = !pEnabled;
 			return true;
 		}
 	}
@@ -432,251 +432,251 @@
 }
 
 
-
-function get1stTBody(){
-	return eval(jst_container).firstChild.firstChild.childNodes[1].childNodes[1].firstChild.firstChild
-}
-
-function __switchAll(tBody, expand){
-	if(!tBody)
-		return false
-
-	for(var c = 0; c < tBody.childNodes.length; c++){
-		var tr = tBody.childNodes[c]
-		var img = tr.firstChild.firstChild
-
-		if(img)
-			if(img.onclick){
-				if((expand && !childExists(tr)) || ((expand && !isExpanded(tr)) || (!expand && isExpanded(tr)))){
-					if(img.id != "rootImage")
-						img.onclick()
-						
-					jst_any_expanded = true
-				}
-				
-				if(tBody.childNodes[c + 1])
-					__switchAll(tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild, expand)
-			}
-	}
-}
-
-function _switchAll(expand){
-	if(jst_reload_halt)
-		return
-
-	__switchAll(get1stTBody(), expand)
-	
-	if(jst_reloading){
-		if(!jst_any_expanded)
-			cancelExpandAll()
-
-		jst_any_expanded = null
-	}
-}
-
-function expandAll(){
-	if(jst_expandAll_warning ? confirm(jst_expandAll_warning) : true)	
-		if(jst_reloading){
-			jst_expandAll_int = window.setInterval("if(!jst_reload_halt)_switchAll(true)", 100)
-		}else{
-			_switchAll(true)
-		}
-}
-
-function cancelExpandAll(){
-	if(jst_expandAll_int)
-		window.clearInterval(jst_expandAll_int)
-}
-
-function closeAll(){
-	_switchAll(false)
-}
-
-function isExpanded(tr){
-	return childExists(tr) ? tr.nextSibling.style.display != "none" : false
-}
-
-function childExists(tr){
-	var n = tr.nextSibling;
-	if(!n||n.childNodes.length<2)return false;
-	n=n.childNodes[1].firstChild;
-	if(!n)return false;
-	return n.nodeName == "TABLE";
-}
-
-function getPath(strData){
-	if(strData.indexOf("[") > 0){
-		
-		var sub3 = strData.substr(0, strData.lastIndexOf("["))
-		var sub6 = sub3.substr(0, sub3.lastIndexOf("["))
-		
-		return (getPath(sub6) != "" ? getPath(sub6) + jst_delimiter[0] : "") + eval(sub3 + "[0]")
-	}else{
-		return ""
-	}
-}
-
-function reloadCallback(){
-
-	eval(jst_reload_strData + "=window.frames['" + jst_reload_frame + "']." + jst_data)
-	
-	renderNode(jst_reload_strData, jst_reload_ctlImage, null, true)
-	
-	window.status = ""
-	
-	jst_reload_halt = false
-	jst_reload_strData = ""
-	jst_reload_ctlImage = null
-}
-
+
+function get1stTBody(){
+	return eval(jst_container).firstChild.firstChild.childNodes[1].childNodes[1].firstChild.firstChild
+}
+
+function __switchAll(tBody, expand){
+	if(!tBody)
+		return false
+
+	for(var c = 0; c < tBody.childNodes.length; c++){
+		var tr = tBody.childNodes[c]
+		var img = tr.firstChild.firstChild
+
+		if(img)
+			if(img.onclick){
+				if((expand && !childExists(tr)) || ((expand && !isExpanded(tr)) || (!expand && isExpanded(tr)))){
+					if(img.id != "rootImage")
+						img.onclick()
+						
+					jst_any_expanded = true
+				}
+				
+				if(tBody.childNodes[c + 1])
+					__switchAll(tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild, expand)
+			}
+	}
+}
+
+function _switchAll(expand){
+	if(jst_reload_halt)
+		return
+
+	__switchAll(get1stTBody(), expand)
+	
+	if(jst_reloading){
+		if(!jst_any_expanded)
+			cancelExpandAll()
+
+		jst_any_expanded = null
+	}
+}
+
+function expandAll(){
+	if(jst_expandAll_warning ? confirm(jst_expandAll_warning) : true)	
+		if(jst_reloading){
+			jst_expandAll_int = window.setInterval("if(!jst_reload_halt)_switchAll(true)", 100)
+		}else{
+			_switchAll(true)
+		}
+}
+
+function cancelExpandAll(){
+	if(jst_expandAll_int)
+		window.clearInterval(jst_expandAll_int)
+}
+
+function closeAll(){
+	_switchAll(false)
+}
+
+function isExpanded(tr){
+	return childExists(tr) ? tr.nextSibling.style.display != "none" : false
+}
+
+function childExists(tr){
+	var n = tr.nextSibling;
+	if(!n||n.childNodes.length<2)return false;
+	n=n.childNodes[1].firstChild;
+	if(!n)return false;
+	return n.nodeName == "TABLE";
+}
+
+function getPath(strData){
+	if(strData.indexOf("[") > 0){
+		
+		var sub3 = strData.substr(0, strData.lastIndexOf("["))
+		var sub6 = sub3.substr(0, sub3.lastIndexOf("["))
+		
+		return (getPath(sub6) != "" ? getPath(sub6) + jst_delimiter[0] : "") + eval(sub3 + "[0]")
+	}else{
+		return ""
+	}
+}
+
+function reloadCallback(){
+
+	eval(jst_reload_strData + "=window.frames['" + jst_reload_frame + "']." + jst_data)
+	
+	renderNode(jst_reload_strData, jst_reload_ctlImage, null, true)
+	
+	window.status = ""
+	
+	jst_reload_halt = false
+	jst_reload_strData = ""
+	jst_reload_ctlImage = null
+}
+
 function renderNode(strData, ctlImg, event, reload){
-
-	if(event)
-		event.cancelBubble = true
-
-	if(jst_reload_halt && !reload)
-		return
-
-	jst_loaded = false
-
-	if(jst_reloading && !reload && eval(strData).length == 0){
-		jst_reload_strData = strData
-		jst_reload_ctlImage = ctlImg
-		jst_reload_halt = true
-		if(jst_reloading_status)
-			window.status = jst_reloading_status
-
-		window.frames[jst_reload_frame].document.location.href = "./" + jst_reload_script + (jst_reload_script.indexOf("?") > -1 ? "&" : "?") + "path=" + getPath(strData)
-		return
-	}
-
-	var tr = ctlImg.parentNode.parentNode
-
-	if(ctlImg.id != "rootFolder"){
-		var fldImg = tr.childNodes[1].firstChild
-
-		if(childExists(tr)){
-			var s = tr.nextSibling.style
-			var img1 = jst_image_folder + "/" + (tr.nextSibling.nextSibling ? "" : "last_")
-
-			if(s.display == ""){
-				s.display = "none"
+
+	if(event)
+		event.cancelBubble = true
+
+	if(jst_reload_halt && !reload)
+		return
+
+	jst_loaded = false
+
+	if(jst_reloading && !reload && eval(strData).length == 0){
+		jst_reload_strData = strData
+		jst_reload_ctlImage = ctlImg
+		jst_reload_halt = true
+		if(jst_reloading_status)
+			window.status = jst_reloading_status
+
+		window.frames[jst_reload_frame].document.location.href = "./" + jst_reload_script + (jst_reload_script.indexOf("?") > -1 ? "&" : "?") + "path=" + getPath(strData)
+		return
+	}
+
+	var tr = ctlImg.parentNode.parentNode
+
+	if(ctlImg.id != "rootFolder"){
+		var fldImg = tr.childNodes[1].firstChild
+
+		if(childExists(tr)){
+			var s = tr.nextSibling.style
+			var img1 = jst_image_folder + "/" + (tr.nextSibling.nextSibling ? "" : "last_")
+
+			if(s.display == ""){
+				s.display = "none"
 				ctlImg.src = img1 + "closed.png"
 				if(String(fldImg.src).indexOf("expanded")!=-1)
-					fldImg.src = jst_image_folder + "/closed_folder.png";
-			}else{
-				s.display = ""
+					fldImg.src = jst_image_folder + "/closed_folder.png";
+			}else{
+				s.display = ""
 				ctlImg.src = img1 + "expanded.png"
-				if(String(fldImg.src).indexOf("closed")!=-1)
-					fldImg.src = jst_image_folder + "/expanded_folder.png";
-			}
-			return
-		}else{
-			ctlImg.src = jst_image_folder + "/" + (tr.nextSibling ? "" : "last_") + "closed.png"
+				if(String(fldImg.src).indexOf("closed")!=-1)
+					fldImg.src = jst_image_folder + "/expanded_folder.png";
+			}
+			return
+		}else{
+			ctlImg.src = jst_image_folder + "/" + (tr.nextSibling ? "" : "last_") + "closed.png"
 			if(eval(strData.substr(0, strData.length-3)+"[1][3]"))
-				fldImg.src = jst_image_folder + "/" + eval(strData.substr(0, strData.length-3)+"[1][3]");
+				fldImg.src = jst_image_folder + "/" + eval(strData.substr(0, strData.length-3)+"[1][3]");
 			else
-				fldImg.src = jst_image_folder + "/closed_folder.png";
-		}
-	}
-
-	var newTr = tr.parentNode.insertRow((tr.rowIndex?tr.rowIndex:0) + 1)
-
-	if(ctlImg.id != "rootFolder"){
-		newTr.style.display = "none";
-	}
-
-	newTr.appendChild(document.createElement('td'))
-	newTr.appendChild(document.createElement('td'))
-		
-	if(newTr.nextSibling)
-		newTr.firstChild.setAttribute("background", jst_image_folder + "/branch.png", "false")
-	
-	newTr.childNodes[1].innerHTML = renderChildren(strData)
-	
-	var nodes = eval(strData)
-
-	var ndWithChildren = 0;
-	for(var n in nodes){
-		var n0 = nodes[n]
-		var n1 = n0[2]
-
-		if(n1){
-			renderNode(strData + "[" + n + "][2]" ,newTr.childNodes[1].firstChild.firstChild.childNodes[parseInt(n)+ndWithChildren].firstChild.firstChild);
-			ndWithChildren++;
-		}
-	}
-	
-	jst_loaded = true
-}
-
-function renderChildren(strData, tblCls, menu){
-
-	var code = Array()
-
-	code.push('<table cellspacing="0" cellpadding="0" border="0" class="' + tblCls + '">')
-	
-	var nodes = eval(strData)
-
-	for(var n in nodes){
-		var n0 = nodes[n]
-		var n1 = n0[2]
-
-		code.push('<tr id="' + n0[0] + '"><td><img' + (strData == jst_data ? ' style="display:none" id="rootImage"' : '') + ' src="' + jst_image_folder + '/')
-
-		if(n1){
-			code.push((n == nodes.length - 1 ? "last_closed" : "closed") + '.png" onClick="renderNode(' + "'" + strData + "[" + n + "][2]" + "'" + ',this,event)" class="action"')
-		}else{
-			code.push((n == nodes.length - 1 ? "last_leaf" : "leaf") + '.png"')
-		}
-		
-		if(jst_context_menu && !n0[1][5] && !menu)
+				fldImg.src = jst_image_folder + "/closed_folder.png";
+		}
+	}
+
+	var newTr = tr.parentNode.insertRow((tr.rowIndex?tr.rowIndex:0) + 1)
+
+	if(ctlImg.id != "rootFolder"){
+		newTr.style.display = "none";
+	}
+
+	newTr.appendChild(document.createElement('td'))
+	newTr.appendChild(document.createElement('td'))
+		
+	if(newTr.nextSibling)
+		newTr.firstChild.setAttribute("background", jst_image_folder + "/branch.png", "false")
+	
+	newTr.childNodes[1].innerHTML = renderChildren(strData)
+	
+	var nodes = eval(strData)
+
+	var ndWithChildren = 0;
+	for(var n in nodes){
+		var n0 = nodes[n]
+		var n1 = n0[2]
+
+		if(n1){
+			renderNode(strData + "[" + n + "][2]" ,newTr.childNodes[1].firstChild.firstChild.childNodes[parseInt(n)+ndWithChildren].firstChild.firstChild);
+			ndWithChildren++;
+		}
+	}
+	
+	jst_loaded = true
+}
+
+function renderChildren(strData, tblCls, menu){
+
+	var code = Array()
+
+	code.push('<table cellspacing="0" cellpadding="0" border="0" class="' + tblCls + '">')
+	
+	var nodes = eval(strData)
+
+	for(var n in nodes){
+		var n0 = nodes[n]
+		var n1 = n0[2]
+
+		code.push('<tr id="' + n0[0] + '"><td><img' + (strData == jst_data ? ' style="display:none" id="rootImage"' : '') + ' src="' + jst_image_folder + '/')
+
+		if(n1){
+			code.push((n == nodes.length - 1 ? "last_closed" : "closed") + '.png" onClick="renderNode(' + "'" + strData + "[" + n + "][2]" + "'" + ',this,event)" class="action"')
+		}else{
+			code.push((n == nodes.length - 1 ? "last_leaf" : "leaf") + '.png"')
+		}
+		
+		if(jst_context_menu && !n0[1][5] && !menu)
 			n0[1][5] = jst_context_menu
 	
-		code.push(' alt=""></td><td nowrap>'+((n1||n0[1][3])?'<img'  + (((strData == jst_data)&&!jst_display_root) ? ' style="display:none"' : '') +  (n0[1][5] ? ' class="action" onClick="showMenu(\'' + strData + '[' + n + ']\', this, event)"' : '') + ' src="' + jst_image_folder + '/' + (n1 ? (n0[1][3]?n0[1][3]:"closed_folder.png") : n0[1][3] ? n0[1][3] : "node.png") + '" alt="">':'')+((n0[1][6]&&((strData != jst_data)||jst_display_root))?n0[1][6]:'')+'<a class="node"'  + (((strData == jst_data)&&!jst_display_root) ? ' style="display:none"' : '')+ (n0[1][4] ? ' title="' + n0[1][4] + '"' : '') + ' onClick="nodeClick(this)" href=' + "'" + (menu ? String(n0[1][1]).replace(/{@strData}/g, strData) : n0[1][1] ) + "'" + (n0[1][2] ? ' target="' + n0[1][2] + '"' : jst_target ? ' target="' + jst_target + '"' : '') + '>' + n0[1][0]  + '</a></td></tr>')			
-	}
-	code.push('</table>')
-	
-	return code.join("")
-}
-
-function showMenu(strData, img, event){
-	var o = window.pageYOffset
-	var offY = o ? o : document.body.scrollTop
-	var offX = o ? window.pageXOffset : document.body.scrollLeft
-	
-	jst_cm.innerHTML = renderChildren(strData + "[1][5]", "menu", true)
-	
-	//TODO find a proper solution for this
-	var treeGDE = jst_cm.parentNode.parentNode;
-	if(treeGDE.id=="treeGDE"){
-		offX -= parseInt(treeGDE.style.left);
-		offY -= parseInt(treeGDE.style.top);
-		if(treeGDE.scrollTop)
-			offY += treeGDE.scrollTop;
-		if(treeGDE.scrollLeft)
-			offX += treeGDE.scrollLeft;
-	}
-	
-	jst_cm.style.top = offY + event.clientY
-	jst_cm.style.left = offX + event.clientX
-	jst_cm.style.visibility = ""
-	
-	event.cancelBubble = true
-}
-
-function hideMenu(){
-	jst_cm.style.visibility = "hidden"
-}
-
-function renderTree(){
-//	TestDate = new Date();TestStartZeit=TestDate.getTime();
-	eval(jst_container).innerHTML = '<table cellspacing="0" cellpadding="0" border="0"><tr id="'+eval(jst_data + "[0][0]")+'"><td colspan="2"><span id="rootFolder"></span></td></tr></table><div style="position:absolute;top:-100;left:-100" id="contextMenu"></div>'
-	renderNode(jst_data, document.getElementById("rootFolder"))
-	renderNode(jst_data + "[0][2]", document.getElementById("rootImage"))
-	
-	jst_cm = document.getElementById("contextMenu")
-	document.body.onclick = hideMenu
-	jst_loaded = true
-//	TestDate=new Date();TestStopZeit=TestDate.getTime();alert(TestStopZeit-TestStartZeit);
-}
+		code.push(' alt=""></td><td nowrap>'+((n1||n0[1][3])?'<img'  + (((strData == jst_data)&&!jst_display_root) ? ' style="display:none"' : '') +  (n0[1][5] ? ' class="action" onClick="showMenu(\'' + strData + '[' + n + ']\', this, event)"' : '') + ' src="' + jst_image_folder + '/' + (n1 ? (n0[1][3]?n0[1][3]:"closed_folder.png") : n0[1][3] ? n0[1][3] : "node.png") + '" alt="">':'')+((n0[1][6]&&((strData != jst_data)||jst_display_root))?n0[1][6]:'')+'<a class="node"'  + (((strData == jst_data)&&!jst_display_root) ? ' style="display:none"' : '')+ (n0[1][4] ? ' title="' + n0[1][4] + '"' : '') + ' onClick="nodeClick(this)" href=' + "'" + (menu ? String(n0[1][1]).replace(/{@strData}/g, strData) : n0[1][1] ) + "'" + (n0[1][2] ? ' target="' + n0[1][2] + '"' : jst_target ? ' target="' + jst_target + '"' : '') + '>' + n0[1][0]  + '</a></td></tr>')			
+	}
+	code.push('</table>')
+	
+	return code.join("")
+}
+
+function showMenu(strData, img, event){
+	var o = window.pageYOffset
+	var offY = o ? o : document.body.scrollTop
+	var offX = o ? window.pageXOffset : document.body.scrollLeft
+	
+	jst_cm.innerHTML = renderChildren(strData + "[1][5]", "menu", true)
+	
+	//TODO find a proper solution for this
+	var treeGDE = jst_cm.parentNode.parentNode;
+	if(treeGDE.id=="treeGDE"){
+		offX -= parseInt(treeGDE.style.left);
+		offY -= parseInt(treeGDE.style.top);
+		if(treeGDE.scrollTop)
+			offY += treeGDE.scrollTop;
+		if(treeGDE.scrollLeft)
+			offX += treeGDE.scrollLeft;
+	}
+	
+	jst_cm.style.top = offY + event.clientY
+	jst_cm.style.left = offX + event.clientX
+	jst_cm.style.visibility = ""
+	
+	event.cancelBubble = true
+}
+
+function hideMenu(){
+	jst_cm.style.visibility = "hidden"
+}
+
+function renderTree(){
+//	TestDate = new Date();TestStartZeit=TestDate.getTime();
+	eval(jst_container).innerHTML = '<table cellspacing="0" cellpadding="0" border="0"><tr id="'+eval(jst_data + "[0][0]")+'"><td colspan="2"><span id="rootFolder"></span></td></tr></table><div style="position:absolute;top:-100;left:-100" id="contextMenu"></div>'
+	renderNode(jst_data, document.getElementById("rootFolder"))
+	renderNode(jst_data + "[0][2]", document.getElementById("rootImage"))
+	
+	jst_cm = document.getElementById("contextMenu")
+	document.body.onclick = hideMenu
+	jst_loaded = true
+//	TestDate=new Date();TestStopZeit=TestDate.getTime();alert(TestStopZeit-TestStartZeit);
+}

Modified: branches/print_dev/http/javascripts/mod_addWMS.php
===================================================================
--- branches/print_dev/http/javascripts/mod_addWMS.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_addWMS.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,32 +1,32 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_addWMS.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-echo "var mod_addWMS_data = '".$e_require."';";
-echo "var mod_addWMS_target1 = '".trim($e_target[0])."';";
-echo "var mod_addWMS_target2 = '".trim($e_target[1])."';";
-?>
-
-function mod_addWMS(){
-   var load = prompt("Capabilities - URL:","");
-   if(load){
-      mod_addWMS_load(load);    
-   }
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_addWMS.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+echo "var mod_addWMS_data = '".$e_require."';";
+echo "var mod_addWMS_target1 = '".trim($e_target[0])."';";
+echo "var mod_addWMS_target2 = '".trim($e_target[1])."';";
+?>
+
+function mod_addWMS(){
+   var load = prompt("Capabilities - URL:","");
+   if(load){
+      mod_addWMS_load(load);    
+   }
+}

Modified: branches/print_dev/http/javascripts/mod_addWMSfromfilteredList.php
===================================================================
--- branches/print_dev/http/javascripts/mod_addWMSfromfilteredList.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_addWMSfromfilteredList.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,751 +1,751 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_addWMSfromfilteredList.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-include '../include/dyn_css.php';
-?>
-<title>Add WMS from Filtered Catalog</title>
-<link rel="stylesheet" type="text/css" href="../css/administration_alloc.css">
-
-<STYLE TYPE="text/css">
-<!--
-body{
-	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-	font-size:10pt
-}    
-   
-table{
-	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-	font-size:11;
-}   
-
-.wms_button{
-	color: black;
-	border: solid thin;
-	height:22px;
-	width:60px;
-}
-
--->
-</STYLE>
-
-
-<script type="text/javascript">
-<!--
-function mod_addWMSfromDB(gui_id, wms_id) {
-	//alert("1/3 mod_addWMSfromDB: GUI ID = " + gui_id + ", WMS ID = " + wms_id);
-	window.opener.mod_addWMSById_load(gui_id, wms_id);
-}
-function mod_addWMSfromfilteredList(pointer_name,version){
-
-	pointer_name=pointer_name + window.opener.mb_getConjunctionCharacter(pointer_name);
-	
-	if (version == '1.0.0'){
-		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
-		var load = cap;
-	}
-	else if (version == '1.1.0'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
-		var load = cap;
-	}
-	else if (version == '1.1.1'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
-		var load = cap;
-	}  
-	//alert (load);
-
-	if(load){
-		if(load.charAt(0) == '/' && load.charAt(1) == 'c'){
-			window.opener.mod_addWMS_load('http://localhost' + load);
-		}
-		else{
-			window.opener.mod_addWMS_load(load);
-		}  
-	}
-}
-
-function mod_show_group_wms(wert){
-	document.form1.show_group_wms.value = wert;
-	document.form1.submit();
-}
-
-function mod_show_gui_wms(wert2){
-	document.form1.show_gui_wms.value = wert2;
-	document.form1.submit();
-}
-			
-function mod_show_gui_configured_wms(wert2){
-	document.form1.show_gui_configured_wms.value = wert2;
-	document.form1.submit();
-}
-			
-function mod_show_wms(wert3){
-
-	document.form1.wms_show.value = wert3;
-   if (wert3 == 4) {
-		document.form1.wmsSource.nodeValue = "db";
-   }
-	else {
-		document.form1.wmsSource.nodeValue = "capabilities";
-	}
-	document.form1.submit();
-}			
-
-function setButtons(wms_option, wms_option2, wms_option3, wms_option4) {
-	if (typeof(option_all) == "undefined") {
-		option_all = '<?php echo $set_option_all;?>';
-	}
-	document.getElementById("set_option_all").value = option_all;
-	if (typeof(option_group) == "undefined") {
-		option_group = '<?php echo $set_option_group;?>';
-	}
-	document.getElementById("set_option_group").value = option_group;
-	if (typeof(option_gui) == "undefined") {
-		option_gui = '<?php echo $set_option_gui;?>';
-	}
-	document.getElementById("set_option_gui").value = option_gui;
-	if (typeof(option_db) == "undefined") {
-		option_db = '<?php echo $set_option_db;?>';
-	}
-	document.getElementById("set_option_db").value = option_db;
-
-	if (wms_option == '' && wms_option2 == '' && wms_option3 == '' && wms_option4 == '') {
-		if (option_all == '1') {
-			mod_show_wms(1);
-		}
-		else if (option_group == '1') {
-			mod_show_wms(2);
-		}
-		else if (option_gui == '1') {
-			mod_show_wms(3);
-		}
-		else if (option_db == '1') {
-			mod_show_wms(4);
-		}
-	}
-	else {
-		if (option_all == '0') {
-			var aNode = document.getElementById("_option_all");
-			if (aNode != null) removeChildNodes(aNode);
-		}
-		if (option_group == '0') {
-			var aNode = document.getElementById("_option_group");
-			if (aNode != null) removeChildNodes(aNode);
-		}
-		if (option_gui == '0') {
-			var aNode = document.getElementById("_option_gui");
-			if (aNode != null) removeChildNodes(aNode);
-		}
-		if (option_db == '0') {
-			var aNode = document.getElementById("_option_db");
-			if (aNode != null) removeChildNodes(aNode);
-		}
-	}
-}
-
-function removeChildNodes(node) {
-	while (node.childNodes.length > 0) {
-		var childNode = node.firstChild;
-		node.removeChild(childNode);
-	}
-}
-// -->
-</script>
-
-</head>
-<body onLoad="window.focus();setButtons('<?php echo $wms_show;?>','<?php echo $show_gui_configured_wms;?>','<?php echo $show_group_wms;?>','<?php echo $show_gui_wms;?>')">
-
-<?php
-require_once(dirname(__FILE__)."/../classes/class_wms.php"); 
-require_once(dirname(__FILE__)."/../php/mb_getGUIs.php");
-
-$fieldHeight = 20;
-$cnt_gui = 0;
-$cnt_gui_wms = 0;
-$cnt_wms = 0;
-$cnt_user_group = 0;
-$cnt_group = 0;
-$cnt_gui_mb_group = 0;
-$cnt_group_gui_wms = 0;
-$cnt_fkey_group_gui_wms = 0;
-$cnt_fkey_show_gui_wms = 0;
-$cnt_show_gui_wms = 0;
-$cnt_group_name = 0;
-$cnt_gui_table = 0;
-$exists = false;
-$logged_user_name=$_SESSION["mb_user_name"];
-$logged_user_id=$_SESSION["mb_user_id"];
-$logged_gui_id=$_SESSION["mb_user_gui"];
-
-######   SQL   #####################################################################################
-
-/*get infos from gui_element ********************************************************/
-
-/*get group from logged user  *******************************************************/
-$sql_user_group = "SELECT * FROM mb_user_mb_group WHERE fkey_mb_user_id= $1 ";
-$array_values = array($logged_user_id);
-$array_types = array('s');
-$res_user_group = db_prep_query($sql_user_group, $array_values, $array_types);
-while($row = db_fetch_array($res_user_group)){
-	$user_id[$cnt_user_group] = $row["fkey_mb_user_id"];
-	$group_id[$cnt_user_group] = $row["fkey_mb_group_id"];
-	$cnt_user_group++;
-}
-/*get group from logged user  ************************************************************/
-
-# Thekla, please recheck
-/*get group name  ********************************************************************************************/								 
-if(count($group_id) > 0){
-	$v = array();
-	$t = array();
-	$sql_group = "SELECT mb_group_id, mb_group_name, mb_group_description FROM mb_group WHERE mb_group_id IN (";	
-	for($i=0; $i < count($group_id); $i++){
-		if($i>0){ $sql_group .= ",";}
-		$sql_group .= "$".strval($i + 1);
-		array_push($v,$group_id[$i]);
-		array_push($t,"i");
-	}		
-	$sql_group.= ") ORDER BY mb_group_name";	
-	$res_group = db_prep_query($sql_group,$v,$t);	
-	while($row = db_fetch_array($res_group)){
-		$mb_group_description[$cnt_group] = $row["mb_group_description"];
-		$my_group_name[$cnt_group] = $row["mb_group_name"];
-		$my_group_id[$cnt_group] = $row["mb_group_id"];
-		$cnt_group++;
-	}				 
-}
-/*get group name  ********************************************************************************************/							 
-
-/*get allocated gui  ********************************************************************************************/
-
-$arrayGuis=mb_getGUIs($logged_user_id);
-$sql_gui = "SELECT * FROM gui WHERE gui_id IN (";
-$v = $arrayGuis;
-$t = array();
-
-for ($i = 1; $i <= count($arrayGuis); $i++){
-	if ($i > 1) { 
-		$sql_gui .= ",";
-	}
-	$sql_gui .= "$" . $i;
-	array_push($t, "s");
-}
-$sql_gui.= ") ORDER BY gui_name";
-
-
-$res_gui = db_prep_query($sql_gui, $v, $t);
-				while($row = db_fetch_array($res_gui)){
-					$gui_id[$cnt_gui] = $row["gui_id"];
-					$gui_name[$cnt_gui] = $row["gui_name"];
-					$gui_description[$cnt_gui] = $row["gui_description"];	
-					#echo"$gui_name[$cnt_gui]";							
-					$cnt_gui++;
-				}
-/*get allocated gui  ********************************************************************************************/
-				 
-/*get allocated wms from allocated gui  ********************************************************************************************/								 
-$sql_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id IN (";
-$v = $arrayGuis;
-$t = array();
-for ($i = 1; $i <= count($arrayGuis); $i++){
-	if ($i > 1) { 
-		$sql_gui_wms .= ",";
-	}
-	$sql_gui_wms .= "$".$i;
-	array_push($t, "s");
-}
-$sql_gui_wms.= ") ORDER BY fkey_wms_id";
-
-$res_gui_wms = db_prep_query($sql_gui_wms, $v, $t);
-while($row = db_fetch_array($res_gui_wms)){
-				$fkey_gui_id[$cnt_gui_wms] = $row["fkey_gui_id"];
-	$fkey_wms_id[$cnt_gui_wms] = $row["fkey_wms_id"];
-	$cnt_gui_wms++;
-}
-/*get allocated wms from allocated gui  ********************************************************************************************/							 
-
-/*get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
-$sql_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_version FROM wms WHERE wms_id IN (";
-$v = $fkey_wms_id;
-$t = array();
-for ($i = 1; $i <= count($fkey_wms_id); $i++){
-	if ($i > 1) { 
-		$sql_wms .= ",";
-	}
-	$sql_wms .= "$".$i;
-	array_push($t, "s");
-}
-$sql_wms.= ") ORDER BY wms_title";
-
-$res_wms = db_prep_query($sql_wms, $v, $t);
-				while($row = db_fetch_array($res_wms)){
-					$wms_title[$cnt_wms] = $row["wms_title"];
-					$wms_abstract[$cnt_wms] = $row["wms_abstract"];
-					$wms_getcapabilities[$cnt_wms] = $row["wms_getcapabilities"];
-					$wms_version[$cnt_wms] = $row["wms_version"];
-					$cnt_wms++;
-				}							 
-/*get allocated wms-Abstract and wms-Capabilities from allocated gui   ********************************************************************************************/							 
-
-
-/*INSERT HTML*/
-echo "<form name='form1' action='" . $PHP_SELF . "?".SID."' method='post'>";
-# Button
-echo "<table border='0' cellpadding='3'  rules='rows'>";
-echo "<tr>";
-if (!empty($wms_show) || !empty($show_gui_configured_wms) || !empty($show_group_wms) || !empty($show_gui_wms)){
-	echo "<td id='_option_all'><input type='button' class='wms_button' name='wms1' value='all wms' onclick='mod_show_wms(1)'></td>";
-	echo "<td id='_option_group'><input type='button' class='wms_button' name='wms2' value='group' onclick = 'mod_show_wms(2)'></td>";	
-	echo "<td id='_option_gui'><input type='button' class='wms_button' name='wms3' value='gui' onclick = 'mod_show_wms(3)'></td>";
-	echo "<td id='_option_db'><input type='button' class='wms_button' name='wms4' value='db' onclick = 'mod_show_wms(4)'></td>";
-	echo "</tr>";
-	echo "</table>";
-
-
-######   SQL   #####################################################################################
-
-
-######   SHOW GUI WMS OR GROUP WMS   #####################################################################################
-
-/*show goup wms  ********************************************************************************************/
-#if (isset($show_group_wms))
-if (!empty($show_group_wms)){
-	/*get gui goup   ********************************************************************************************/
-	$sql_gui_mb_group = "SELECT fkey_gui_id, fkey_mb_group_id FROM gui_mb_group WHERE fkey_mb_group_id=$1";
-	$v = array($show_group_wms);
-	$t = array("s");
-	$res_gui_mb_group = db_prep_query($sql_gui_mb_group, $v, $t);
-
-				while($row = db_fetch_array($res_gui_mb_group)){
-					$group_gui_id[$cnt_gui_mb_group] = $row["fkey_gui_id"];
-					$fkey_mb_group_id[$cnt_gui_mb_group] = $row["fkey_mb_group_id"];
-					#echo"$group_gui_id[$cnt_gui_mb_group]";  
-					$cnt_gui_mb_group++;
-				}
-								 
-  /*get gui goup   ********************************************************************************************/			
-
-	/*get group gui WMS  ********************************************************************************************/
-	if(count($group_gui_id)>0)	{								 
-		$sql_fkey_group_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id IN (";
-		$v = $group_gui_id;
-		$t = array();
-		for ($i = 1; $i <= count($group_gui_id); $i++){
-			if ($i > 1) { 
-				$sql_fkey_group_gui_wms .= ",";
-			}
-			$sql_fkey_group_gui_wms .= "$".$i;
-			array_push($t, "s");
-		}
-		$sql_fkey_group_gui_wms.=  ") ORDER BY fkey_wms_id";
-		
-		$res_fkey_group_gui_wms = db_prep_query($sql_fkey_group_gui_wms, $v, $t);
-		while($row = db_fetch_array($res_fkey_group_gui_wms)){
-			$fkey_group_gui_gui_id[$cnt_fkey_group_gui_wms] = $row["fkey_gui_id"];
-			$fkey_group_gui_wms_id[$cnt_fkey_group_gui_wms] = $row["fkey_wms_id"];
-			#echo"$fkey_group_gui_wms_id[$cnt_fkey_group_gui_wms]";
-			$cnt_fkey_group_gui_wms++;
-		}	
-
-		/*get group gui WMS  ********************************************************************************************/		
-
-		/*group: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
-		if(count($fkey_group_gui_wms_id)>0){
-			$sql_group_gui_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_version FROM wms WHERE wms_id IN (";
-			$v = $fkey_group_gui_wms_id;
-			$t = array();
-			for ($i = 1; $i <= count($fkey_group_gui_wms_id); $i++){
-				if ($i > 1) { 
-					$sql_group_gui_wms .= ",";
-				}
-				$sql_group_gui_wms .= "$".$i;
-				array_push($t, "s");
-			}
-			$sql_group_gui_wms.= ") ORDER BY wms_title";
-		  
-			$res_group_gui_wms = db_prep_query($sql_group_gui_wms, $v, $t);
-			while($row = db_fetch_array($res_group_gui_wms)){
-				$group_wms_title[$cnt_group_gui_wms] = $row["wms_title"];
-				$group_wms_abstract[$cnt_group_gui_wms] = $row["wms_abstract"];
-				$group_wms_getcapabilities[$cnt_group_gui_wms] = $row["wms_getcapabilities"];
-				$group_wms_version[$cnt_group_gui_wms] = $row["wms_version"];
-				#echo"$group_wms_title[$cnt_group_gui_wms]";
-				$cnt_group_gui_wms++;
-			}
-		}         	
-	}		
-					 
-	/*group: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
-
-	/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
-	#if ($show_group_wms > 0)
-	if ($cnt_group_gui_wms > 0){
-		/*get goup name for showing in the table ********************************************************************************************/								 
-		$sql_group_name = "SELECT mb_group_id, mb_group_name FROM mb_group WHERE mb_group_id = $1";   
-		$v = array($show_group_wms);
-		$t = array("s");
-		$res_group_name = db_prep_query($sql_group_name, $v, $t);
-		while($row = db_fetch_array($res_group_name)){
-			$group_name_table[$cnt_group_name] = $row["mb_group_name"];
-			$my_group_id_table[$cnt_group_name] = $row["mb_group_id"];
-			$cnt_group_name++;
-		}
-					 
-	/*get goup name  ********************************************************************************************/
-
-	echo"<br>";
-	echo"<br>";
-		echo"wms from group: $group_name_table[0]";
-		echo"<br>";
-		echo"<br>";	
-	echo "<table border='1' width ='98%' cellpadding='3' rules='rows'>";
-	echo " <thead bgcolor = '#FAEBD7' >";
-	echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
-	echo " </thead>";
-	echo " <tbody >";
-		for($i=0; $i<$cnt_group_gui_wms; $i++){
-			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
-			
-			echo "<td><div id ='id_".$group_wms_title[$i]."' class='even' name ='name_".$group_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$group_wms_getcapabilities[$i]."\",\"".$group_wms_version[$i]."\")'>".$group_wms_title[$i]."</div></td>";
-			echo "<td><div id ='id_".$group_wms_abstract[$i]."' class='even' name ='name_".$group_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$group_wms_getcapabilities[$i]."\",\"".$group_wms_version[$i]."\")'>".$group_wms_abstract[$i]."</div></td>";
-			echo "</tr>";		
-		}		
-		echo "  </tbody>";							 						 
-		echo "</table>";
-		}  
-		else{
-			echo"<br>";
-			echo"<br>";
-			echo "no wms in this group";
-		}/*End: if ($show_group_wms > 0)   *********/
-		/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/	
-
-
-	}/*End: if (!empty($show_group_wms))   *********/
-
-/*show gui wms  ********************************************************************************************/
-if (!empty($show_gui_wms)){
-	/*get group gui WMS  ********************************************************************************************/								 
-	$sql_fkey_show_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id = $1";
-	$v = array($show_gui_wms);
-	$t = array("s");
-	#$sql_fkey_show_gui_wms.= ") ORDER BY fkey_wms_id";
-
-	$res_fkey_show_gui_wms = db_prep_query($sql_fkey_show_gui_wms, $v, $t);
-	while($row = db_fetch_array($res_fkey_show_gui_wms)){
-		$fkey_show_gui_gui_id[$cnt_fkey_show_gui_wms] = $row["fkey_gui_id"];
-		$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms] = $row["fkey_wms_id"];
-		#echo"$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms]";
-		$cnt_fkey_show_gui_wms++;
-	}								 
-	/*get group gui WMS  ********************************************************************************************/		
-
-	/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
-	if(count($fkey_show_gui_wms_id)>0){
-		$sql_show_gui_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_id, wms_version FROM wms WHERE wms_id IN (";
-		$v = $fkey_show_gui_wms_id;
-		$t = array();
-		for ($i = 1; $i <= count($fkey_show_gui_wms_id); $i++){
-			if ($i > 1) { 
-				$sql_show_gui_wms .= ",";
-			}
-			$sql_show_gui_wms .= "$".$i;
-			array_push($t, "s");
-		}
-		$sql_show_gui_wms.= ") ORDER BY wms_title";
-
-		$res_show_gui_wms = db_prep_query($sql_show_gui_wms, $v, $t);
-		while($row = db_fetch_array($res_show_gui_wms)){
-			$gui_wms_id[$cnt_show_gui_wms] = $row["wms_id"];
-			$gui_wms_title[$cnt_show_gui_wms] = $row["wms_title"];
-			$gui_wms_abstract[$cnt_show_gui_wms] = $row["wms_abstract"];
-			$gui_wms_getcapabilities[$cnt_show_gui_wms] = $row["wms_getcapabilities"];
-			$gui_wms_version[$cnt_show_gui_wms] = $row["wms_version"];
-			#echo"$gui_wms_title[$cnt_show_gui_wms]";
-			$cnt_show_gui_wms++;
-		}							 
-		/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
-
-		/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
-		#if (isset($cnt_show_gui_wms > 0))
-	}
-
-	if ($cnt_show_gui_wms > 0){
-	/*get selected gui name for table caption ********************************************************************************************/  
-	$sql_gui_table = "SELECT * FROM gui WHERE gui_id = $1";       
-	$v = array($show_gui_wms);
-	$t = array("s");
-	$res_gui_table = db_prep_query($sql_gui_table, $v, $t);
-		while($row = db_fetch_array($res_gui_table)){
-			$gui_id_table[$cnt_gui_table] = $row["gui_id"];
-			$gui_name_table[$cnt_gui_table] = $row["gui_name"];							
-			$cnt_gui_table++;
-			#echo"$gui_id_table[0]";
-		}
-
-		/*get selected gui name for table caption ********************************************************************************************/
-
-		echo"<br>";
-		echo"<br>";
-			echo"wms from gui: $gui_name_table[0]";
-			echo"<br>";
-			echo"<br>";
-		echo "<table border='1'  width ='98%'   cellpadding='3' rules='rows'>";
-		echo " <thead bgcolor = '#FAEBD7' >";
-		echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
-		echo " </thead>";
-		echo " <tbody >";
-		for($i=0; $i<$cnt_show_gui_wms; $i++){
-			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
-			echo "<td><div id ='id_".$gui_wms_title[$i]."' class='even' name ='name_".$gui_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$gui_wms_getcapabilities[$i]."\",\"".$gui_wms_version[$i]."\")'>".$gui_wms_title[$i]."</div></td>";
-			echo "<td><div  id ='id_".$gui_wms_abstract[$i]."' class='even' name ='name_".$gui_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$gui_wms_getcapabilities[$i]."\",\"".$gui_wms_version[$i]."\")'>".$gui_wms_abstract[$i]."</div></td>";
-			echo "</tr>";	
-		}	
-		echo "  </tbody>";							 						 
-		echo "</table>";
-	}
-	else{
-		echo"<br>";
-		echo"<br>";
-		echo"<br>";
-
-		echo "no wms in this gui";
-  	}  /*End: if ($cnt_show_gui_wms > 0)  *********/
-	/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/	
-
-
-} /*End: if(isset($show_gui_wms))   *********/
-
-
-
-/*show gui wms  ********************************************************************************************/
-if (!empty($show_gui_configured_wms)){
-	/*get group gui WMS  ********************************************************************************************/								 
-	$sql_fkey_show_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id = $1";
-	#$sql_fkey_show_gui_wms.= ") ORDER BY fkey_wms_id";
-	$v = array($show_gui_configured_wms);
-	$t = array("s");
-	$res_fkey_show_gui_wms = db_prep_query($sql_fkey_show_gui_wms, $v, $t);
-	while($row = db_fetch_array($res_fkey_show_gui_wms)){
-		$fkey_show_gui_gui_id[$cnt_fkey_show_gui_wms] = $row["fkey_gui_id"];
-		$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms] = $row["fkey_wms_id"];
-		#echo"$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms]";
-		$cnt_fkey_show_gui_wms++;
-	}								 
-	/*get group gui WMS  ********************************************************************************************/		
-
-	/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
-	if(count($fkey_show_gui_wms_id)>0){
-		$sql_show_gui_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_id, wms_version FROM wms WHERE wms_id IN (";
-		$v = $fkey_show_gui_wms_id;
-		$t = array();
-		for ($i = 1; $i <= count($fkey_show_gui_wms_id); $i++){
-			if ($i > 1) { 
-				$sql_show_gui_wms .= ",";
-			}
-			$sql_show_gui_wms .= "$".$i;
-			array_push($t, "s");
-		}
-		$sql_show_gui_wms.= ") ORDER BY wms_title";
-
-		$res_show_gui_wms = db_prep_query($sql_show_gui_wms, $v, $t);
-		while($row = db_fetch_array($res_show_gui_wms)){
-			$gui_wms_id[$cnt_show_gui_wms] = $row["wms_id"];
-			$gui_wms_title[$cnt_show_gui_wms] = $row["wms_title"];
-			$gui_wms_abstract[$cnt_show_gui_wms] = $row["wms_abstract"];
-			$gui_wms_getcapabilities[$cnt_show_gui_wms] = $row["wms_getcapabilities"];
-			$gui_wms_version[$cnt_show_gui_wms] = $row["wms_version"];
-			#echo"$gui_wms_title[$cnt_show_gui_wms]";
-			$cnt_show_gui_wms++;
-		}							 
-		/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
-
-		/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
-		#if (isset($cnt_show_gui_wms > 0))
-	}
-
-	if ($cnt_show_gui_wms > 0){
-	/*get selected gui name for table caption ********************************************************************************************/  
-	$sql_gui_table = "SELECT * FROM gui WHERE gui_id = $1";
-	$v = array($show_gui_configured_wms);
-	$t = array("s");       
-	$res_gui_table = db_prep_query($sql_gui_table, $v, $t);
-		while($row = db_fetch_array($res_gui_table)){
-			$gui_id_table[$cnt_gui_table] = $row["gui_id"];
-			$gui_name_table[$cnt_gui_table] = $row["gui_name"];							
-			$cnt_gui_table++;
-			#echo"$gui_id_table[0]";
-		}
-
-		/*get selected gui name for table caption ********************************************************************************************/
-
-		echo"<br>";
-		echo"<br>";
-			echo"wms from gui: $gui_name_table[0]";
-			echo"<br>";
-			echo"<br>";
-		echo "<table border='1'  width ='98%'   cellpadding='3' rules='rows'>";
-		echo " <thead bgcolor = '#FAEBD7' >";
-		echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
-		echo " </thead>";
-		echo " <tbody >";
-		for($i=0; $i<$cnt_show_gui_wms; $i++){
-			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
-			echo "<td><div id ='id_".$gui_wms_title[$i]."' class='even' name ='name_".$gui_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromDB(\"".$show_gui_configured_wms."\",\"".$gui_wms_id[$i]."\")'>".$gui_wms_title[$i]."</div></td>";
-			echo "<td><div  id ='id_".$gui_wms_abstract[$i]."' class='even' name ='name_".$gui_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromDB(\"".$show_gui_configured_wms."\",\"".$gui_wms_id[$i]."\")'>".$gui_wms_abstract[$i]."</div></td>";
-			echo "</tr>";	
-		}	
-		echo "  </tbody>";							 						 
-		echo "</table>";
-	}
-	else{
-		echo"<br>";
-		echo"<br>";
-		echo"<br>";
-
-		echo "no wms in this gui";
-  	}  /*End: if ($cnt_show_gui_wms > 0)  *********/
-	/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/	
-
-
-} /*End: if(isset($show_gui_configured_wms))   *********/
-
-######   SHOW GUI WMS OR GROUP WMS   #####################################################################################
-
-######   SHOW GUI OR GROUP OR ALL WMS   #####################################################################################
-
-	if ($wms_show == 4){ #gui
-		echo"<br>";
-		echo"<br>";
-		echo"Please select a gui:";
-		echo"<br>";
-		echo"<br>";	
-		echo "<table border='1' width='98%' cellpadding='3' rules='rows'>";
-		echo " <thead bgcolor = 'lightgrey' >";
-		echo "<tr><td width='200' height='10'>gui name</td><td  align = 'left' class='fieldnames_s'>description</td>";
-		echo " </thead>";
-		echo " <tbody >";
-		for($i=0; $i<$cnt_gui; $i++){
-			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
-			echo "<td><div id ='id_".$gui_name[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_name[$i]."'  style='cursor:pointer'  onclick = 'mod_show_gui_configured_wms(\"".$gui_id[$i]."\")'>".$gui_name[$i]."</div></td>";
-			echo "<td><div id ='id_".$gui_description[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_description[$i]."' style='cursor:pointer' onclick = 'mod_show_gui_configured_wms(\"".$gui_id[$i]."\")'>".$gui_description[$i]."</div></td>";
-			echo "</tr>";
-		}		
-		echo "  </tbody>";							 						 
-		echo "</table>";		
-
-	}
-	if ($wms_show == 3){ #gui
-		echo"<br>";
-		echo"<br>";
-		echo"Please select a gui:";
-		echo"<br>";
-		echo"<br>";	
-		echo "<table border='1' width='98%' cellpadding='3' rules='rows'>";
-		echo " <thead bgcolor = 'lightgrey' >";
-		echo "<tr><td width='200' height='10'>gui name</td><td  align = 'left' class='fieldnames_s'>description</td>";
-		echo " </thead>";
-		echo " <tbody >";
-		for($i=0; $i<$cnt_gui; $i++){
-			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
-			echo "<td><div id ='id_".$gui_name[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_name[$i]."'  style='cursor:pointer'  onclick = 'mod_show_gui_wms(\"".$gui_id[$i]."\")'>".$gui_name[$i]."</div></td>";
-			echo "<td><div id ='id_".$gui_description[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_description[$i]."' style='cursor:pointer' onclick = 'mod_show_gui_wms(\"".$gui_id[$i]."\")'>".$gui_description[$i]."</div></td>";
-			echo "</tr>";
-		}		
-		echo "  </tbody>";							 						 
-		echo "</table>";		
-
-	}
-	elseif  ($wms_show== 2){  # group
-		echo"<br>";
-		echo"<br>";
-  
-		if($cnt_group>0){
-			echo "Please select a group:";
-			echo"<br>";
-			echo"<br>";
-			echo "<table border='1' width='98%' cellpadding='3' rules='rows'>";
-			echo " <thead bgcolor = 'lightgrey' >";
-			echo "<tr><td  width='200' height='10'>group name</td><td  align = 'left' class='fieldnames_s'>description</td>";
-			echo " </thead>";
-			echo " <tbody >";
-			for($i=0; $i<$cnt_group; $i++){
-				echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";  				
-				echo "<td><div id ='id_".$my_group_name[$i]."' value='".$my_group_id[$i]."' class='even' name ='".$my_group_name[$i]."'  style='cursor:pointer'  onclick = 'mod_show_group_wms(\"".$my_group_id[$i]."\")'>".$my_group_name[$i]."</div></td>";
-				echo "<td><div id ='id_".$mb_group_description[$i]."' value='".$my_group_id[$i]."' class='even' name ='".$mb_group_description[$i]."' style='cursor:pointer' onclick = 'mod_show_group_wms(\"".$my_group_id[$i]."\")'>".$mb_group_description[$i]."</div></td>";
-				echo "</tr>";
-			}		
-			echo "  </tbody>";							 						 
-			echo "</table>";
-		}
-		else{
-			echo"no group for this user";
-		}
-	
-	}
-	elseif  ($wms_show== 1){  # all wms
-		echo"<br>";
-		echo"<br>";
-
-		echo "<table border='1'  width ='98%'   cellpadding='3' rules='rows'>";
-		echo " <thead bgcolor = '#FAEBD7' >";
-		echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
-		echo " </thead>";
-		echo " <tbody >";
-		for($i=0; $i<$cnt_wms; $i++){
-        	echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
-			echo "<td><div id ='id_".$wms_title[$i]."' class='even' name ='name_".$wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$wms_getcapabilities[$i]."\",\"".$wms_version[$i]."\")'>".$wms_title[$i]."</div></td>";
-			echo "<td><div  id ='id_".$wms_abstract[$i]."' class='even' name ='name_".$wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$wms_getcapabilities[$i]."\",\"".$wms_version[$i]."\")'>".$wms_abstract[$i]."</div></td>";
-			echo "</tr>"; 					 					
-		}		
-		echo "  </tbody>";							 						 
-		echo "</table>";
-	}
-}
-
-
-######   SHOW GUI OR GROUP OR ALL WMS   #####################################################################################
-
-
-/*show group wms  ********************************************************************************************/
-echo "<input type='hidden' name='show_group_wms'>";
-/*show gui wms  ********************************************************************************************/
-echo "<input type='hidden' name='show_gui_wms'>";
-echo "<input type='hidden' name='show_gui_configured_wms'>";
-/*show button  ********************************************************************************************/
-echo "<input type='hidden' name='wms_show'>";
-echo "<input id='wmsSource' type='hidden' name='wmsSource'>";
-echo "<input name ='set_option_all' id='set_option_all' type='hidden'>";
-echo "<input name='set_option_group' id='set_option_group' type='hidden'>";
-echo "<input name='set_option_gui' id='set_option_gui' type='hidden'>";
-echo "<input name='set_option_db' id='set_option_db' type='hidden'>";
-echo "</form>";
-?>
-<script type="text/javascript">
-
-// -->
-</script>
-</body>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_addWMSfromfilteredList.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+include '../include/dyn_css.php';
+?>
+<title>Add WMS from Filtered Catalog</title>
+<link rel="stylesheet" type="text/css" href="../css/administration_alloc.css">
+
+<STYLE TYPE="text/css">
+<!--
+body{
+	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+	font-size:10pt
+}    
+   
+table{
+	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+	font-size:11;
+}   
+
+.wms_button{
+	color: black;
+	border: solid thin;
+	height:22px;
+	width:60px;
+}
+
+-->
+</STYLE>
+
+
+<script type="text/javascript">
+<!--
+function mod_addWMSfromDB(gui_id, wms_id) {
+	//alert("1/3 mod_addWMSfromDB: GUI ID = " + gui_id + ", WMS ID = " + wms_id);
+	window.opener.mod_addWMSById_load(gui_id, wms_id);
+}
+function mod_addWMSfromfilteredList(pointer_name,version){
+
+	pointer_name=pointer_name + window.opener.mb_getConjunctionCharacter(pointer_name);
+	
+	if (version == '1.0.0'){
+		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
+		var load = cap;
+	}
+	else if (version == '1.1.0'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
+		var load = cap;
+	}
+	else if (version == '1.1.1'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
+		var load = cap;
+	}  
+	//alert (load);
+
+	if(load){
+		if(load.charAt(0) == '/' && load.charAt(1) == 'c'){
+			window.opener.mod_addWMS_load('http://localhost' + load);
+		}
+		else{
+			window.opener.mod_addWMS_load(load);
+		}  
+	}
+}
+
+function mod_show_group_wms(wert){
+	document.form1.show_group_wms.value = wert;
+	document.form1.submit();
+}
+
+function mod_show_gui_wms(wert2){
+	document.form1.show_gui_wms.value = wert2;
+	document.form1.submit();
+}
+			
+function mod_show_gui_configured_wms(wert2){
+	document.form1.show_gui_configured_wms.value = wert2;
+	document.form1.submit();
+}
+			
+function mod_show_wms(wert3){
+
+	document.form1.wms_show.value = wert3;
+   if (wert3 == 4) {
+		document.form1.wmsSource.nodeValue = "db";
+   }
+	else {
+		document.form1.wmsSource.nodeValue = "capabilities";
+	}
+	document.form1.submit();
+}			
+
+function setButtons(wms_option, wms_option2, wms_option3, wms_option4) {
+	if (typeof(option_all) == "undefined") {
+		option_all = '<?php echo $set_option_all;?>';
+	}
+	document.getElementById("set_option_all").value = option_all;
+	if (typeof(option_group) == "undefined") {
+		option_group = '<?php echo $set_option_group;?>';
+	}
+	document.getElementById("set_option_group").value = option_group;
+	if (typeof(option_gui) == "undefined") {
+		option_gui = '<?php echo $set_option_gui;?>';
+	}
+	document.getElementById("set_option_gui").value = option_gui;
+	if (typeof(option_db) == "undefined") {
+		option_db = '<?php echo $set_option_db;?>';
+	}
+	document.getElementById("set_option_db").value = option_db;
+
+	if (wms_option == '' && wms_option2 == '' && wms_option3 == '' && wms_option4 == '') {
+		if (option_all == '1') {
+			mod_show_wms(1);
+		}
+		else if (option_group == '1') {
+			mod_show_wms(2);
+		}
+		else if (option_gui == '1') {
+			mod_show_wms(3);
+		}
+		else if (option_db == '1') {
+			mod_show_wms(4);
+		}
+	}
+	else {
+		if (option_all == '0') {
+			var aNode = document.getElementById("_option_all");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+		if (option_group == '0') {
+			var aNode = document.getElementById("_option_group");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+		if (option_gui == '0') {
+			var aNode = document.getElementById("_option_gui");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+		if (option_db == '0') {
+			var aNode = document.getElementById("_option_db");
+			if (aNode != null) removeChildNodes(aNode);
+		}
+	}
+}
+
+function removeChildNodes(node) {
+	while (node.childNodes.length > 0) {
+		var childNode = node.firstChild;
+		node.removeChild(childNode);
+	}
+}
+// -->
+</script>
+
+</head>
+<body onLoad="window.focus();setButtons('<?php echo $wms_show;?>','<?php echo $show_gui_configured_wms;?>','<?php echo $show_group_wms;?>','<?php echo $show_gui_wms;?>')">
+
+<?php
+require_once(dirname(__FILE__)."/../classes/class_wms.php"); 
+require_once(dirname(__FILE__)."/../php/mb_getGUIs.php");
+
+$fieldHeight = 20;
+$cnt_gui = 0;
+$cnt_gui_wms = 0;
+$cnt_wms = 0;
+$cnt_user_group = 0;
+$cnt_group = 0;
+$cnt_gui_mb_group = 0;
+$cnt_group_gui_wms = 0;
+$cnt_fkey_group_gui_wms = 0;
+$cnt_fkey_show_gui_wms = 0;
+$cnt_show_gui_wms = 0;
+$cnt_group_name = 0;
+$cnt_gui_table = 0;
+$exists = false;
+$logged_user_name=$_SESSION["mb_user_name"];
+$logged_user_id=$_SESSION["mb_user_id"];
+$logged_gui_id=$_SESSION["mb_user_gui"];
+
+######   SQL   #####################################################################################
+
+/*get infos from gui_element ********************************************************/
+
+/*get group from logged user  *******************************************************/
+$sql_user_group = "SELECT * FROM mb_user_mb_group WHERE fkey_mb_user_id= $1 ";
+$array_values = array($logged_user_id);
+$array_types = array('s');
+$res_user_group = db_prep_query($sql_user_group, $array_values, $array_types);
+while($row = db_fetch_array($res_user_group)){
+	$user_id[$cnt_user_group] = $row["fkey_mb_user_id"];
+	$group_id[$cnt_user_group] = $row["fkey_mb_group_id"];
+	$cnt_user_group++;
+}
+/*get group from logged user  ************************************************************/
+
+# Thekla, please recheck
+/*get group name  ********************************************************************************************/								 
+if(count($group_id) > 0){
+	$v = array();
+	$t = array();
+	$sql_group = "SELECT mb_group_id, mb_group_name, mb_group_description FROM mb_group WHERE mb_group_id IN (";	
+	for($i=0; $i < count($group_id); $i++){
+		if($i>0){ $sql_group .= ",";}
+		$sql_group .= "$".strval($i + 1);
+		array_push($v,$group_id[$i]);
+		array_push($t,"i");
+	}		
+	$sql_group.= ") ORDER BY mb_group_name";	
+	$res_group = db_prep_query($sql_group,$v,$t);	
+	while($row = db_fetch_array($res_group)){
+		$mb_group_description[$cnt_group] = $row["mb_group_description"];
+		$my_group_name[$cnt_group] = $row["mb_group_name"];
+		$my_group_id[$cnt_group] = $row["mb_group_id"];
+		$cnt_group++;
+	}				 
+}
+/*get group name  ********************************************************************************************/							 
+
+/*get allocated gui  ********************************************************************************************/
+
+$arrayGuis=mb_getGUIs($logged_user_id);
+$sql_gui = "SELECT * FROM gui WHERE gui_id IN (";
+$v = $arrayGuis;
+$t = array();
+
+for ($i = 1; $i <= count($arrayGuis); $i++){
+	if ($i > 1) { 
+		$sql_gui .= ",";
+	}
+	$sql_gui .= "$" . $i;
+	array_push($t, "s");
+}
+$sql_gui.= ") ORDER BY gui_name";
+
+
+$res_gui = db_prep_query($sql_gui, $v, $t);
+				while($row = db_fetch_array($res_gui)){
+					$gui_id[$cnt_gui] = $row["gui_id"];
+					$gui_name[$cnt_gui] = $row["gui_name"];
+					$gui_description[$cnt_gui] = $row["gui_description"];	
+					#echo"$gui_name[$cnt_gui]";							
+					$cnt_gui++;
+				}
+/*get allocated gui  ********************************************************************************************/
+				 
+/*get allocated wms from allocated gui  ********************************************************************************************/								 
+$sql_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id IN (";
+$v = $arrayGuis;
+$t = array();
+for ($i = 1; $i <= count($arrayGuis); $i++){
+	if ($i > 1) { 
+		$sql_gui_wms .= ",";
+	}
+	$sql_gui_wms .= "$".$i;
+	array_push($t, "s");
+}
+$sql_gui_wms.= ") ORDER BY fkey_wms_id";
+
+$res_gui_wms = db_prep_query($sql_gui_wms, $v, $t);
+while($row = db_fetch_array($res_gui_wms)){
+				$fkey_gui_id[$cnt_gui_wms] = $row["fkey_gui_id"];
+	$fkey_wms_id[$cnt_gui_wms] = $row["fkey_wms_id"];
+	$cnt_gui_wms++;
+}
+/*get allocated wms from allocated gui  ********************************************************************************************/							 
+
+/*get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
+$sql_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_version FROM wms WHERE wms_id IN (";
+$v = $fkey_wms_id;
+$t = array();
+for ($i = 1; $i <= count($fkey_wms_id); $i++){
+	if ($i > 1) { 
+		$sql_wms .= ",";
+	}
+	$sql_wms .= "$".$i;
+	array_push($t, "s");
+}
+$sql_wms.= ") ORDER BY wms_title";
+
+$res_wms = db_prep_query($sql_wms, $v, $t);
+				while($row = db_fetch_array($res_wms)){
+					$wms_title[$cnt_wms] = $row["wms_title"];
+					$wms_abstract[$cnt_wms] = $row["wms_abstract"];
+					$wms_getcapabilities[$cnt_wms] = $row["wms_getcapabilities"];
+					$wms_version[$cnt_wms] = $row["wms_version"];
+					$cnt_wms++;
+				}							 
+/*get allocated wms-Abstract and wms-Capabilities from allocated gui   ********************************************************************************************/							 
+
+
+/*INSERT HTML*/
+echo "<form name='form1' action='" . $PHP_SELF . "?".SID."' method='post'>";
+# Button
+echo "<table border='0' cellpadding='3'  rules='rows'>";
+echo "<tr>";
+if (!empty($wms_show) || !empty($show_gui_configured_wms) || !empty($show_group_wms) || !empty($show_gui_wms)){
+	echo "<td id='_option_all'><input type='button' class='wms_button' name='wms1' value='all wms' onclick='mod_show_wms(1)'></td>";
+	echo "<td id='_option_group'><input type='button' class='wms_button' name='wms2' value='group' onclick = 'mod_show_wms(2)'></td>";	
+	echo "<td id='_option_gui'><input type='button' class='wms_button' name='wms3' value='gui' onclick = 'mod_show_wms(3)'></td>";
+	echo "<td id='_option_db'><input type='button' class='wms_button' name='wms4' value='db' onclick = 'mod_show_wms(4)'></td>";
+	echo "</tr>";
+	echo "</table>";
+
+
+######   SQL   #####################################################################################
+
+
+######   SHOW GUI WMS OR GROUP WMS   #####################################################################################
+
+/*show goup wms  ********************************************************************************************/
+#if (isset($show_group_wms))
+if (!empty($show_group_wms)){
+	/*get gui goup   ********************************************************************************************/
+	$sql_gui_mb_group = "SELECT fkey_gui_id, fkey_mb_group_id FROM gui_mb_group WHERE fkey_mb_group_id=$1";
+	$v = array($show_group_wms);
+	$t = array("s");
+	$res_gui_mb_group = db_prep_query($sql_gui_mb_group, $v, $t);
+
+				while($row = db_fetch_array($res_gui_mb_group)){
+					$group_gui_id[$cnt_gui_mb_group] = $row["fkey_gui_id"];
+					$fkey_mb_group_id[$cnt_gui_mb_group] = $row["fkey_mb_group_id"];
+					#echo"$group_gui_id[$cnt_gui_mb_group]";  
+					$cnt_gui_mb_group++;
+				}
+								 
+  /*get gui goup   ********************************************************************************************/			
+
+	/*get group gui WMS  ********************************************************************************************/
+	if(count($group_gui_id)>0)	{								 
+		$sql_fkey_group_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id IN (";
+		$v = $group_gui_id;
+		$t = array();
+		for ($i = 1; $i <= count($group_gui_id); $i++){
+			if ($i > 1) { 
+				$sql_fkey_group_gui_wms .= ",";
+			}
+			$sql_fkey_group_gui_wms .= "$".$i;
+			array_push($t, "s");
+		}
+		$sql_fkey_group_gui_wms.=  ") ORDER BY fkey_wms_id";
+		
+		$res_fkey_group_gui_wms = db_prep_query($sql_fkey_group_gui_wms, $v, $t);
+		while($row = db_fetch_array($res_fkey_group_gui_wms)){
+			$fkey_group_gui_gui_id[$cnt_fkey_group_gui_wms] = $row["fkey_gui_id"];
+			$fkey_group_gui_wms_id[$cnt_fkey_group_gui_wms] = $row["fkey_wms_id"];
+			#echo"$fkey_group_gui_wms_id[$cnt_fkey_group_gui_wms]";
+			$cnt_fkey_group_gui_wms++;
+		}	
+
+		/*get group gui WMS  ********************************************************************************************/		
+
+		/*group: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
+		if(count($fkey_group_gui_wms_id)>0){
+			$sql_group_gui_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_version FROM wms WHERE wms_id IN (";
+			$v = $fkey_group_gui_wms_id;
+			$t = array();
+			for ($i = 1; $i <= count($fkey_group_gui_wms_id); $i++){
+				if ($i > 1) { 
+					$sql_group_gui_wms .= ",";
+				}
+				$sql_group_gui_wms .= "$".$i;
+				array_push($t, "s");
+			}
+			$sql_group_gui_wms.= ") ORDER BY wms_title";
+		  
+			$res_group_gui_wms = db_prep_query($sql_group_gui_wms, $v, $t);
+			while($row = db_fetch_array($res_group_gui_wms)){
+				$group_wms_title[$cnt_group_gui_wms] = $row["wms_title"];
+				$group_wms_abstract[$cnt_group_gui_wms] = $row["wms_abstract"];
+				$group_wms_getcapabilities[$cnt_group_gui_wms] = $row["wms_getcapabilities"];
+				$group_wms_version[$cnt_group_gui_wms] = $row["wms_version"];
+				#echo"$group_wms_title[$cnt_group_gui_wms]";
+				$cnt_group_gui_wms++;
+			}
+		}         	
+	}		
+					 
+	/*group: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+
+	/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+	#if ($show_group_wms > 0)
+	if ($cnt_group_gui_wms > 0){
+		/*get goup name for showing in the table ********************************************************************************************/								 
+		$sql_group_name = "SELECT mb_group_id, mb_group_name FROM mb_group WHERE mb_group_id = $1";   
+		$v = array($show_group_wms);
+		$t = array("s");
+		$res_group_name = db_prep_query($sql_group_name, $v, $t);
+		while($row = db_fetch_array($res_group_name)){
+			$group_name_table[$cnt_group_name] = $row["mb_group_name"];
+			$my_group_id_table[$cnt_group_name] = $row["mb_group_id"];
+			$cnt_group_name++;
+		}
+					 
+	/*get goup name  ********************************************************************************************/
+
+	echo"<br>";
+	echo"<br>";
+		echo"wms from group: $group_name_table[0]";
+		echo"<br>";
+		echo"<br>";	
+	echo "<table border='1' width ='98%' cellpadding='3' rules='rows'>";
+	echo " <thead bgcolor = '#FAEBD7' >";
+	echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
+	echo " </thead>";
+	echo " <tbody >";
+		for($i=0; $i<$cnt_group_gui_wms; $i++){
+			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			
+			echo "<td><div id ='id_".$group_wms_title[$i]."' class='even' name ='name_".$group_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$group_wms_getcapabilities[$i]."\",\"".$group_wms_version[$i]."\")'>".$group_wms_title[$i]."</div></td>";
+			echo "<td><div id ='id_".$group_wms_abstract[$i]."' class='even' name ='name_".$group_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$group_wms_getcapabilities[$i]."\",\"".$group_wms_version[$i]."\")'>".$group_wms_abstract[$i]."</div></td>";
+			echo "</tr>";		
+		}		
+		echo "  </tbody>";							 						 
+		echo "</table>";
+		}  
+		else{
+			echo"<br>";
+			echo"<br>";
+			echo "no wms in this group";
+		}/*End: if ($show_group_wms > 0)   *********/
+		/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/	
+
+
+	}/*End: if (!empty($show_group_wms))   *********/
+
+/*show gui wms  ********************************************************************************************/
+if (!empty($show_gui_wms)){
+	/*get group gui WMS  ********************************************************************************************/								 
+	$sql_fkey_show_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id = $1";
+	$v = array($show_gui_wms);
+	$t = array("s");
+	#$sql_fkey_show_gui_wms.= ") ORDER BY fkey_wms_id";
+
+	$res_fkey_show_gui_wms = db_prep_query($sql_fkey_show_gui_wms, $v, $t);
+	while($row = db_fetch_array($res_fkey_show_gui_wms)){
+		$fkey_show_gui_gui_id[$cnt_fkey_show_gui_wms] = $row["fkey_gui_id"];
+		$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms] = $row["fkey_wms_id"];
+		#echo"$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms]";
+		$cnt_fkey_show_gui_wms++;
+	}								 
+	/*get group gui WMS  ********************************************************************************************/		
+
+	/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
+	if(count($fkey_show_gui_wms_id)>0){
+		$sql_show_gui_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_id, wms_version FROM wms WHERE wms_id IN (";
+		$v = $fkey_show_gui_wms_id;
+		$t = array();
+		for ($i = 1; $i <= count($fkey_show_gui_wms_id); $i++){
+			if ($i > 1) { 
+				$sql_show_gui_wms .= ",";
+			}
+			$sql_show_gui_wms .= "$".$i;
+			array_push($t, "s");
+		}
+		$sql_show_gui_wms.= ") ORDER BY wms_title";
+
+		$res_show_gui_wms = db_prep_query($sql_show_gui_wms, $v, $t);
+		while($row = db_fetch_array($res_show_gui_wms)){
+			$gui_wms_id[$cnt_show_gui_wms] = $row["wms_id"];
+			$gui_wms_title[$cnt_show_gui_wms] = $row["wms_title"];
+			$gui_wms_abstract[$cnt_show_gui_wms] = $row["wms_abstract"];
+			$gui_wms_getcapabilities[$cnt_show_gui_wms] = $row["wms_getcapabilities"];
+			$gui_wms_version[$cnt_show_gui_wms] = $row["wms_version"];
+			#echo"$gui_wms_title[$cnt_show_gui_wms]";
+			$cnt_show_gui_wms++;
+		}							 
+		/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+
+		/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+		#if (isset($cnt_show_gui_wms > 0))
+	}
+
+	if ($cnt_show_gui_wms > 0){
+	/*get selected gui name for table caption ********************************************************************************************/  
+	$sql_gui_table = "SELECT * FROM gui WHERE gui_id = $1";       
+	$v = array($show_gui_wms);
+	$t = array("s");
+	$res_gui_table = db_prep_query($sql_gui_table, $v, $t);
+		while($row = db_fetch_array($res_gui_table)){
+			$gui_id_table[$cnt_gui_table] = $row["gui_id"];
+			$gui_name_table[$cnt_gui_table] = $row["gui_name"];							
+			$cnt_gui_table++;
+			#echo"$gui_id_table[0]";
+		}
+
+		/*get selected gui name for table caption ********************************************************************************************/
+
+		echo"<br>";
+		echo"<br>";
+			echo"wms from gui: $gui_name_table[0]";
+			echo"<br>";
+			echo"<br>";
+		echo "<table border='1'  width ='98%'   cellpadding='3' rules='rows'>";
+		echo " <thead bgcolor = '#FAEBD7' >";
+		echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
+		echo " </thead>";
+		echo " <tbody >";
+		for($i=0; $i<$cnt_show_gui_wms; $i++){
+			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			echo "<td><div id ='id_".$gui_wms_title[$i]."' class='even' name ='name_".$gui_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$gui_wms_getcapabilities[$i]."\",\"".$gui_wms_version[$i]."\")'>".$gui_wms_title[$i]."</div></td>";
+			echo "<td><div  id ='id_".$gui_wms_abstract[$i]."' class='even' name ='name_".$gui_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$gui_wms_getcapabilities[$i]."\",\"".$gui_wms_version[$i]."\")'>".$gui_wms_abstract[$i]."</div></td>";
+			echo "</tr>";	
+		}	
+		echo "  </tbody>";							 						 
+		echo "</table>";
+	}
+	else{
+		echo"<br>";
+		echo"<br>";
+		echo"<br>";
+
+		echo "no wms in this gui";
+  	}  /*End: if ($cnt_show_gui_wms > 0)  *********/
+	/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/	
+
+
+} /*End: if(isset($show_gui_wms))   *********/
+
+
+
+/*show gui wms  ********************************************************************************************/
+if (!empty($show_gui_configured_wms)){
+	/*get group gui WMS  ********************************************************************************************/								 
+	$sql_fkey_show_gui_wms = "SELECT DISTINCT fkey_wms_id, fkey_gui_id FROM gui_wms WHERE fkey_gui_id = $1";
+	#$sql_fkey_show_gui_wms.= ") ORDER BY fkey_wms_id";
+	$v = array($show_gui_configured_wms);
+	$t = array("s");
+	$res_fkey_show_gui_wms = db_prep_query($sql_fkey_show_gui_wms, $v, $t);
+	while($row = db_fetch_array($res_fkey_show_gui_wms)){
+		$fkey_show_gui_gui_id[$cnt_fkey_show_gui_wms] = $row["fkey_gui_id"];
+		$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms] = $row["fkey_wms_id"];
+		#echo"$fkey_show_gui_wms_id[$cnt_fkey_show_gui_wms]";
+		$cnt_fkey_show_gui_wms++;
+	}								 
+	/*get group gui WMS  ********************************************************************************************/		
+
+	/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/								 
+	if(count($fkey_show_gui_wms_id)>0){
+		$sql_show_gui_wms = "SELECT DISTINCT wms_title, wms_abstract, wms_getcapabilities, wms_id, wms_version FROM wms WHERE wms_id IN (";
+		$v = $fkey_show_gui_wms_id;
+		$t = array();
+		for ($i = 1; $i <= count($fkey_show_gui_wms_id); $i++){
+			if ($i > 1) { 
+				$sql_show_gui_wms .= ",";
+			}
+			$sql_show_gui_wms .= "$".$i;
+			array_push($t, "s");
+		}
+		$sql_show_gui_wms.= ") ORDER BY wms_title";
+
+		$res_show_gui_wms = db_prep_query($sql_show_gui_wms, $v, $t);
+		while($row = db_fetch_array($res_show_gui_wms)){
+			$gui_wms_id[$cnt_show_gui_wms] = $row["wms_id"];
+			$gui_wms_title[$cnt_show_gui_wms] = $row["wms_title"];
+			$gui_wms_abstract[$cnt_show_gui_wms] = $row["wms_abstract"];
+			$gui_wms_getcapabilities[$cnt_show_gui_wms] = $row["wms_getcapabilities"];
+			$gui_wms_version[$cnt_show_gui_wms] = $row["wms_version"];
+			#echo"$gui_wms_title[$cnt_show_gui_wms]";
+			$cnt_show_gui_wms++;
+		}							 
+		/*gui: get allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+
+		/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/
+		#if (isset($cnt_show_gui_wms > 0))
+	}
+
+	if ($cnt_show_gui_wms > 0){
+	/*get selected gui name for table caption ********************************************************************************************/  
+	$sql_gui_table = "SELECT * FROM gui WHERE gui_id = $1";
+	$v = array($show_gui_configured_wms);
+	$t = array("s");       
+	$res_gui_table = db_prep_query($sql_gui_table, $v, $t);
+		while($row = db_fetch_array($res_gui_table)){
+			$gui_id_table[$cnt_gui_table] = $row["gui_id"];
+			$gui_name_table[$cnt_gui_table] = $row["gui_name"];							
+			$cnt_gui_table++;
+			#echo"$gui_id_table[0]";
+		}
+
+		/*get selected gui name for table caption ********************************************************************************************/
+
+		echo"<br>";
+		echo"<br>";
+			echo"wms from gui: $gui_name_table[0]";
+			echo"<br>";
+			echo"<br>";
+		echo "<table border='1'  width ='98%'   cellpadding='3' rules='rows'>";
+		echo " <thead bgcolor = '#FAEBD7' >";
+		echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
+		echo " </thead>";
+		echo " <tbody >";
+		for($i=0; $i<$cnt_show_gui_wms; $i++){
+			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			echo "<td><div id ='id_".$gui_wms_title[$i]."' class='even' name ='name_".$gui_wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromDB(\"".$show_gui_configured_wms."\",\"".$gui_wms_id[$i]."\")'>".$gui_wms_title[$i]."</div></td>";
+			echo "<td><div  id ='id_".$gui_wms_abstract[$i]."' class='even' name ='name_".$gui_wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromDB(\"".$show_gui_configured_wms."\",\"".$gui_wms_id[$i]."\")'>".$gui_wms_abstract[$i]."</div></td>";
+			echo "</tr>";	
+		}	
+		echo "  </tbody>";							 						 
+		echo "</table>";
+	}
+	else{
+		echo"<br>";
+		echo"<br>";
+		echo"<br>";
+
+		echo "no wms in this gui";
+  	}  /*End: if ($cnt_show_gui_wms > 0)  *********/
+	/*table with allocated wms-Abstract and wms-Capabilities from allocated gui  ********************************************************************************************/	
+
+
+} /*End: if(isset($show_gui_configured_wms))   *********/
+
+######   SHOW GUI WMS OR GROUP WMS   #####################################################################################
+
+######   SHOW GUI OR GROUP OR ALL WMS   #####################################################################################
+
+	if ($wms_show == 4){ #gui
+		echo"<br>";
+		echo"<br>";
+		echo"Please select a gui:";
+		echo"<br>";
+		echo"<br>";	
+		echo "<table border='1' width='98%' cellpadding='3' rules='rows'>";
+		echo " <thead bgcolor = 'lightgrey' >";
+		echo "<tr><td width='200' height='10'>gui name</td><td  align = 'left' class='fieldnames_s'>description</td>";
+		echo " </thead>";
+		echo " <tbody >";
+		for($i=0; $i<$cnt_gui; $i++){
+			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			echo "<td><div id ='id_".$gui_name[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_name[$i]."'  style='cursor:pointer'  onclick = 'mod_show_gui_configured_wms(\"".$gui_id[$i]."\")'>".$gui_name[$i]."</div></td>";
+			echo "<td><div id ='id_".$gui_description[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_description[$i]."' style='cursor:pointer' onclick = 'mod_show_gui_configured_wms(\"".$gui_id[$i]."\")'>".$gui_description[$i]."</div></td>";
+			echo "</tr>";
+		}		
+		echo "  </tbody>";							 						 
+		echo "</table>";		
+
+	}
+	if ($wms_show == 3){ #gui
+		echo"<br>";
+		echo"<br>";
+		echo"Please select a gui:";
+		echo"<br>";
+		echo"<br>";	
+		echo "<table border='1' width='98%' cellpadding='3' rules='rows'>";
+		echo " <thead bgcolor = 'lightgrey' >";
+		echo "<tr><td width='200' height='10'>gui name</td><td  align = 'left' class='fieldnames_s'>description</td>";
+		echo " </thead>";
+		echo " <tbody >";
+		for($i=0; $i<$cnt_gui; $i++){
+			echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			echo "<td><div id ='id_".$gui_name[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_name[$i]."'  style='cursor:pointer'  onclick = 'mod_show_gui_wms(\"".$gui_id[$i]."\")'>".$gui_name[$i]."</div></td>";
+			echo "<td><div id ='id_".$gui_description[$i]."' value='".$gui_id[$i]."' class='even' name ='".$gui_description[$i]."' style='cursor:pointer' onclick = 'mod_show_gui_wms(\"".$gui_id[$i]."\")'>".$gui_description[$i]."</div></td>";
+			echo "</tr>";
+		}		
+		echo "  </tbody>";							 						 
+		echo "</table>";		
+
+	}
+	elseif  ($wms_show== 2){  # group
+		echo"<br>";
+		echo"<br>";
+  
+		if($cnt_group>0){
+			echo "Please select a group:";
+			echo"<br>";
+			echo"<br>";
+			echo "<table border='1' width='98%' cellpadding='3' rules='rows'>";
+			echo " <thead bgcolor = 'lightgrey' >";
+			echo "<tr><td  width='200' height='10'>group name</td><td  align = 'left' class='fieldnames_s'>description</td>";
+			echo " </thead>";
+			echo " <tbody >";
+			for($i=0; $i<$cnt_group; $i++){
+				echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";  				
+				echo "<td><div id ='id_".$my_group_name[$i]."' value='".$my_group_id[$i]."' class='even' name ='".$my_group_name[$i]."'  style='cursor:pointer'  onclick = 'mod_show_group_wms(\"".$my_group_id[$i]."\")'>".$my_group_name[$i]."</div></td>";
+				echo "<td><div id ='id_".$mb_group_description[$i]."' value='".$my_group_id[$i]."' class='even' name ='".$mb_group_description[$i]."' style='cursor:pointer' onclick = 'mod_show_group_wms(\"".$my_group_id[$i]."\")'>".$mb_group_description[$i]."</div></td>";
+				echo "</tr>";
+			}		
+			echo "  </tbody>";							 						 
+			echo "</table>";
+		}
+		else{
+			echo"no group for this user";
+		}
+	
+	}
+	elseif  ($wms_show== 1){  # all wms
+		echo"<br>";
+		echo"<br>";
+
+		echo "<table border='1'  width ='98%'   cellpadding='3' rules='rows'>";
+		echo " <thead bgcolor = '#FAEBD7' >";
+		echo "<tr><td width='200' height='10'>WMS-Title</td><td  align = 'left' class='fieldnames_s'>WMS-Abstract</td>";
+		echo " </thead>";
+		echo " <tbody >";
+		for($i=0; $i<$cnt_wms; $i++){
+        	echo "<tr class='Farbe' onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
+			echo "<td><div id ='id_".$wms_title[$i]."' class='even' name ='name_".$wms_title[$i]."'  style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$wms_getcapabilities[$i]."\",\"".$wms_version[$i]."\")'>".$wms_title[$i]."</div></td>";
+			echo "<td><div  id ='id_".$wms_abstract[$i]."' class='even' name ='name_".$wms_abstract[$i]."' style='cursor:pointer' onclick = 'mod_addWMSfromfilteredList(\"".$wms_getcapabilities[$i]."\",\"".$wms_version[$i]."\")'>".$wms_abstract[$i]."</div></td>";
+			echo "</tr>"; 					 					
+		}		
+		echo "  </tbody>";							 						 
+		echo "</table>";
+	}
+}
+
+
+######   SHOW GUI OR GROUP OR ALL WMS   #####################################################################################
+
+
+/*show group wms  ********************************************************************************************/
+echo "<input type='hidden' name='show_group_wms'>";
+/*show gui wms  ********************************************************************************************/
+echo "<input type='hidden' name='show_gui_wms'>";
+echo "<input type='hidden' name='show_gui_configured_wms'>";
+/*show button  ********************************************************************************************/
+echo "<input type='hidden' name='wms_show'>";
+echo "<input id='wmsSource' type='hidden' name='wmsSource'>";
+echo "<input name ='set_option_all' id='set_option_all' type='hidden'>";
+echo "<input name='set_option_group' id='set_option_group' type='hidden'>";
+echo "<input name='set_option_gui' id='set_option_gui' type='hidden'>";
+echo "<input name='set_option_db' id='set_option_db' type='hidden'>";
+echo "</form>";
+?>
+<script type="text/javascript">
+
+// -->
+</script>
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_add_SLD.php
===================================================================
--- branches/print_dev/http/javascripts/mod_add_SLD.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_add_SLD.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,64 +1,64 @@
-<?php
-# $Id$
-# add SLD-Parameter parameters to MapRequest
-# http://www.mapbender.org/index.php/mod_add_vendorspecific.php
-# 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.
-
-?>
-var sldURL = "";
-var mod_remove_layer_and_styles = "";
-var removeLayerAndStylesAffectedWMSTitle = "deegree wms";
-//var addSldAffectedWMSTitle = "deegree wms";
-//var sldLocationUrl = "http://wms1.ccgis.de/mapbender_dev/tmp/";
-
-var addSldAffectedWMSTitle = "Bonn Ergebnisse"; 
-var sldLocationUrl = "http://localhost/bonn_orlando_svn/http/tmp/"; 
-
-mod_remove_layer_and_styles += "if (sldURL != '' && (functionName == 'setMapRequest' || functionName == 'setSingleMapRequest') && mb_mapObj[i].wms[ii].wms_title == removeLayerAndStylesAffectedWMSTitle){";
-mod_remove_layer_and_styles += "newMapURL = newMapURL.replace(/LAYERS=[^&]*&/, '');";
-mod_remove_layer_and_styles += "newMapURL = newMapURL.replace(/STYLES=[^&]*&/, '');";
-mod_remove_layer_and_styles += "}";
-
-function mod_sld_init(wmsTitle, functionName) {
-		//alert(sldURL + ' ' + functionName );
-	if (sldURL != ''){
-		if (functionName == 'setMapRequest' || functionName == 'setSingleMapRequest') {
-			//Stadt Bonn: if (wmsTitle == 'deegree wms'){	
-					
-			if (wmsTitle == addSldAffectedWMSTitle){
-				return 'SLD=' + sldURL;
-			}
-		}
-	}
-
-	return "";
-}
-
-
-mb_registerVendorSpecific(mod_remove_layer_and_styles);
-mb_registerVendorSpecific("mod_sld_init(mb_mapObj[i].wms[ii].wms_title, functionName);");
-
-
-function mod_set_sld(sldString){ 
-	//console.debug("%s",sldString);  
-	mb_ajax_post("../orlando/saveSLD.php", {'sld':sldString}, function (json, status) {
-	var result = eval('('+json+')');
-	sldURL = sldLocationUrl + result.filename;
-	zoom("mapframe1", true,0.9999);
-	});
-
-}
+<?php
+# $Id$
+# add SLD-Parameter parameters to MapRequest
+# http://www.mapbender.org/index.php/mod_add_vendorspecific.php
+# 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.
+
+?>
+var sldURL = "";
+var mod_remove_layer_and_styles = "";
+var removeLayerAndStylesAffectedWMSTitle = "deegree wms";
+//var addSldAffectedWMSTitle = "deegree wms";
+//var sldLocationUrl = "http://wms1.ccgis.de/mapbender_dev/tmp/";
+
+var addSldAffectedWMSTitle = "Bonn Ergebnisse"; 
+var sldLocationUrl = "http://localhost/bonn_orlando_svn/http/tmp/"; 
+
+mod_remove_layer_and_styles += "if (sldURL != '' && (functionName == 'setMapRequest' || functionName == 'setSingleMapRequest') && mb_mapObj[i].wms[ii].wms_title == removeLayerAndStylesAffectedWMSTitle){";
+mod_remove_layer_and_styles += "newMapURL = newMapURL.replace(/LAYERS=[^&]*&/, '');";
+mod_remove_layer_and_styles += "newMapURL = newMapURL.replace(/STYLES=[^&]*&/, '');";
+mod_remove_layer_and_styles += "}";
+
+function mod_sld_init(wmsTitle, functionName) {
+		//alert(sldURL + ' ' + functionName );
+	if (sldURL != ''){
+		if (functionName == 'setMapRequest' || functionName == 'setSingleMapRequest') {
+			//Stadt Bonn: if (wmsTitle == 'deegree wms'){	
+					
+			if (wmsTitle == addSldAffectedWMSTitle){
+				return 'SLD=' + sldURL;
+			}
+		}
+	}
+
+	return "";
+}
+
+
+mb_registerVendorSpecific(mod_remove_layer_and_styles);
+mb_registerVendorSpecific("mod_sld_init(mb_mapObj[i].wms[ii].wms_title, functionName);");
+
+
+function mod_set_sld(sldString){ 
+	//console.debug("%s",sldString);  
+	mb_ajax_post("../orlando/saveSLD.php", {'sld':sldString}, function (json, status) {
+	var result = eval('('+json+')');
+	sldURL = sldLocationUrl + result.filename;
+	zoom("mapframe1", true,0.9999);
+	});
+
+}

Modified: branches/print_dev/http/javascripts/mod_add_vendorspecific.php
===================================================================
--- branches/print_dev/http/javascripts/mod_add_vendorspecific.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_add_vendorspecific.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,28 +1,28 @@
-<?php
-# $Id:
-# add vendor-specific parameters to MapRequest and FeatureInfoRequests
-# http://www.mapbender.org/index.php/mod_add_vendorspecific.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-mb_registerVendorSpecific("mod_vs_init()");
-function mod_vs_init(){   
-   var re = "vendorspecific=<?php echo $_SESSION['mb_user_name'] ?>";
-   return re;
-}
-
+<?php
+# $Id:
+# add vendor-specific parameters to MapRequest and FeatureInfoRequests
+# http://www.mapbender.org/index.php/mod_add_vendorspecific.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+mb_registerVendorSpecific("mod_vs_init()");
+function mod_vs_init(){   
+   var re = "vendorspecific=<?php echo $_SESSION['mb_user_name'] ?>";
+   return re;
+}
+

Modified: branches/print_dev/http/javascripts/mod_adminNavigation.js
===================================================================
--- branches/print_dev/http/javascripts/mod_adminNavigation.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_adminNavigation.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,8 +1,8 @@
-eventInit.register(function () {
-	$("a").click(function () {
-		$("a").each(function () {
-			this.style.color = "#808080";
-		});
-		this.style.color = "#0000ff";
-	});
+eventInit.register(function () {
+	$("a").click(function () {
+		$("a").each(function () {
+			this.style.color = "#808080";
+		});
+		this.style.color = "#0000ff";
+	});
 });
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_exportMapImage.php
===================================================================
--- branches/print_dev/http/javascripts/mod_exportMapImage.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_exportMapImage.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,166 +1,166 @@
-<?php
-# $Id$
-# http://www.mapbender.org/ExportMapimage
-# 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.
-
-require_once(dirname(__FILE__) . "/../php/mb_validatePermission.php");
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Export Mapimage</title>
-<?php
- include '../include/dyn_css.php';
-?>
-</head>
-<style type="text/css">
-<!-- 
- 
-input{
-	width:50px;
-    font-family: Arial, Helvetica, sans-serif;
-	font-size: 12px;
-}
-div{
-	font-family : Arial, Helvetica, sans-serif;
-	font-size: 12px;
-}
-.imageformat{
-	width:50px;
-	font-family : Arial, Helvetica, sans-serif;
-	font-size: 14px;
-    font-weight: bold;
-}
-
--->
-</style>
-<?php
-
-
-
-echo "<script type='text/javascript'>";
-echo "var target = '".$_REQUEST["target"]."';";
-
-echo "</script>";
-?>
-<script type="text/javascript">
-
-
-// some defaults
-try{if (pngExport){}}catch(e){pngExport = 'true';}
-try{if (jpegExport){}}catch(e){jpegExport = 'true';}
-try{if (geotiffExport){}}catch(e){geotiffExport = 'true';}
-
-
-function generateExportOptions(){
-if (pngExport=='true'){
-	document.write('<tr><td><span class="imageformat"><input type="radio" name="imageformat" value="png">PNG</span></td></tr>');		
-}
-if (jpegExport=='true'){
-	document.write('<tr><td><span class="imageformat"><input type="radio" name="imageformat" value="jpeg">JPEG / JPG</span></td></tr>');		
-}
-if (geotiffExport=='true'){
-	document.write('<tr><td><span class="imageformat"><input type="radio" name="imageformat" value="geotiff">GeoTIFF</span></td></tr>');		
-}
-
-
-
-}
-
-function exportMapimage(){
-		
-	choosen = "";
-	len = document.form1.imageformat.length;
-	
-	for (i = 0; i <len; i++) {
-		if (document.form1.imageformat[i].checked) {
-			choosen = document.form1.imageformat[i].value;
-		}
-	}
-	
-	if (choosen == "") {
-		alert("Keine Wahl getroffen, per DEFAULT wird die Karte als PNG exportiert");
-		choosen = document.form1.imageformat[0].value;
-	}
-	else {
-		//alert(choosen)
-	}
-
-	
-	var idx = window.opener.getMapObjIndexByName(target);
-	
-    
-	var wms_string = "";
-    
-	for(var ii=0; ii<window.opener.mb_mapObj[idx].wms.length; ii++){
-
-    
-    if (window.opener.mb_mapObj[idx].mapURL[ii] == false || typeof(window.opener.mb_mapObj[idx].mapURL[ii]) == 'undefined' || window.opener.mb_mapObj[idx].mapURL[ii] == 'undefined'){
-				
-				//alert('Keine WMSe vorhanden.');
-			} else{
-
-   				if (ii==0){
-					wms_string = window.opener.mb_mapObj[idx].mapURL[ii];	
-				} else {
-					wms_string += "___"+window.opener.mb_mapObj[idx].mapURL[ii];
-				}
-			}		
-	}
-	wms_string = encodeURIComponent(wms_string);
-	var myLocation = "../php/mod_exportMapImage_server.php?target="+target+"&imagetype="+choosen+"&wms_urls="+wms_string;
-	//mynewwin = window.open("../php/mod_exportMapImage_server.php?target="+target+"&imagetype="+choosen+"&wms_urls="+wms_string+"","exportMapImage","width=180, height=200, resizable=yes ");
-	document.location.href = myLocation; 
-	
-//	alert('ImageExport done');
-//	window.close();
-	
-}
-
-function close_exportMapimage(){
-	window.close();
-}
-
-</script>
-<body>
-<form name='form1' method='POST' action='' target="_blank" onSubmit="return FormCheck()">
-<table border='0'>
-<div>Please select a format for the exported image!</div><br>
-
-<script type="text/javascript"> generateExportOptions();
-</script>
-
-<tr>
-<td> <br><br> </td>
-</tr>
-
-</table>  
-<div id="buttons" align='right'>
-		<input type='button' name='expImg_ok' value="OK" onclick='exportMapimage();'>
-		<input type='button' name='expImg_close' value="Close" onclick='close_exportMapimage();'>
-</div>
-</form>
-</body>
-</html>
+<?php
+# $Id$
+# http://www.mapbender.org/ExportMapimage
+# 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.
+
+require_once(dirname(__FILE__) . "/../php/mb_validatePermission.php");
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>Export Mapimage</title>
+<?php
+ include '../include/dyn_css.php';
+?>
+</head>
+<style type="text/css">
+<!-- 
+ 
+input{
+	width:50px;
+    font-family: Arial, Helvetica, sans-serif;
+	font-size: 12px;
+}
+div{
+	font-family : Arial, Helvetica, sans-serif;
+	font-size: 12px;
+}
+.imageformat{
+	width:50px;
+	font-family : Arial, Helvetica, sans-serif;
+	font-size: 14px;
+    font-weight: bold;
+}
+
+-->
+</style>
+<?php
+
+
+
+echo "<script type='text/javascript'>";
+echo "var target = '".$_REQUEST["target"]."';";
+
+echo "</script>";
+?>
+<script type="text/javascript">
+
+
+// some defaults
+try{if (pngExport){}}catch(e){pngExport = 'true';}
+try{if (jpegExport){}}catch(e){jpegExport = 'true';}
+try{if (geotiffExport){}}catch(e){geotiffExport = 'true';}
+
+
+function generateExportOptions(){
+if (pngExport=='true'){
+	document.write('<tr><td><span class="imageformat"><input type="radio" name="imageformat" value="png">PNG</span></td></tr>');		
+}
+if (jpegExport=='true'){
+	document.write('<tr><td><span class="imageformat"><input type="radio" name="imageformat" value="jpeg">JPEG / JPG</span></td></tr>');		
+}
+if (geotiffExport=='true'){
+	document.write('<tr><td><span class="imageformat"><input type="radio" name="imageformat" value="geotiff">GeoTIFF</span></td></tr>');		
+}
+
+
+
+}
+
+function exportMapimage(){
+		
+	choosen = "";
+	len = document.form1.imageformat.length;
+	
+	for (i = 0; i <len; i++) {
+		if (document.form1.imageformat[i].checked) {
+			choosen = document.form1.imageformat[i].value;
+		}
+	}
+	
+	if (choosen == "") {
+		alert("Keine Wahl getroffen, per DEFAULT wird die Karte als PNG exportiert");
+		choosen = document.form1.imageformat[0].value;
+	}
+	else {
+		//alert(choosen)
+	}
+
+	
+	var idx = window.opener.getMapObjIndexByName(target);
+	
+    
+	var wms_string = "";
+    
+	for(var ii=0; ii<window.opener.mb_mapObj[idx].wms.length; ii++){
+
+    
+    if (window.opener.mb_mapObj[idx].mapURL[ii] == false || typeof(window.opener.mb_mapObj[idx].mapURL[ii]) == 'undefined' || window.opener.mb_mapObj[idx].mapURL[ii] == 'undefined'){
+				
+				//alert('Keine WMSe vorhanden.');
+			} else{
+
+   				if (ii==0){
+					wms_string = window.opener.mb_mapObj[idx].mapURL[ii];	
+				} else {
+					wms_string += "___"+window.opener.mb_mapObj[idx].mapURL[ii];
+				}
+			}		
+	}
+	wms_string = encodeURIComponent(wms_string);
+	var myLocation = "../php/mod_exportMapImage_server.php?target="+target+"&imagetype="+choosen+"&wms_urls="+wms_string;
+	//mynewwin = window.open("../php/mod_exportMapImage_server.php?target="+target+"&imagetype="+choosen+"&wms_urls="+wms_string+"","exportMapImage","width=180, height=200, resizable=yes ");
+	document.location.href = myLocation; 
+	
+//	alert('ImageExport done');
+//	window.close();
+	
+}
+
+function close_exportMapimage(){
+	window.close();
+}
+
+</script>
+<body>
+<form name='form1' method='POST' action='' target="_blank" onSubmit="return FormCheck()">
+<table border='0'>
+<div>Please select a format for the exported image!</div><br>
+
+<script type="text/javascript"> generateExportOptions();
+</script>
+
+<tr>
+<td> <br><br> </td>
+</tr>
+
+</table>  
+<div id="buttons" align='right'>
+		<input type='button' name='expImg_ok' value="OK" onclick='exportMapimage();'>
+		<input type='button' name='expImg_close' value="Close" onclick='close_exportMapimage();'>
+</div>
+</form>
+</body>
+</html>

Modified: branches/print_dev/http/javascripts/mod_gazetteerSQL_client.php
===================================================================
--- branches/print_dev/http/javascripts/mod_gazetteerSQL_client.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_gazetteerSQL_client.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,391 +1,391 @@
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;?>">
-<title>Gazetteer</title>
-<?php
-include '../include/dyn_css.php';
-?>
-<script type="text/javascript">
-
-var targetFrameArray = [];
-<?php
-echo "var e_id = '". $e_id . "';";
-for ($i = 0; $i < count($e_target); $i++) {
-	echo "targetFrameArray.push('".$e_target[$i]."');";
-}
-?>
-<!--
-// --- begin: expected element vars ---
-// var scale 
-// var numberOfResults
-// var profile = "adresse" | "alk" | "alb" | "adresse2"
-
-if (typeof(scale) == 'undefined') {
-	var scale = 2000;
-	var e = new parent.Mb_warning("mod_gazetteerSQL: element var scale is missing.");
-}
-if (typeof(numberOfResults) == 'undefined') {
-	var numberOfResults = 0;
-	var e = new parent.Mb_warning("mod_gazetteerSQL: element var numberOfResults is missing.");
-}
-if (typeof(tooManyResultsString) == 'undefined') {
-	var tooManyResultsString = "Too many results. Please specify your query.";
-	var e = new parent.Mb_warning("mod_gazetteerSQL: element var tooManyResultsString is missing.");
-}
-if (typeof(profile) == 'undefined' || (profile != "alb" && profile != "alk" && profile != "adresse" && profile != "adresse2")) {
-	profile = "adresse"
-	var e = new parent.Mb_exception("mod_gazetteerSQL: element var profile is missing.");
-}
-
-// --- end: expected element vars ---
-
-
-var generalPreFunctions = [];
-var generalSubFunctions = [];
-var onloadSubFunctions = [];
-var communesSubFunctions = [];
-var streetSubFunctions = [];
-var numberSubFunctions = [];
-var districtSubFunctions = [];
-var parcelSubFunctions = [];
-var ownerSubFunctions = [];
-
-registerFunction(generalPreFunctions, "disableForm();");
-registerFunction(generalSubFunctions, "enableForm();");
-if (profile == "alb") {
-	registerFunction(onloadSubFunctions, "updateCommunes();");
-	registerFunction(communesSubFunctions, "updateOwner();");
-	registerFunction(ownerSubFunctions, "updateOwner();");
-}
-else if (profile == "alk") {
-	registerFunction(onloadSubFunctions, "updateCommunes();");
-	registerFunction(communesSubFunctions, "updateDistricts();");
-	registerFunction(parcelSubFunctions, "updateParcels();");
-}
-else if (profile == "adresse") {
-	registerFunction(onloadSubFunctions, "updateCommunes();");
-	registerFunction(communesSubFunctions, "updateStreets();");
-	registerFunction(streetSubFunctions, "updateNumbers();");
-}
-else if (profile == "adresse2") {
-	registerFunction(onloadSubFunctions, "updateStreets();");
-	registerFunction(streetSubFunctions, "updateNumbers();");
-}
-
-function executeFunctions(arrayOfFunctionStrings) {
-	for (var i = 0; i < arrayOfFunctionStrings.length; i++) {
-		eval(arrayOfFunctionStrings[i]);
-	}
-}
-
-function registerFunction(functionStringArray, functionString) {
-	functionStringArray.push(functionString);
-}
-
-function disableForm() {
-	document.getElementById('selectCommune').disabled = true;
-	document.getElementById('selectStreet').disabled = true;
-	document.getElementById('selectDistrict').disabled = true;
-	document.getElementById('inputParcel1').disabled = true;
-	document.getElementById('inputParcel2').disabled = true;
-	document.getElementById('inputParcelButton').disabled = true;
-	document.getElementById('inputOwner').disabled = true;
-	document.getElementById('inputOwnerButton').disabled = true;
-	document.getElementById("divResults").innerHTML = searchImage;
-}
-
-function enableForm() {
-	document.getElementById('selectCommune').removeAttribute("disabled");
-	document.getElementById('selectStreet').removeAttribute("disabled");
-	document.getElementById('selectDistrict').removeAttribute("disabled");
-	document.getElementById('inputParcel1').removeAttribute("disabled");
-	document.getElementById('inputParcel2').removeAttribute("disabled");
-	document.getElementById('inputParcelButton').removeAttribute("disabled");
-	document.getElementById('inputOwner').removeAttribute("disabled");
-	document.getElementById('inputOwnerButton').removeAttribute("disabled");
-	document.getElementById("divResults").innerHTML = "";
-}
-
-var highlight;
-var houseLocation;
-var parcelLocation;
-var searchImage = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
-var phpUrl = "../php/mod_gazetteerSQL_server.php";
-
-parent.mb_registerInitFunctions("window.frames['"+e_id+"'].initHighlight()");
-parent.mb_registerInitFunctions("window.frames['"+e_id+"'].executeFunctions(window.frames['"+e_id+"'].onloadSubFunctions)");
-
-
-// - BEGIN -------- HIGHLIGHTING AND ZOOMING ------------------------------------------
-
-function zoomToLocation(aPoint) {
-	parent.mb_repaintScale(targetFrameArray[0], aPoint.x, aPoint.y, scale)
-}
-
-function initHighlight() {
-	var generalHighlightZIndex = 100;
-	var generalHighlightLineWidth = 3;
-	var styleObj = {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex};
-	highlight = new parent.Highlight(targetFrameArray, e_id, styleObj, generalHighlightLineWidth);
-}
-
-function zoomToHouseNumber(houseNumber) {
-	zoomToLocation(houseLocation[houseNumber]);
-	removeHighlight();
-	highlightHouseNumber(houseNumber);
-}
-
-function zoomToParcel(parcelId) {
-	zoomToLocation(parcelLocation[parcelId]);
-	removeHighlight();
-	highlightParcel(parcelId);
-}
-
-function highlightHouseNumber(houseNumber) {
-	var mG = new parent.MultiGeometry(parent.geomType.point);
-	mG.addGeometry();
-	mG.get(-1).addPoint(houseLocation[houseNumber]);
-	highlight.add(mG);
-	highlight.paint();
-}
-
-function highlightParcel(parcelId) {
-	var mG = new parent.MultiGeometry(parent.geomType.point);
-	mG.addGeometry();
-	mG.get(-1).addPoint(parcelLocation[parcelId]);
-	highlight.add(mG);
-	highlight.paint();
-}
-
-function removeHighlight() {
-	highlight.clean();
-}
-
-// - END -------- HIGHLIGHTING AND ZOOMING ------------------------------------------
-
-
-
-function removeChildNodes(node) {
-	while (node.childNodes.length > 0) {
-		var childNode = node.firstChild;
-		node.removeChild(childNode);
-	}
-}
-
-function getSize(result) {
-	if (typeof(result) == "array") {
-		return result.length;
-	}
-	else if (typeof(result) == "object") {
-		var c = 0;
-		for (var attr in result) {
-			c++;
-		}
-		return c;
-	}
-	return 1;
-}
-
-function updateCommunes() {
-	executeFunctions(generalPreFunctions);
-	parent.mb_ajax_json(phpUrl, {"command":"getCommunes"}, function (json, status) {
-		executeFunctions(generalSubFunctions);
-
-		removeChildNodes(document.getElementById('selectCommune'));
-
-		for (var communeId in json.communes) {
-			if (typeof(json.communes[communeId]) != 'function') {
-				var currentNode = document.createElement("option");
-			
-				if (document.getElementById('selectCommune').childNodes.length == 0) {
-					currentNode.selected = "selected";
-				}
-				currentNode.value = communeId;
-				currentNode.innerHTML = json.communes[communeId];
-				document.getElementById('selectCommune').appendChild(currentNode);
-			}
-		}
-		executeFunctions(communesSubFunctions);
-	});
-}
-
-function updateStreets() {
-	executeFunctions(generalPreFunctions);
-	var communeId = document.getElementById('selectCommune').value;
-	
-	parent.mb_ajax_json(phpUrl, {"command":"getStreets", "communeId":communeId}, function (json, status) {
-		executeFunctions(generalSubFunctions);
-
-		removeChildNodes(document.getElementById('selectStreet'));
-
-		for (var streetId in json.streets) {
-			if (typeof(json.streets[streetId]) != 'function') {
-				var currentNode = document.createElement("option");
-	
-				if (document.getElementById('selectStreet').childNodes.length == 0) {
-					currentNode.selected = "selected";
-				}
-				
-				currentNode.value = json.streets[streetId];
-				currentNode.innerHTML = json.streets[streetId];
-				document.getElementById('selectStreet').appendChild(currentNode);
-			}
-		}
-		executeFunctions(streetSubFunctions);
-	});
-}
-
-function updateDistricts() {
-	executeFunctions(generalPreFunctions);
-
-	var communeId = document.getElementById('selectCommune').value;
-	
-	parent.mb_ajax_json(phpUrl, {"command":"getDistricts", "communeId":communeId}, function (districtObject, status) {
-		executeFunctions(generalSubFunctions);
-
-		removeChildNodes(document.getElementById('selectDistrict'));
-
-		for (var districtId in districtObject.districts) {
-			if (typeof(districtObject.districts[districtId]) != 'function') {
-				var currentNode = document.createElement("option");
-	
-				currentNode.value = districtId;
-	
-				if (document.getElementById('selectDistrict').childNodes.length == 0) {
-					currentNode.selected = "selected";
-				}
-				
-				currentNode.value = districtObject.districts[districtId];
-				currentNode.innerHTML = districtObject.districts[districtId];
-				document.getElementById('selectDistrict').appendChild(currentNode);
-			}
-		}
-		executeFunctions(districtSubFunctions);
-	});
-}
-
-function updateNumbers() {
-	executeFunctions(generalPreFunctions);
-
-	var streetName = document.getElementById('selectStreet').value;
-	var communeId = document.getElementById('selectCommune').value;
-
-	parent.mb_ajax_json(phpUrl, {"command":"getNumbers", "communeId":communeId, "streetName":streetName, "numberOfResults":numberOfResults}, function (json, status) {
-		executeFunctions(generalSubFunctions);
-		houseLocation = {};
-		var resultString = "";
-		if (getSize(json.houseNumbers) > 0) {
-			if (json.limited === true) {
-				resultString += tooManyResultsString;
-			}
-			for (var houseNumber in json.houseNumbers) {
-				if (typeof(json.houseNumbers[houseNumber]) != 'function') {
-					houseLocation[houseNumber] = new parent.Point(json.houseNumbers[houseNumber].x, json.houseNumbers[houseNumber].y);
-					resultString += "<b style=\"cursor:pointer\" onclick=\"zoomToHouseNumber('"+houseNumber+"')\" onmouseover=\"highlightHouseNumber('"+houseNumber+"')\" onmouseout=\"removeHighlight()\">"+houseNumber+"</b>&nbsp;&nbsp; ";
-				}
-			}
-		}
-		else {
-			resultString += noResultsString;
-		}
-		document.getElementById("divResults").innerHTML = resultString;
-		executeFunctions(numberSubFunctions);
-	});
-}
-
-function updateParcels() {
-	executeFunctions(generalPreFunctions);
-	
-	var districtId = document.getElementById('selectDistrict').value;
-	var inputParcel1 = document.getElementById('inputParcel1').value;
-	var inputParcel2 = document.getElementById('inputParcel2').value;
-
-
-	parent.mb_ajax_json(phpUrl, {"command":"getLandparcelsByDistrict", "districtId":districtId, "parcelNumber1":inputParcel1, "parcelNumber2":inputParcel2, "numberOfResults":numberOfResults}, function (json, status) {
-		executeFunctions(generalSubFunctions);
-
-		parcelLocation = {};
-		var resultString = "";
-		if (getSize(json.landparcels) > 0) {
-			if (json.limited === true) {
-				resultString += tooManyResultsString;
-			}
-			resultString += "<ol>";
-			for (var parcelId in json.landparcels) {
-				if (typeof(json.landparcels[parcelId]) != 'function') {
-					parcelLocation[parcelId] = new parent.Point(json.landparcels[parcelId].x, json.landparcels[parcelId].y);
-					resultString += "<li style=\"cursor:pointer\" onclick=\"zoomToParcel('"+parcelId+"')\" onmouseover=\"highlightParcel('"+parcelId+"')\" onmouseout=\"removeHighlight()\">"+parcelId+"</li>";
-				}
-			}
-			resultString += "</ol>";
-		}
-		else {
-			resultString += noResultsString;
-		}
-		document.getElementById("divResults").innerHTML = resultString;
-		executeFunctions(numberSubFunctions);
-	});
-}
-
-function updateOwner() {
-	var ownerQueryString = document.getElementById('inputOwner').value;
-	var communeId = document.getElementById('selectCommune').value;
-
-	document.getElementById("divResults").innerHTML = "";
-	document.getElementById('selectCommune').removeAttribute("disabled");
-	document.getElementById('inputOwner').removeAttribute("disabled");
-	document.getElementById('inputOwnerButton').removeAttribute("disabled");
-	
-	if (ownerQueryString != "") {
-		executeFunctions(generalPreFunctions);
-		parent.mb_ajax_json(phpUrl, {"command":"getLandparcelsByOwner", "communeId":communeId, "ownerQueryString":ownerQueryString, "numberOfResults":numberOfResults}, function (json, status) {
-			executeFunctions(generalSubFunctions);
-
-			parcelLocation = {};
-			var resultString = "";
-			if (getSize(json.landparcels) > 0) {
-				if (json.limited === true) {
-					resultString += tooManyResultsString;
-				}
-				resultString += "<ol>";
-				for (var i=0; i < json.landparcels.length; i++) {
-					var parcelId = json.landparcels[i].landparcelId;
-					parcelLocation[parcelId] = new parent.Point(json.landparcels[i].x, json.landparcels[i].y);
-					resultString += "<li style=\"cursor:pointer\" onclick=\"zoomToParcel('"+parcelId+"')\" onmouseover=\"highlightParcel('"+parcelId+"')\" onmouseout=\"removeHighlight()\">"+json.landparcels[i].owner+ " (" + parcelId+")</li>";
-				}
-				resultString += "</ol>";
-			}
-			else {
-				resultString += noResultsString;
-			}
-			document.getElementById("divResults").innerHTML = resultString;
-			executeFunctions(numberSubFunctions);
-	
-		});
-	}
-}
-// -->
-</script>
-</head>
-<body>
-<form>
-<select class='selectCommune' id='selectCommune' onchange='executeFunctions(communesSubFunctions)'></select>
-<select class='selectStreet' id='selectStreet' onchange='executeFunctions(streetSubFunctions);' size=5 disabled></select>
-<select class='selectDistrict' id='selectDistrict' onchange='executeFunctions(districtSubFunctions);' size=5 disabled></select>
-<div id='divParcel' class='divParcel'>
-Flur: <input type='input' class='inputParcel1' id='inputParcel1' disabled></select>
-Flstz: <input type='input' class='inputParcel2' id='inputParcel2' disabled></select>
-<input type='button' id='inputParcelButton' value='?' onclick='executeFunctions(parcelSubFunctions);'>
-</div>
-<div id='divOwner' class='divOwner'>
-Eigent&uuml;mer: <input type='input' class='inputOwner' id='inputOwner' disabled></select>
-<input type='button' id='inputOwnerButton' value='?' onclick='executeFunctions(ownerSubFunctions);'>
-</div>
-</form>
-<div class='divResults' id='divResults'></div>
-</body>
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;?>">
+<title>Gazetteer</title>
+<?php
+include '../include/dyn_css.php';
+?>
+<script type="text/javascript">
+
+var targetFrameArray = [];
+<?php
+echo "var e_id = '". $e_id . "';";
+for ($i = 0; $i < count($e_target); $i++) {
+	echo "targetFrameArray.push('".$e_target[$i]."');";
+}
+?>
+<!--
+// --- begin: expected element vars ---
+// var scale 
+// var numberOfResults
+// var profile = "adresse" | "alk" | "alb" | "adresse2"
+
+if (typeof(scale) == 'undefined') {
+	var scale = 2000;
+	var e = new parent.Mb_warning("mod_gazetteerSQL: element var scale is missing.");
+}
+if (typeof(numberOfResults) == 'undefined') {
+	var numberOfResults = 0;
+	var e = new parent.Mb_warning("mod_gazetteerSQL: element var numberOfResults is missing.");
+}
+if (typeof(tooManyResultsString) == 'undefined') {
+	var tooManyResultsString = "Too many results. Please specify your query.";
+	var e = new parent.Mb_warning("mod_gazetteerSQL: element var tooManyResultsString is missing.");
+}
+if (typeof(profile) == 'undefined' || (profile != "alb" && profile != "alk" && profile != "adresse" && profile != "adresse2")) {
+	profile = "adresse"
+	var e = new parent.Mb_exception("mod_gazetteerSQL: element var profile is missing.");
+}
+
+// --- end: expected element vars ---
+
+
+var generalPreFunctions = [];
+var generalSubFunctions = [];
+var onloadSubFunctions = [];
+var communesSubFunctions = [];
+var streetSubFunctions = [];
+var numberSubFunctions = [];
+var districtSubFunctions = [];
+var parcelSubFunctions = [];
+var ownerSubFunctions = [];
+
+registerFunction(generalPreFunctions, "disableForm();");
+registerFunction(generalSubFunctions, "enableForm();");
+if (profile == "alb") {
+	registerFunction(onloadSubFunctions, "updateCommunes();");
+	registerFunction(communesSubFunctions, "updateOwner();");
+	registerFunction(ownerSubFunctions, "updateOwner();");
+}
+else if (profile == "alk") {
+	registerFunction(onloadSubFunctions, "updateCommunes();");
+	registerFunction(communesSubFunctions, "updateDistricts();");
+	registerFunction(parcelSubFunctions, "updateParcels();");
+}
+else if (profile == "adresse") {
+	registerFunction(onloadSubFunctions, "updateCommunes();");
+	registerFunction(communesSubFunctions, "updateStreets();");
+	registerFunction(streetSubFunctions, "updateNumbers();");
+}
+else if (profile == "adresse2") {
+	registerFunction(onloadSubFunctions, "updateStreets();");
+	registerFunction(streetSubFunctions, "updateNumbers();");
+}
+
+function executeFunctions(arrayOfFunctionStrings) {
+	for (var i = 0; i < arrayOfFunctionStrings.length; i++) {
+		eval(arrayOfFunctionStrings[i]);
+	}
+}
+
+function registerFunction(functionStringArray, functionString) {
+	functionStringArray.push(functionString);
+}
+
+function disableForm() {
+	document.getElementById('selectCommune').disabled = true;
+	document.getElementById('selectStreet').disabled = true;
+	document.getElementById('selectDistrict').disabled = true;
+	document.getElementById('inputParcel1').disabled = true;
+	document.getElementById('inputParcel2').disabled = true;
+	document.getElementById('inputParcelButton').disabled = true;
+	document.getElementById('inputOwner').disabled = true;
+	document.getElementById('inputOwnerButton').disabled = true;
+	document.getElementById("divResults").innerHTML = searchImage;
+}
+
+function enableForm() {
+	document.getElementById('selectCommune').removeAttribute("disabled");
+	document.getElementById('selectStreet').removeAttribute("disabled");
+	document.getElementById('selectDistrict').removeAttribute("disabled");
+	document.getElementById('inputParcel1').removeAttribute("disabled");
+	document.getElementById('inputParcel2').removeAttribute("disabled");
+	document.getElementById('inputParcelButton').removeAttribute("disabled");
+	document.getElementById('inputOwner').removeAttribute("disabled");
+	document.getElementById('inputOwnerButton').removeAttribute("disabled");
+	document.getElementById("divResults").innerHTML = "";
+}
+
+var highlight;
+var houseLocation;
+var parcelLocation;
+var searchImage = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
+var phpUrl = "../php/mod_gazetteerSQL_server.php";
+
+parent.mb_registerInitFunctions("window.frames['"+e_id+"'].initHighlight()");
+parent.mb_registerInitFunctions("window.frames['"+e_id+"'].executeFunctions(window.frames['"+e_id+"'].onloadSubFunctions)");
+
+
+// - BEGIN -------- HIGHLIGHTING AND ZOOMING ------------------------------------------
+
+function zoomToLocation(aPoint) {
+	parent.mb_repaintScale(targetFrameArray[0], aPoint.x, aPoint.y, scale)
+}
+
+function initHighlight() {
+	var generalHighlightZIndex = 100;
+	var generalHighlightLineWidth = 3;
+	var styleObj = {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex};
+	highlight = new parent.Highlight(targetFrameArray, e_id, styleObj, generalHighlightLineWidth);
+}
+
+function zoomToHouseNumber(houseNumber) {
+	zoomToLocation(houseLocation[houseNumber]);
+	removeHighlight();
+	highlightHouseNumber(houseNumber);
+}
+
+function zoomToParcel(parcelId) {
+	zoomToLocation(parcelLocation[parcelId]);
+	removeHighlight();
+	highlightParcel(parcelId);
+}
+
+function highlightHouseNumber(houseNumber) {
+	var mG = new parent.MultiGeometry(parent.geomType.point);
+	mG.addGeometry();
+	mG.get(-1).addPoint(houseLocation[houseNumber]);
+	highlight.add(mG);
+	highlight.paint();
+}
+
+function highlightParcel(parcelId) {
+	var mG = new parent.MultiGeometry(parent.geomType.point);
+	mG.addGeometry();
+	mG.get(-1).addPoint(parcelLocation[parcelId]);
+	highlight.add(mG);
+	highlight.paint();
+}
+
+function removeHighlight() {
+	highlight.clean();
+}
+
+// - END -------- HIGHLIGHTING AND ZOOMING ------------------------------------------
+
+
+
+function removeChildNodes(node) {
+	while (node.childNodes.length > 0) {
+		var childNode = node.firstChild;
+		node.removeChild(childNode);
+	}
+}
+
+function getSize(result) {
+	if (typeof(result) == "array") {
+		return result.length;
+	}
+	else if (typeof(result) == "object") {
+		var c = 0;
+		for (var attr in result) {
+			c++;
+		}
+		return c;
+	}
+	return 1;
+}
+
+function updateCommunes() {
+	executeFunctions(generalPreFunctions);
+	parent.mb_ajax_json(phpUrl, {"command":"getCommunes"}, function (json, status) {
+		executeFunctions(generalSubFunctions);
+
+		removeChildNodes(document.getElementById('selectCommune'));
+
+		for (var communeId in json.communes) {
+			if (typeof(json.communes[communeId]) != 'function') {
+				var currentNode = document.createElement("option");
+			
+				if (document.getElementById('selectCommune').childNodes.length == 0) {
+					currentNode.selected = "selected";
+				}
+				currentNode.value = communeId;
+				currentNode.innerHTML = json.communes[communeId];
+				document.getElementById('selectCommune').appendChild(currentNode);
+			}
+		}
+		executeFunctions(communesSubFunctions);
+	});
+}
+
+function updateStreets() {
+	executeFunctions(generalPreFunctions);
+	var communeId = document.getElementById('selectCommune').value;
+	
+	parent.mb_ajax_json(phpUrl, {"command":"getStreets", "communeId":communeId}, function (json, status) {
+		executeFunctions(generalSubFunctions);
+
+		removeChildNodes(document.getElementById('selectStreet'));
+
+		for (var streetId in json.streets) {
+			if (typeof(json.streets[streetId]) != 'function') {
+				var currentNode = document.createElement("option");
+	
+				if (document.getElementById('selectStreet').childNodes.length == 0) {
+					currentNode.selected = "selected";
+				}
+				
+				currentNode.value = json.streets[streetId];
+				currentNode.innerHTML = json.streets[streetId];
+				document.getElementById('selectStreet').appendChild(currentNode);
+			}
+		}
+		executeFunctions(streetSubFunctions);
+	});
+}
+
+function updateDistricts() {
+	executeFunctions(generalPreFunctions);
+
+	var communeId = document.getElementById('selectCommune').value;
+	
+	parent.mb_ajax_json(phpUrl, {"command":"getDistricts", "communeId":communeId}, function (districtObject, status) {
+		executeFunctions(generalSubFunctions);
+
+		removeChildNodes(document.getElementById('selectDistrict'));
+
+		for (var districtId in districtObject.districts) {
+			if (typeof(districtObject.districts[districtId]) != 'function') {
+				var currentNode = document.createElement("option");
+	
+				currentNode.value = districtId;
+	
+				if (document.getElementById('selectDistrict').childNodes.length == 0) {
+					currentNode.selected = "selected";
+				}
+				
+				currentNode.value = districtObject.districts[districtId];
+				currentNode.innerHTML = districtObject.districts[districtId];
+				document.getElementById('selectDistrict').appendChild(currentNode);
+			}
+		}
+		executeFunctions(districtSubFunctions);
+	});
+}
+
+function updateNumbers() {
+	executeFunctions(generalPreFunctions);
+
+	var streetName = document.getElementById('selectStreet').value;
+	var communeId = document.getElementById('selectCommune').value;
+
+	parent.mb_ajax_json(phpUrl, {"command":"getNumbers", "communeId":communeId, "streetName":streetName, "numberOfResults":numberOfResults}, function (json, status) {
+		executeFunctions(generalSubFunctions);
+		houseLocation = {};
+		var resultString = "";
+		if (getSize(json.houseNumbers) > 0) {
+			if (json.limited === true) {
+				resultString += tooManyResultsString;
+			}
+			for (var houseNumber in json.houseNumbers) {
+				if (typeof(json.houseNumbers[houseNumber]) != 'function') {
+					houseLocation[houseNumber] = new parent.Point(json.houseNumbers[houseNumber].x, json.houseNumbers[houseNumber].y);
+					resultString += "<b style=\"cursor:pointer\" onclick=\"zoomToHouseNumber('"+houseNumber+"')\" onmouseover=\"highlightHouseNumber('"+houseNumber+"')\" onmouseout=\"removeHighlight()\">"+houseNumber+"</b>&nbsp;&nbsp; ";
+				}
+			}
+		}
+		else {
+			resultString += noResultsString;
+		}
+		document.getElementById("divResults").innerHTML = resultString;
+		executeFunctions(numberSubFunctions);
+	});
+}
+
+function updateParcels() {
+	executeFunctions(generalPreFunctions);
+	
+	var districtId = document.getElementById('selectDistrict').value;
+	var inputParcel1 = document.getElementById('inputParcel1').value;
+	var inputParcel2 = document.getElementById('inputParcel2').value;
+
+
+	parent.mb_ajax_json(phpUrl, {"command":"getLandparcelsByDistrict", "districtId":districtId, "parcelNumber1":inputParcel1, "parcelNumber2":inputParcel2, "numberOfResults":numberOfResults}, function (json, status) {
+		executeFunctions(generalSubFunctions);
+
+		parcelLocation = {};
+		var resultString = "";
+		if (getSize(json.landparcels) > 0) {
+			if (json.limited === true) {
+				resultString += tooManyResultsString;
+			}
+			resultString += "<ol>";
+			for (var parcelId in json.landparcels) {
+				if (typeof(json.landparcels[parcelId]) != 'function') {
+					parcelLocation[parcelId] = new parent.Point(json.landparcels[parcelId].x, json.landparcels[parcelId].y);
+					resultString += "<li style=\"cursor:pointer\" onclick=\"zoomToParcel('"+parcelId+"')\" onmouseover=\"highlightParcel('"+parcelId+"')\" onmouseout=\"removeHighlight()\">"+parcelId+"</li>";
+				}
+			}
+			resultString += "</ol>";
+		}
+		else {
+			resultString += noResultsString;
+		}
+		document.getElementById("divResults").innerHTML = resultString;
+		executeFunctions(numberSubFunctions);
+	});
+}
+
+function updateOwner() {
+	var ownerQueryString = document.getElementById('inputOwner').value;
+	var communeId = document.getElementById('selectCommune').value;
+
+	document.getElementById("divResults").innerHTML = "";
+	document.getElementById('selectCommune').removeAttribute("disabled");
+	document.getElementById('inputOwner').removeAttribute("disabled");
+	document.getElementById('inputOwnerButton').removeAttribute("disabled");
+	
+	if (ownerQueryString != "") {
+		executeFunctions(generalPreFunctions);
+		parent.mb_ajax_json(phpUrl, {"command":"getLandparcelsByOwner", "communeId":communeId, "ownerQueryString":ownerQueryString, "numberOfResults":numberOfResults}, function (json, status) {
+			executeFunctions(generalSubFunctions);
+
+			parcelLocation = {};
+			var resultString = "";
+			if (getSize(json.landparcels) > 0) {
+				if (json.limited === true) {
+					resultString += tooManyResultsString;
+				}
+				resultString += "<ol>";
+				for (var i=0; i < json.landparcels.length; i++) {
+					var parcelId = json.landparcels[i].landparcelId;
+					parcelLocation[parcelId] = new parent.Point(json.landparcels[i].x, json.landparcels[i].y);
+					resultString += "<li style=\"cursor:pointer\" onclick=\"zoomToParcel('"+parcelId+"')\" onmouseover=\"highlightParcel('"+parcelId+"')\" onmouseout=\"removeHighlight()\">"+json.landparcels[i].owner+ " (" + parcelId+")</li>";
+				}
+				resultString += "</ol>";
+			}
+			else {
+				resultString += noResultsString;
+			}
+			document.getElementById("divResults").innerHTML = resultString;
+			executeFunctions(numberSubFunctions);
+	
+		});
+	}
+}
+// -->
+</script>
+</head>
+<body>
+<form>
+<select class='selectCommune' id='selectCommune' onchange='executeFunctions(communesSubFunctions)'></select>
+<select class='selectStreet' id='selectStreet' onchange='executeFunctions(streetSubFunctions);' size=5 disabled></select>
+<select class='selectDistrict' id='selectDistrict' onchange='executeFunctions(districtSubFunctions);' size=5 disabled></select>
+<div id='divParcel' class='divParcel'>
+Flur: <input type='input' class='inputParcel1' id='inputParcel1' disabled></select>
+Flstz: <input type='input' class='inputParcel2' id='inputParcel2' disabled></select>
+<input type='button' id='inputParcelButton' value='?' onclick='executeFunctions(parcelSubFunctions);'>
+</div>
+<div id='divOwner' class='divOwner'>
+Eigent&uuml;mer: <input type='input' class='inputOwner' id='inputOwner' disabled></select>
+<input type='button' id='inputOwnerButton' value='?' onclick='executeFunctions(ownerSubFunctions);'>
+</div>
+</form>
+<div class='divResults' id='divResults'></div>
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_highlightPOI.php
===================================================================
--- branches/print_dev/http/javascripts/mod_highlightPOI.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_highlightPOI.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,148 +1,148 @@
-<?php
-# $Id$ 
-# http://www.mapbender.org/index.php/mod_highlightPOI.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-echo "var mod_highlightPOI_target = '".$e_target[0]."';";
-
-include('../include/dyn_js.php');
-
-?>
-try{
-	if (poi_image){}
-}
-catch(e){
-	poi_image = '../img/redball.gif';
-}
-
-try{
-	if (poi_width){}
-}
-catch(e){
-	poi_width = 14;
-}
-
-try{
-	if (poi_height){}
-}
-catch(e){
-	poi_height = 14;
-}
-
-try{
-	if (poi_style){}
-}
-catch(e){
-	poi_style = 'background-color:white;font-weight: bold;color:black;font-family:Arial;';
-}
-
-eventInit.register(function () {
-	mod_highlightPOI_init();
-});
-eventAfterMapRequest.register(function () {
-	mod_highlightPOI_draw();
-});
-
-var mod_highlightPOI_minx;
-var mod_highlightPOI_miny;
-var mod_highlightPOI_maxx;
-var mod_highlightPOI_maxy;
-var mod_highlightPOI_name = new Array();
-var mod_highlightPOI_x = new Array();
-var mod_highlightPOI_y = new Array();
-var mod_highlightPOI_params = new Array();
-var myPOI;
-
-function mod_highlightPOI_init(){
-		var myPOI = "<?php if (CHARSET == 'UTF-8'){
-				echo preg_replace("/\n/", "<br>", $_SESSION['mb_myPOI']);
-			}else{
-				echo preg_replace("/\n/", "<br>", utf8_decode($_SESSION['mb_myPOI']));
-			} 
-			?>";
-
-	if(myPOI != ""){
- 		mod_highlightPOI_params = myPOI.split("|");
-
-	  
-  
-	  for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
-	    if(i==0){
-	      mod_highlightPOI_name[i] = mod_highlightPOI_params[i];
-	      mod_highlightPOI_minx = parseInt(mod_highlightPOI_params[i+1]);
-	      mod_highlightPOI_miny = parseInt(mod_highlightPOI_params[i+2]);
-	      mod_highlightPOI_maxx = parseInt(mod_highlightPOI_params[i+1]);
-	      mod_highlightPOI_maxy = parseInt(mod_highlightPOI_params[i+2]);
-	    }  
-	    else{
-	      mod_highlightPOI_name[i] = mod_highlightPOI_params[i];
-	      if(mod_highlightPOI_params[i+1] < mod_highlightPOI_minx){
-	        mod_highlightPOI_minx = parseInt(mod_highlightPOI_params[i+1]);
-	      }
-	      if(mod_highlightPOI_params[i+2] < mod_highlightPOI_miny){
-	        mod_highlightPOI_miny = parseInt(mod_highlightPOI_params[i+2]);
-	      }
-	      if(mod_highlightPOI_params[i+1] > mod_highlightPOI_maxx){
-	        mod_highlightPOI_maxx = parseInt(mod_highlightPOI_params[i+1]);
-	      }
-	      if(mod_highlightPOI_params[i+2] > mod_highlightPOI_maxy){
-	        mod_highlightPOI_maxy = parseInt(mod_highlightPOI_params[i+2]);
-	      }  
-	    }
-	  }
-	  if((mod_highlightPOI_maxx - mod_highlightPOI_minx) < 100){
-	    mod_highlightPOI_minx -= 50;
-	    mod_highlightPOI_maxx += 50;
-	  }
-	  if((mod_highlightPOI_maxy - mod_highlightPOI_miny) < 100){
-	    mod_highlightPOI_miny -= 50;
-	    mod_highlightPOI_maxy += 50;
-	  }
-	  mod_highlightPOI_minx -= 50;
-	  mod_highlightPOI_maxx += 50;
-	  mod_highlightPOI_miny -= 50;
-	  mod_highlightPOI_maxy += 50;
-	  //mb_calculateExtent( mod_highlightPOI_target,mod_highlightPOI_minx,mod_highlightPOI_miny,mod_highlightPOI_maxx,mod_highlightPOI_maxy);
-  }
-}
-
-
-function mod_highlightPOI_draw(){
-  var ind = getMapObjIndexByName(mod_highlightPOI_target);
-  var div = new DivTag(mod_highlightPOI_target+'permanent', mb_mapObj[ind].frameName, 
-  	{
-		"position":"absolute",
-		"width":mb_mapObj[ind].width+"px",
-		"height":mb_mapObj[ind].height+"px",
-		"top":0,
-		"left":0,
-		"width":0,
-		"height":0,
-		"visibility":"visible"
-	});
-  var tagSource = "";
-  for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
-    var pos = makeRealWorld2mapPos(mod_highlightPOI_target,mod_highlightPOI_params[i+1], mod_highlightPOI_params[i+2]);
-    tagSource += "<div style='z-index:13;position:absolute;left:"+(pos[0]-Math.round(0.5*poi_width))+"px;top:"+(pos[1]-Math.round(0.5*poi_height))+"px'>";
-    tagSource += "<img src='"+poi_image+"'>";
-    tagSource += "<span style='"+poi_style+"'>"+mod_highlightPOI_params[i]+"<span>";
-    tagSource += "</div>";
-  }
-  div.write(tagSource);
-}
+<?php
+# $Id$ 
+# http://www.mapbender.org/index.php/mod_highlightPOI.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+echo "var mod_highlightPOI_target = '".$e_target[0]."';";
+
+include('../include/dyn_js.php');
+
+?>
+try{
+	if (poi_image){}
+}
+catch(e){
+	poi_image = '../img/redball.gif';
+}
+
+try{
+	if (poi_width){}
+}
+catch(e){
+	poi_width = 14;
+}
+
+try{
+	if (poi_height){}
+}
+catch(e){
+	poi_height = 14;
+}
+
+try{
+	if (poi_style){}
+}
+catch(e){
+	poi_style = 'background-color:white;font-weight: bold;color:black;font-family:Arial;';
+}
+
+eventInit.register(function () {
+	mod_highlightPOI_init();
+});
+eventAfterMapRequest.register(function () {
+	mod_highlightPOI_draw();
+});
+
+var mod_highlightPOI_minx;
+var mod_highlightPOI_miny;
+var mod_highlightPOI_maxx;
+var mod_highlightPOI_maxy;
+var mod_highlightPOI_name = new Array();
+var mod_highlightPOI_x = new Array();
+var mod_highlightPOI_y = new Array();
+var mod_highlightPOI_params = new Array();
+var myPOI;
+
+function mod_highlightPOI_init(){
+		var myPOI = "<?php if (CHARSET == 'UTF-8'){
+				echo preg_replace("/\n/", "<br>", $_SESSION['mb_myPOI']);
+			}else{
+				echo preg_replace("/\n/", "<br>", utf8_decode($_SESSION['mb_myPOI']));
+			} 
+			?>";
+
+	if(myPOI != ""){
+ 		mod_highlightPOI_params = myPOI.split("|");
+
+	  
+  
+	  for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
+	    if(i==0){
+	      mod_highlightPOI_name[i] = mod_highlightPOI_params[i];
+	      mod_highlightPOI_minx = parseInt(mod_highlightPOI_params[i+1]);
+	      mod_highlightPOI_miny = parseInt(mod_highlightPOI_params[i+2]);
+	      mod_highlightPOI_maxx = parseInt(mod_highlightPOI_params[i+1]);
+	      mod_highlightPOI_maxy = parseInt(mod_highlightPOI_params[i+2]);
+	    }  
+	    else{
+	      mod_highlightPOI_name[i] = mod_highlightPOI_params[i];
+	      if(mod_highlightPOI_params[i+1] < mod_highlightPOI_minx){
+	        mod_highlightPOI_minx = parseInt(mod_highlightPOI_params[i+1]);
+	      }
+	      if(mod_highlightPOI_params[i+2] < mod_highlightPOI_miny){
+	        mod_highlightPOI_miny = parseInt(mod_highlightPOI_params[i+2]);
+	      }
+	      if(mod_highlightPOI_params[i+1] > mod_highlightPOI_maxx){
+	        mod_highlightPOI_maxx = parseInt(mod_highlightPOI_params[i+1]);
+	      }
+	      if(mod_highlightPOI_params[i+2] > mod_highlightPOI_maxy){
+	        mod_highlightPOI_maxy = parseInt(mod_highlightPOI_params[i+2]);
+	      }  
+	    }
+	  }
+	  if((mod_highlightPOI_maxx - mod_highlightPOI_minx) < 100){
+	    mod_highlightPOI_minx -= 50;
+	    mod_highlightPOI_maxx += 50;
+	  }
+	  if((mod_highlightPOI_maxy - mod_highlightPOI_miny) < 100){
+	    mod_highlightPOI_miny -= 50;
+	    mod_highlightPOI_maxy += 50;
+	  }
+	  mod_highlightPOI_minx -= 50;
+	  mod_highlightPOI_maxx += 50;
+	  mod_highlightPOI_miny -= 50;
+	  mod_highlightPOI_maxy += 50;
+	  //mb_calculateExtent( mod_highlightPOI_target,mod_highlightPOI_minx,mod_highlightPOI_miny,mod_highlightPOI_maxx,mod_highlightPOI_maxy);
+  }
+}
+
+
+function mod_highlightPOI_draw(){
+  var ind = getMapObjIndexByName(mod_highlightPOI_target);
+  var div = new DivTag(mod_highlightPOI_target+'permanent', mb_mapObj[ind].frameName, 
+  	{
+		"position":"absolute",
+		"width":mb_mapObj[ind].width+"px",
+		"height":mb_mapObj[ind].height+"px",
+		"top":0,
+		"left":0,
+		"width":0,
+		"height":0,
+		"visibility":"visible"
+	});
+  var tagSource = "";
+  for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
+    var pos = makeRealWorld2mapPos(mod_highlightPOI_target,mod_highlightPOI_params[i+1], mod_highlightPOI_params[i+2]);
+    tagSource += "<div style='z-index:13;position:absolute;left:"+(pos[0]-Math.round(0.5*poi_width))+"px;top:"+(pos[1]-Math.round(0.5*poi_height))+"px'>";
+    tagSource += "<img src='"+poi_image+"'>";
+    tagSource += "<span style='"+poi_style+"'>"+mod_highlightPOI_params[i]+"<span>";
+    tagSource += "</div>";
+  }
+  div.write(tagSource);
+}

Modified: branches/print_dev/http/javascripts/mod_home.php
===================================================================
--- branches/print_dev/http/javascripts/mod_home.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_home.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,39 +1,39 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_home
-# 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.
-?>
-function mod_home_init(){
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-echo "var url = '".LOGIN."';";
-echo "var name = '".urlencode($_SESSION["mb_user_name"])."';";
-echo "var pw = '".$_SESSION["mb_user_password"]."';";
-
-?>	
-	var str = "<form name='myGuiList_form' method='POST' action='' target='_self'>";
-	str += "<input type='hidden' name='name' value='"+name+"' />";
-	str += "<input type='hidden' name='password' value='"+pw+"' />";
-	str += "</form>";
-	
-	var mod_home_div = document.createElement('div');
-	mod_home_div.setAttribute("id","mod_home_d");
-	var tmp = document.body.appendChild(mod_home_div);
-	document.getElementById("mod_home_d").innerHTML = str;
-	document.forms.myGuiList_form.action = url;
-	document.forms.myGuiList_form.submit();
-	//document.location.href = url + "?name=" + name + "&password=" + pw;	
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_home
+# 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.
+?>
+function mod_home_init(){
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+echo "var url = '".LOGIN."';";
+echo "var name = '".urlencode($_SESSION["mb_user_name"])."';";
+echo "var pw = '".$_SESSION["mb_user_password"]."';";
+
+?>	
+	var str = "<form name='myGuiList_form' method='POST' action='' target='_self'>";
+	str += "<input type='hidden' name='name' value='"+name+"' />";
+	str += "<input type='hidden' name='password' value='"+pw+"' />";
+	str += "</form>";
+	
+	var mod_home_div = document.createElement('div');
+	mod_home_div.setAttribute("id","mod_home_d");
+	var tmp = document.body.appendChild(mod_home_div);
+	document.getElementById("mod_home_d").innerHTML = str;
+	document.forms.myGuiList_form.action = url;
+	document.forms.myGuiList_form.submit();
+	//document.location.href = url + "?name=" + name + "&password=" + pw;	
 }
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_initWmc.php
===================================================================
--- branches/print_dev/http/javascripts/mod_initWmc.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_initWmc.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,116 +1,116 @@
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
-require_once(dirname(__FILE__) . "/../classes/class_kml.php");
-require_once(dirname(__FILE__) . "/../classes/class_administration.php");
-
-if ($_SESSION['mb_myWmc'] && $_SESSION['mb_myWmc_action'] && 
-	in_array($_SESSION['mb_myWmc_action'], 
-	array("load", "merge", "append"))) {
-	
-	$action = $_SESSION['mb_myWmc_action'];
-	$wmc_id = $_SESSION['mb_myWmc'];
-}
-$user = $_SESSION['mb_user_id'];
-$meetingPointId = $_SESSION['mb_myKml'];
-
-$x = false;
-$y = false;
-$icon = false;
-$alt = false;
-$url = false;
-
-$adm = new administration();
-
-//KML
-if (isset($meetingPointId)) {
-	$sql = "SELECT * FROM mb_meetingpoint WHERE mb_meetingpoint_id = $1";
-	$v = array($meetingPointId);
-	$t = array('s');
-	$res = db_prep_query($sql,$v,$t);
-	if($row = db_fetch_array($res)){
-		$user = $row['fkey_mb_user_id'];
-		$password = $row['mb_user_password'];
-		$gui = $row['fkey_gui_id'];
-		$wmc_id = $row['fkey_wmc_id'];
-		$kml_doc = $row['kml'];
-		
-		$kml = new kml("", "", 0, 0, "");
-		$value = $kml->createObjFromKML($kml_doc);
-		
-		$x = $kml->x;
-		$y = $kml->y;
-		$icon = $kml->icon;
-		if ($kml->title) {
-			if ($kml->description) $alt = $kml->title . ", " .$kml->description;
-			else $alt = $kml->title;
-		}
-		else $alt = $kml->description;
-
-		if (mb_ereg("^.*,[[:space:]]((([[:alpha:]]+://)|(www.))[^<>[:space:]]+[[:alnum:]/]).*$", $kml->title)) {
-			$url = mb_ereg_replace("^.*,[[:space:]]((([[:alpha:]]+://)|(www.))[^<>[:space:]]+[[:alnum:]/]).*$", "\\1", $kml->title);
-			if (mb_substr($url, 0, 4) == "www.") {
-				$url = "http://" . $url;
-			}
-		}
-	}
-	else {
-		$js_error .= "alert('Meetingpoint ID id ".$meetingPointId." is not valid. Default GUI will be loaded instead.');"; 
-	}
-}
-	
-//WMC
-if (isset($wmc_id)) {
-	$myInitWmc = new wmc();
-	$success = $myInitWmc->createFromDb($wmc_id);
-	if ($success) {
-
-		$js_wmc = implode("", $myInitWmc->toJavaScript());
-		new mb_exception("WMC JS: " . $js_wmc);
-		
-		if (!empty($x) && !empty($y) && !empty($icon)) {
-			
-			$js_kml .= "var myPoint = realToMap('".$e_target[0]."', new Point(".$x.",".$y."));\n";
-
-			// 7 is half the width of pin.png
-			$js_kml .= "myPoint.x -= 7;";
-			// 20 is the height of pin.png
-			$js_kml .= "myPoint.y -= 20;";
-
-			$js_kml .= "var meetingPointLogoStyle = {'position':'absolute', 'top':0, 'left':0, 'z-index':100, 'font-size':'10px'};\n"; 
-			$js_kml .= "meetingPointLogoTag = new DivTag('meeting_logo', '".$e_target[0]."', meetingPointLogoStyle);\n";
-			$js_img .= "<img id='meeting_img' border='0' src='".$icon."' title='".$alt."'>";
-			if ($url) {
-				$js_img = "<a href='".$url."' target='_blank'>" . $js_img . "</a>";
-			}
-			$js_kml .= "var meetingPointLogoText = \"" . $js_img . "\";\n";
-			$js_kml .= "meetingPointLogoTag.write(meetingPointLogoText);\n";
-			$js_kml .= "var meeting_img = window.frames['".$e_target[0]."'].document.getElementById('meeting_img');";
-			$js_kml .= "meeting_img.style.position = 'absolute';";
-			$js_kml .= "meeting_img.style.top = myPoint.y;";
-			$js_kml .= "meeting_img.style.left = myPoint.x;";
-			$js_kml .= "mb_registerPanSubElement('meeting_logo');";
-		}
-	}
-	else {
-		$js_error .= "alert('WMC id ".$wmc_id." is not valid. Default GUI will be loaded instead.');"; 
-	}
-}
-echo "function mod_initWMC_init() {";
-echo $js_wmc;
-echo $js_kml;
-echo $js_error;
-echo "}";
-
-echo "function addFlag() {";
-echo $js_kml;
-echo "}";
-
-
-?>
-
-mb_registerInitFunctions("mod_initWMC()");
-function mod_initWMC(){
-	mod_initWMC_init();
-	mb_registerSubFunctions('addFlag()');
-} 
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
+require_once(dirname(__FILE__) . "/../classes/class_kml.php");
+require_once(dirname(__FILE__) . "/../classes/class_administration.php");
+
+if ($_SESSION['mb_myWmc'] && $_SESSION['mb_myWmc_action'] && 
+	in_array($_SESSION['mb_myWmc_action'], 
+	array("load", "merge", "append"))) {
+	
+	$action = $_SESSION['mb_myWmc_action'];
+	$wmc_id = $_SESSION['mb_myWmc'];
+}
+$user = $_SESSION['mb_user_id'];
+$meetingPointId = $_SESSION['mb_myKml'];
+
+$x = false;
+$y = false;
+$icon = false;
+$alt = false;
+$url = false;
+
+$adm = new administration();
+
+//KML
+if (isset($meetingPointId)) {
+	$sql = "SELECT * FROM mb_meetingpoint WHERE mb_meetingpoint_id = $1";
+	$v = array($meetingPointId);
+	$t = array('s');
+	$res = db_prep_query($sql,$v,$t);
+	if($row = db_fetch_array($res)){
+		$user = $row['fkey_mb_user_id'];
+		$password = $row['mb_user_password'];
+		$gui = $row['fkey_gui_id'];
+		$wmc_id = $row['fkey_wmc_id'];
+		$kml_doc = $row['kml'];
+		
+		$kml = new kml("", "", 0, 0, "");
+		$value = $kml->createObjFromKML($kml_doc);
+		
+		$x = $kml->x;
+		$y = $kml->y;
+		$icon = $kml->icon;
+		if ($kml->title) {
+			if ($kml->description) $alt = $kml->title . ", " .$kml->description;
+			else $alt = $kml->title;
+		}
+		else $alt = $kml->description;
+
+		if (mb_ereg("^.*,[[:space:]]((([[:alpha:]]+://)|(www.))[^<>[:space:]]+[[:alnum:]/]).*$", $kml->title)) {
+			$url = mb_ereg_replace("^.*,[[:space:]]((([[:alpha:]]+://)|(www.))[^<>[:space:]]+[[:alnum:]/]).*$", "\\1", $kml->title);
+			if (mb_substr($url, 0, 4) == "www.") {
+				$url = "http://" . $url;
+			}
+		}
+	}
+	else {
+		$js_error .= "alert('Meetingpoint ID id ".$meetingPointId." is not valid. Default GUI will be loaded instead.');"; 
+	}
+}
+	
+//WMC
+if (isset($wmc_id)) {
+	$myInitWmc = new wmc();
+	$success = $myInitWmc->createFromDb($wmc_id);
+	if ($success) {
+
+		$js_wmc = implode("", $myInitWmc->toJavaScript());
+		new mb_exception("WMC JS: " . $js_wmc);
+		
+		if (!empty($x) && !empty($y) && !empty($icon)) {
+			
+			$js_kml .= "var myPoint = realToMap('".$e_target[0]."', new Point(".$x.",".$y."));\n";
+
+			// 7 is half the width of pin.png
+			$js_kml .= "myPoint.x -= 7;";
+			// 20 is the height of pin.png
+			$js_kml .= "myPoint.y -= 20;";
+
+			$js_kml .= "var meetingPointLogoStyle = {'position':'absolute', 'top':0, 'left':0, 'z-index':100, 'font-size':'10px'};\n"; 
+			$js_kml .= "meetingPointLogoTag = new DivTag('meeting_logo', '".$e_target[0]."', meetingPointLogoStyle);\n";
+			$js_img .= "<img id='meeting_img' border='0' src='".$icon."' title='".$alt."'>";
+			if ($url) {
+				$js_img = "<a href='".$url."' target='_blank'>" . $js_img . "</a>";
+			}
+			$js_kml .= "var meetingPointLogoText = \"" . $js_img . "\";\n";
+			$js_kml .= "meetingPointLogoTag.write(meetingPointLogoText);\n";
+			$js_kml .= "var meeting_img = window.frames['".$e_target[0]."'].document.getElementById('meeting_img');";
+			$js_kml .= "meeting_img.style.position = 'absolute';";
+			$js_kml .= "meeting_img.style.top = myPoint.y;";
+			$js_kml .= "meeting_img.style.left = myPoint.x;";
+			$js_kml .= "mb_registerPanSubElement('meeting_logo');";
+		}
+	}
+	else {
+		$js_error .= "alert('WMC id ".$wmc_id." is not valid. Default GUI will be loaded instead.');"; 
+	}
+}
+echo "function mod_initWMC_init() {";
+echo $js_wmc;
+echo $js_kml;
+echo $js_error;
+echo "}";
+
+echo "function addFlag() {";
+echo $js_kml;
+echo "}";
+
+
+?>
+
+mb_registerInitFunctions("mod_initWMC()");
+function mod_initWMC(){
+	mod_initWMC_init();
+	mb_registerSubFunctions('addFlag()');
+} 

Modified: branches/print_dev/http/javascripts/mod_insertKmlIntoDb.php
===================================================================
--- branches/print_dev/http/javascripts/mod_insertKmlIntoDb.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_insertKmlIntoDb.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,98 +1,98 @@
-<?php
-#$Id$
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include(dirname(__FILE__) . "/../classes/class_kml.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<!-- 
-Licensing: See the GNU General Public License for more details.
-http://www.gnu.org/copyleft/gpl.html
-or:
-mapbender/licence/ 
--->
-
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>MB2 - <?php  echo  $gui_id;?></title>
-</head>
-<body>
-<?php
-if ($_POST["data"]) {
-	
-	$d = explode("____", $_POST["data"]);	
-	$wmc_id = $d[0];
-	$x = $d[1];
-	$y = $d[2];
-	$icon = $d[3];
-	$gui_id = $d[4];
-	$title_array = array();
-	if ($_POST['name']) $title_array[count($title_array)] = $_POST['name']; 
-	if ($_POST['street']) $title_array[count($title_array)] = $_POST['street'];
-	if ($_POST['postcode']) {
-		if ($_POST['city']) {
-			$title_array[count($title_array)] = $_POST['postcode'] . " " . $_POST['city'];
-		}
-		else {
-			$title_array[count($title_array)] = $_POST['postcode'];
-		}
-	}
-	elseif ($_POST['city']) {
-		$title_array[count($title_array)] = $_POST['city'];
-	}
-	if ($_POST['website']) $title_array[count($title_array)] = $_POST['website'];
-
-	$title = implode(", ", $title_array);	
-	$description = $_POST['description']; 
-	
-	$kml = new kml($title, $description, $x, $y, $icon);
-	$kml->createKMLFromObj();
-	
-	$sql = "INSERT INTO mb_meetingpoint VALUES ($1, $2, $3, $4, $5, $6)";
-	$v = array($kml->kml_id, $wmc_id, preg_replace("/&/", "&#38;" , html_entity_decode($kml->kml)), $_SESSION["mb_user_id"], $_SESSION["mb_user_password"], $gui_id);
-	$t = array('s', 's', 's', 'i', 's', 's');
-	$res = db_prep_query($sql, $v, $t);
-	
-	if (db_error()) {
-		echo "<script>var title = \"" . $title . "\";alert(\"Error while saving KML document \" + title + \"! ".db_error()."\");</script>";
-	}
-	else {
-		if ($alert) {
-			 echo "<script>var title = \"" . $title . "\";alert(\"KML document \" + title + \"has been saved!\")</script>";
-		}
-	}
-	$filename = "../tmp/".$kml->kml_id.'.kml';
-	$handle = fopen($filename, "w");
-	fputs($handle, preg_replace("/&/", "&#38;" , html_entity_decode($kml->kml)));
-	fclose($handle);
-	
-	echo "Please feel free to add the <a href = 'http://".$_SERVER['HTTP_HOST']."/mburl/".$kml->kml_id."'>link</a> to your meeting point to your website.<br><br>";
-	echo "<a href='".$filename."'>kml</a>";
-}
-?>
-
-</body>
-</html>
+<?php
+#$Id$
+#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include(dirname(__FILE__) . "/../classes/class_kml.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<!-- 
+Licensing: See the GNU General Public License for more details.
+http://www.gnu.org/copyleft/gpl.html
+or:
+mapbender/licence/ 
+-->
+
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>MB2 - <?php  echo  $gui_id;?></title>
+</head>
+<body>
+<?php
+if ($_POST["data"]) {
+	
+	$d = explode("____", $_POST["data"]);	
+	$wmc_id = $d[0];
+	$x = $d[1];
+	$y = $d[2];
+	$icon = $d[3];
+	$gui_id = $d[4];
+	$title_array = array();
+	if ($_POST['name']) $title_array[count($title_array)] = $_POST['name']; 
+	if ($_POST['street']) $title_array[count($title_array)] = $_POST['street'];
+	if ($_POST['postcode']) {
+		if ($_POST['city']) {
+			$title_array[count($title_array)] = $_POST['postcode'] . " " . $_POST['city'];
+		}
+		else {
+			$title_array[count($title_array)] = $_POST['postcode'];
+		}
+	}
+	elseif ($_POST['city']) {
+		$title_array[count($title_array)] = $_POST['city'];
+	}
+	if ($_POST['website']) $title_array[count($title_array)] = $_POST['website'];
+
+	$title = implode(", ", $title_array);	
+	$description = $_POST['description']; 
+	
+	$kml = new kml($title, $description, $x, $y, $icon);
+	$kml->createKMLFromObj();
+	
+	$sql = "INSERT INTO mb_meetingpoint VALUES ($1, $2, $3, $4, $5, $6)";
+	$v = array($kml->kml_id, $wmc_id, preg_replace("/&/", "&#38;" , html_entity_decode($kml->kml)), $_SESSION["mb_user_id"], $_SESSION["mb_user_password"], $gui_id);
+	$t = array('s', 's', 's', 'i', 's', 's');
+	$res = db_prep_query($sql, $v, $t);
+	
+	if (db_error()) {
+		echo "<script>var title = \"" . $title . "\";alert(\"Error while saving KML document \" + title + \"! ".db_error()."\");</script>";
+	}
+	else {
+		if ($alert) {
+			 echo "<script>var title = \"" . $title . "\";alert(\"KML document \" + title + \"has been saved!\")</script>";
+		}
+	}
+	$filename = "../tmp/".$kml->kml_id.'.kml';
+	$handle = fopen($filename, "w");
+	fputs($handle, preg_replace("/&/", "&#38;" , html_entity_decode($kml->kml)));
+	fclose($handle);
+	
+	echo "Please feel free to add the <a href = 'http://".$_SERVER['HTTP_HOST']."/mburl/".$kml->kml_id."'>link</a> to your meeting point to your website.<br><br>";
+	echo "<a href='".$filename."'>kml</a>";
+}
+?>
+
+</body>
+</html>

Modified: branches/print_dev/http/javascripts/mod_insertLayerPreviewIntoDb.php
===================================================================
--- branches/print_dev/http/javascripts/mod_insertLayerPreviewIntoDb.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_insertLayerPreviewIntoDb.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,163 +1,163 @@
-<?php
-#$Id$
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-#include(dirname(__FILE__)."/../../conf/geoportal.conf");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_connector.php");
-
-function savePreview($fileName, $fileContent) {
-	if (strlen($fileContent) > 0) {
-		$fileMapImg = fopen("..".LAYER_PREVIEW_URL."/".$fileName, 'w+');
-		if ($fileMapImg) {
-			rewind($fileMapImg);
-			$bytesWritten = fwrite($fileMapImg, $fileContent);
-			if ($bytesWritten) {
-				fflush($fileMapImg);
-				ftruncate($fileMapImg, ftell($fileMapImg));
-				fclose($fileMapImg);
-				return true;
-			}
-			$e = new mb_exception("..".LAYER_PREVIEW_URL."/".$fileName.": 0 bytes written.");
-			return false;
-		}
-		$e = new mb_exception("..".LAYER_PREVIEW_URL."/".$fileName.": could not open.");
-		return false;
-	}
-	$e = new mb_exception($fileName.": no file content.");
-	return false;
-}
-
-if ($_POST["data"]) {
-	$d = explode("____", $_POST["data"]);	
-
-	$mapurl = $d[0];
-	$legendurl = $d[1];
-	
-	$mapurl = eregi_replace("(&width=)[0-9]+($|[^0-9])", "\\1".LAYER_PREVIEW_WIDTH."\\2", $mapurl);
-	$mapurl = eregi_replace("(&height=)[0-9]+($|[^0-9])", "\\1".LAYER_PREVIEW_HEIGHT."\\2", $mapurl);
-		
-	$adm = new administration();
-	$layer_id = $_SESSION['layer_preview'];
-	if (!$layer_id) {
-		 echo "<script>alert('Could not find wms: ".$wms_getmap."');</script>";
-	}
-	else {
-		session_write_close();
-		$con1 = new connector($mapurl);
-		$fileNameMap = $layer_id."_layer_map_preview.png";
-		$fileContentMap = $con1->file;
-		$success = savePreview($fileNameMap, $fileContentMap);
-		if (!$success) $fileNameMap = "";
-		
-		$con2 = new	connector($legendurl);
-		$fileNameLegend = $layer_id."_layer_legend_preview.png";
-		$fileContentLegend = $con2->file;
-		$success = savePreview($fileNameLegend, $fileContentLegend);
-		if (!$success) $fileNameLegend = "";
- 		
-//		$rlp_4326_box = array(6.10988942079081,48.987785376052,8.58790010810365,50.9273496139233);
-		$rlp_4326_box = array(6.05,48.9,8.6,50.96);
-		
-		$sql = "SELECT * FROM layer_epsg WHERE fkey_layer_id = $1 AND epsg = 'EPSG:4326'";
-		$v = array($layer_id);
-		$t = array('i');
-		$res = db_prep_query($sql, $v, $t);
-		$row = db_fetch_array($res);
-		if ($row['minx'] && $row['miny'] && $row['maxx'] && $row['maxy']) {
-			$extent_layer_id = $layer_id;
-			$layer_4326_box = array($row['minx'], $row['miny'], $row['maxx'], $row['maxy']);
-		}
-		else {
-			$sql = "SELECT * FROM (SELECT fkey_wms_id FROM layer WHERE layer_id = $1 LIMIT 1) AS w, layer_epsg AS e, layer AS l WHERE l.fkey_wms_id = w.fkey_wms_id AND l.layer_pos = 0 AND l.layer_id = e.fkey_layer_id AND e.epsg = 'EPSG:4326'";
-			$v = array($layer_id);
-			$t = array('i');
-			$res = db_prep_query($sql, $v, $t);
-			$row = db_fetch_array($res);
-			if ($row['epsg'] && $row['minx'] && $row['miny'] && $row['maxx'] && $row['maxy']) {
-				$layer_4326_box = array($row['minx'], $row['miny'], $row['maxx'], $row['maxy']);
-				$extent_layer_id = $row['layer_id'];
-			}
-			else {
-				$layer_4326_box = $rlp_4326_box;
-				$extent_layer_id = $layer_id;
-			}
-		}
-
-		if ($layer_4326_box[0] <= $rlp_4326_box[0] || $layer_4326_box[2] >= $rlp_4326_box[2] || $layer_4326_box[1] <= $rlp_4326_box[1] || $layer_4326_box[3] >= $rlp_4326_box[3]) {
-			if ($layer_4326_box[0] < $rlp_4326_box[0]) {
-				$rlp_4326_box[0] = $layer_4326_box[0]; 
-			}
-			if ($layer_4326_box[2] > $rlp_4326_box[2]) {
-				$rlp_4326_box[2] = $layer_4326_box[2]; 
-			}
-			if ($layer_4326_box[1] < $rlp_4326_box[1]) {
-				$rlp_4326_box[1] = $layer_4326_box[1]; 
-			}
-			if ($layer_4326_box[3] > $rlp_4326_box[3]) {
-				$rlp_4326_box[3] = $layer_4326_box[3]; 
-			}
-
-			$d_x = $rlp_4326_box[2] - $rlp_4326_box[0]; 
-			$d_y = $rlp_4326_box[3] - $rlp_4326_box[1];
-			
-			$new_minx = $rlp_4326_box[0] - 0.05*($d_x);
-			$new_maxx = $rlp_4326_box[2] + 0.05*($d_x);
-			$new_miny = $rlp_4326_box[1] - 0.05*($d_y);
-			$new_maxy = $rlp_4326_box[3] + 0.05*($d_y);
-
-			if ($new_minx < -180) $rlp_4326_box[0] = -180; else $rlp_4326_box[0] = $new_minx;
-			if ($new_maxx > 180) $rlp_4326_box[2] = 180; else $rlp_4326_box[2] = $new_maxx;
-			if ($new_miny < -90) $rlp_4326_box[1] = -90; else $rlp_4326_box[1] = $new_miny;
-			if ($new_maxy > 90) $rlp_4326_box[3] = 90; else $rlp_4326_box[3] = $new_maxy;
-		}
-		$con3 = new connector(LAYER_EXTENT_URL."VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=rlp,ows_layer&STYLES=&SRS=EPSG:4326&BBOX=".$rlp_4326_box[0].",".$rlp_4326_box[1].",".$rlp_4326_box[2].",".$rlp_4326_box[3]."&WIDTH=120&HEIGHT=120&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage&layer_id=".$extent_layer_id);
-		$fileNameExtent = $layer_id."_layer_extent_preview.png";
-		$fileContentExtent = $con3->file;
-		$success = savePreview($fileNameExtent, $fileContentExtent);
-		if (!$success) $fileNameExtent = "";
-
-		$sql = "SELECT * FROM layer_preview WHERE fkey_layer_id = $1";
-		$v = array($layer_id);
-		$t = array('i');
-		$res = db_prep_query($sql, $v, $t);
-		$row = db_fetch_array($res);
-		if ($row['fkey_layer_id'] == $layer_id) {
-			$sql = "UPDATE layer_preview SET layer_map_preview_filename = $1, layer_extent_preview_filename = $2, layer_legend_preview_filename = $3 WHERE fkey_layer_id = $4";
-			$v = array($fileNameMap, $fileNameExtent, $fileNameLegend, $layer_id);
-			$t = array('s', 's', 's', 'i');
-		}
-		else {
-			$sql = "INSERT INTO layer_preview (fkey_layer_id, layer_map_preview_filename, layer_extent_preview_filename, layer_legend_preview_filename) VALUES ($1, $2, $3, $4)";
-			$v = array($layer_id, $fileNameMap, $fileNameExtent, $fileNameLegend);
-			$t = array('i', 's', 's', 's');
-		}
-			
-		$res = db_prep_query($sql, $v, $t);
-		if (db_error()) {
-			 echo "<script>alert(\"Error while saving layer preview: ".addslashes(db_error())."\");</script>";
-		}
-		else {
-			 echo "<script>try{parent.opener.document.getElementById('".$layer_id."_dp').style.display='';}catch(e){};alert(\"Layer preview has been saved!\")</script>";
-		}
-	}
-}
-?>
-</body>
-<html>
+<?php
+#$Id$
+#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+#include(dirname(__FILE__)."/../../conf/geoportal.conf");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+
+function savePreview($fileName, $fileContent) {
+	if (strlen($fileContent) > 0) {
+		$fileMapImg = fopen("..".LAYER_PREVIEW_URL."/".$fileName, 'w+');
+		if ($fileMapImg) {
+			rewind($fileMapImg);
+			$bytesWritten = fwrite($fileMapImg, $fileContent);
+			if ($bytesWritten) {
+				fflush($fileMapImg);
+				ftruncate($fileMapImg, ftell($fileMapImg));
+				fclose($fileMapImg);
+				return true;
+			}
+			$e = new mb_exception("..".LAYER_PREVIEW_URL."/".$fileName.": 0 bytes written.");
+			return false;
+		}
+		$e = new mb_exception("..".LAYER_PREVIEW_URL."/".$fileName.": could not open.");
+		return false;
+	}
+	$e = new mb_exception($fileName.": no file content.");
+	return false;
+}
+
+if ($_POST["data"]) {
+	$d = explode("____", $_POST["data"]);	
+
+	$mapurl = $d[0];
+	$legendurl = $d[1];
+	
+	$mapurl = eregi_replace("(&width=)[0-9]+($|[^0-9])", "\\1".LAYER_PREVIEW_WIDTH."\\2", $mapurl);
+	$mapurl = eregi_replace("(&height=)[0-9]+($|[^0-9])", "\\1".LAYER_PREVIEW_HEIGHT."\\2", $mapurl);
+		
+	$adm = new administration();
+	$layer_id = $_SESSION['layer_preview'];
+	if (!$layer_id) {
+		 echo "<script>alert('Could not find wms: ".$wms_getmap."');</script>";
+	}
+	else {
+		session_write_close();
+		$con1 = new connector($mapurl);
+		$fileNameMap = $layer_id."_layer_map_preview.png";
+		$fileContentMap = $con1->file;
+		$success = savePreview($fileNameMap, $fileContentMap);
+		if (!$success) $fileNameMap = "";
+		
+		$con2 = new	connector($legendurl);
+		$fileNameLegend = $layer_id."_layer_legend_preview.png";
+		$fileContentLegend = $con2->file;
+		$success = savePreview($fileNameLegend, $fileContentLegend);
+		if (!$success) $fileNameLegend = "";
+ 		
+//		$rlp_4326_box = array(6.10988942079081,48.987785376052,8.58790010810365,50.9273496139233);
+		$rlp_4326_box = array(6.05,48.9,8.6,50.96);
+		
+		$sql = "SELECT * FROM layer_epsg WHERE fkey_layer_id = $1 AND epsg = 'EPSG:4326'";
+		$v = array($layer_id);
+		$t = array('i');
+		$res = db_prep_query($sql, $v, $t);
+		$row = db_fetch_array($res);
+		if ($row['minx'] && $row['miny'] && $row['maxx'] && $row['maxy']) {
+			$extent_layer_id = $layer_id;
+			$layer_4326_box = array($row['minx'], $row['miny'], $row['maxx'], $row['maxy']);
+		}
+		else {
+			$sql = "SELECT * FROM (SELECT fkey_wms_id FROM layer WHERE layer_id = $1 LIMIT 1) AS w, layer_epsg AS e, layer AS l WHERE l.fkey_wms_id = w.fkey_wms_id AND l.layer_pos = 0 AND l.layer_id = e.fkey_layer_id AND e.epsg = 'EPSG:4326'";
+			$v = array($layer_id);
+			$t = array('i');
+			$res = db_prep_query($sql, $v, $t);
+			$row = db_fetch_array($res);
+			if ($row['epsg'] && $row['minx'] && $row['miny'] && $row['maxx'] && $row['maxy']) {
+				$layer_4326_box = array($row['minx'], $row['miny'], $row['maxx'], $row['maxy']);
+				$extent_layer_id = $row['layer_id'];
+			}
+			else {
+				$layer_4326_box = $rlp_4326_box;
+				$extent_layer_id = $layer_id;
+			}
+		}
+
+		if ($layer_4326_box[0] <= $rlp_4326_box[0] || $layer_4326_box[2] >= $rlp_4326_box[2] || $layer_4326_box[1] <= $rlp_4326_box[1] || $layer_4326_box[3] >= $rlp_4326_box[3]) {
+			if ($layer_4326_box[0] < $rlp_4326_box[0]) {
+				$rlp_4326_box[0] = $layer_4326_box[0]; 
+			}
+			if ($layer_4326_box[2] > $rlp_4326_box[2]) {
+				$rlp_4326_box[2] = $layer_4326_box[2]; 
+			}
+			if ($layer_4326_box[1] < $rlp_4326_box[1]) {
+				$rlp_4326_box[1] = $layer_4326_box[1]; 
+			}
+			if ($layer_4326_box[3] > $rlp_4326_box[3]) {
+				$rlp_4326_box[3] = $layer_4326_box[3]; 
+			}
+
+			$d_x = $rlp_4326_box[2] - $rlp_4326_box[0]; 
+			$d_y = $rlp_4326_box[3] - $rlp_4326_box[1];
+			
+			$new_minx = $rlp_4326_box[0] - 0.05*($d_x);
+			$new_maxx = $rlp_4326_box[2] + 0.05*($d_x);
+			$new_miny = $rlp_4326_box[1] - 0.05*($d_y);
+			$new_maxy = $rlp_4326_box[3] + 0.05*($d_y);
+
+			if ($new_minx < -180) $rlp_4326_box[0] = -180; else $rlp_4326_box[0] = $new_minx;
+			if ($new_maxx > 180) $rlp_4326_box[2] = 180; else $rlp_4326_box[2] = $new_maxx;
+			if ($new_miny < -90) $rlp_4326_box[1] = -90; else $rlp_4326_box[1] = $new_miny;
+			if ($new_maxy > 90) $rlp_4326_box[3] = 90; else $rlp_4326_box[3] = $new_maxy;
+		}
+		$con3 = new connector(LAYER_EXTENT_URL."VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=rlp,ows_layer&STYLES=&SRS=EPSG:4326&BBOX=".$rlp_4326_box[0].",".$rlp_4326_box[1].",".$rlp_4326_box[2].",".$rlp_4326_box[3]."&WIDTH=120&HEIGHT=120&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage&layer_id=".$extent_layer_id);
+		$fileNameExtent = $layer_id."_layer_extent_preview.png";
+		$fileContentExtent = $con3->file;
+		$success = savePreview($fileNameExtent, $fileContentExtent);
+		if (!$success) $fileNameExtent = "";
+
+		$sql = "SELECT * FROM layer_preview WHERE fkey_layer_id = $1";
+		$v = array($layer_id);
+		$t = array('i');
+		$res = db_prep_query($sql, $v, $t);
+		$row = db_fetch_array($res);
+		if ($row['fkey_layer_id'] == $layer_id) {
+			$sql = "UPDATE layer_preview SET layer_map_preview_filename = $1, layer_extent_preview_filename = $2, layer_legend_preview_filename = $3 WHERE fkey_layer_id = $4";
+			$v = array($fileNameMap, $fileNameExtent, $fileNameLegend, $layer_id);
+			$t = array('s', 's', 's', 'i');
+		}
+		else {
+			$sql = "INSERT INTO layer_preview (fkey_layer_id, layer_map_preview_filename, layer_extent_preview_filename, layer_legend_preview_filename) VALUES ($1, $2, $3, $4)";
+			$v = array($layer_id, $fileNameMap, $fileNameExtent, $fileNameLegend);
+			$t = array('i', 's', 's', 's');
+		}
+			
+		$res = db_prep_query($sql, $v, $t);
+		if (db_error()) {
+			 echo "<script>alert(\"Error while saving layer preview: ".addslashes(db_error())."\");</script>";
+		}
+		else {
+			 echo "<script>try{parent.opener.document.getElementById('".$layer_id."_dp').style.display='';}catch(e){};alert(\"Layer preview has been saved!\")</script>";
+		}
+	}
+}
+?>
+</body>
+<html>

Modified: branches/print_dev/http/javascripts/mod_perimeter.php
===================================================================
--- branches/print_dev/http/javascripts/mod_perimeter.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_perimeter.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,173 +1,173 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_perimeter.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include(dirname(__FILE__).'/../include/dyn_js.php');
-?>
-
-var mod_perimeter_target = "<?php echo $e_target[0]; ?>";
-mb_registerInitFunctions("mod_perimeter_prepare()");
-mb_registerSubFunctions("mod_perimeter_draw()");
-mb_registerPanSubElement("perimeter");
-var mod_perimeter_img_on = new Image(); mod_perimeter_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
-var mod_perimeter_img_off = new Image(); mod_perimeter_img_off.src ="<?php  echo $e_src;  ?>";
-var mod_perimeter_img_over = new Image(); mod_perimeter_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
-var mod_perimeter_prevEvent = null;
-var mod_perimeter_x = null;
-var mod_perimeter_y = null;
-var mod_perimeter_r = null;
-var mod_perimeter_canvas = null;
-var mod_perimeter_status = 0;
-var mod_perimeter_img_obj = null;
-
-function mb_checkTag(frameName, tagName, elementId, appendAtTagName, attributes){
-	var oldElement;
-	var newElement;
-	var prefix;
-	if(frameName && frameName !== ""){
-		prefix = window.frames[frameName].document;
-	}
-	else if(!frameName || frameName === ""){
-		prefix = document;
-	}
-	oldElement = prefix.getElementById(elementId);
-	if (oldElement === null) {
-		newElement = prefix.createElement(tagName);
-		newElement = prefix.getElementsByTagName(appendAtTagName)[0].appendChild(newElement);
-	}
-	else {
-		if (oldElement.nodeName.toLowerCase() == tagName.toLowerCase()) {
-			for (var i=0; i<attributes.length; i++) {
-				oldElement.setAttribute(attributes[i][0], attributes[i][1]);
-			}
-			return oldElement;
-		}
-		else {
-			return false;
-		}
-	}
-	var newElementAttributeNode = document.createAttribute("id");
-	newElementAttributeNode.value = elementId;
-	newElement.setAttributeNode(newElementAttributeNode);
-	for (var i=0; i<attributes.length; i++) {
-		newElement.setAttribute(attributes[i][0], attributes[i][1]);
-	}
-	return newElement;
-}
-function mod_perimeter_checkDefaults(){
-	try{var t = mod_perimeter_thickness;}catch(e){mod_perimeter_thickness = 2;}
-	try{var t = mod_perimeter_color;}catch(e){mod_perimeter_color = '#000000';}
-	try{var t = mod_perimeter_text;}catch(e){mod_perimeter_text = 'Please insert a radius: ';}
-	try{var t = mod_perimeter_error;}catch(e){mod_perimeter_error = 'Invalid Input.';}
-}
-function mod_perimeter_click(o){
-	mod_perimeter_img_obj = o;
-	mod_perimeter_status = (mod_perimeter_status == 0) ? 1 : 0;
-	o.src = (mod_perimeter_status == 0) ? mod_perimeter_img_off.src : mod_perimeter_img_on.src;
-	if(mod_perimeter_status == 1){
-		mod_perimeter_saveEvents();
-	}
-	else{
-		mod_perimeter_disable();	
-	}
-}
-function mod_perimeter_saveEvents(){
-	var myE = window.frames[mod_perimeter_target].document;
-	mod_perimeter_mouseclick = myE.onclick;
-	mod_perimeter_mouseover = myE.onmouseover;
-	mod_perimeter_mousedown = myE.onmousedown;
-	mod_perimeter_mouseup = myE.onmouseup;
-	mod_perimeter_mousemove = myE.onmousemove;
-	myE.onclick = mod_perimeter_event;
-	myE.onmouseover = null;
-	myE.onmousedown = null;
-	myE.onmouseup = null;
-	myE.onmousemove = null;	
-}
-function mod_perimeter_restoreEvents(){
-	var myE = window.frames[mod_perimeter_target].document;
-	myE.onclick = mod_perimeter_mouseclick;
-	myE.onmouseover = mod_perimeter_mouseover;
-	myE.onmousedown = mod_perimeter_mousedown;
-	myE.onmouseup = mod_perimeter_mouseup;
-	myE.onmousemove = mod_perimeter_mousemove;
-}
-function mod_perimeter_over(o){
-	o.src = mod_perimeter_img_over.src;
-}
-function mod_perimeter_out(o){
-	o.src = (mod_perimeter_status == 0) ? mod_perimeter_img_off.src : mod_perimeter_img_on.src;
-}
-function mod_perimeter_disable(){
-	window.frames[mod_perimeter_target].document.getElementById("perimeter").innerHTML = '';
-}
-function mod_perimeter_event(e){
-	if(ie){
-		clickX = window.frames[mod_perimeter_target].event.clientX;
-		clickY = window.frames[mod_perimeter_target].event.clientY;
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
-	var pos = makeClickPos2RealWorldPos(mod_perimeter_target, clickX, clickY)
-	mod_perimeter_x = pos[0];
-	mod_perimeter_y = pos[1];
-	var units = prompt(mod_perimeter_text);
-	var myUnits = mod_perimeter_validate(units);
-	if(myUnits != false){
-		mod_perimeter_r = myUnits;
-		mod_perimeter_draw();
-	}
-	else{
-		mod_perimeter_click(mod_perimeter_img_obj);	
-	}
-	mod_perimeter_restoreEvents();
-}
-function mod_perimeter_validate(u){
-	if(isNaN(u) == true){
-  		alert(mod_perimeter_error);
-  		return false;
- 	}
- 	else{
-		return parseInt(u);
- 	}
-}
-function mod_perimeter_prepare(){
-	cw_opacity=1;
-	mod_perimeter_checkDefaults();	
-	var attributes = new Array();
-	attributes[0] = new Array();
-	attributes[0][0] = "style";
-	attributes[0][1] = "position:absolute; top:0px; left:0px; z-index:100; font-size:10px;"; 
-	var node = mb_checkTag(mod_perimeter_target, "div", "perimeter", "body", attributes);
-	mod_perimeter_canvas = new jsGraphics("perimeter", window.frames[mod_perimeter_target]);
-	mod_perimeter_canvas.setStroke(mod_perimeter_thickness);
-	mod_perimeter_canvas.setColor(mod_perimeter_color);
-}
-function mod_perimeter_draw(){
-	if(mod_perimeter_status == 1){
-		mod_perimeter_disable();
-		var posCenter = makeRealWorld2mapPos(mod_perimeter_target,mod_perimeter_x, mod_perimeter_y);
-		var posRadius = makeRealWorld2mapPos(mod_perimeter_target,(mod_perimeter_x + mod_perimeter_r), mod_perimeter_y);
-		var pxRadius =  posRadius[0] - posCenter[0];
-		mod_perimeter_canvas.drawEllipse((posCenter[0]-pxRadius), (posCenter[1]-pxRadius), pxRadius*2, pxRadius*2);
-		mod_perimeter_canvas.paint();
-	}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_perimeter.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include(dirname(__FILE__).'/../include/dyn_js.php');
+?>
+
+var mod_perimeter_target = "<?php echo $e_target[0]; ?>";
+mb_registerInitFunctions("mod_perimeter_prepare()");
+mb_registerSubFunctions("mod_perimeter_draw()");
+mb_registerPanSubElement("perimeter");
+var mod_perimeter_img_on = new Image(); mod_perimeter_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
+var mod_perimeter_img_off = new Image(); mod_perimeter_img_off.src ="<?php  echo $e_src;  ?>";
+var mod_perimeter_img_over = new Image(); mod_perimeter_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
+var mod_perimeter_prevEvent = null;
+var mod_perimeter_x = null;
+var mod_perimeter_y = null;
+var mod_perimeter_r = null;
+var mod_perimeter_canvas = null;
+var mod_perimeter_status = 0;
+var mod_perimeter_img_obj = null;
+
+function mb_checkTag(frameName, tagName, elementId, appendAtTagName, attributes){
+	var oldElement;
+	var newElement;
+	var prefix;
+	if(frameName && frameName !== ""){
+		prefix = window.frames[frameName].document;
+	}
+	else if(!frameName || frameName === ""){
+		prefix = document;
+	}
+	oldElement = prefix.getElementById(elementId);
+	if (oldElement === null) {
+		newElement = prefix.createElement(tagName);
+		newElement = prefix.getElementsByTagName(appendAtTagName)[0].appendChild(newElement);
+	}
+	else {
+		if (oldElement.nodeName.toLowerCase() == tagName.toLowerCase()) {
+			for (var i=0; i<attributes.length; i++) {
+				oldElement.setAttribute(attributes[i][0], attributes[i][1]);
+			}
+			return oldElement;
+		}
+		else {
+			return false;
+		}
+	}
+	var newElementAttributeNode = document.createAttribute("id");
+	newElementAttributeNode.value = elementId;
+	newElement.setAttributeNode(newElementAttributeNode);
+	for (var i=0; i<attributes.length; i++) {
+		newElement.setAttribute(attributes[i][0], attributes[i][1]);
+	}
+	return newElement;
+}
+function mod_perimeter_checkDefaults(){
+	try{var t = mod_perimeter_thickness;}catch(e){mod_perimeter_thickness = 2;}
+	try{var t = mod_perimeter_color;}catch(e){mod_perimeter_color = '#000000';}
+	try{var t = mod_perimeter_text;}catch(e){mod_perimeter_text = 'Please insert a radius: ';}
+	try{var t = mod_perimeter_error;}catch(e){mod_perimeter_error = 'Invalid Input.';}
+}
+function mod_perimeter_click(o){
+	mod_perimeter_img_obj = o;
+	mod_perimeter_status = (mod_perimeter_status == 0) ? 1 : 0;
+	o.src = (mod_perimeter_status == 0) ? mod_perimeter_img_off.src : mod_perimeter_img_on.src;
+	if(mod_perimeter_status == 1){
+		mod_perimeter_saveEvents();
+	}
+	else{
+		mod_perimeter_disable();	
+	}
+}
+function mod_perimeter_saveEvents(){
+	var myE = window.frames[mod_perimeter_target].document;
+	mod_perimeter_mouseclick = myE.onclick;
+	mod_perimeter_mouseover = myE.onmouseover;
+	mod_perimeter_mousedown = myE.onmousedown;
+	mod_perimeter_mouseup = myE.onmouseup;
+	mod_perimeter_mousemove = myE.onmousemove;
+	myE.onclick = mod_perimeter_event;
+	myE.onmouseover = null;
+	myE.onmousedown = null;
+	myE.onmouseup = null;
+	myE.onmousemove = null;	
+}
+function mod_perimeter_restoreEvents(){
+	var myE = window.frames[mod_perimeter_target].document;
+	myE.onclick = mod_perimeter_mouseclick;
+	myE.onmouseover = mod_perimeter_mouseover;
+	myE.onmousedown = mod_perimeter_mousedown;
+	myE.onmouseup = mod_perimeter_mouseup;
+	myE.onmousemove = mod_perimeter_mousemove;
+}
+function mod_perimeter_over(o){
+	o.src = mod_perimeter_img_over.src;
+}
+function mod_perimeter_out(o){
+	o.src = (mod_perimeter_status == 0) ? mod_perimeter_img_off.src : mod_perimeter_img_on.src;
+}
+function mod_perimeter_disable(){
+	window.frames[mod_perimeter_target].document.getElementById("perimeter").innerHTML = '';
+}
+function mod_perimeter_event(e){
+	if(ie){
+		clickX = window.frames[mod_perimeter_target].event.clientX;
+		clickY = window.frames[mod_perimeter_target].event.clientY;
+	}
+	else{
+		clickX = e.pageX;
+		clickY = e.pageY;
+	}
+	var pos = makeClickPos2RealWorldPos(mod_perimeter_target, clickX, clickY)
+	mod_perimeter_x = pos[0];
+	mod_perimeter_y = pos[1];
+	var units = prompt(mod_perimeter_text);
+	var myUnits = mod_perimeter_validate(units);
+	if(myUnits != false){
+		mod_perimeter_r = myUnits;
+		mod_perimeter_draw();
+	}
+	else{
+		mod_perimeter_click(mod_perimeter_img_obj);	
+	}
+	mod_perimeter_restoreEvents();
+}
+function mod_perimeter_validate(u){
+	if(isNaN(u) == true){
+  		alert(mod_perimeter_error);
+  		return false;
+ 	}
+ 	else{
+		return parseInt(u);
+ 	}
+}
+function mod_perimeter_prepare(){
+	cw_opacity=1;
+	mod_perimeter_checkDefaults();	
+	var attributes = new Array();
+	attributes[0] = new Array();
+	attributes[0][0] = "style";
+	attributes[0][1] = "position:absolute; top:0px; left:0px; z-index:100; font-size:10px;"; 
+	var node = mb_checkTag(mod_perimeter_target, "div", "perimeter", "body", attributes);
+	mod_perimeter_canvas = new jsGraphics("perimeter", window.frames[mod_perimeter_target]);
+	mod_perimeter_canvas.setStroke(mod_perimeter_thickness);
+	mod_perimeter_canvas.setColor(mod_perimeter_color);
+}
+function mod_perimeter_draw(){
+	if(mod_perimeter_status == 1){
+		mod_perimeter_disable();
+		var posCenter = makeRealWorld2mapPos(mod_perimeter_target,mod_perimeter_x, mod_perimeter_y);
+		var posRadius = makeRealWorld2mapPos(mod_perimeter_target,(mod_perimeter_x + mod_perimeter_r), mod_perimeter_y);
+		var pxRadius =  posRadius[0] - posCenter[0];
+		mod_perimeter_canvas.drawEllipse((posCenter[0]-pxRadius), (posCenter[1]-pxRadius), pxRadius*2, pxRadius*2);
+		mod_perimeter_canvas.paint();
+	}
 }
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_poi.php
===================================================================
--- branches/print_dev/http/javascripts/mod_poi.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_poi.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,316 +1,316 @@
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta name="author-mail" content="info at ccgis.de">
-<meta name="author" content="U. Rothstein">
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="DC.Rights" content="CCGIS GbR, Bonn">
-<title>Suche</title>
-<?
-	include_once(dirname(__FILE__) . "/../include/dyn_css.php");
-?>
-<style type="text/css">
-<!--
-	body{
-		font-family : Arial, Helvetica, sans-serif;
-		font-size : 12px;
-		font-weight : bold;
-		color: #808080;
-		background-color: 'ffffff';
-	}
-	.header{
-		color: #cc3366;
-	}
-	a:link{
-		font-family : Arial, Helvetica, sans-serif;
-		text-decoration : none;
-		color: #808080;
-		font-size : 12px;
-		font-weight : bold;
-	}
-	a:visited{
-		font-family : Arial, Helvetica, sans-serif;
-		text-decoration : none;
-		color: #808080;
-		font-size : 12px;
-		font-weight : bold;
-	}
-	a:hover{
-		font-family : Arial, Helvetica, sans-serif;
-		color: white;
-		text-decoration : none;
-		font-weight : bold;
-		background-color : #999999;
-	}
-	a:active{
-		font-family : Arial, Helvetica, sans-serif;
-		color: blue;
-		text-decoration : none;
-		font-weight : bold;
-	}
-	.textfield{
-		border : 2 solid #D3D3D3;
-		font-family : Arial, Helvetica, sans-serif;
-		font-size : 12px;
-		font-weight : bold;
-		color: #808080;
-		width: 100px;
-		position: absolute;
-		left: 50px
-	}
-	.sbutton{
-	font-size : 10px;
-		width: 28px;
-		height: 22px;
-		position: absolute;
-		left: 152px;
-	}
-	.resultFrame{
-		width: 180px;
-		height: 140px;
-		border: 1px;
-		position: absolute;
-		top: 25px;
-		left: 5px;
-		overflow-x : hidden;
-	}
--->
-</style>
-<?php
-#if(isset($lingo)){$lingo = $_REQUEST["lingo"];}
-#else{$lingo = "deutsch";}
-#$language = parse_ini_file("../language/".$lingo.".txt");
-
-echo "<script type='text/javascript'>";  
-echo "var conffile = '".$_REQUEST["conf_file"]."';";
-echo "var lingo = '".$_REQUEST["lingo"]."';";
-echo "var backlink = '".$_REQUEST["backlink"]."';";
-
-$lingo = $_REQUEST["lingo"];
-$title = "layername_".$lingo;
-require_once(dirname(__FILE__) . "/../../conf/".$_REQUEST["conf_file"]);
-
-echo "</script>"; 
-?>
-<script type="text/javascript">
-<!--
-
-function validate(){
-
-   if(document.form1.search.value.length < 1){
-      alert("Bitte vervollst�ndigen Sie die Angaben!");
-      document.form1.search.focus();
-      return false;
-   }
-   else{   
-      text = "mod_poi.php?&search=" + document.form1.search.value+"&conf_file="+conffile+"&lingo="+lingo+"&backlink="+backlink;
-      if (backlink=='parent'){
-      	window.frames["result"].location.href = text;
-      }else{
-      	parent.result.window.location.href = text;
-      }
-      return false;
-   }
-}
-function statistic(value){
-	if (backlink =='parent'){
-   		parent.parent.StatisticFrame.location.href = "../statistic.php?request=" + escape(value);
-   	}
-   	else{
-   		parent.StatisticFrame.location.href = "../statistic.php?request=" + escape(value);
-    }
-   return;
-}
-
-
-function showHighlight(x,y){
-
-	if (backlink =='parent'){
-		parent.parent.mb_showHighlight("mapframe1",x,y);
-		parent.parent.mb_showHighlight("overview",x,y);
-		//alert (backlink);
-	}else{
-		parent.mb_showHighlight("mapframe1",x,y);
-		parent.mb_showHighlight("overview",x,y);
-	}
-}
-function hideHighlight(){
-	if (backlink =='parent'){
-		parent.parent.mb_hideHighlight("mapframe1");
-		parent.parent.mb_hideHighlight("overview");
-	}else{
-		parent.mb_hideHighlight("mapframe1");
-		parent.mb_hideHighlight("overview");
-	}
-}
-
-function handleLayer(sel_lay, wms_title){
-    
-	//var wms_title = document.forms[0].wmsTitle.value
-
-	var x = new Array();
-
-    x[0] = sel_lay;
-
-    var y = new Array();
-    
-    if (backlink =='parent'){
-		var wms_ID = parent.parent.getWMSIDByTitle('mapframe1',wms_title);
-	}
-	else{
-		var wms_ID = parent.getWMSIDByTitle('mapframe1',wms_title);
-	}
-
-    y[0] = wms_ID;
-    
-	//alert(wms_title + " -- X "+ x + "wms_id" + wms_ID);
-	
-	if (backlink =='parent'){
-		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
-		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);
-		parent.parent.mb_execloadWmsSubFunctions();
-	}
-	else{
-		parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
-		parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);		
-		parent.mb_execloadWmsSubFunctions();
-	}
-}
-// -->
-</script>
-</head>
-<body leftmargin="2" topmargin="0" bgcolor="#ffffff">
-<?php
-
-if(!isset($_REQUEST["search"]) || $_REQUEST["search"] == ""){
-	echo "<form name='form1' target='result' onsubmit='return validate();'>";
-	echo "Suchen: &nbsp;&nbsp;<input class='textfield' name='search' type='text'> ";
-	echo "<input class='sbutton' type='submit' name='send'  value='ok'>";
-	echo "<iframe frameborder='1' name='result' src='../html/mod_blank.html' class='resultFrame' scrolling='auto'></iframe>";
-	echo "</form>";
-}
-else{
-	if(preg_match("/\*/",$_REQUEST["search"])){
-		$search = trim(preg_replace("/\*/i","", $_REQUEST["search"]));
-	}
-
-	$con = pg_connect ($con_string) or die ("Error while connecting database $dbname");
-
-	#$sql = "SELECT DISTINCT identificationinfo,minscale, md_fileidentifier ,search_columns, search_result  FROM tab_metadata WHERE public = '1' and not identificationinfo = 'Rasterebene' and not identificationinfo = 'rasterlayer'";
-	$sql = "SELECT DISTINCT identificationinfo,minscale, md_fileidentifier ,".$title.",search_columns, search_result,search_keywords, wms_title  FROM tab_metadata WHERE public = '1' and not identificationinfo = 'Rasterebene' and not identificationinfo = 'rasterlayer'";
-	$res = pg_query($con,$sql);
-	$cnt = 0;
-
-	while(pg_fetch_row($res)){
-		$table[$cnt] = pg_result($res,$cnt,"identificationinfo"); # Tabellen, Abfragenname
-		$minscale[$cnt] = pg_result($res,$cnt,"minscale");	
-		$md_fileidentifier[$cnt] = pg_result($res,$cnt,"md_fileidentifier"); # Layername
-		$layername[$cnt] = pg_result($res,$cnt,"md_fileidentifier"); # Layername in der Mapdatei
-		$result_title[$cnt] = pg_result($res,$cnt,"\"".$title."\""); # layer_deutsch Ergebnisname
-		$search_columns[$cnt] = pg_result($res,$cnt,"search_columns"); # Suchspalten, Trennung �ber ,
-		$search_result[$cnt] = pg_result($res,$cnt,"search_result"); # Ergebnisspalte
-		$search_keywords[$cnt] = pg_result($res,$cnt,"search_keywords"); # Ergebnisspalte
-		$wms_title[$cnt] = pg_result($res,$cnt,"wms_title"); # WMS tile
-           
-		# if one of the searchkeywords is found the data of the whole table is displayed as the result
-		if($search_keywords[$cnt] != '') { 
-			$array_search_keywords = explode(",", $search_keywords[$cnt]);
-			$all[$cnt] = false;
-			for ($p=0 ; $p<count($array_search_keywords);$p++){
-				$hit = preg_match("/".$_REQUEST["search"]."/i",$array_search_keywords[$p]);
-				if ($hit >0){	
-					$all[$cnt] = true;
-				}
-			}
-		}  	
-		//echo "hit:".$hit."all: ".$all[$cnt] ;
-		$cnt++;
-	}
-	$field_has_parent = false; 
-	$has_result = false; 
-
-	for($i=0; $i<count($table); $i++){
-		$sql = "Select GeometryType(the_geom) as type FROM ".$table[$i]." LIMIT 1";
-		$res = pg_query($con,$sql);
-		$type = pg_result($res,0,"type");      
-		$sql = "Select * FROM ".$table[$i]." LIMIT 1";
-		$res = pg_query($con,$sql);
-
-		if(mb_strtoupper($type) =='MULTIPOLYGON'){
-			$sql1 = "SELECT '". $layername[$i]."' as fkey_md_fileidentifier,".$search_result[$i].", '".$wms_title[$i]."' as wms_title, X(Centroid(the_geom)) as x,Y(Centroid(the_geom)) as y  FROM ".$table[$i];
-		}
-		if(mb_strtoupper($type) =='MULTILINESTRING'){
-			$sql1 = "SELECT '". $layername[$i]."' as fkey_md_fileidentifier,".$search_result[$i].",'".$wms_title[$i]."' as wms_title, X(Centroid(the_geom)) as x,Y(Centroid(the_geom)) as y  FROM ".$table[$i];
-		}
-		if(mb_strtoupper($type)=='POINT'){
-			$sql1 = "SELECT '". $layername[$i]."' as fkey_md_fileidentifier,".$search_result[$i].",'".$wms_title[$i]."' as wms_title, X(the_geom) as x,Y(the_geom) as y FROM ".$table[$i];
-		}
-      
-		#---------------- search_columns search_result 
-		if ($all[$i] == false){
-			$array_search_columns = explode(",", $search_columns[$i]);
-
-			if (count($array_search_columns)>0){ 
-				$array_search_columns[count($array_search_columns)] =  $array_search_columns [0];
-				$array_search_columns [0] = "platzhalterxy";
-
-				for($j=0; $j<pg_num_fields($res); $j++){
-					if(array_search(pg_field_name($res,$j),$array_search_columns) == true  ){
-						if($field_has_parent == true){
-							$sql1 .= " OR ";
-						}
-						else {
-							$sql1 .= " WHERE ";
-						};
-						$field_has_parent = true;
-						$sql1 .= pg_field_name($res,$j) ." ILIKE ";
-						$sql1 .= "'%".$_REQUEST["search"]."%'";
-					}
-				}
-				$field_has_parent = false;
-			};
-		}
-		else {
-		}
-		$sql1 .= " ORDER BY ".$search_result[$i];
-		$res1 = pg_query($con,$sql1);
-		$cnt = 0;
-		if(pg_fetch_row($res1)>0){
-			$sel_lay = pg_result($res1,$cnt,"fkey_md_fileidentifier"); 
-      
-			if($minscale[$i] > 0){$scale = $minscale[$i]+100; }
-
-			for ($cnt=0; $cnt < pg_num_rows($res1); $cnt++){
-				if($cnt == 0){
-					$title = "layername_".$lingo;
-					echo "<div class='header'>".$result_title[$i]. "</div>";
-				}
-				if($_REQUEST["backlink"]=='parent'){
-					echo "<nobr><a href='javascript:hideHighlight();parent.parent.mb_repaintScale(\"mapframe1\"," .pg_result($res1,$cnt,"x"). ",".pg_result($res1,$cnt,"y"). ",$scale);'";
-				}
-				else{
-					echo "<nobr><a href='javascript:hideHighlight();parent.mb_repaintScale(\"mapframe1\"," .pg_result($res1,$cnt,"x"). ",".pg_result($res1,$cnt,"y"). ",$scale);'";
-				}
-
-				echo " onmouseover='showHighlight(" .pg_result($res1,$cnt,"x"). "," .pg_result($res1,$cnt,"y"). ")' ";
-				echo "onmouseout='hideHighlight();' ";
-				echo "onclick='handleLayer(\"" .pg_result($res1,$cnt,"fkey_md_fileidentifier"). "\",\"".pg_result($res1,$cnt,"wms_title")."\")'>";
-
-				echo pg_result($res1,$cnt,$search_result[$i])."</a></nobr><br>";
-				$has_result = true;
-			}
-		}
-	}
-	if($has_result == false){echo "Kein Ergebnis!";}
-	echo "<form action='" . $PHP_SELF . "?".SID."' method='post'>";
-	echo "</form>";
-}
-?>
-</body>
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta name="author-mail" content="info at ccgis.de">
+<meta name="author" content="U. Rothstein">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="DC.Rights" content="CCGIS GbR, Bonn">
+<title>Suche</title>
+<?
+	include_once(dirname(__FILE__) . "/../include/dyn_css.php");
+?>
+<style type="text/css">
+<!--
+	body{
+		font-family : Arial, Helvetica, sans-serif;
+		font-size : 12px;
+		font-weight : bold;
+		color: #808080;
+		background-color: 'ffffff';
+	}
+	.header{
+		color: #cc3366;
+	}
+	a:link{
+		font-family : Arial, Helvetica, sans-serif;
+		text-decoration : none;
+		color: #808080;
+		font-size : 12px;
+		font-weight : bold;
+	}
+	a:visited{
+		font-family : Arial, Helvetica, sans-serif;
+		text-decoration : none;
+		color: #808080;
+		font-size : 12px;
+		font-weight : bold;
+	}
+	a:hover{
+		font-family : Arial, Helvetica, sans-serif;
+		color: white;
+		text-decoration : none;
+		font-weight : bold;
+		background-color : #999999;
+	}
+	a:active{
+		font-family : Arial, Helvetica, sans-serif;
+		color: blue;
+		text-decoration : none;
+		font-weight : bold;
+	}
+	.textfield{
+		border : 2 solid #D3D3D3;
+		font-family : Arial, Helvetica, sans-serif;
+		font-size : 12px;
+		font-weight : bold;
+		color: #808080;
+		width: 100px;
+		position: absolute;
+		left: 50px
+	}
+	.sbutton{
+	font-size : 10px;
+		width: 28px;
+		height: 22px;
+		position: absolute;
+		left: 152px;
+	}
+	.resultFrame{
+		width: 180px;
+		height: 140px;
+		border: 1px;
+		position: absolute;
+		top: 25px;
+		left: 5px;
+		overflow-x : hidden;
+	}
+-->
+</style>
+<?php
+#if(isset($lingo)){$lingo = $_REQUEST["lingo"];}
+#else{$lingo = "deutsch";}
+#$language = parse_ini_file("../language/".$lingo.".txt");
+
+echo "<script type='text/javascript'>";  
+echo "var conffile = '".$_REQUEST["conf_file"]."';";
+echo "var lingo = '".$_REQUEST["lingo"]."';";
+echo "var backlink = '".$_REQUEST["backlink"]."';";
+
+$lingo = $_REQUEST["lingo"];
+$title = "layername_".$lingo;
+require_once(dirname(__FILE__) . "/../../conf/".$_REQUEST["conf_file"]);
+
+echo "</script>"; 
+?>
+<script type="text/javascript">
+<!--
+
+function validate(){
+
+   if(document.form1.search.value.length < 1){
+      alert("Bitte vervollst�ndigen Sie die Angaben!");
+      document.form1.search.focus();
+      return false;
+   }
+   else{   
+      text = "mod_poi.php?&search=" + document.form1.search.value+"&conf_file="+conffile+"&lingo="+lingo+"&backlink="+backlink;
+      if (backlink=='parent'){
+      	window.frames["result"].location.href = text;
+      }else{
+      	parent.result.window.location.href = text;
+      }
+      return false;
+   }
+}
+function statistic(value){
+	if (backlink =='parent'){
+   		parent.parent.StatisticFrame.location.href = "../statistic.php?request=" + escape(value);
+   	}
+   	else{
+   		parent.StatisticFrame.location.href = "../statistic.php?request=" + escape(value);
+    }
+   return;
+}
+
+
+function showHighlight(x,y){
+
+	if (backlink =='parent'){
+		parent.parent.mb_showHighlight("mapframe1",x,y);
+		parent.parent.mb_showHighlight("overview",x,y);
+		//alert (backlink);
+	}else{
+		parent.mb_showHighlight("mapframe1",x,y);
+		parent.mb_showHighlight("overview",x,y);
+	}
+}
+function hideHighlight(){
+	if (backlink =='parent'){
+		parent.parent.mb_hideHighlight("mapframe1");
+		parent.parent.mb_hideHighlight("overview");
+	}else{
+		parent.mb_hideHighlight("mapframe1");
+		parent.mb_hideHighlight("overview");
+	}
+}
+
+function handleLayer(sel_lay, wms_title){
+    
+	//var wms_title = document.forms[0].wmsTitle.value
+
+	var x = new Array();
+
+    x[0] = sel_lay;
+
+    var y = new Array();
+    
+    if (backlink =='parent'){
+		var wms_ID = parent.parent.getWMSIDByTitle('mapframe1',wms_title);
+	}
+	else{
+		var wms_ID = parent.getWMSIDByTitle('mapframe1',wms_title);
+	}
+
+    y[0] = wms_ID;
+    
+	//alert(wms_title + " -- X "+ x + "wms_id" + wms_ID);
+	
+	if (backlink =='parent'){
+		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
+		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);
+		parent.parent.mb_execloadWmsSubFunctions();
+	}
+	else{
+		parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
+		parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);		
+		parent.mb_execloadWmsSubFunctions();
+	}
+}
+// -->
+</script>
+</head>
+<body leftmargin="2" topmargin="0" bgcolor="#ffffff">
+<?php
+
+if(!isset($_REQUEST["search"]) || $_REQUEST["search"] == ""){
+	echo "<form name='form1' target='result' onsubmit='return validate();'>";
+	echo "Suchen: &nbsp;&nbsp;<input class='textfield' name='search' type='text'> ";
+	echo "<input class='sbutton' type='submit' name='send'  value='ok'>";
+	echo "<iframe frameborder='1' name='result' src='../html/mod_blank.html' class='resultFrame' scrolling='auto'></iframe>";
+	echo "</form>";
+}
+else{
+	if(preg_match("/\*/",$_REQUEST["search"])){
+		$search = trim(preg_replace("/\*/i","", $_REQUEST["search"]));
+	}
+
+	$con = pg_connect ($con_string) or die ("Error while connecting database $dbname");
+
+	#$sql = "SELECT DISTINCT identificationinfo,minscale, md_fileidentifier ,search_columns, search_result  FROM tab_metadata WHERE public = '1' and not identificationinfo = 'Rasterebene' and not identificationinfo = 'rasterlayer'";
+	$sql = "SELECT DISTINCT identificationinfo,minscale, md_fileidentifier ,".$title.",search_columns, search_result,search_keywords, wms_title  FROM tab_metadata WHERE public = '1' and not identificationinfo = 'Rasterebene' and not identificationinfo = 'rasterlayer'";
+	$res = pg_query($con,$sql);
+	$cnt = 0;
+
+	while(pg_fetch_row($res)){
+		$table[$cnt] = pg_result($res,$cnt,"identificationinfo"); # Tabellen, Abfragenname
+		$minscale[$cnt] = pg_result($res,$cnt,"minscale");	
+		$md_fileidentifier[$cnt] = pg_result($res,$cnt,"md_fileidentifier"); # Layername
+		$layername[$cnt] = pg_result($res,$cnt,"md_fileidentifier"); # Layername in der Mapdatei
+		$result_title[$cnt] = pg_result($res,$cnt,"\"".$title."\""); # layer_deutsch Ergebnisname
+		$search_columns[$cnt] = pg_result($res,$cnt,"search_columns"); # Suchspalten, Trennung �ber ,
+		$search_result[$cnt] = pg_result($res,$cnt,"search_result"); # Ergebnisspalte
+		$search_keywords[$cnt] = pg_result($res,$cnt,"search_keywords"); # Ergebnisspalte
+		$wms_title[$cnt] = pg_result($res,$cnt,"wms_title"); # WMS tile
+           
+		# if one of the searchkeywords is found the data of the whole table is displayed as the result
+		if($search_keywords[$cnt] != '') { 
+			$array_search_keywords = explode(",", $search_keywords[$cnt]);
+			$all[$cnt] = false;
+			for ($p=0 ; $p<count($array_search_keywords);$p++){
+				$hit = preg_match("/".$_REQUEST["search"]."/i",$array_search_keywords[$p]);
+				if ($hit >0){	
+					$all[$cnt] = true;
+				}
+			}
+		}  	
+		//echo "hit:".$hit."all: ".$all[$cnt] ;
+		$cnt++;
+	}
+	$field_has_parent = false; 
+	$has_result = false; 
+
+	for($i=0; $i<count($table); $i++){
+		$sql = "Select GeometryType(the_geom) as type FROM ".$table[$i]." LIMIT 1";
+		$res = pg_query($con,$sql);
+		$type = pg_result($res,0,"type");      
+		$sql = "Select * FROM ".$table[$i]." LIMIT 1";
+		$res = pg_query($con,$sql);
+
+		if(mb_strtoupper($type) =='MULTIPOLYGON'){
+			$sql1 = "SELECT '". $layername[$i]."' as fkey_md_fileidentifier,".$search_result[$i].", '".$wms_title[$i]."' as wms_title, X(Centroid(the_geom)) as x,Y(Centroid(the_geom)) as y  FROM ".$table[$i];
+		}
+		if(mb_strtoupper($type) =='MULTILINESTRING'){
+			$sql1 = "SELECT '". $layername[$i]."' as fkey_md_fileidentifier,".$search_result[$i].",'".$wms_title[$i]."' as wms_title, X(Centroid(the_geom)) as x,Y(Centroid(the_geom)) as y  FROM ".$table[$i];
+		}
+		if(mb_strtoupper($type)=='POINT'){
+			$sql1 = "SELECT '". $layername[$i]."' as fkey_md_fileidentifier,".$search_result[$i].",'".$wms_title[$i]."' as wms_title, X(the_geom) as x,Y(the_geom) as y FROM ".$table[$i];
+		}
+      
+		#---------------- search_columns search_result 
+		if ($all[$i] == false){
+			$array_search_columns = explode(",", $search_columns[$i]);
+
+			if (count($array_search_columns)>0){ 
+				$array_search_columns[count($array_search_columns)] =  $array_search_columns [0];
+				$array_search_columns [0] = "platzhalterxy";
+
+				for($j=0; $j<pg_num_fields($res); $j++){
+					if(array_search(pg_field_name($res,$j),$array_search_columns) == true  ){
+						if($field_has_parent == true){
+							$sql1 .= " OR ";
+						}
+						else {
+							$sql1 .= " WHERE ";
+						};
+						$field_has_parent = true;
+						$sql1 .= pg_field_name($res,$j) ." ILIKE ";
+						$sql1 .= "'%".$_REQUEST["search"]."%'";
+					}
+				}
+				$field_has_parent = false;
+			};
+		}
+		else {
+		}
+		$sql1 .= " ORDER BY ".$search_result[$i];
+		$res1 = pg_query($con,$sql1);
+		$cnt = 0;
+		if(pg_fetch_row($res1)>0){
+			$sel_lay = pg_result($res1,$cnt,"fkey_md_fileidentifier"); 
+      
+			if($minscale[$i] > 0){$scale = $minscale[$i]+100; }
+
+			for ($cnt=0; $cnt < pg_num_rows($res1); $cnt++){
+				if($cnt == 0){
+					$title = "layername_".$lingo;
+					echo "<div class='header'>".$result_title[$i]. "</div>";
+				}
+				if($_REQUEST["backlink"]=='parent'){
+					echo "<nobr><a href='javascript:hideHighlight();parent.parent.mb_repaintScale(\"mapframe1\"," .pg_result($res1,$cnt,"x"). ",".pg_result($res1,$cnt,"y"). ",$scale);'";
+				}
+				else{
+					echo "<nobr><a href='javascript:hideHighlight();parent.mb_repaintScale(\"mapframe1\"," .pg_result($res1,$cnt,"x"). ",".pg_result($res1,$cnt,"y"). ",$scale);'";
+				}
+
+				echo " onmouseover='showHighlight(" .pg_result($res1,$cnt,"x"). "," .pg_result($res1,$cnt,"y"). ")' ";
+				echo "onmouseout='hideHighlight();' ";
+				echo "onclick='handleLayer(\"" .pg_result($res1,$cnt,"fkey_md_fileidentifier"). "\",\"".pg_result($res1,$cnt,"wms_title")."\")'>";
+
+				echo pg_result($res1,$cnt,$search_result[$i])."</a></nobr><br>";
+				$has_result = true;
+			}
+		}
+	}
+	if($has_result == false){echo "Kein Ergebnis!";}
+	echo "<form action='" . $PHP_SELF . "?".SID."' method='post'>";
+	echo "</form>";
+}
+?>
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_reload.php
===================================================================
--- branches/print_dev/http/javascripts/mod_reload.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_reload.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,40 +1,40 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/reload
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-var mod_reload_img = new Image(); 
-mod_reload_img.src = "<?php  echo $e_src;  ?>";
-var mod_reload_img_over = new Image(); 
-mod_reload_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
-
-function mod_reload(){
-    location.reload();
-}
-function mod_reload_init(obj){
-	document.getElementById("reload").src = mod_reload_img_over.src;
-	obj.onmouseover = new Function("mod_reload_over()");
-	obj.onmouseout = new Function("mod_reload_out()");
-}
-function mod_reload_over(){
-	document.getElementById("reload").src = mod_reload_img_over.src;
-}
-function mod_reload_out(){
-	document.getElementById("reload").src = mod_reload_img.src;
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/reload
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+var mod_reload_img = new Image(); 
+mod_reload_img.src = "<?php  echo $e_src;  ?>";
+var mod_reload_img_over = new Image(); 
+mod_reload_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
+
+function mod_reload(){
+    location.reload();
+}
+function mod_reload_init(obj){
+	document.getElementById("reload").src = mod_reload_img_over.src;
+	obj.onmouseover = new Function("mod_reload_over()");
+	obj.onmouseout = new Function("mod_reload_out()");
+}
+function mod_reload_over(){
+	document.getElementById("reload").src = mod_reload_img_over.src;
+}
+function mod_reload_out(){
+	document.getElementById("reload").src = mod_reload_img.src;
+}

Modified: branches/print_dev/http/javascripts/mod_renderGML.php
===================================================================
--- branches/print_dev/http/javascripts/mod_renderGML.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_renderGML.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,50 +1,50 @@
-<?php
-# http://www.mapbender.org/index.php/Monitor_Capabilities
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_gml2.php");
-
-$gml_string = $_SESSION["GML"];
-
-if ($gml_string) {
-	$gml = new gml2();
-	$gml->parse_xml($gml_string);
-	$bbox = $gml->bbox;
-	echo "mb_registerInitFunctions('highlight_init()');\n";
-	echo "function highlight_init() {\n";
-	echo "var mf = new Array(";
-	for ($i=0; $i<count($e_target); $i++) {
-		if ($i>0) echo ", ";
-		echo "'".$e_target[$i]."'";
-	}
-	echo ");\n";
-	echo "hl = new Highlight(mf, 'GML_rendering', {'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':" . GML_HIGHLIGHT_Z_INDEX . "});\n";
-	echo $gml->exportMemberToJS(0, false);
-	echo "hl.add(q);\n";
-	echo "hl.paint();\n";
-	echo "mb_registerSubFunctions('hl.paint()');\n";
-	echo "}\n";
-	$e = new mb_notice("renderGML: GML: " . $_SESSION["GML"] . "; EPSG: " . $_SESSION["epsg"] . "; BBOX: " . implode(", ", $bbox));
-	$_SESSION["GML"] = NULL;
-	$e = new mb_notice("renderGML: deleting GML...");
-	
-}
-else {
-	$e = new mb_notice("renderGML: no GML.");
-}
+<?php
+# http://www.mapbender.org/index.php/Monitor_Capabilities
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_gml2.php");
+
+$gml_string = $_SESSION["GML"];
+
+if ($gml_string) {
+	$gml = new gml2();
+	$gml->parse_xml($gml_string);
+	$bbox = $gml->bbox;
+	echo "mb_registerInitFunctions('highlight_init()');\n";
+	echo "function highlight_init() {\n";
+	echo "var mf = new Array(";
+	for ($i=0; $i<count($e_target); $i++) {
+		if ($i>0) echo ", ";
+		echo "'".$e_target[$i]."'";
+	}
+	echo ");\n";
+	echo "hl = new Highlight(mf, 'GML_rendering', {'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':" . GML_HIGHLIGHT_Z_INDEX . "});\n";
+	echo $gml->exportMemberToJS(0, false);
+	echo "hl.add(q);\n";
+	echo "hl.paint();\n";
+	echo "mb_registerSubFunctions('hl.paint()');\n";
+	echo "}\n";
+	$e = new mb_notice("renderGML: GML: " . $_SESSION["GML"] . "; EPSG: " . $_SESSION["epsg"] . "; BBOX: " . implode(", ", $bbox));
+	$_SESSION["GML"] = NULL;
+	$e = new mb_notice("renderGML: deleting GML...");
+	
+}
+else {
+	$e = new mb_notice("renderGML: no GML.");
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_resize_mapsize.php
===================================================================
--- branches/print_dev/http/javascripts/mod_resize_mapsize.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_resize_mapsize.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,123 +1,123 @@
-<?php
-# $Id:mod_resize_mapsize.php 1964 2008-01-15 08:11:29Z christoph $
-# http://www.mapbender.org/index.php/ResizeMapsize
-# Created on 12.07.2006/07:32:08
-# Copyright (C) 2002 CCGIS 
-# Projekt: mapbender
-# File: mod_resize_mapsize.php
-#
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-include(dirname(__FILE__) . "/../include/dyn_js.php");
-
-$sqltarget = "SELECT e_target FROM gui_element WHERE e_id = 'resizeMapsize' AND fkey_gui_id = $1";
-$v = array($gui_id);
-$t = array('s');
-$res = db_prep_query($sqltarget, $v, $t);
-while($row = db_fetch_array($res)){
-	$e_target = $row["e_target"];
-}
-
-$sql = "SELECT e_left, e_top FROM gui_element WHERE e_id = '".$e_target."' AND fkey_gui_id = $1";
-$v = array($gui_id);
-$t = array('s');
-$res = db_prep_query($sql, $v, $t);
-while($row = db_fetch_array($res)){
-	$e_left = $row["e_left"];
-	$e_top = $row["e_top"];
-}
-
-$sqllegend = "SELECT e_width FROM gui_element WHERE e_id = 'legend' AND fkey_gui_id = $1";
-$v = array($gui_id);
-$t = array('s');
-$res = db_prep_query($sqllegend, $v, $t);
-while($row = db_fetch_array($res)){
-	$leg_e_width = $row["e_width"];
-}
-
-?>
-try{
-	if (resize_option){}
-}
-catch(e){
-	resize_option = "auto";
-}
-
-try{
-	if (adjust_width){}
-}
-catch(e){
-	adjust_width = "-45";
-}
-
-try{
-	if (adjust_height){}
-}
-catch(e){
-	adjust_height = "-35";
-}
-var map_frame = "<?php echo $e_target ?>";
-var map_frame_left = "<?php echo $e_left ?>";
-var map_frame_top = "<?php echo $e_top ?>";
-var legend_width = "<?php echo $leg_e_width ?>";
-
-function frameWidth(){
-  	if (window.innerWidth) return window.innerWidth;
-  	else if (document.body && document.body.offsetWidth)  return document.body.offsetWidth;
-  	else return 0;
-}
-
-function frameHeight(){
-  	if (window.innerHeight)return window.innerHeight;
-	else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
-    else return 0;
-}
-
-function adjustDimension(){
-	var ind = getMapObjIndexByName("<?php  echo $e_target;  ?>");
-	var mapheight = frameHeight() - <?php echo $e_top ?> + parseInt(adjust_height);
-	var mapwidth = frameWidth() - map_frame_left - legend_width + parseInt(adjust_width) ;
-	var coords = mb_mapObj[ind].extent.split(",");
-	midcoordx=parseFloat((parseFloat(coords[2])-parseFloat(coords[0]))/2)+parseFloat(coords[0]);
-	midcoordy=parseFloat((parseFloat(coords[3])-parseFloat(coords[1]))/2)+parseFloat(coords[1]);
-	mb_mapObj[ind].setWidth(mapwidth);
-	mb_mapObj[ind].setHeight(mapheight);
-	mb_mapObj[ind].repaintScale(midcoordx,midcoordy,mb_mapObj[ind].getScale());
-}
-
-function rebuild() {
-  	if (width_temp != frameWidth() || height_temp != frameHeight()) window.setTimeout('adjustDimension()', 500);
-}
-
-function control(){
-  	adjustDimension();
-	if (!window.width_temp && window.innerWidth) {
-  	    window.onresize = rebuild;
-  	    width_temp = frameWidth();
-  	    height_temp = frameHeight();
-    }
-
-    if (!window.width_temp && document.body && document.body.offsetWidth) {
-  	    window.onresize = rebuild;
-  	    width_temp = frameWidth();
-  	    height_temp = frameHeight();
-    }
-}
-if (resize_option == 'auto'){
-	eventInit.register(function() {
-		control();
-	});
-}
+<?php
+# $Id:mod_resize_mapsize.php 1964 2008-01-15 08:11:29Z christoph $
+# http://www.mapbender.org/index.php/ResizeMapsize
+# Created on 12.07.2006/07:32:08
+# Copyright (C) 2002 CCGIS 
+# Projekt: mapbender
+# File: mod_resize_mapsize.php
+#
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+include(dirname(__FILE__) . "/../include/dyn_js.php");
+
+$sqltarget = "SELECT e_target FROM gui_element WHERE e_id = 'resizeMapsize' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sqltarget, $v, $t);
+while($row = db_fetch_array($res)){
+	$e_target = $row["e_target"];
+}
+
+$sql = "SELECT e_left, e_top FROM gui_element WHERE e_id = '".$e_target."' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
+while($row = db_fetch_array($res)){
+	$e_left = $row["e_left"];
+	$e_top = $row["e_top"];
+}
+
+$sqllegend = "SELECT e_width FROM gui_element WHERE e_id = 'legend' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sqllegend, $v, $t);
+while($row = db_fetch_array($res)){
+	$leg_e_width = $row["e_width"];
+}
+
+?>
+try{
+	if (resize_option){}
+}
+catch(e){
+	resize_option = "auto";
+}
+
+try{
+	if (adjust_width){}
+}
+catch(e){
+	adjust_width = "-45";
+}
+
+try{
+	if (adjust_height){}
+}
+catch(e){
+	adjust_height = "-35";
+}
+var map_frame = "<?php echo $e_target ?>";
+var map_frame_left = "<?php echo $e_left ?>";
+var map_frame_top = "<?php echo $e_top ?>";
+var legend_width = "<?php echo $leg_e_width ?>";
+
+function frameWidth(){
+  	if (window.innerWidth) return window.innerWidth;
+  	else if (document.body && document.body.offsetWidth)  return document.body.offsetWidth;
+  	else return 0;
+}
+
+function frameHeight(){
+  	if (window.innerHeight)return window.innerHeight;
+	else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
+    else return 0;
+}
+
+function adjustDimension(){
+	var ind = getMapObjIndexByName("<?php  echo $e_target;  ?>");
+	var mapheight = frameHeight() - <?php echo $e_top ?> + parseInt(adjust_height);
+	var mapwidth = frameWidth() - map_frame_left - legend_width + parseInt(adjust_width) ;
+	var coords = mb_mapObj[ind].extent.split(",");
+	midcoordx=parseFloat((parseFloat(coords[2])-parseFloat(coords[0]))/2)+parseFloat(coords[0]);
+	midcoordy=parseFloat((parseFloat(coords[3])-parseFloat(coords[1]))/2)+parseFloat(coords[1]);
+	mb_mapObj[ind].setWidth(mapwidth);
+	mb_mapObj[ind].setHeight(mapheight);
+	mb_mapObj[ind].repaintScale(midcoordx,midcoordy,mb_mapObj[ind].getScale());
+}
+
+function rebuild() {
+  	if (width_temp != frameWidth() || height_temp != frameHeight()) window.setTimeout('adjustDimension()', 500);
+}
+
+function control(){
+  	adjustDimension();
+	if (!window.width_temp && window.innerWidth) {
+  	    window.onresize = rebuild;
+  	    width_temp = frameWidth();
+  	    height_temp = frameHeight();
+    }
+
+    if (!window.width_temp && document.body && document.body.offsetWidth) {
+  	    window.onresize = rebuild;
+  	    width_temp = frameWidth();
+  	    height_temp = frameHeight();
+    }
+}
+if (resize_option == 'auto'){
+	eventInit.register(function() {
+		control();
+	});
+}

Modified: branches/print_dev/http/javascripts/mod_saveLayerPreview.php
===================================================================
--- branches/print_dev/http/javascripts/mod_saveLayerPreview.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_saveLayerPreview.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,34 +1,34 @@
-<?php
-# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze 
-# http://www.mapbender.org/index.php/mod_savewmc.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include(dirname(__FILE__) . "/../include/dyn_js.php");
-
-echo "mod_savewmc_target = '".$e_target[0]."';";
-?>
-var mod_saveLayerPreview_img = new Image(); mod_saveLayerPreview_img.src = "<?php  echo $e_src;  ?>";
-
-function mod_saveLayerPreview(){
-//	document.sendData.target = "_blank";
-	document.sendData.action = "../javascripts/mod_insertLayerPreviewIntoDb.php";
-	document.sendData.data.value = mb_mapObj[0].mapURL[0] + "____" + wms[0].wms_getlegendurl;
-	document.sendData.submit();
-}
-
-
+<?php
+# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze 
+# http://www.mapbender.org/index.php/mod_savewmc.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include(dirname(__FILE__) . "/../include/dyn_js.php");
+
+echo "mod_savewmc_target = '".$e_target[0]."';";
+?>
+var mod_saveLayerPreview_img = new Image(); mod_saveLayerPreview_img.src = "<?php  echo $e_src;  ?>";
+
+function mod_saveLayerPreview(){
+//	document.sendData.target = "_blank";
+	document.sendData.action = "../javascripts/mod_insertLayerPreviewIntoDb.php";
+	document.sendData.data.value = mb_mapObj[0].mapURL[0] + "____" + wms[0].wms_getlegendurl;
+	document.sendData.submit();
+}
+
+

Modified: branches/print_dev/http/javascripts/mod_saveWmcKml.php
===================================================================
--- branches/print_dev/http/javascripts/mod_saveWmcKml.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_saveWmcKml.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,108 +1,108 @@
-<?php
-# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze 
-# http://www.mapbender.org/index.php/mod_savewmc.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-echo "mod_savewmc_target = '".$e_target[0]."';";
-?>
-
-var mod_savewmc_img = new Image(); mod_savewmc_img.src = "<?php  echo $e_src;  ?>";
-//var mod_savewmc_img_over = new Image(); mod_savewmc_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
-
-function mod_saveWmcKml(obj){
-	current_user = "<?php echo $_SESSION["mb_user_id"]; ?>";
-	current_password = "<?php echo $_SESSION["mb_user_password"];?>";
-	current_gui = "<?php echo $gui_id;?>";
-	
-	alert('Please set the meeting point by clicking the map.');
-	
-	var ind = getMapObjIndexByName(mod_savewmc_target);
-	
-	var el = frames[mod_savewmc_target].document;
-	el.onmousedown = mod_getMousePos;
-	el.onmouseup = null;
-	el.onmousemove = null;
-	el.onmouseover = null;
-}
-
-function mod_getMousePos(e) {
-	mb_getMousePos(e,mod_savewmc_target);
-	var q = new Point(clickX,clickY);
-	var realWorldPos = mapToReal(mod_savewmc_target,q);
-
-	var el = frames[mod_savewmc_target].document;
-	el.onmousedown = null;
-	//alert(realWorldPos);
-	//document.sendData.target = "_blank";
-	//document.sendData.action = "../javascripts/mod_insertWmcIntoDb.php";
-	//document.sendData.data.value = user + "____" + generalTitle + "____" + wmc + "____" + id;
-	//document.sendData.submit();
-
-	saveWindow = open("", "save", "width=400, height=300, resizable, dependent=yes, scrollbars=yes");
-	saveWindow.document.open("text/html");
-/*
-	var cssLink = saveWindow.document.createElement("link");
-	cssLink.setAttribute("href", wfsCssUrl); 
-	cssLink.setAttribute("type", "text/css"); 
-	cssLink.setAttribute("rel", "stylesheet"); 
-	var cssTmp = saveWindow.document.getElementsByTagName("head")[0];
-	cssTmp.appendChild(cssLink);
-*/
-	var wmc_title = "meetingpoint";
-	var icon = "http://wms1.ccgis.de/mapbender_dev/img/pin.png";
-	
-	var str = "";
-	var onclick = "wmcid=window.opener.mod_savewmc('"+wmc_title+"');";
-	onclick += "document.sendData.action = '../javascripts/mod_insertKmlIntoDb.php?<?php echo SID;?>';";
-	onclick += "document.sendData.data.value = wmcid + '____" + realWorldPos.x + "____" + realWorldPos.y + "____"+ icon + "____<?php echo $gui_id;?>';";
-	onclick += "document.sendData.submit();" 
-	str += "<form name='sendData' method='post'>\n";
-	str += "<table>\n";
-	str += "<tr>\n";
-	str += "<td>Name</td>\n";
-	str += "<td><input type='text' name='name'></td>\n";
-	str += "</tr>\n";
-	str += "<tr>\n";
-	str += "<td>Strasse</td>\n";
-	str += "<td><input type='text' name='street'></td>\n";
-	str += "</tr>\n";
-	str += "<tr>\n";
-	str += "<td>PLZ</td>\n";
-	str += "<td><input type='text' name='postcode'></td>\n";
-	str += "</tr>\n";
-	str += "<tr>\n";
-	str += "<td>Ort</td>\n";
-	str += "<td><input type='text' name='city'></td>\n";
-	str += "</tr>\n";
-	str += "<tr>\n";
-	str += "<td>Webseite</td>\n";
-	str += "<td><input type='text' name='website'></td>\n";
-	str += "</tr>\n";
-	str += "<tr>\n";
-	str += "<td>Beschreibung</td>\n";
-	str += "<td><textarea name='description'></textarea></td>\n";
-	str += "</tr>\n";
-	str += "<tr>\n";
-	str += "<td colspan=2><input type='button' value='URL generieren' name='generateUrl' onclick=\""+onclick+"\"></td>\n";
-	str += "</tr>\n";
-	str += "</table>\n";
-	str += "<input type=hidden name=data>\n";
-	str += "</form>";
-	saveWindow.document.write(str);
-	saveWindow.document.close();
+<?php
+# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze 
+# http://www.mapbender.org/index.php/mod_savewmc.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+echo "mod_savewmc_target = '".$e_target[0]."';";
+?>
+
+var mod_savewmc_img = new Image(); mod_savewmc_img.src = "<?php  echo $e_src;  ?>";
+//var mod_savewmc_img_over = new Image(); mod_savewmc_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
+
+function mod_saveWmcKml(obj){
+	current_user = "<?php echo $_SESSION["mb_user_id"]; ?>";
+	current_password = "<?php echo $_SESSION["mb_user_password"];?>";
+	current_gui = "<?php echo $gui_id;?>";
+	
+	alert('Please set the meeting point by clicking the map.');
+	
+	var ind = getMapObjIndexByName(mod_savewmc_target);
+	
+	var el = frames[mod_savewmc_target].document;
+	el.onmousedown = mod_getMousePos;
+	el.onmouseup = null;
+	el.onmousemove = null;
+	el.onmouseover = null;
+}
+
+function mod_getMousePos(e) {
+	mb_getMousePos(e,mod_savewmc_target);
+	var q = new Point(clickX,clickY);
+	var realWorldPos = mapToReal(mod_savewmc_target,q);
+
+	var el = frames[mod_savewmc_target].document;
+	el.onmousedown = null;
+	//alert(realWorldPos);
+	//document.sendData.target = "_blank";
+	//document.sendData.action = "../javascripts/mod_insertWmcIntoDb.php";
+	//document.sendData.data.value = user + "____" + generalTitle + "____" + wmc + "____" + id;
+	//document.sendData.submit();
+
+	saveWindow = open("", "save", "width=400, height=300, resizable, dependent=yes, scrollbars=yes");
+	saveWindow.document.open("text/html");
+/*
+	var cssLink = saveWindow.document.createElement("link");
+	cssLink.setAttribute("href", wfsCssUrl); 
+	cssLink.setAttribute("type", "text/css"); 
+	cssLink.setAttribute("rel", "stylesheet"); 
+	var cssTmp = saveWindow.document.getElementsByTagName("head")[0];
+	cssTmp.appendChild(cssLink);
+*/
+	var wmc_title = "meetingpoint";
+	var icon = "http://wms1.ccgis.de/mapbender_dev/img/pin.png";
+	
+	var str = "";
+	var onclick = "wmcid=window.opener.mod_savewmc('"+wmc_title+"');";
+	onclick += "document.sendData.action = '../javascripts/mod_insertKmlIntoDb.php?<?php echo SID;?>';";
+	onclick += "document.sendData.data.value = wmcid + '____" + realWorldPos.x + "____" + realWorldPos.y + "____"+ icon + "____<?php echo $gui_id;?>';";
+	onclick += "document.sendData.submit();" 
+	str += "<form name='sendData' method='post'>\n";
+	str += "<table>\n";
+	str += "<tr>\n";
+	str += "<td>Name</td>\n";
+	str += "<td><input type='text' name='name'></td>\n";
+	str += "</tr>\n";
+	str += "<tr>\n";
+	str += "<td>Strasse</td>\n";
+	str += "<td><input type='text' name='street'></td>\n";
+	str += "</tr>\n";
+	str += "<tr>\n";
+	str += "<td>PLZ</td>\n";
+	str += "<td><input type='text' name='postcode'></td>\n";
+	str += "</tr>\n";
+	str += "<tr>\n";
+	str += "<td>Ort</td>\n";
+	str += "<td><input type='text' name='city'></td>\n";
+	str += "</tr>\n";
+	str += "<tr>\n";
+	str += "<td>Webseite</td>\n";
+	str += "<td><input type='text' name='website'></td>\n";
+	str += "</tr>\n";
+	str += "<tr>\n";
+	str += "<td>Beschreibung</td>\n";
+	str += "<td><textarea name='description'></textarea></td>\n";
+	str += "</tr>\n";
+	str += "<tr>\n";
+	str += "<td colspan=2><input type='button' value='URL generieren' name='generateUrl' onclick=\""+onclick+"\"></td>\n";
+	str += "</tr>\n";
+	str += "</table>\n";
+	str += "<input type=hidden name=data>\n";
+	str += "</form>";
+	saveWindow.document.write(str);
+	saveWindow.document.close();
 }
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_savewmc.php
===================================================================
--- branches/print_dev/http/javascripts/mod_savewmc.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_savewmc.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,82 +1,82 @@
-<?php
-# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze 
-# http://www.mapbender.org/index.php/mod_savewmc.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-include(dirname(__FILE__) . "/../include/dyn_js.php");
-
-echo "mod_savewmc_target = '".$e_target[0]."';";
-?>
-function setOnUnload() {
-	if (ie) {
-		document.getElementsByTagName('body')[0].onunload = function() {
-			var x = new Function ("", "mod_savewmc_session()"); x(); 
-		};
-	}
-	else {
-		document.getElementsByTagName('body')[0].setAttribute("onUnload", "mod_savewmc_session();");
-	}
-}
-
-try {if (saveInSession) {}}catch(e) {saveInSession = 0;}
-
-if (saveInSession == 1) {
-	eventAfterMapRequest.register(function () {
-		mod_savewmc_session();
-	});
-//	mb_registerInitFunctions('setOnUnload()');
-}
-
-<?php 
-if ($e_src) {
-	sprintf("var mod_savewmc_img = new Image(); 
-			mod_savewmc_img.src = '%s';", $e_src);
-}
-?>
-//var mod_savewmc_img_over = new Image(); mod_savewmc_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
-
-function mod_savewmc_session(){
-	sendMapDataToServer("session", 1, function(result, status) {});
-}
-
-function mod_savewmc(title){
-	var generalTitle = title ? title : prompt("Save WMC as...");
-	if (generalTitle != "" && generalTitle != null) {
-		sendMapDataToServer(generalTitle, 0, function(result, status) {alert(status + ": " + result);});
-	}
-}
-
-function sendMapDataToServer(generalTitle, storeInSession, callbackFunction) {
-	var user = "<?php echo $_SESSION["mb_user_id"]; ?>";
-	var ind = getMapObjIndexByName(mod_savewmc_target);
-	
-	var	extensionDataString = "";
-	if (currentWmcExtensionData != null) {
-		extensionDataString = $.toJSON(currentWmcExtensionData);
-	}
-
-	if (storeInSession) {
-		$.ajaxSetup({async:false}); 
-	}
-	$.post("../php/mod_savewmc_server.php", {
-		"saveInSession":storeInSession, 
-		"generalTitle":generalTitle, 
-		"extensionData":extensionDataString, 
-		"mapObject":$.toJSON(mb_mapObj)
-	}, callbackFunction);
-}
+<?php
+# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze 
+# http://www.mapbender.org/index.php/mod_savewmc.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+include(dirname(__FILE__) . "/../include/dyn_js.php");
+
+echo "mod_savewmc_target = '".$e_target[0]."';";
+?>
+function setOnUnload() {
+	if (ie) {
+		document.getElementsByTagName('body')[0].onunload = function() {
+			var x = new Function ("", "mod_savewmc_session()"); x(); 
+		};
+	}
+	else {
+		document.getElementsByTagName('body')[0].setAttribute("onUnload", "mod_savewmc_session();");
+	}
+}
+
+try {if (saveInSession) {}}catch(e) {saveInSession = 0;}
+
+if (saveInSession == 1) {
+	eventAfterMapRequest.register(function () {
+		mod_savewmc_session();
+	});
+//	mb_registerInitFunctions('setOnUnload()');
+}
+
+<?php 
+if ($e_src) {
+	sprintf("var mod_savewmc_img = new Image(); 
+			mod_savewmc_img.src = '%s';", $e_src);
+}
+?>
+//var mod_savewmc_img_over = new Image(); mod_savewmc_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
+
+function mod_savewmc_session(){
+	sendMapDataToServer("session", 1, function(result, status) {});
+}
+
+function mod_savewmc(title){
+	var generalTitle = title ? title : prompt("Save WMC as...");
+	if (generalTitle != "" && generalTitle != null) {
+		sendMapDataToServer(generalTitle, 0, function(result, status) {alert(status + ": " + result);});
+	}
+}
+
+function sendMapDataToServer(generalTitle, storeInSession, callbackFunction) {
+	var user = "<?php echo $_SESSION["mb_user_id"]; ?>";
+	var ind = getMapObjIndexByName(mod_savewmc_target);
+	
+	var	extensionDataString = "";
+	if (currentWmcExtensionData != null) {
+		extensionDataString = $.toJSON(currentWmcExtensionData);
+	}
+
+	if (storeInSession) {
+		$.ajaxSetup({async:false}); 
+	}
+	$.post("../php/mod_savewmc_server.php", {
+		"saveInSession":storeInSession, 
+		"generalTitle":generalTitle, 
+		"extensionData":extensionDataString, 
+		"mapObject":$.toJSON(mb_mapObj)
+	}, callbackFunction);
+}

Modified: branches/print_dev/http/javascripts/mod_setPOI2Scale.php
===================================================================
--- branches/print_dev/http/javascripts/mod_setPOI2Scale.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_setPOI2Scale.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,51 +1,51 @@
-<?php
-# $Id$ 
-# http://www.mapbender.org/index.php/mod_setPOI2Scale.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-echo "var mod_setPOI2Scale_target = '".$e_target[0]."';";
-include(dirname(__FILE__) . "/../include/dyn_js.php");
-
-?>
-
-try{
-	if (mod_setPOI2Scale_defScale){}
-}
-catch(e){
-	mod_setPOI2Scale_defScale = 5000;
-}
-
-eventInit.register(function () {
-	mod_setPOI2Scale();
-});
-
-function mod_setPOI2Scale(){
-	var my_target = mod_setPOI2Scale_target.split(",");
-	var myPOI = "<?php echo $_SESSION['mb_myPOI2SCALE'] ?>";
-	if(myPOI && myPOI != ""){
-		var coord = myPOI.split(",");
-		if(coord.length == 2){
-			coord[2] = mod_setPOI2Scale_defScale; 	
-		}
-		for(var i=0; i<my_target.length; i++){		
-			if(myPOI != ""){							
-				mb_repaintScale(my_target[i], coord[0], coord[1], coord[2]);			
-			}
-		}
-	}
-}
+<?php
+# $Id$ 
+# http://www.mapbender.org/index.php/mod_setPOI2Scale.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+echo "var mod_setPOI2Scale_target = '".$e_target[0]."';";
+include(dirname(__FILE__) . "/../include/dyn_js.php");
+
+?>
+
+try{
+	if (mod_setPOI2Scale_defScale){}
+}
+catch(e){
+	mod_setPOI2Scale_defScale = 5000;
+}
+
+eventInit.register(function () {
+	mod_setPOI2Scale();
+});
+
+function mod_setPOI2Scale(){
+	var my_target = mod_setPOI2Scale_target.split(",");
+	var myPOI = "<?php echo $_SESSION['mb_myPOI2SCALE'] ?>";
+	if(myPOI && myPOI != ""){
+		var coord = myPOI.split(",");
+		if(coord.length == 2){
+			coord[2] = mod_setPOI2Scale_defScale; 	
+		}
+		for(var i=0; i<my_target.length; i++){		
+			if(myPOI != ""){							
+				mb_repaintScale(my_target[i], coord[0], coord[1], coord[2]);			
+			}
+		}
+	}
+}

Modified: branches/print_dev/http/javascripts/mod_setTimeout.php
===================================================================
--- branches/print_dev/http/javascripts/mod_setTimeout.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_setTimeout.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,94 +1,94 @@
-<?php
-# $Id$
-# maintained by http://www.mapbender.org/index.php/User:Astrid Emde
-# http://www.mapbender.org/index.php/mod_setTimeout.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include '../include/dyn_js.php';
-
-?>
-
-try{
-	if (mod_timeout_text){}
-}
-catch(e){
-	mod_timeout_text = "Your session may not be valid anymore!";
-	//mod_timeout_text = "Bitte beachten Sie, dass Ihre Session abgelaufen sein kann!";
-}
-
-try{
-	if (mod_timeout_ttl){}
-}
-catch(e){
-	mod_timeout_ttl = '15';
-}
-
-/*
-* alert:    a confirm - window to reload the application when timeout is reached
-* logout:  request mod_logout after timeout
-*/
-try{
-	if (mod_timeout_action){}
-}
-catch(e){
-	mod_timeout_action = 'alert';
-}
-
-
-/*version 2.0.0*/
-mod_timeout_cnt = false;
-
-
-mb_registerSubFunctions("mod_setTimeout_set()");            // maprequest
-mb_registerInitFunctions("mod_setTimeout_interval()");
-
-function mod_setTimeout_interval(){
-   var aktiv = window.setInterval("mod_setTimeout_check()",60000);
-   mod_setTimeout_set();
-   mod_setTimeout_check();
-}
-
-function mod_setTimeout_set(){
-   mod_timeout_cnt = parseInt(mod_timeout_ttl);
-   mod_setTimeout_check();
-}
-
-function mod_setTimeout_check(){
-   
-   var str = "<span style='font-family: Arial, Helvetica, sans-serif;font-size:10px;'>";
-   str += "Logout in ";
-   
-   if(mod_timeout_cnt >= 0){
-      str += mod_timeout_cnt;
-   }
-   else { str += "0";  }
-   
-   str += " min";
-   str += "</span>";
-   writeTag("", "timeout",  str ); 
-   
-   if(mod_timeout_cnt == 0 && mod_timeout_action == 'alert'){       
-      var go = confirm(mod_timeout_text);
-      if(go == true){
-        //  document.location.href = "./login.php"; 
-      }
-      
-   }
-   if(mod_timeout_cnt == 0 && mod_timeout_action == 'logout'){ document.location.href = "../php/mod_logout.php";}
-   mod_timeout_cnt--;
-}
+<?php
+# $Id$
+# maintained by http://www.mapbender.org/index.php/User:Astrid Emde
+# http://www.mapbender.org/index.php/mod_setTimeout.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+
+?>
+
+try{
+	if (mod_timeout_text){}
+}
+catch(e){
+	mod_timeout_text = "Your session may not be valid anymore!";
+	//mod_timeout_text = "Bitte beachten Sie, dass Ihre Session abgelaufen sein kann!";
+}
+
+try{
+	if (mod_timeout_ttl){}
+}
+catch(e){
+	mod_timeout_ttl = '15';
+}
+
+/*
+* alert:    a confirm - window to reload the application when timeout is reached
+* logout:  request mod_logout after timeout
+*/
+try{
+	if (mod_timeout_action){}
+}
+catch(e){
+	mod_timeout_action = 'alert';
+}
+
+
+/*version 2.0.0*/
+mod_timeout_cnt = false;
+
+
+mb_registerSubFunctions("mod_setTimeout_set()");            // maprequest
+mb_registerInitFunctions("mod_setTimeout_interval()");
+
+function mod_setTimeout_interval(){
+   var aktiv = window.setInterval("mod_setTimeout_check()",60000);
+   mod_setTimeout_set();
+   mod_setTimeout_check();
+}
+
+function mod_setTimeout_set(){
+   mod_timeout_cnt = parseInt(mod_timeout_ttl);
+   mod_setTimeout_check();
+}
+
+function mod_setTimeout_check(){
+   
+   var str = "<span style='font-family: Arial, Helvetica, sans-serif;font-size:10px;'>";
+   str += "Logout in ";
+   
+   if(mod_timeout_cnt >= 0){
+      str += mod_timeout_cnt;
+   }
+   else { str += "0";  }
+   
+   str += " min";
+   str += "</span>";
+   writeTag("", "timeout",  str ); 
+   
+   if(mod_timeout_cnt == 0 && mod_timeout_action == 'alert'){       
+      var go = confirm(mod_timeout_text);
+      if(go == true){
+        //  document.location.href = "./login.php"; 
+      }
+      
+   }
+   if(mod_timeout_cnt == 0 && mod_timeout_action == 'logout'){ document.location.href = "../php/mod_logout.php";}
+   mod_timeout_cnt--;
+}

Modified: branches/print_dev/http/javascripts/mod_switchLocale_noreload.php
===================================================================
--- branches/print_dev/http/javascripts/mod_switchLocale_noreload.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_switchLocale_noreload.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,54 +1,54 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/localeSwitch
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_locale.php");
-
-include(dirname(__FILE__) . "/../include/dyn_js.php");
-
-if (!USE_I18N) {
-	echo "var languages = '" . $_SESSION["mb_lang"] . "';";
-}
-?>
-
-function validate_locale(){
-	var index = document.getElementById("language").selectedIndex;
-	var lang = document.getElementById("language").options[index].value;
-	mb_ajax_post("../php/mod_setLocale.php", {"lang":lang}, function(result, status) {
-		Mapbender.locale = result;
-		eventLocalize.trigger();
-	});
-}
-
-eventInit.register(function () {
-	var localeSelectNode = document.getElementById('language');
-	var languageArray = languages.split(",");
-	var selected = false;
-	for (var i = 0; i < languageArray.length; i++) {
-		if (languageArray[i] == '<?php echo $_SESSION["mb_lang"];?>') {
-			selected = true;
-		}		
-		else {
-			selected = false;
-		}
-		
-		var currentOption = new Option(languageArray[i], languageArray[i], selected, selected);
-		localeSelectNode.options[i] = currentOption;
-	}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/localeSwitch
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_locale.php");
+
+include(dirname(__FILE__) . "/../include/dyn_js.php");
+
+if (!USE_I18N) {
+	echo "var languages = '" . $_SESSION["mb_lang"] . "';";
+}
+?>
+
+function validate_locale(){
+	var index = document.getElementById("language").selectedIndex;
+	var lang = document.getElementById("language").options[index].value;
+	mb_ajax_post("../php/mod_setLocale.php", {"lang":lang}, function(result, status) {
+		Mapbender.locale = result;
+		eventLocalize.trigger();
+	});
+}
+
+eventInit.register(function () {
+	var localeSelectNode = document.getElementById('language');
+	var languageArray = languages.split(",");
+	var selected = false;
+	for (var i = 0; i < languageArray.length; i++) {
+		if (languageArray[i] == '<?php echo $_SESSION["mb_lang"];?>') {
+			selected = true;
+		}		
+		else {
+			selected = false;
+		}
+		
+		var currentOption = new Option(languageArray[i], languageArray[i], selected, selected);
+		localeSelectNode.options[i] = currentOption;
+	}
 });
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/mod_tab.js
===================================================================
--- branches/print_dev/http/javascripts/mod_tab.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_tab.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,498 +1,498 @@
-// check element vars
-try{
-	if (open_tab){
-		open_tab = Number(open_tab);
-
-		if (isNaN(open_tab)) {
-			var e = new Mb_warning("mod_tab.js: tab_init: open_tab must be a number or an empty string.");
-		}
-	}
-}
-catch(e){
-	var z = new Mb_warning("mod_tab.js: tab_init: open_tab is not set.");
-	open_tab = "";
-}
-
-var tabs;
-
-eventLocalize.register(function () {
-	localizeTabs();
-});
-
-eventInit.register(function () {
-	tab_init();
-	localizeTabs();
-});
-
-function localizeTabs() {
-	mb_ajax_json("../php/mod_tab_messages.php", function(obj, status){
-		tabs.setTitles(obj);
-	});
-}
-
-function tab_init(){
-	var obj = document.getElementById("tabs").style;
-
-	// generate a new tab array
-	tabs = new VerticalTabArray(tab_style);
-
-	// add the tabs from element vars
-	for (var i = 0; i < tab_ids.length; i++){
-		tabs.addTab(tab_ids[i], tab_prefix + tab_titles[i], tab_frameHeight[i]);
-	}
-
-	if (open_tab !== "") {
-		tabs.openTab(tabs.get(open_tab).module);
-	}
-}
-
-function tab_open(elementName) {
-  // show the desired tab
-	tabs.openTab(elementName);
-}
-
-/**
- * @class A single vertical tab
- * 
- * @constructor
- * @param {String} id the ID of the GUI element that will be displayed within the tab
- * @param {String} title the header of the tab
- * @param {Integer} frameHeight the height of the frame containing the GUI element
- * @param {Integer} tabWidth the width of a tab (NOT the frame)
- * @param {Integer} tabHeight the height of a tab (NOT the frame)
- * @param {String} tabStyle A string with a CSS (example: position:absolute;visibility:visible;border: 1px solid white;font-size:12;color:#343434;background-color:#CFD2D4;cursor:pointer;)
- * @param {Integer} number the index of the current tab in a {@link VerticalTabArray}.
- */
-var VerticalTab = function (id, title, frameHeight, tabWidth, tabHeight, tabStyle, number) {
-	
-	/**
-	 * Sets the attributes of the tabs DOM node.
-	 * 
-	 * @private
-	 * @param {String} title the header of the tab
-	 * @param {Integer} frameHeight the height of the frame containing the GUI element
-	 * @param {Integer} tabWidth the width of a tab (NOT the frame)
-	 * @param {Integer} tabHeight the height of a tab (NOT the frame)
-	 * @param {String} tabStyle A string with a CSS (example: position:absolute;visibility:visible;border: 1px solid white;font-size:12;color:#343434;background-color:#CFD2D4;cursor:pointer;)
-	 * @param {Integer} number the index of the current tab in a {@link VerticalTabArray}.
-	 * 
-	 */
-	var setNodeAttributes = function(title, frameHeight, tabWidth, tabHeight, tabStyle, number) {
-	
-		node.id = "tabs_" + that.module;
-		
-		//set css class
-		node.className = "verticalTabs";
-
-		//mandatory style entries
-		node.style.position = "absolute";
-		node.style.width = tabWidth;
-		node.style.height = tabHeight;
-		node.style.top = number * tabHeight;
-		
-		// open or close on click
-		// see http://www.mapbender.org/index.php/Add_events_via_DOM_in_IE_and_FF
-		if ($.browser.msie) {
-		
-		   node.onclick = function() {
-		      tabs.toggleTab(that.module);
-		   };
-		}
-		else {
-			node.onclick = function(){
-				tabs.toggleTab(that.module);
-			};
-		}
-		
-		// tab header
-		node.innerHTML = title;
-	};
-
-	/**
-	 * Returns the DOM node of this tab.
-	 *
-	 * @return the DOM node of this tab.
-	 * @type DOMNode
-	 */
-	this.getNode = function() {
-		return node;
-	};
-	
-	/**
-	 * The ID of the GUI element that will be displayed within the tab.
-	 */
-	this.module = id;
-
-	/**
-	 * The height of the frame containing the GUI element.
-	 */
-	this.height = frameHeight;
-	
-	/**
-	 * While a tab is opened or closed, the value is false.
-	 */
-	this.animationFinished = true;
-
-	/**
-	 * The DOM node of this tab.
-	 *
-	 * @private
-	 */
-	var node = document.createElement("div");
-	var that = this;
-	
-	setNodeAttributes(title, frameHeight, tabWidth, tabHeight, tabStyle, number);
-};
-	
-/**
- * An array of vertical tabs, behaving like an accordion
- *
- * @extends List
- * @param {String} cssString A string with a CSS (example: position:absolute;visibility:visible;border: 1px solid white;font-size:12;color:#343434;background-color:#CFD2D4;cursor:pointer;)
- */	
-var VerticalTabArray = function (cssString) {
-	
-	/**
-	 * Adds a new tab to the Array.
-	 *
-	 * @param {String} id the ID of the GUI element that will be displayed within the tab
-	 * @param {String} title the header of the tab
-	 * @param {Integer} height the height of the frame containing the GUI element
-	 */
-	this.addTab = function(id, title, height) {
-		var tab = new VerticalTab(id, title, height, tabWidth, tabHeight, tabStyle, this.count());
-		this.add(tab);
-
-		document.getElementById(id).style.visibility = 'hidden';
-		document.getElementById(id).style.display = 'none';
-
-		// append the new tab
-		rootNode.appendChild(this.get(-1).getNode());
-	};
-	
-	/**
-	 * Removes a tab from the Array.
-	 *
-	 * @param {String} id the ID of the GUI element within the tab.
-	 */
-	this.delTab = function(id) {
-		var index = getIndexById(id);
-		
-		if (index !== null) {
-			// delete the DOM node
-			rootNode.removeChild(this.get(index).getNode());
-
-			// delete the tab
-			this.del(index);
-			
-			// move the other tabs (below the removed tab) up
-			for (var i = index; i < this.count(); i++) {
-				var currentNode = this.get(i).getNode();
-				
-				// parseInt removes "px"
-				var currentTop = parseInt(currentNode.style.top, 10);
-				currentNode.style.top = currentTop - tabHeight;
-			}			
-		}
-	};
-		
-	/**
-	 * Opens a tab specified by the module Id.
-	 *
-	 * @param {String} id the ID of the GUI element within the tab.
-	 */
-	this.toggleTab = function(id) {
-		// if no tab is currently opening or closing
-		if (isAnimationFinished()) {
-			for (var i=0; i < this.count(); i++) {
-				hideFrame(this.get(i).module);
-			}
-			// if the opened tab is the active tab, close it
-			if (id === activeTabId) {
-				closeTab(activeTabId);
-			}
-			//otherwise
-			else {
-				// show the desired tab
-		  	activeTabId = id;
-				startAnimation("open");
-			}
-		}
-		else {
-			var e = new Mb_warning("mod_tab.js: could not activate tab, opening or closing in progress!");
-		}
-	};
-	
-	/**
-	 * Sets the titles of each single tab after l10n
-	 * 
-	 * @param {Object} obj an array containing objects with id and title
-	 */
-	this.setTitles = function (obj) {
-		for (var i = 0; i < this.count(); i++) {
-			for(var j=0; j<obj.length; j++){
-				if (this.get(i).module == obj[j].id) {
-					this.get(i).getNode().innerHTML = tabPrefix + obj[j].title;
-				}
-			}
-		}		
-	}
-	/**
-	 * Returns the absolute coordinates of tab by the module ID
-	 * 
-	 * @param {String} id the ID of the GUI element within the tab.
-	 * @return {String} String with "left,top,right,bottom"
-	 */
-	 
-	 this.getCoords = function(id) {
-	 	var coords=[];
-	 	//get indixes
-	 	if (activeTabId) {
-			var indexOfOpeningTab = getIndexById(activeTabId);
-		}
-		var index = getIndexById(id);
-	 	
-	 	//left
-	 	coords[0] = tabLeftOffset;
-	 	//top
-	 	coords[1] = tabTopOffset + index*tabHeight + (activeTabId&&indexOfOpeningTab<index?this.get(indexOfOpeningTab).height:0);
-	 	//right
-	 	coords[2] = coords[0] + tabWidth;
-	 	//bottom
-	 	coords[3] = coords[1] + (id==activeTabId?this.get(indexOfOpeningTab).height+tabHeight:tabHeight);
-	 	
-	 	return coords.join(",");
-	 };
-
-	/**
-	 * Animated opening and closing of the tab with the given id.
-	 * Needs to be public because it is called via "setInterval". 
-	 *
-	 * @param {String} openOrClose a string with the values "open" or "close".
-	 */
-	this.animate = function(openOrClose) {
-
-		for (var i=0; i < this.count(); i++) {
-			
-			if (this.get(i).animationFinished === false) {
-
-				//The 'top' position of the i-th tab after the animation
-				var currentTabNewTop = i * tabHeight;
-	
-				if (openOrClose == 'open') {
-					var indexOfOpeningTab = getIndexById(activeTabId);
-					
-					// move the lower tabs down by the height of the opening tab
-					if (indexOfOpeningTab !== null && i > indexOfOpeningTab) {
-						currentTabNewTop += this.get(indexOfOpeningTab).height;
-					}
-				}	
-				//The current 'top' position of the i-th tab
-				//(parseInt removes 'px')
-				var currentTabCurrentTop = parseInt(this.get(i).getNode().style.top, 10);
-				
-				// animation is finished
-				if (currentTabCurrentTop == currentTabNewTop) {
-					this.get(i).animationFinished = true;
-				}	
-				// animation not yet finished, move the tab down
-				else if (currentTabCurrentTop < currentTabNewTop) {
-					var pixel = Math.min(pixelPerIteration, currentTabNewTop - currentTabCurrentTop);
-					this.get(i).getNode().style.top = currentTabCurrentTop + pixel;
-				}
-				// animation not yet finished, move the tab up
-				else if (currentTabCurrentTop > currentTabNewTop) {
-					var pixel = Math.min(pixelPerIteration, currentTabCurrentTop - currentTabNewTop);
-					this.get(i).getNode().style.top = currentTabCurrentTop - pixel;
-				}
-				else {
-					var e = new Mb_exception("mod_tab.js: animate: unknown state for tab "+ i + " (currentTop: "+currentTabCurrentTop+", newTop:"+currentTabNewTop+")");
-				}
-			}
-		}
-		// check if the animation is finished
-		if (isAnimationFinished()) {
-			stopAnimation();
-			if (openOrClose == "open") {
-				showFrame(activeTabId);
-			}
-		}
-	};
-
-	/**
-	 * Returns the index of the vertical tab with a given id 
-	 *
-	 * @private
-	 * @param {String} id the ID of the GUI element within the tab.
-	 */
-	var getIndexById = function(id) {
-		for (var i = 0; i < that.count(); i++) {
-			if (that.get(i).module == id) {
-				return i;
-			}
-		}
-		var e = new Mb_exception("mod_tab.js: getIndexById: ID '"+id+"' not found.");
-		return null;
-	};
-	
-	/**
-	 * Closes a tab.
-	 * 
-	 * @private
-	 * @param {String} id the ID of the GUI element within the tab.
-	 */
-	var closeTab = function(id) {
-		if (id !== null) {
-			hideFrame(id);
-			activeTabId = null;
-			startAnimation("close");
-		}		
-	};
-	
-	/**
-	 * Opens a tab.
-	 *
-	 * @public
-	 * @param {String} id the ID of the GUI element within the tab.
-	 */
-	this.openTab = function(id) {
-		if (id !== null && activeTabId != id) {
-  		// if no tab is currently opening or closing
-  		if (isAnimationFinished()) {
-  			for (var i=0; i < this.count(); i++) {
-  				hideFrame(this.get(i).module);
-  			}
-  		}
-      activeTabId = id;
-    	startAnimation("open");
-		}
-	};
-
-	/**
-	 * Hides a frame within a tab (before closing the tab).
-	 *
-	 * @private
-	 * @param {String} id the ID of the GUI element within the tab.
-	 */
-	var hideFrame = function(id) {
-		var index = getIndexById(id);
-		if (index !== null) {
-			var obj = document.getElementById(id);
-			obj.style.visibility = 'hidden';
-			//try to apply for childs of horizontal tabs
-			try{
-				if(obj.tabs)
-					document.getElementById(obj.tabs[obj.activeTab].id).style.visibility = 'hidden';
-		}
-			catch(e){}
-		}
-	};
-	
-	/**
-	 * Shows a frame within a tab (after opening the tab).
-	 *
-	 * @private
-	 * @param {String} id the ID of the GUI element within the tab.
-	 */
-	var showFrame = function(id) {
-		var index = getIndexById(id);
-		if (index !== null) {
-			var obj = document.getElementById(id);
-			var newpos = ((index+1) * tabHeight) + parseInt(tabTopOffset);
-			//try to apply for childs of horizontal tabs
-			try{
-				if(obj.tabs){
-					activeTab = document.getElementById(obj.tabs[obj.activeTab].id).style;
-					activeTab.visibility = 'visible';
-					activeTab.top = ((newpos + 1) + obj.tab_height) + "px";
-					activeTab.left = (tabLeftOffset) + "px";
-					activeTab.width = tabWidth;
-					activeTab.height = (parseInt(that.get(index).height) - 2) - obj.tab_height;
-				}
-			}
-			catch(e){}
-			obj=obj.style;
-			obj.top = (newpos + 1) + "px";
-			obj.left = (tabLeftOffset) + "px";
-			obj.width = tabWidth;
-			obj.height = (parseInt(that.get(index).height, 10) - 2);
-			obj.visibility = 'visible';
-			obj.display = 'block';
-		}
-	};
-
-	/**
-	 * Starts the animation of the opening and closing tabs
-	 *
-	 * @private
-	 * @param {String} openOrClose a string with the values "open" or "close".
-	 */
-	var startAnimation = function(openOrClose) {
-		for (var i = 0; i < that.count(); i++) {
-			that.get(i).animationFinished = false;
-		}
-		tabInterval = setInterval(function(){
-			tabs.animate(openOrClose);
-		},1);
-	};
-	
-	/**
-	 * Checks if the animation of the opening and closing tabs is finished.
-	 *
-	 * @private
-	 */
-	var isAnimationFinished = function() {
-		for (var i = 0; i < that.count(); i ++) {
-			if (that.get(i).animationFinished === false) {
-				return false;
-			}
-		}
-		return true;
-	};
-
-	/**
-	 * Stops the animation of the opening and closing tabs
-	 *
-	 * @private
-	 */
-	var stopAnimation = function() {
-		clearInterval(tabInterval);		
-	};
-
-	this.list = [];
-	var that = this;
-
-	/**
-	 * The DOM node of the tab array.
-	 */
-	var rootNode = document.getElementById("tabs");
-
-	/**
-	 * The ID of the currently open tab. If no tab is open, the value is NULL
-	 */
-	var activeTabId = null;
-
-	/**
-	 * Number of pixel that a tab moves while opening or closing.
-	 * @private
-	 */
-	var pixelPerIteration = 20;
-	
-	/**
-	 * Used for the 'setInterval' call of 'this.animate'
-	 */
-	var tabInterval;
-
-
-	var tabTopOffset = parseInt(rootNode.style.top, 10);
-	var tabLeftOffset = parseInt(rootNode.style.left, 10);
-	var tabWidth = parseInt(rootNode.style.width, 10);
-	var tabHeight = parseInt(rootNode.style.height, 10);
-	var tabStyle = cssString;
-
-	var tabPrefix = tab_prefix || '';
-	var styleObj = new StyleTag();
-	styleObj.addClass("verticalTabs", tabStyle);
-};
-
-VerticalTabArray.prototype = new List();
+// check element vars
+try{
+	if (open_tab){
+		open_tab = Number(open_tab);
+
+		if (isNaN(open_tab)) {
+			var e = new Mb_warning("mod_tab.js: tab_init: open_tab must be a number or an empty string.");
+		}
+	}
+}
+catch(e){
+	var z = new Mb_warning("mod_tab.js: tab_init: open_tab is not set.");
+	open_tab = "";
+}
+
+var tabs;
+
+eventLocalize.register(function () {
+	localizeTabs();
+});
+
+eventInit.register(function () {
+	tab_init();
+	localizeTabs();
+});
+
+function localizeTabs() {
+	mb_ajax_json("../php/mod_tab_messages.php", function(obj, status){
+		tabs.setTitles(obj);
+	});
+}
+
+function tab_init(){
+	var obj = document.getElementById("tabs").style;
+
+	// generate a new tab array
+	tabs = new VerticalTabArray(tab_style);
+
+	// add the tabs from element vars
+	for (var i = 0; i < tab_ids.length; i++){
+		tabs.addTab(tab_ids[i], tab_prefix + tab_titles[i], tab_frameHeight[i]);
+	}
+
+	if (open_tab !== "") {
+		tabs.openTab(tabs.get(open_tab).module);
+	}
+}
+
+function tab_open(elementName) {
+  // show the desired tab
+	tabs.openTab(elementName);
+}
+
+/**
+ * @class A single vertical tab
+ * 
+ * @constructor
+ * @param {String} id the ID of the GUI element that will be displayed within the tab
+ * @param {String} title the header of the tab
+ * @param {Integer} frameHeight the height of the frame containing the GUI element
+ * @param {Integer} tabWidth the width of a tab (NOT the frame)
+ * @param {Integer} tabHeight the height of a tab (NOT the frame)
+ * @param {String} tabStyle A string with a CSS (example: position:absolute;visibility:visible;border: 1px solid white;font-size:12;color:#343434;background-color:#CFD2D4;cursor:pointer;)
+ * @param {Integer} number the index of the current tab in a {@link VerticalTabArray}.
+ */
+var VerticalTab = function (id, title, frameHeight, tabWidth, tabHeight, tabStyle, number) {
+	
+	/**
+	 * Sets the attributes of the tabs DOM node.
+	 * 
+	 * @private
+	 * @param {String} title the header of the tab
+	 * @param {Integer} frameHeight the height of the frame containing the GUI element
+	 * @param {Integer} tabWidth the width of a tab (NOT the frame)
+	 * @param {Integer} tabHeight the height of a tab (NOT the frame)
+	 * @param {String} tabStyle A string with a CSS (example: position:absolute;visibility:visible;border: 1px solid white;font-size:12;color:#343434;background-color:#CFD2D4;cursor:pointer;)
+	 * @param {Integer} number the index of the current tab in a {@link VerticalTabArray}.
+	 * 
+	 */
+	var setNodeAttributes = function(title, frameHeight, tabWidth, tabHeight, tabStyle, number) {
+	
+		node.id = "tabs_" + that.module;
+		
+		//set css class
+		node.className = "verticalTabs";
+
+		//mandatory style entries
+		node.style.position = "absolute";
+		node.style.width = tabWidth;
+		node.style.height = tabHeight;
+		node.style.top = number * tabHeight;
+		
+		// open or close on click
+		// see http://www.mapbender.org/index.php/Add_events_via_DOM_in_IE_and_FF
+		if ($.browser.msie) {
+		
+		   node.onclick = function() {
+		      tabs.toggleTab(that.module);
+		   };
+		}
+		else {
+			node.onclick = function(){
+				tabs.toggleTab(that.module);
+			};
+		}
+		
+		// tab header
+		node.innerHTML = title;
+	};
+
+	/**
+	 * Returns the DOM node of this tab.
+	 *
+	 * @return the DOM node of this tab.
+	 * @type DOMNode
+	 */
+	this.getNode = function() {
+		return node;
+	};
+	
+	/**
+	 * The ID of the GUI element that will be displayed within the tab.
+	 */
+	this.module = id;
+
+	/**
+	 * The height of the frame containing the GUI element.
+	 */
+	this.height = frameHeight;
+	
+	/**
+	 * While a tab is opened or closed, the value is false.
+	 */
+	this.animationFinished = true;
+
+	/**
+	 * The DOM node of this tab.
+	 *
+	 * @private
+	 */
+	var node = document.createElement("div");
+	var that = this;
+	
+	setNodeAttributes(title, frameHeight, tabWidth, tabHeight, tabStyle, number);
+};
+	
+/**
+ * An array of vertical tabs, behaving like an accordion
+ *
+ * @extends List
+ * @param {String} cssString A string with a CSS (example: position:absolute;visibility:visible;border: 1px solid white;font-size:12;color:#343434;background-color:#CFD2D4;cursor:pointer;)
+ */	
+var VerticalTabArray = function (cssString) {
+	
+	/**
+	 * Adds a new tab to the Array.
+	 *
+	 * @param {String} id the ID of the GUI element that will be displayed within the tab
+	 * @param {String} title the header of the tab
+	 * @param {Integer} height the height of the frame containing the GUI element
+	 */
+	this.addTab = function(id, title, height) {
+		var tab = new VerticalTab(id, title, height, tabWidth, tabHeight, tabStyle, this.count());
+		this.add(tab);
+
+		document.getElementById(id).style.visibility = 'hidden';
+		document.getElementById(id).style.display = 'none';
+
+		// append the new tab
+		rootNode.appendChild(this.get(-1).getNode());
+	};
+	
+	/**
+	 * Removes a tab from the Array.
+	 *
+	 * @param {String} id the ID of the GUI element within the tab.
+	 */
+	this.delTab = function(id) {
+		var index = getIndexById(id);
+		
+		if (index !== null) {
+			// delete the DOM node
+			rootNode.removeChild(this.get(index).getNode());
+
+			// delete the tab
+			this.del(index);
+			
+			// move the other tabs (below the removed tab) up
+			for (var i = index; i < this.count(); i++) {
+				var currentNode = this.get(i).getNode();
+				
+				// parseInt removes "px"
+				var currentTop = parseInt(currentNode.style.top, 10);
+				currentNode.style.top = currentTop - tabHeight;
+			}			
+		}
+	};
+		
+	/**
+	 * Opens a tab specified by the module Id.
+	 *
+	 * @param {String} id the ID of the GUI element within the tab.
+	 */
+	this.toggleTab = function(id) {
+		// if no tab is currently opening or closing
+		if (isAnimationFinished()) {
+			for (var i=0; i < this.count(); i++) {
+				hideFrame(this.get(i).module);
+			}
+			// if the opened tab is the active tab, close it
+			if (id === activeTabId) {
+				closeTab(activeTabId);
+			}
+			//otherwise
+			else {
+				// show the desired tab
+		  	activeTabId = id;
+				startAnimation("open");
+			}
+		}
+		else {
+			var e = new Mb_warning("mod_tab.js: could not activate tab, opening or closing in progress!");
+		}
+	};
+	
+	/**
+	 * Sets the titles of each single tab after l10n
+	 * 
+	 * @param {Object} obj an array containing objects with id and title
+	 */
+	this.setTitles = function (obj) {
+		for (var i = 0; i < this.count(); i++) {
+			for(var j=0; j<obj.length; j++){
+				if (this.get(i).module == obj[j].id) {
+					this.get(i).getNode().innerHTML = tabPrefix + obj[j].title;
+				}
+			}
+		}		
+	}
+	/**
+	 * Returns the absolute coordinates of tab by the module ID
+	 * 
+	 * @param {String} id the ID of the GUI element within the tab.
+	 * @return {String} String with "left,top,right,bottom"
+	 */
+	 
+	 this.getCoords = function(id) {
+	 	var coords=[];
+	 	//get indixes
+	 	if (activeTabId) {
+			var indexOfOpeningTab = getIndexById(activeTabId);
+		}
+		var index = getIndexById(id);
+	 	
+	 	//left
+	 	coords[0] = tabLeftOffset;
+	 	//top
+	 	coords[1] = tabTopOffset + index*tabHeight + (activeTabId&&indexOfOpeningTab<index?this.get(indexOfOpeningTab).height:0);
+	 	//right
+	 	coords[2] = coords[0] + tabWidth;
+	 	//bottom
+	 	coords[3] = coords[1] + (id==activeTabId?this.get(indexOfOpeningTab).height+tabHeight:tabHeight);
+	 	
+	 	return coords.join(",");
+	 };
+
+	/**
+	 * Animated opening and closing of the tab with the given id.
+	 * Needs to be public because it is called via "setInterval". 
+	 *
+	 * @param {String} openOrClose a string with the values "open" or "close".
+	 */
+	this.animate = function(openOrClose) {
+
+		for (var i=0; i < this.count(); i++) {
+			
+			if (this.get(i).animationFinished === false) {
+
+				//The 'top' position of the i-th tab after the animation
+				var currentTabNewTop = i * tabHeight;
+	
+				if (openOrClose == 'open') {
+					var indexOfOpeningTab = getIndexById(activeTabId);
+					
+					// move the lower tabs down by the height of the opening tab
+					if (indexOfOpeningTab !== null && i > indexOfOpeningTab) {
+						currentTabNewTop += this.get(indexOfOpeningTab).height;
+					}
+				}	
+				//The current 'top' position of the i-th tab
+				//(parseInt removes 'px')
+				var currentTabCurrentTop = parseInt(this.get(i).getNode().style.top, 10);
+				
+				// animation is finished
+				if (currentTabCurrentTop == currentTabNewTop) {
+					this.get(i).animationFinished = true;
+				}	
+				// animation not yet finished, move the tab down
+				else if (currentTabCurrentTop < currentTabNewTop) {
+					var pixel = Math.min(pixelPerIteration, currentTabNewTop - currentTabCurrentTop);
+					this.get(i).getNode().style.top = currentTabCurrentTop + pixel;
+				}
+				// animation not yet finished, move the tab up
+				else if (currentTabCurrentTop > currentTabNewTop) {
+					var pixel = Math.min(pixelPerIteration, currentTabCurrentTop - currentTabNewTop);
+					this.get(i).getNode().style.top = currentTabCurrentTop - pixel;
+				}
+				else {
+					var e = new Mb_exception("mod_tab.js: animate: unknown state for tab "+ i + " (currentTop: "+currentTabCurrentTop+", newTop:"+currentTabNewTop+")");
+				}
+			}
+		}
+		// check if the animation is finished
+		if (isAnimationFinished()) {
+			stopAnimation();
+			if (openOrClose == "open") {
+				showFrame(activeTabId);
+			}
+		}
+	};
+
+	/**
+	 * Returns the index of the vertical tab with a given id 
+	 *
+	 * @private
+	 * @param {String} id the ID of the GUI element within the tab.
+	 */
+	var getIndexById = function(id) {
+		for (var i = 0; i < that.count(); i++) {
+			if (that.get(i).module == id) {
+				return i;
+			}
+		}
+		var e = new Mb_exception("mod_tab.js: getIndexById: ID '"+id+"' not found.");
+		return null;
+	};
+	
+	/**
+	 * Closes a tab.
+	 * 
+	 * @private
+	 * @param {String} id the ID of the GUI element within the tab.
+	 */
+	var closeTab = function(id) {
+		if (id !== null) {
+			hideFrame(id);
+			activeTabId = null;
+			startAnimation("close");
+		}		
+	};
+	
+	/**
+	 * Opens a tab.
+	 *
+	 * @public
+	 * @param {String} id the ID of the GUI element within the tab.
+	 */
+	this.openTab = function(id) {
+		if (id !== null && activeTabId != id) {
+  		// if no tab is currently opening or closing
+  		if (isAnimationFinished()) {
+  			for (var i=0; i < this.count(); i++) {
+  				hideFrame(this.get(i).module);
+  			}
+  		}
+      activeTabId = id;
+    	startAnimation("open");
+		}
+	};
+
+	/**
+	 * Hides a frame within a tab (before closing the tab).
+	 *
+	 * @private
+	 * @param {String} id the ID of the GUI element within the tab.
+	 */
+	var hideFrame = function(id) {
+		var index = getIndexById(id);
+		if (index !== null) {
+			var obj = document.getElementById(id);
+			obj.style.visibility = 'hidden';
+			//try to apply for childs of horizontal tabs
+			try{
+				if(obj.tabs)
+					document.getElementById(obj.tabs[obj.activeTab].id).style.visibility = 'hidden';
+		}
+			catch(e){}
+		}
+	};
+	
+	/**
+	 * Shows a frame within a tab (after opening the tab).
+	 *
+	 * @private
+	 * @param {String} id the ID of the GUI element within the tab.
+	 */
+	var showFrame = function(id) {
+		var index = getIndexById(id);
+		if (index !== null) {
+			var obj = document.getElementById(id);
+			var newpos = ((index+1) * tabHeight) + parseInt(tabTopOffset);
+			//try to apply for childs of horizontal tabs
+			try{
+				if(obj.tabs){
+					activeTab = document.getElementById(obj.tabs[obj.activeTab].id).style;
+					activeTab.visibility = 'visible';
+					activeTab.top = ((newpos + 1) + obj.tab_height) + "px";
+					activeTab.left = (tabLeftOffset) + "px";
+					activeTab.width = tabWidth;
+					activeTab.height = (parseInt(that.get(index).height) - 2) - obj.tab_height;
+				}
+			}
+			catch(e){}
+			obj=obj.style;
+			obj.top = (newpos + 1) + "px";
+			obj.left = (tabLeftOffset) + "px";
+			obj.width = tabWidth;
+			obj.height = (parseInt(that.get(index).height, 10) - 2);
+			obj.visibility = 'visible';
+			obj.display = 'block';
+		}
+	};
+
+	/**
+	 * Starts the animation of the opening and closing tabs
+	 *
+	 * @private
+	 * @param {String} openOrClose a string with the values "open" or "close".
+	 */
+	var startAnimation = function(openOrClose) {
+		for (var i = 0; i < that.count(); i++) {
+			that.get(i).animationFinished = false;
+		}
+		tabInterval = setInterval(function(){
+			tabs.animate(openOrClose);
+		},1);
+	};
+	
+	/**
+	 * Checks if the animation of the opening and closing tabs is finished.
+	 *
+	 * @private
+	 */
+	var isAnimationFinished = function() {
+		for (var i = 0; i < that.count(); i ++) {
+			if (that.get(i).animationFinished === false) {
+				return false;
+			}
+		}
+		return true;
+	};
+
+	/**
+	 * Stops the animation of the opening and closing tabs
+	 *
+	 * @private
+	 */
+	var stopAnimation = function() {
+		clearInterval(tabInterval);		
+	};
+
+	this.list = [];
+	var that = this;
+
+	/**
+	 * The DOM node of the tab array.
+	 */
+	var rootNode = document.getElementById("tabs");
+
+	/**
+	 * The ID of the currently open tab. If no tab is open, the value is NULL
+	 */
+	var activeTabId = null;
+
+	/**
+	 * Number of pixel that a tab moves while opening or closing.
+	 * @private
+	 */
+	var pixelPerIteration = 20;
+	
+	/**
+	 * Used for the 'setInterval' call of 'this.animate'
+	 */
+	var tabInterval;
+
+
+	var tabTopOffset = parseInt(rootNode.style.top, 10);
+	var tabLeftOffset = parseInt(rootNode.style.left, 10);
+	var tabWidth = parseInt(rootNode.style.width, 10);
+	var tabHeight = parseInt(rootNode.style.height, 10);
+	var tabStyle = cssString;
+
+	var tabPrefix = tab_prefix || '';
+	var styleObj = new StyleTag();
+	styleObj.addClass("verticalTabs", tabStyle);
+};
+
+VerticalTabArray.prototype = new List();

Modified: branches/print_dev/http/javascripts/mod_wfs_client.html
===================================================================
--- branches/print_dev/http/javascripts/mod_wfs_client.html	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/mod_wfs_client.html	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,453 +1,453 @@
-<html>
-<head>
-<meta http-equiv="content-type" content="text/html;CHARSET=iso-8859-1">
-
-<link rel="stylesheet" type="text/css" media="screen,projection" href="../css/admin.screen.css" title="screen" />
-
-<script type='text/javascript'>
-
-
-/*
- * services['action']: instructs the servercomponent
- * services['services']: infos about the services (wfs)
- * services['services']['id']: a list of ids
- * services['service']['title']: a corresponding list of titles
- *
- */
-var services = {};
-/*
- * wfsConf['action']: instructs the servercomponent
- * wfsConf['wfs']: the ID of the selected wfs
- * wfsConf['wfsConf']: infos about the wfs configurations
- * wfsConf['wfsConf']['id']: a list of ids
- * wfsConf['wfsConf']['abstract']: a corresponding list of descriptions
- */
-var wfsConf = {};
-
-/*
- * guis['action']: instructs the servercomponent
- * guis['id']: a list of gui-IDs where the current user is owner
- * guis['selectedGui']: the selected Gui
- */
-var guis = {};
-
-/*
- * handleAssignment['action']: instructs the servercomponent
- * handleAssignment['selectedConf']: a list of wfs-conf Ids
- * handleAssignment['selectedGui']: the selected Gui
- */
-var handleAssignment = {}
-
-/*
- * vupdateWfs['action']: instructs the servercomponent
- * vupdateWfs['wfs']: id of wfs to update
- * vupdateWfs['url']: capabilities url
- */
-var vupdateWfs = {};
-
-/*
- * deleteWfs_['action']: instructs the servercomponent
- * deleteWfs_['wfs']: id of wfs to update
- */
-var deleteWfs_ = {};
-
-/*
- * geturl['action']: instructs the servercomponent
- * geturl['wfs']: id of wfs to get the url for
- * geturl['column']: column of the url to get in table wfs
- */
-var geturl = {}
-
-var owsproxy = {}
-
-
-
-
-function getWfsList(){
-	services['action'] = 'getServices';
-	getData(services);
-}
-function getGuis(){
-	guis['action'] = 'getGuis';
-	getData(guis);
-}
-function getWfsConfData(){
-	wfsConf['action'] = 'getWfsConfData';
-	wfsConf['wfs'] = getSelectedWfs();
-	getData(wfsConf);
-}
-function getSelectedWfs(){
-	var w = document.wfsForm.wfsList;
-	var ind  = w.selectedIndex;
-	if(ind == -1){
-		return false;
-	}
-	if(ind == w.options.length-1)
-		return "gui_confs";
-	return w.options[ind].value;
-}
-function getGuiConfs(){
-	guis['action'] = 'getAssignedConfs';
-	var g = document.wfsForm.guiList;
-	var ind  = g.selectedIndex;
-	if(ind == -1){
-		return false;
-	}
-	guis['selectedGui'] = g.options[ind].value;
-	guis['selectedWfs'] = wfsConf['wfs'];
-	getData(guis);
-}
-/**
- * Sends an request to get the url to the capabilities doc of selected wfs
- *
- */
-
-function getUpdateUrl(column){
-	geturl['action'] = 'getUpdateUrl';
-	var w = document.wfsForm.wfsList;
-	var ind  = w.selectedIndex;
-	if(ind == -1){
-		alert("please select an WFS");
-		return;
-	}
-	geturl['wfs'] = w.options[ind].value;
-	geturl['column'] = column;
-	geturl['wfs_version'] = '';
-	getData(geturl);
-}
-
-function addConfsToGui(){
-	handleAssignment['action'] = 'add';
-	handleAssignment['confs'] = getSelectedConfs();
-	handleAssignment['gui'] = getSelectedGui();
-	getData(handleAssignment);
-}
-function removeConfsFromGui(){
-	handleAssignment['action'] = 'remove';
-	handleAssignment['confs'] = getSelectedAssignedConfs();
-	handleAssignment['gui'] = getSelectedGui();
-	getData(handleAssignment);
-}
-/**
- * Sends an update request to update the capabilities of selected wfs
- *
- * @return success
- * @type boolean
- */
-
-function updateWfs(){
-	vupdateWfs['action'] = 'updateWfs';
-	var w = document.wfsForm.wfsList;
-	var ind  = w.selectedIndex;
-	if(ind == -1){
-		alert("please select an WFS");
-		return false;
-	}
-	vupdateWfs['wfs'] = w.options[ind].value;
-	if(document.getElementById("updateUrl").value == ''){
-		alert("Please choose the link to the new WFS Capabilities URL.");
-		return false;
-	}
-
-	vupdateWfs['url'] = document.getElementById("updateUrl").value;
-	getData(vupdateWfs);
-	return true;
-}
-
-function deleteWfs(){
-	deleteWfs_['action'] = 'deleteWfs';
-	deleteWfs_['wfs'] = getSelectedWfs();
-	if(deleteWfs_['wfs']&&deleteWfs_['wfs']!="gui_confs"){
-		if(confirm("Do you really want to delete the Wfs with Wfs-id:"+deleteWfs_['wfs']+"?")){
-			getData(deleteWfs_);
-		}
-		return true;
-	}
-	return false;
-}
-
-function setIndicator(){
-	var str = "<img src='../img/indicator_wheel.gif'>";
-	document.getElementById("indicator").innerHTML = str;
-}
-function removeIndicator(){
-	document.getElementById("indicator").innerHTML = "";
-}
-function getOwsproxy(){
-	owsproxy['action'] = 'getOwsproxy';
-	owsproxy['wfs'] = getSelectedWfs();
-	getData(owsproxy);
-}
-function setOwsproxy(obj){
-	if(obj.checked == true){
-		owsproxy['action'] = 'setOwsproxy';
-	}
-	else{
-		owsproxy['action'] = 'removeOwsproxy';
-	}
-	owsproxy['wfs'] = getSelectedWfs();
-	if(owsproxy['wfs']){
-		getData(owsproxy);
-	}
-	else{
-		obj.checked = false;
-	}
-}
-/*
- * Ajax-function to get data from the server
- */
-function getData(obj){
-	setIndicator();
-	var obj2json = parent.$.toJSON(obj);
-	parent.$.post("../php/mod_wfs_server.php",{"obj":obj2json}, function (json,status){
-		if(status == 'success'){
-			var dsJson = eval('(' + json + ')');
-			switch(obj['action']){
-				case "getServices":
-					appendServices(dsJson);
-				break;
-				case "getWfsConfData":
-					getOwsproxy();
-					appendWfsConfData(dsJson);
-				break;
-				case "getGuis":
-					appendGuis(dsJson);
-				break;
-				case "getAssignedConfs":
-					appendGuiConfs(dsJson);
-				break;
-				case "getUpdateUrl":
-					setUpdateUrl(dsJson)
-				break;
-				case "add":
-					getGuiConfs();
-				break;
-				case "remove":
-					getGuiConfs();
-				break;
-				case "updateWfs":
-					if(dsJson['success'])
-						alert("Update performed.");
-					else
-						alert("An error occured, see log for details.");
-				break;
-				case "deleteWfs":
-					if(dsJson['success']){
-						clearList(document.forms[0].wfsList);
-						clearList(document.forms[0].guiList);
-						getWfsList();
-						getGuis();
-						alert("WFS deleted.");
-					}
-				break;
-				case "setOwsproxy":
-					displayOwsproxy(dsJson);
-				break;
-				case "removeOwsproxy":
-					displayOwsproxy(dsJson);
-				break;
-				case "getOwsproxy":
-					displayOwsproxy(dsJson);
-				break;
-				default:
-					alert("No action specified.....");
-				break;
-			}
-		}
-		else{
-			alert("An error occured!");
-		}
-		removeIndicator();
-	});
-}
-
-/**
- * Sets the update url comming from db in the html form
- *
- */
-
-function setUpdateUrl(dsJson){
-	document.getElementById("updateUrl").value = dsJson['url'];
-}
-
-function clearUpdateUrl(){
-	document.getElementById("updateUrl").value = '';
-}
-
-/*
- *
- */
-function displayOwsproxy(dsJson){
-	if(dsJson.string == "" || dsJson.string == false){
-		document.wfsForm.owsproxy.checked = false;
-	}
-	else{
-		document.wfsForm.owsproxy.checked = true;
-	}
-}
-
-function appendServices(dsJson){
-	services['services'] = dsJson.services;
-	var o = services['services'];
-	for(var i=0; i<o.id.length; i++){
-		appendOption(document.forms[0].wfsList, o.title[i], o.id[i], false);
-	}
-	appendOption(document.forms[0].wfsList, "all WFS Configurations", "-1", false);
-}
-
-function appendWfsConfData(dsJson){
-	wfsConf['wfsConf'] = {};
-	wfsConf['wfsConf'] = dsJson.wfsConf;
-	var o = wfsConf['wfsConf'];
-	document.forms[0].wfsConfList.innerHTML = '';
-	if(typeof(o.id)=="undefined")
-		return;
-	for(var i=0; i<o.id.length; i++){
-		appendOption(document.forms[0].wfsConfList, o.abstract[i], o.id[i], false);
-	}
-}
-
-function appendGuis(dsJson){
-	guis['id'] = {};
-	guis['id'] = dsJson.id;
-	var o = guis['id'];
-	for(var i=0; i<o.length; i++){
-		appendOption(document.forms[0].guiList, o[i], o[i], false);
-	}
-}
-function appendGuiConfs(dsJson){
-	var list = document.forms[0].guiConfList;
-	list.innerHTML = '';
-	for(var i=0; i<dsJson.assignedConfs.length; i++){
-		var confAbstract = getConfAbstract(dsJson.assignedConfs[i]);
-		appendOption(list, confAbstract, dsJson.assignedConfs[i], false);
-	}
-}
-function appendOption(boxObject, optionText, optionValue, selected){
-	var newOption = new Option(optionText,optionValue,false,selected);
-	boxObject.options[boxObject.length] = newOption;
-}
-function clearList(boxObject){
-	boxObject.length = 0;
-}
-
-/*
- * returns id and abstract from a wfs configuration
- */
-function getConfAbstract(confId){
-	var c = wfsConf['wfsConf'];
-	for(var i=0; i < c['id'].length; i++){
-		if(c['id'][i] == confId){
-			return c['abstract'][i];
-		}
-	}
-}
-function getSelectedConfs(){
-	var list = document.forms[0].wfsConfList;
-	var confs = [];
-	for(var i=0; i<list.length; i++){
-		if(list.options[i].selected === true){
-			confs.push(list.options[i].value);
-		}
-	}
-	return confs;
-}
-function getSelectedAssignedConfs(){
-	var list = document.forms[0].guiConfList;
-	var confs = [];
-	for(var i=0; i<list.length; i++){
-		if(list.options[i].selected === true){
-			confs.push(list.options[i].value);
-		}
-	}
-	return confs;
-}
-function getSelectedGui(){
-	var ind = document.forms[0].guiList.selectedIndex;
-	return document.forms[0].guiList.options[ind].value;
-}
-
-function previewWfsUrl(){
-				 var previewUrl = document.forms[0].updateUrl.value;
-				 if(previewUrl !=''){
-				 							 capabilitiesWin = window.open(previewUrl);
-				}else{
-							alert("Please select a WFS first");			
-				}			
-}
-</script>
-</head>
-<body onload='getWfsList();getGuis();'>
-
-<h1>Edit WFS</h1>
-<form name='wfsForm'>
-	<div id='indicator'>ahh</div>
-
-	<fieldset class="leftContainer">
-	<legend>WFS List</legend>
-		<p>
-			<select size='10' name='wfsList' class='wfsList' onchange='getWfsConfData();getGuiConfs();clearUpdateUrl();'></select>
-		</p>
-	</fieldset>
-
-	<fieldset class="rightContainer">
-		<legend>Options</legend>
-		<p>
-			<input type='checkbox' name='owsproxy' id='owsproxy' onclick='setOwsproxy(this)' />
-			<label for="owsproxy">enable OWSProxy for the selected WFS</label>
-			<br><br>
-			<input type='button' value='Delete WFS' name='delete' id='deleteButton' onclick='deleteWfs()' />
-		</p>
-	</fieldset>
-
-	<fieldset class="rightContainer">
-		<legend>Update WFS</legend>
-		<p>
-				Please choose the Link to the WFS Capabilities URL:
-				<br />
-				<a href='javascript:getUpdateUrl("wfs_getcapabilities")'>wfs_getcapabilities</a> or <a href='javascript:getUpdateUrl("wfs_upload_url")'>wfs_upload_url</a>
-			</label>
-			<input id='updateUrl' type='text' value='' name='updateUrl' class='updateUrl' />
-			<br />
-			<input type='button' value='Update WFS' name='update' id='updateButton' onclick='updateWfs()' />
-						<input type='button' value='Preview WFS Capabilities' name='preview' id='previewButton' onclick='previewWfsUrl();' />
-		</p>
-	</fieldset>
-<hr />
-
-	<fieldset class="rightContainer">
-	<legend>GUI List</legend>
-		<p>
-			<select size='6' name='guiList' class='guiList' onchange='getGuiConfs()'></select>
-		</p>
-	</fieldset>
-
-<hr />
-
-	<fieldset class="leftContainer">
-	<legend>WFS Configuration List</legend>
-		<p>
-			<select size='6' name='wfsConfList' class='wfsConfList' onchange='' multiple="multiple"></select>
-		</p>
-	</fieldset>
-
-	<fieldset class="centerContainer">
-	<legend>Action</legend>
-		<p>
-			<input type='button' value='&gt;' name ='add' id ='add' class='add' onclick='addConfsToGui()'><br />
-			<input type='button' value='&lt;' name ='remove' id ='remove' class='remove' onclick='removeConfsFromGui()'>
-		</p>
-	</fieldset>
-
-	<fieldset class="rightContainer">
-	<legend>GUI Configuration List</legend>
-		<p>
-			<select size='6' name='guiConfList' class='guiConfList' onchange='' multiple="multiple"></select>
-		</p>
-	</fieldset>
-
-<hr />
-</form>
-
-</body>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html;CHARSET=iso-8859-1">
+
+<link rel="stylesheet" type="text/css" media="screen,projection" href="../css/admin.screen.css" title="screen" />
+
+<script type='text/javascript'>
+
+
+/*
+ * services['action']: instructs the servercomponent
+ * services['services']: infos about the services (wfs)
+ * services['services']['id']: a list of ids
+ * services['service']['title']: a corresponding list of titles
+ *
+ */
+var services = {};
+/*
+ * wfsConf['action']: instructs the servercomponent
+ * wfsConf['wfs']: the ID of the selected wfs
+ * wfsConf['wfsConf']: infos about the wfs configurations
+ * wfsConf['wfsConf']['id']: a list of ids
+ * wfsConf['wfsConf']['abstract']: a corresponding list of descriptions
+ */
+var wfsConf = {};
+
+/*
+ * guis['action']: instructs the servercomponent
+ * guis['id']: a list of gui-IDs where the current user is owner
+ * guis['selectedGui']: the selected Gui
+ */
+var guis = {};
+
+/*
+ * handleAssignment['action']: instructs the servercomponent
+ * handleAssignment['selectedConf']: a list of wfs-conf Ids
+ * handleAssignment['selectedGui']: the selected Gui
+ */
+var handleAssignment = {}
+
+/*
+ * vupdateWfs['action']: instructs the servercomponent
+ * vupdateWfs['wfs']: id of wfs to update
+ * vupdateWfs['url']: capabilities url
+ */
+var vupdateWfs = {};
+
+/*
+ * deleteWfs_['action']: instructs the servercomponent
+ * deleteWfs_['wfs']: id of wfs to update
+ */
+var deleteWfs_ = {};
+
+/*
+ * geturl['action']: instructs the servercomponent
+ * geturl['wfs']: id of wfs to get the url for
+ * geturl['column']: column of the url to get in table wfs
+ */
+var geturl = {}
+
+var owsproxy = {}
+
+
+
+
+function getWfsList(){
+	services['action'] = 'getServices';
+	getData(services);
+}
+function getGuis(){
+	guis['action'] = 'getGuis';
+	getData(guis);
+}
+function getWfsConfData(){
+	wfsConf['action'] = 'getWfsConfData';
+	wfsConf['wfs'] = getSelectedWfs();
+	getData(wfsConf);
+}
+function getSelectedWfs(){
+	var w = document.wfsForm.wfsList;
+	var ind  = w.selectedIndex;
+	if(ind == -1){
+		return false;
+	}
+	if(ind == w.options.length-1)
+		return "gui_confs";
+	return w.options[ind].value;
+}
+function getGuiConfs(){
+	guis['action'] = 'getAssignedConfs';
+	var g = document.wfsForm.guiList;
+	var ind  = g.selectedIndex;
+	if(ind == -1){
+		return false;
+	}
+	guis['selectedGui'] = g.options[ind].value;
+	guis['selectedWfs'] = wfsConf['wfs'];
+	getData(guis);
+}
+/**
+ * Sends an request to get the url to the capabilities doc of selected wfs
+ *
+ */
+
+function getUpdateUrl(column){
+	geturl['action'] = 'getUpdateUrl';
+	var w = document.wfsForm.wfsList;
+	var ind  = w.selectedIndex;
+	if(ind == -1){
+		alert("please select an WFS");
+		return;
+	}
+	geturl['wfs'] = w.options[ind].value;
+	geturl['column'] = column;
+	geturl['wfs_version'] = '';
+	getData(geturl);
+}
+
+function addConfsToGui(){
+	handleAssignment['action'] = 'add';
+	handleAssignment['confs'] = getSelectedConfs();
+	handleAssignment['gui'] = getSelectedGui();
+	getData(handleAssignment);
+}
+function removeConfsFromGui(){
+	handleAssignment['action'] = 'remove';
+	handleAssignment['confs'] = getSelectedAssignedConfs();
+	handleAssignment['gui'] = getSelectedGui();
+	getData(handleAssignment);
+}
+/**
+ * Sends an update request to update the capabilities of selected wfs
+ *
+ * @return success
+ * @type boolean
+ */
+
+function updateWfs(){
+	vupdateWfs['action'] = 'updateWfs';
+	var w = document.wfsForm.wfsList;
+	var ind  = w.selectedIndex;
+	if(ind == -1){
+		alert("please select an WFS");
+		return false;
+	}
+	vupdateWfs['wfs'] = w.options[ind].value;
+	if(document.getElementById("updateUrl").value == ''){
+		alert("Please choose the link to the new WFS Capabilities URL.");
+		return false;
+	}
+
+	vupdateWfs['url'] = document.getElementById("updateUrl").value;
+	getData(vupdateWfs);
+	return true;
+}
+
+function deleteWfs(){
+	deleteWfs_['action'] = 'deleteWfs';
+	deleteWfs_['wfs'] = getSelectedWfs();
+	if(deleteWfs_['wfs']&&deleteWfs_['wfs']!="gui_confs"){
+		if(confirm("Do you really want to delete the Wfs with Wfs-id:"+deleteWfs_['wfs']+"?")){
+			getData(deleteWfs_);
+		}
+		return true;
+	}
+	return false;
+}
+
+function setIndicator(){
+	var str = "<img src='../img/indicator_wheel.gif'>";
+	document.getElementById("indicator").innerHTML = str;
+}
+function removeIndicator(){
+	document.getElementById("indicator").innerHTML = "";
+}
+function getOwsproxy(){
+	owsproxy['action'] = 'getOwsproxy';
+	owsproxy['wfs'] = getSelectedWfs();
+	getData(owsproxy);
+}
+function setOwsproxy(obj){
+	if(obj.checked == true){
+		owsproxy['action'] = 'setOwsproxy';
+	}
+	else{
+		owsproxy['action'] = 'removeOwsproxy';
+	}
+	owsproxy['wfs'] = getSelectedWfs();
+	if(owsproxy['wfs']){
+		getData(owsproxy);
+	}
+	else{
+		obj.checked = false;
+	}
+}
+/*
+ * Ajax-function to get data from the server
+ */
+function getData(obj){
+	setIndicator();
+	var obj2json = parent.$.toJSON(obj);
+	parent.$.post("../php/mod_wfs_server.php",{"obj":obj2json}, function (json,status){
+		if(status == 'success'){
+			var dsJson = eval('(' + json + ')');
+			switch(obj['action']){
+				case "getServices":
+					appendServices(dsJson);
+				break;
+				case "getWfsConfData":
+					getOwsproxy();
+					appendWfsConfData(dsJson);
+				break;
+				case "getGuis":
+					appendGuis(dsJson);
+				break;
+				case "getAssignedConfs":
+					appendGuiConfs(dsJson);
+				break;
+				case "getUpdateUrl":
+					setUpdateUrl(dsJson)
+				break;
+				case "add":
+					getGuiConfs();
+				break;
+				case "remove":
+					getGuiConfs();
+				break;
+				case "updateWfs":
+					if(dsJson['success'])
+						alert("Update performed.");
+					else
+						alert("An error occured, see log for details.");
+				break;
+				case "deleteWfs":
+					if(dsJson['success']){
+						clearList(document.forms[0].wfsList);
+						clearList(document.forms[0].guiList);
+						getWfsList();
+						getGuis();
+						alert("WFS deleted.");
+					}
+				break;
+				case "setOwsproxy":
+					displayOwsproxy(dsJson);
+				break;
+				case "removeOwsproxy":
+					displayOwsproxy(dsJson);
+				break;
+				case "getOwsproxy":
+					displayOwsproxy(dsJson);
+				break;
+				default:
+					alert("No action specified.....");
+				break;
+			}
+		}
+		else{
+			alert("An error occured!");
+		}
+		removeIndicator();
+	});
+}
+
+/**
+ * Sets the update url comming from db in the html form
+ *
+ */
+
+function setUpdateUrl(dsJson){
+	document.getElementById("updateUrl").value = dsJson['url'];
+}
+
+function clearUpdateUrl(){
+	document.getElementById("updateUrl").value = '';
+}
+
+/*
+ *
+ */
+function displayOwsproxy(dsJson){
+	if(dsJson.string == "" || dsJson.string == false){
+		document.wfsForm.owsproxy.checked = false;
+	}
+	else{
+		document.wfsForm.owsproxy.checked = true;
+	}
+}
+
+function appendServices(dsJson){
+	services['services'] = dsJson.services;
+	var o = services['services'];
+	for(var i=0; i<o.id.length; i++){
+		appendOption(document.forms[0].wfsList, o.title[i], o.id[i], false);
+	}
+	appendOption(document.forms[0].wfsList, "all WFS Configurations", "-1", false);
+}
+
+function appendWfsConfData(dsJson){
+	wfsConf['wfsConf'] = {};
+	wfsConf['wfsConf'] = dsJson.wfsConf;
+	var o = wfsConf['wfsConf'];
+	document.forms[0].wfsConfList.innerHTML = '';
+	if(typeof(o.id)=="undefined")
+		return;
+	for(var i=0; i<o.id.length; i++){
+		appendOption(document.forms[0].wfsConfList, o.abstract[i], o.id[i], false);
+	}
+}
+
+function appendGuis(dsJson){
+	guis['id'] = {};
+	guis['id'] = dsJson.id;
+	var o = guis['id'];
+	for(var i=0; i<o.length; i++){
+		appendOption(document.forms[0].guiList, o[i], o[i], false);
+	}
+}
+function appendGuiConfs(dsJson){
+	var list = document.forms[0].guiConfList;
+	list.innerHTML = '';
+	for(var i=0; i<dsJson.assignedConfs.length; i++){
+		var confAbstract = getConfAbstract(dsJson.assignedConfs[i]);
+		appendOption(list, confAbstract, dsJson.assignedConfs[i], false);
+	}
+}
+function appendOption(boxObject, optionText, optionValue, selected){
+	var newOption = new Option(optionText,optionValue,false,selected);
+	boxObject.options[boxObject.length] = newOption;
+}
+function clearList(boxObject){
+	boxObject.length = 0;
+}
+
+/*
+ * returns id and abstract from a wfs configuration
+ */
+function getConfAbstract(confId){
+	var c = wfsConf['wfsConf'];
+	for(var i=0; i < c['id'].length; i++){
+		if(c['id'][i] == confId){
+			return c['abstract'][i];
+		}
+	}
+}
+function getSelectedConfs(){
+	var list = document.forms[0].wfsConfList;
+	var confs = [];
+	for(var i=0; i<list.length; i++){
+		if(list.options[i].selected === true){
+			confs.push(list.options[i].value);
+		}
+	}
+	return confs;
+}
+function getSelectedAssignedConfs(){
+	var list = document.forms[0].guiConfList;
+	var confs = [];
+	for(var i=0; i<list.length; i++){
+		if(list.options[i].selected === true){
+			confs.push(list.options[i].value);
+		}
+	}
+	return confs;
+}
+function getSelectedGui(){
+	var ind = document.forms[0].guiList.selectedIndex;
+	return document.forms[0].guiList.options[ind].value;
+}
+
+function previewWfsUrl(){
+				 var previewUrl = document.forms[0].updateUrl.value;
+				 if(previewUrl !=''){
+				 							 capabilitiesWin = window.open(previewUrl);
+				}else{
+							alert("Please select a WFS first");			
+				}			
+}
+</script>
+</head>
+<body onload='getWfsList();getGuis();'>
+
+<h1>Edit WFS</h1>
+<form name='wfsForm'>
+	<div id='indicator'>ahh</div>
+
+	<fieldset class="leftContainer">
+	<legend>WFS List</legend>
+		<p>
+			<select size='10' name='wfsList' class='wfsList' onchange='getWfsConfData();getGuiConfs();clearUpdateUrl();'></select>
+		</p>
+	</fieldset>
+
+	<fieldset class="rightContainer">
+		<legend>Options</legend>
+		<p>
+			<input type='checkbox' name='owsproxy' id='owsproxy' onclick='setOwsproxy(this)' />
+			<label for="owsproxy">enable OWSProxy for the selected WFS</label>
+			<br><br>
+			<input type='button' value='Delete WFS' name='delete' id='deleteButton' onclick='deleteWfs()' />
+		</p>
+	</fieldset>
+
+	<fieldset class="rightContainer">
+		<legend>Update WFS</legend>
+		<p>
+				Please choose the Link to the WFS Capabilities URL:
+				<br />
+				<a href='javascript:getUpdateUrl("wfs_getcapabilities")'>wfs_getcapabilities</a> or <a href='javascript:getUpdateUrl("wfs_upload_url")'>wfs_upload_url</a>
+			</label>
+			<input id='updateUrl' type='text' value='' name='updateUrl' class='updateUrl' />
+			<br />
+			<input type='button' value='Update WFS' name='update' id='updateButton' onclick='updateWfs()' />
+						<input type='button' value='Preview WFS Capabilities' name='preview' id='previewButton' onclick='previewWfsUrl();' />
+		</p>
+	</fieldset>
+<hr />
+
+	<fieldset class="rightContainer">
+	<legend>GUI List</legend>
+		<p>
+			<select size='6' name='guiList' class='guiList' onchange='getGuiConfs()'></select>
+		</p>
+	</fieldset>
+
+<hr />
+
+	<fieldset class="leftContainer">
+	<legend>WFS Configuration List</legend>
+		<p>
+			<select size='6' name='wfsConfList' class='wfsConfList' onchange='' multiple="multiple"></select>
+		</p>
+	</fieldset>
+
+	<fieldset class="centerContainer">
+	<legend>Action</legend>
+		<p>
+			<input type='button' value='&gt;' name ='add' id ='add' class='add' onclick='addConfsToGui()'><br />
+			<input type='button' value='&lt;' name ='remove' id ='remove' class='remove' onclick='removeConfsFromGui()'>
+		</p>
+	</fieldset>
+
+	<fieldset class="rightContainer">
+	<legend>GUI Configuration List</legend>
+		<p>
+			<select size='6' name='guiConfList' class='guiConfList' onchange='' multiple="multiple"></select>
+		</p>
+	</fieldset>
+
+<hr />
+</form>
+
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/javascripts/requestGeometryConstructor.js
===================================================================
--- branches/print_dev/http/javascripts/requestGeometryConstructor.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/requestGeometryConstructor.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,228 +1,228 @@
-/* 
-* $Id: requestGeometryConstructor.js 1882 2007-12-03 09:01:24Z verenadiewald $
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
-*/
-//http://www.mapbender.org/index.php/requestGeometryConstructor.js
-
-/**
- * @class A class representing a constructor for a geometry/WFS request.
- *
- * @constructor
- * @param {String} geomType type of the {@link RequestGeometryConstructor}
- * @param {String} geomType target of the {@link RequestGeometryConstructor}
- */
- function RequestGeometryConstructor(geomTarget){
- 	/**
- 	 * geomTarget target of the {@link RequestGeometryConstructor}
-	 *
-	 * @type String
-	 */
-
-	this.geomTarget = geomTarget;
-
-	var ind = getMapObjIndexByName(this.geomTarget);
-	var myMapObj = mb_mapObj[ind];		
-	var map_el = myMapObj.getDomElement();
-	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_measuring")){
-		//create Box Elements
-		var el_top = map_el.ownerDocument.createElement("div");
-		el_top.style.position = "absolute";
-		el_top.style.top = "0px";
-		el_top.style.left = "0px";
-		el_top.style.zIndex = "16";
-		el_top.style.fontSize = "10px";
-		el_top.id = myMapObj.elementName+"_measuring";
-		map_el.appendChild(el_top);
-	}
-	
-	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_measure_display")){
-		//create Box Elements
-		var el_top = map_el.ownerDocument.createElement("div");
-		el_top.style.position = "absolute";
-		el_top.style.top = "0px";
-		el_top.style.left = "0px";
-		el_top.style.zIndex = "17";
-		el_top.id = myMapObj.elementName+"_measure_display";
-		map_el.appendChild(el_top);
-	}
-
-	
-	this.getGeometry = function(queryType,callbackFunction){
-		var target = this.geomTarget;
-		s = new Snapping(this.geomTarget);
-		callback = callbackFunction;
-		
-		var ind = getMapObjIndexByName(target);
-		var el = mb_mapObj[ind].getDomElement();
-	   	el.onmouseover = null;
-	   	el.onmousedown = null;
-	   	el.onmouseup = null;
-	   	el.onmousemove = null;
-	
-		if (queryType == "point") {
-			queryGeom = new Geometry(geomType.point);
-			el.onmousedown = function (e) {
-				realWorldPos = mapToReal(target,myMapObj.getMousePosition(e));
-				queryGeom.addPoint(realWorldPos);
-				callback(target, queryGeom);
-				el.onmouseover = null;
-	   			el.onmousedown = null;
-	   			el.onmouseup = null;
-	   			el.onmousemove = null;
-				queryGeom = null;
-		   	};
-		}
-		else if (queryType == "polygon") {
-			queryGeom = new Geometry(geomType.polygon);
-			el.onmousedown = wfsSpatialRequestStart;
-			el.onmousemove = wfsSpatialRequestRun;
-		}
-		else if (queryType == "rectangle") {
-			queryGeom = new Geometry(geomType.line);
-			el.onmouseover = selAreaExtInit;
-			el.onmousedown = mod_box_start;
-		   	el.onmouseup = selAreaExtGet;
-		   	el.onmousemove = mod_box_run;
-		}
-		else if (queryType == "extent") {
-			queryGeom = new Geometry(geomType.line);
-			var ind = getMapObjIndexByName(target);
-			var p0 = mapToReal(target, new Point(0,0));
-			var p1 = mapToReal(target, new Point(mb_mapObj[ind].width,mb_mapObj[ind].height)); 
-			queryGeom.addPoint(p0);
-			queryGeom.addPoint(p1);
-			callback(target, queryGeom);
-			el.onmouseover = null;
-   			el.onmousedown = null;
-   			el.onmouseup = null;
-   			el.onmousemove = null;
-			queryGeom = null;
-		}
-		
-	}
-	
-	var s;
-	var callback;
-	
-	var wfsSpatialRequestStart = function(e){
-		this.geomTarget = geomTarget;
-		var that = this;
-		var realWorldPos;
-		if (s.isSnapped() == true) {
-			realWorldPos = s.getSnappedPoint(); 
-			s.clean();
-		}
-		else {
-			realWorldPos = mapToReal(that.geomTarget,myMapObj.getMousePosition(e));
-		}
-		queryGeom.addPoint(realWorldPos);
-	
-		if (queryGeom.count() == 1) {
-			s.add(queryGeom.get(0));
-		}
-		if (s.isSnapped() && queryGeom.count() >= 3 && queryGeom.get(-1).equals(queryGeom.get(0))) {
-			queryGeom.close();
-			callback(that.geomTarget,queryGeom);
-			writeTag(myMapObj.frameName, myMapObj.elementName+"_measuring", "");
-			writeTag(myMapObj.frameName, myMapObj.elementName+"_measure_display", "");
-			var ind = getMapObjIndexByName("mapframe1");
-			var el = mb_mapObj[ind].getDomElement();
-			el.onmouseover = null;
-   			el.onmousedown = null;
-   			el.onmouseup = null;
-   			el.onmousemove = null;
-			queryGeom = null;
-			return;
-		}
-		drawDashedLineExt();	
-	}
-	
-	var wfsSpatialRequestRun = function(e){
-		this.geomTarget = geomTarget;
-		var that = this;
-		if (queryGeom.count() >= 3) {
-			var pos = myMapObj.getMousePosition(e);
-			s.check(pos);
-		}
-	}
-	
-	var drawDashedLineExt = function(e){
-		this.geomTarget = geomTarget;
-		var that = this;
-		var ind = getMapObjIndexByName(that.geomTarget);
-		var str_mPoints = "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='"+mb_mapObj[ind].width+"' height='0'></div>";
-		str_mPoints += "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='0' height='"+mb_mapObj[ind].height+"'></div>";
-		if (queryGeom != null) {
-			for(var i=0; i<queryGeom.count(); i++){
-				var pos = realToMap(that.geomTarget,queryGeom.get(i));
-				str_mPoints += "<div style='font-size:1px;position:absolute;top:"+(pos.y-2)+"px;left:"+(pos.x-2)+"px;width:3px;height:3px;background-color:#ff0000'></div>";
-			}
-			if(queryGeom.count()>1){
-				for(var k=1; k<queryGeom.count(); k++){
-					var pos0 = realToMap(that.geomTarget,queryGeom.get(k));
-					var pos1 = realToMap(that.geomTarget,queryGeom.get(k-1));
-					str_mPoints += evaluateDashesExt(pos1,pos0,k);
-				}
-			}
-		}
-		writeTag(myMapObj.frameName, myMapObj.elementName+"_measuring", str_mPoints);
-	}
-	
-	var evaluateDashesExt = function(p1,p0,count){
-		this.geomTarget = geomTarget;
-		var that = this;
-		var ind = getMapObjIndexByName(that.geomTarget);
-		var str_dashedLine = "";
-		var d = p0.dist(p1);
-		var n = Math.round(d);
-		var s =  p0.minus(p1).dividedBy(n);
-		for(var i=1; i<n; i++){
-			var currPoint = p1.plus(s.times(i)).minus(new Point(2,2)).round(0); 
-			if(currPoint.x >= 0 && currPoint.x <= mb_mapObj[ind].width && currPoint.y >= 0 && currPoint.y <= mb_mapObj[ind].height){
-				str_dashedLine += "<div style='font-size:1px;position:absolute;top:"+currPoint.y+"px;left:"+currPoint.x+"px;width:3px;height:3px;background-color:#ff0000'></div>";
-			}
-		}
-		return str_dashedLine;
-	}
-	
-	var selAreaExtInit = function(e){
-		this.geomTarget = geomTarget;
-		var that = this;
-   		mb_isBF = that.geomTarget;
-   		mb_zF = that.geomTarget;
-	}
-	
-	var selAreaExtGet = function(e){
-		this.geomTarget = geomTarget;
-		var that = this;
-		selAreaExtSetValidClipping(mod_box_stop(e));
-		mb_isBF = that.geomTarget;
-		mb_zF = that.geomTarget;
-	}
-	
-	var selAreaExtSetValidClipping = function(coords){
-		this.geomTarget = geomTarget;
-		var that = this;
-		if (queryGeom != null) {
-			queryGeom.addPoint(new Point(coords[0],coords[1]));
-			queryGeom.addPoint(new Point(coords[2],coords[3]));
-			
-			if(queryGeom.count() == 2){
-				callback(that.geomTarget,queryGeom);
-				var ind = getMapObjIndexByName("mapframe1");
-				var el = mb_mapObj[ind].getDomElement();
-				el.onmouseover = null;
-	   			el.onmousedown = null;
-	   			el.onmouseup = null;
-	   			el.onmousemove = null;
-				queryGeom = null;
-			}
-			else{
-				callback(that.geomTarget,queryGeom);
-			}
-		}
-	}	
-}
-
-
+/* 
+* $Id: requestGeometryConstructor.js 1882 2007-12-03 09:01:24Z verenadiewald $
+* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
+*/
+//http://www.mapbender.org/index.php/requestGeometryConstructor.js
+
+/**
+ * @class A class representing a constructor for a geometry/WFS request.
+ *
+ * @constructor
+ * @param {String} geomType type of the {@link RequestGeometryConstructor}
+ * @param {String} geomType target of the {@link RequestGeometryConstructor}
+ */
+ function RequestGeometryConstructor(geomTarget){
+ 	/**
+ 	 * geomTarget target of the {@link RequestGeometryConstructor}
+	 *
+	 * @type String
+	 */
+
+	this.geomTarget = geomTarget;
+
+	var ind = getMapObjIndexByName(this.geomTarget);
+	var myMapObj = mb_mapObj[ind];		
+	var map_el = myMapObj.getDomElement();
+	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_measuring")){
+		//create Box Elements
+		var el_top = map_el.ownerDocument.createElement("div");
+		el_top.style.position = "absolute";
+		el_top.style.top = "0px";
+		el_top.style.left = "0px";
+		el_top.style.zIndex = "16";
+		el_top.style.fontSize = "10px";
+		el_top.id = myMapObj.elementName+"_measuring";
+		map_el.appendChild(el_top);
+	}
+	
+	if(!map_el.ownerDocument.getElementById(myMapObj.elementName+"_measure_display")){
+		//create Box Elements
+		var el_top = map_el.ownerDocument.createElement("div");
+		el_top.style.position = "absolute";
+		el_top.style.top = "0px";
+		el_top.style.left = "0px";
+		el_top.style.zIndex = "17";
+		el_top.id = myMapObj.elementName+"_measure_display";
+		map_el.appendChild(el_top);
+	}
+
+	
+	this.getGeometry = function(queryType,callbackFunction){
+		var target = this.geomTarget;
+		s = new Snapping(this.geomTarget);
+		callback = callbackFunction;
+		
+		var ind = getMapObjIndexByName(target);
+		var el = mb_mapObj[ind].getDomElement();
+	   	el.onmouseover = null;
+	   	el.onmousedown = null;
+	   	el.onmouseup = null;
+	   	el.onmousemove = null;
+	
+		if (queryType == "point") {
+			queryGeom = new Geometry(geomType.point);
+			el.onmousedown = function (e) {
+				realWorldPos = mapToReal(target,myMapObj.getMousePosition(e));
+				queryGeom.addPoint(realWorldPos);
+				callback(target, queryGeom);
+				el.onmouseover = null;
+	   			el.onmousedown = null;
+	   			el.onmouseup = null;
+	   			el.onmousemove = null;
+				queryGeom = null;
+		   	};
+		}
+		else if (queryType == "polygon") {
+			queryGeom = new Geometry(geomType.polygon);
+			el.onmousedown = wfsSpatialRequestStart;
+			el.onmousemove = wfsSpatialRequestRun;
+		}
+		else if (queryType == "rectangle") {
+			queryGeom = new Geometry(geomType.line);
+			el.onmouseover = selAreaExtInit;
+			el.onmousedown = mod_box_start;
+		   	el.onmouseup = selAreaExtGet;
+		   	el.onmousemove = mod_box_run;
+		}
+		else if (queryType == "extent") {
+			queryGeom = new Geometry(geomType.line);
+			var ind = getMapObjIndexByName(target);
+			var p0 = mapToReal(target, new Point(0,0));
+			var p1 = mapToReal(target, new Point(mb_mapObj[ind].width,mb_mapObj[ind].height)); 
+			queryGeom.addPoint(p0);
+			queryGeom.addPoint(p1);
+			callback(target, queryGeom);
+			el.onmouseover = null;
+   			el.onmousedown = null;
+   			el.onmouseup = null;
+   			el.onmousemove = null;
+			queryGeom = null;
+		}
+		
+	}
+	
+	var s;
+	var callback;
+	
+	var wfsSpatialRequestStart = function(e){
+		this.geomTarget = geomTarget;
+		var that = this;
+		var realWorldPos;
+		if (s.isSnapped() == true) {
+			realWorldPos = s.getSnappedPoint(); 
+			s.clean();
+		}
+		else {
+			realWorldPos = mapToReal(that.geomTarget,myMapObj.getMousePosition(e));
+		}
+		queryGeom.addPoint(realWorldPos);
+	
+		if (queryGeom.count() == 1) {
+			s.add(queryGeom.get(0));
+		}
+		if (s.isSnapped() && queryGeom.count() >= 3 && queryGeom.get(-1).equals(queryGeom.get(0))) {
+			queryGeom.close();
+			callback(that.geomTarget,queryGeom);
+			writeTag(myMapObj.frameName, myMapObj.elementName+"_measuring", "");
+			writeTag(myMapObj.frameName, myMapObj.elementName+"_measure_display", "");
+			var ind = getMapObjIndexByName("mapframe1");
+			var el = mb_mapObj[ind].getDomElement();
+			el.onmouseover = null;
+   			el.onmousedown = null;
+   			el.onmouseup = null;
+   			el.onmousemove = null;
+			queryGeom = null;
+			return;
+		}
+		drawDashedLineExt();	
+	}
+	
+	var wfsSpatialRequestRun = function(e){
+		this.geomTarget = geomTarget;
+		var that = this;
+		if (queryGeom.count() >= 3) {
+			var pos = myMapObj.getMousePosition(e);
+			s.check(pos);
+		}
+	}
+	
+	var drawDashedLineExt = function(e){
+		this.geomTarget = geomTarget;
+		var that = this;
+		var ind = getMapObjIndexByName(that.geomTarget);
+		var str_mPoints = "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='"+mb_mapObj[ind].width+"' height='0'></div>";
+		str_mPoints += "<div style='position:absolute;left:0px;top:0px' ><img src='"+mb_trans.src+"' width='0' height='"+mb_mapObj[ind].height+"'></div>";
+		if (queryGeom != null) {
+			for(var i=0; i<queryGeom.count(); i++){
+				var pos = realToMap(that.geomTarget,queryGeom.get(i));
+				str_mPoints += "<div style='font-size:1px;position:absolute;top:"+(pos.y-2)+"px;left:"+(pos.x-2)+"px;width:3px;height:3px;background-color:#ff0000'></div>";
+			}
+			if(queryGeom.count()>1){
+				for(var k=1; k<queryGeom.count(); k++){
+					var pos0 = realToMap(that.geomTarget,queryGeom.get(k));
+					var pos1 = realToMap(that.geomTarget,queryGeom.get(k-1));
+					str_mPoints += evaluateDashesExt(pos1,pos0,k);
+				}
+			}
+		}
+		writeTag(myMapObj.frameName, myMapObj.elementName+"_measuring", str_mPoints);
+	}
+	
+	var evaluateDashesExt = function(p1,p0,count){
+		this.geomTarget = geomTarget;
+		var that = this;
+		var ind = getMapObjIndexByName(that.geomTarget);
+		var str_dashedLine = "";
+		var d = p0.dist(p1);
+		var n = Math.round(d);
+		var s =  p0.minus(p1).dividedBy(n);
+		for(var i=1; i<n; i++){
+			var currPoint = p1.plus(s.times(i)).minus(new Point(2,2)).round(0); 
+			if(currPoint.x >= 0 && currPoint.x <= mb_mapObj[ind].width && currPoint.y >= 0 && currPoint.y <= mb_mapObj[ind].height){
+				str_dashedLine += "<div style='font-size:1px;position:absolute;top:"+currPoint.y+"px;left:"+currPoint.x+"px;width:3px;height:3px;background-color:#ff0000'></div>";
+			}
+		}
+		return str_dashedLine;
+	}
+	
+	var selAreaExtInit = function(e){
+		this.geomTarget = geomTarget;
+		var that = this;
+   		mb_isBF = that.geomTarget;
+   		mb_zF = that.geomTarget;
+	}
+	
+	var selAreaExtGet = function(e){
+		this.geomTarget = geomTarget;
+		var that = this;
+		selAreaExtSetValidClipping(mod_box_stop(e));
+		mb_isBF = that.geomTarget;
+		mb_zF = that.geomTarget;
+	}
+	
+	var selAreaExtSetValidClipping = function(coords){
+		this.geomTarget = geomTarget;
+		var that = this;
+		if (queryGeom != null) {
+			queryGeom.addPoint(new Point(coords[0],coords[1]));
+			queryGeom.addPoint(new Point(coords[2],coords[3]));
+			
+			if(queryGeom.count() == 2){
+				callback(that.geomTarget,queryGeom);
+				var ind = getMapObjIndexByName("mapframe1");
+				var el = mb_mapObj[ind].getDomElement();
+				el.onmouseover = null;
+	   			el.onmousedown = null;
+	   			el.onmouseup = null;
+	   			el.onmousemove = null;
+				queryGeom = null;
+			}
+			else{
+				callback(that.geomTarget,queryGeom);
+			}
+		}
+	}	
+}
+
+

Modified: branches/print_dev/http/javascripts/wfs.php
===================================================================
--- branches/print_dev/http/javascripts/wfs.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/wfs.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,552 +1,552 @@
-<?php
-# $Id$
-# 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.
-
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-
-?>
-// ---------------------------------------------------------------------------------------------------------------
-// --- usemap (begin) --------------------------------------------------------------------------------------------
-
-function mod_usemap(wfs_name) {
-	if (wfs_name == "") {
-		usemap = "";
-	}
-	var ind = getMapObjIndexByName(mb_wfs_targets[0]);
-	var myImg = window.frames[mb_wfs_targets[0]].document.getElementById("um_img").style; 
-	myImg.width = mb_mapObj[ind].width;
-	myImg.height = mb_mapObj[ind].height;
-
-	for (var i = 0 ; i < mb_wfs_fetch.count() ; i ++) {
-		if (mb_wfs_fetch.get(i).wfs_conf == wfs_name || wfs_name == "") {
-		
-			if (mb_wfs_fetch.get(i).geomType == geomType.polygon) {
-				usemap += mod_usemap_polygon(i);
-			}
-			else if (mb_wfs_fetch.get(i).geomType == geomType.point) {
-				usemap += mod_usemap_circle(i);
-			}
-			else if (mb_wfs_fetch.get(i).geomType == geomType.line) {
-				usemap += mod_usemap_line(i);
-			}
-		}
-	}
-	writeUsemap(usemap);
-}
-
-function mod_usemap_circle(ind){
-	var str = "";
-	var coord = "";
-	
-	var title = "";
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
-		if (i>0) title += "&#10;";
-		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
-	}
-
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
-		var p = mb_wfs_fetch.getPoint(ind, i, 0);
-		var pos = realToMap(mb_wfs_targets[0],p);
-		coord += pos.x + ", " + pos.y;
-		
-		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
-		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
-		str += coord + ", " + mod_usemap_radius + "' href='#'>";
-	}
-	
-	return str;
-}
-
-function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
-	var coord = "";
-
-	var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
-	var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
-
-	var vec = p2.minus(p1);
-	
-	if (vec.x != 0 || vec.y != 0) {
-		var n_vec;
-		if (vec.x != 0) {
-			if (vec.x > 0) n_vec = new Point((-vec.y)/vec.x, -1);
-			else n_vec = new Point(vec.y/vec.x, 1);
-		}
-		else {
-			if (vec.y > 0) n_vec = new Point(1,0);
-			else n_vec = new Point(-1,0);
-		}
-		n_vec = n_vec.times(mod_usemap_line_tolerance).dividedBy(n_vec.dist(new Point(0,0)))
-
-		lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
-
-		if (cnt > 0) coord += ", ";
-
-		coord += parseInt(lp.x) + ", " + parseInt(lp.y);
-		coord += ", " + parseInt(lp.x+vec.x) + ", " + parseInt(lp.y+vec.y);
-	}
-	return coord;
-}
-
-function mod_usemap_line(ind){
-	var str = "";
-	var title = "";
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
-		if (i>0) title += "&#10;";
-		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
-	}
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
-		var coord = "";
-		var cnt = 0;
-
-		for (var j = 0 ; j < mb_wfs_fetch.getGeometry(ind,i).count() - 1  ; j ++) {
-			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, 1, cnt);
-			if (result != "") {
-				coord += result;
-				cnt++;
-			}
-		}
-		
-		for (var j = (mb_wfs_fetch.getGeometry(ind,i).count() - 1) ; j > 0 ; j--) {
-			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, -1, cnt);
-			if (result != "") {
-				coord += result;
-				cnt++;
-			}
-		}
-		
-		if (coord != "") {
-			str += "<AREA title='"+title+"'";
-			str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
-			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' ";
-			str += "shape='poly'  coords='";
-			str += coord + "' href='#'>";
-		}
-		else {
-			//display circle
-			var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
-			coord += pos.x + ", " + pos.y;
-			
-			str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
-			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
-			str += coord + ", " + mod_usemap_radius + "' href='#'>";
-		}
-	}
-	
-	return str;
-}
-
-function mod_usemap_polygon(ind){
-	var str = "";
-	var coord = "";
-	var title = "";
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
-		if (i>0) title += "&#10;";
-		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
-	}
-
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
-		var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, 0));
-		coord += pos.x + ", " + pos.y;
-		
-		for (var j = 1 ; j < mb_wfs_fetch.getGeometry(ind,i).count() ; j ++) {
-			pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, j));
-			coord += ", " + pos.x + ", " + pos.y;
-		}
-		
-		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
-		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='poly'  coords='";
-		str += coord + "' href='#'>";
-	}
-	
-	return str;
-}
-
-function writeUsemap(str) {
-	writeTag(mb_wfs_targets[0], 'um', str);
-}
-// --- usemap (end) ----------------------------------------------------------------------------------------------
-// ---------------------------------------------------------------------------------------------------------------
-
-
-var highlight_tag_id = "wfs_highlight_tag";
-var mb_wfs_fetched = [];
-
-var mb_wfs_objwin = null;
-var mb_wfs_objwin_left = 800;
-var mb_wfs_objwin_top = 200;
-var mb_wfs_objwin_width = 200;
-var mb_wfs_objwin_height = 200;
-var mb_wfs_targetString = "<?php echo implode(",", $e_target); ?>";
-var mb_wfs_targets = mb_wfs_targetString.split(",");
-var mb_wfs_fillColor = "#ff0000";
-var usemap = "";
-var mod_usemap_radius = 10;
-var mod_usemap_line_tolerance = 5;
-var useCheckboxForHighlighting = false;
-
-var mb_wfs_fetch = new GeometryArray();
-
-var highlight;
-
-try {if(generalHighlightZIndex){}}catch(e) {generalHighlightZIndex = 90;}
-try {if(generalHighlightLineWidth){}}catch(e) {generalHighlightLineWidth = 2;}
-try {if(useUsemap){}}catch(e) {useUsemap = 0;}
-
-mb_registerInitFunctions('initHighlight()');
-
-function initHighlight() {
-	var styleObj = {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex};
-	highlight = new Highlight(mb_wfs_targets, highlight_tag_id, styleObj, generalHighlightLineWidth);
-}
-try {if(displayWfsResultList){}}catch(e) {displayWfsResultList = 0;};
-
-if (displayWfsResultList == 1) {
-	//mb_registerWfsReadSubFunctions(function(geom){mb_wfs_listMember(geom)});
-}
-
-
-if (parseInt(useUsemap) == 1) {
-	mb_registerSubFunctions('mod_usemap("")');
-}
-
-if (useCheckboxForHighlighting) {
-	eventInit.register(function() {
-		mb_registerSubFunctions('highlight.paint()');
-	});
-}
-
-/*
-if (useExtentIsSet()) {
-	mb_registerSubFunctions("mb_setwfsrequest_extent()");
-}
-function mb_setwfsrequest_extent() {
-
-	if (useExtentIsSet()) {
-		var ind = getMapObjIndexByName(mb_wfs_targets[0]);
-		var pos_a = makeClickPos2RealWorldPos(mb_wfs_targets[0],0,0);
-		var pos_b = makeClickPos2RealWorldPos(mb_wfs_targets[0],mb_mapObj[ind].width,mb_mapObj[ind].height);
-
-		var x = [];
-		var y = [];
-		x[0] = pos_a[0];
-		x[1] = pos_b[0];
-		y[0] = pos_a[1];
-		y[1] = pos_b[1];
-
-		mb_setwfsrequest(mb_wfs_targets[0],'rectangle',x,y);
-	}
-}
-*/
-
-function mb_wfs_listMember(geomArray){
-	mb_wfs_fetch.union(geomArray);
-	var wfs_conf = get_complete_wfs_conf();
-	var str = "<table>";
-	for(var i=0; i<mb_wfs_fetch.count(); i++){
-		var t = wfs_conf[mb_wfs_fetch.get(i).wfs_conf];
-		for(var j=0; j<t['element'].length; j++){
-			if(t['element'][j]['f_show'] > 0){
-				var k = mb_wfs_fetch.get(i).e.getElementIndexByName(t['element'][j]['element_name']);
-				//alert(k);
-				if(k != -1){
-					str += "<tr><td>";
-					if (useCheckboxForHighlighting) {
-						str += "<input type=checkbox id=highlightCheckbox" + i + " onChange='highlightGeometry(" + i + ")'></td><td>";
-					}
-					str += "<div";
-					if (!useCheckboxForHighlighting) {
-						str += " onmouseover='mb_wfs_perform(\"over\",mb_wfs_fetch.get("+i+"))' ";
-						str += " onmouseout='mb_wfs_perform(\"out\",mb_wfs_fetch.get("+i+"))' ";
-					}
-					str += " onclick='mb_wfs_perform(\"click\",mb_wfs_fetch.get("+i+"))' ";
-					str += ">" + mb_wfs_fetch.get(i).e.getValue(k)+ "</div></td></tr>";
-				}
-			}
-		}
-	}
-	str += "</table>";
-	mb_wfs_objwin.innerHTML = str;
-//	if (parseInt(useUsemap) == 1) mod_usemap(wfs_name);
-}
-
-function mb_wfs_reset(){
-	mb_wfs_fetch = new parent.GeometryArray();
-	usemap = "";
-
-	if(mb_wfs_objwin == null){
-		var iframe=document.createElement('div');
-		iframe.setAttribute("style","position:absolute;left:"+mb_wfs_objwin_left+"px;top:"+mb_wfs_objwin_top+"px;width:"+mb_wfs_objwin_width+"px;height:"+mb_wfs_objwin_height+"px");
-		mb_wfs_objwin = document.body.appendChild(iframe);
-		mb_wfs_objwin.id = "mb_wfs_objwin";
-		mb_wfs_objwin.name = "mb_wfs_objwin";
-		mb_wfs_objwin.style.position = 'absolute';
-		mb_wfs_objwin.style.left = mb_wfs_objwin_left+"px";
-		mb_wfs_objwin.style.top = mb_wfs_objwin_top+"px";
-		mb_wfs_objwin.style.width = mb_wfs_objwin_width+"px";
-		mb_wfs_objwin.style.height = mb_wfs_objwin_height+"px";
-	}
-	for(var i=0; i<mb_wfsreq; i++){
-		if(document.getElementById("mb_wfs_win_"+mb_wfsreq)){
-			document.removeChild("mb_wfs_win_"+mb_wfsreq);
-		}
-	}
-	mb_wfsreq = 0;
-	return true;
-}
-
-function get_complete_wfs_conf() {
-	var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
-	return wfs_conf;
-}
-
-function highlightGeometry(i) {
-	var id = "highlightCheckbox"+i;
-	if (document.getElementById(id).checked) {
-		highlight.add(mb_wfs_fetch.get(i), '#00ff00');
-		highlight.paint();
-	}
-	else {
-		highlight.del(mb_wfs_fetch.get(i), '#00ff00');
-		highlight.paint();
-	}
-}
-
-function mb_wfs_perform(type,m){
-
-	var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
-	if(type=='over') {
-		highlight.add(m, '#ff0000');
-		highlight.paint();
-	}
-	else if (type == 'out') {
-		highlight.del(m, '#ff0000');
-		highlight.paint();
-	}
-	else
-		if (type == 'click') {
-			var tmp = m.getBBox();
-			if (m.geomType == geomType.point) {
-				var b = 1;
-			}
-			else {
-				var b = 0;
-			}
-			if (typeof(m.wfs_conf) != "undefined") {
-				b = parseFloat(wfs_conf[m.wfs_conf]['g_buffer']);
-			}
-			var buffer = new Point(b, b);
-			var bbox_ll = tmp[0].minus(buffer);
-			var bbox_ru = tmp[1].plus(buffer);
-			mb_calcExtent(mb_wfs_targets[0], bbox_ll, bbox_ru);
-			highlight.del(m, '#ff0000');
-			zoom(mb_wfs_targets[0], 'true', 1.0);
-			highlight.add(m, '#ff0000');
-			highlight.paint();
-		}
-}
-
-function get_wfs_str(myconf, d, m, type, fid) {
-
-	var featureTypeArray = myconf['featuretype_name'].split(':')
-	var featureNS = featureTypeArray[0];
-
-	var str = '<wfs:Transaction version="1.0.0" service="WFS" ';
-
-	var ns_gml = false;	var ns_ogc = false;	var ns_xsi = false;	var ns_wfs = false;	var ns_featureNS = false;
-
-	for (var q = 0 ; q < myconf['namespaces'].length ; q++) {
-
-		if (myconf['namespaces'][q]['name'] == "gml"){
-			 ns_gml = true;
-			 str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
-		} else if (myconf['namespaces'][q]['name'] == "ogc") {
-			ns_ogc = true;
-			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
-		} else if (myconf['namespaces'][q]['name'] == "xsi") {
-			ns_xsi = true;
-			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
-		} else if (myconf['namespaces'][q]['name'] == "wfs") {
-			ns_wfs = true;
-			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
-		} else if (myconf['namespaces'][q]['name'] == featureNS) {
-			ns_featureNS = true;
-			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" '
-			strForSchemaLocation = myconf['namespaces'][q]['location'];
-		}
-	}
-
-	if (ns_gml == false) str += 'xmlns:gml="http://www.opengis.net/gml" ';
-	if (ns_ogc == false) str += 'xmlns:ogc="http://www.opengis.net/ogc" ';
-	if (ns_xsi == false) str += 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
-	if (ns_featureNS == false) str += 'xmlns:"+featureNS+"="http://www.someserver.com/"+featureNS+"" ';
-	if (ns_wfs == false) str += 'xmlns:wfs="http://www.opengis.net/wfs" ';
-
-	str += 'xsi:schemaLocation="http://www.opengis.net/wfs';
-	str += ' http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd';
-	str += ' ' + strForSchemaLocation;
-	str += ' '+ myconf['wfs_describefeaturetype'];
-	//str += mb_getConjunctionCharacter(myconf['wfs_describefeaturetype']);
-	//str += 'typename=' + myconf['featuretype_name'];
-	str += '">';
-
-	//
-	// ---------------------------------------- SAVE -------------------------------------------------
-	//
-	if (type == "save") {
-		str += '<wfs:Insert><'+ myconf['featuretype_name']+'>';
-		for(var i=0; i<d.get(m).e.count(); i++){
-			if(d.get(m).e.getValue(i) != "" && d.get(m).e.getName(i) != "fid"){
-				var tmp = d.get(m).e.getName(i);
-				str += '<' + tmp  + '><![CDATA[' + d.get(m).e.getValue(i) + ']]></' + tmp  + '>';
-			}
-		}
-		for(var j=0; j<myconf['element'].length; j++){
-			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];
-			}
-		}
-		str += '<' + el_geom + '>';
-		if(d.get(m).geomType == geomType.point){
-			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '">';
-			str += '<gml:coordinates>';
-			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
-			str += '</gml:coordinates>';
-			str += '</gml:Point>';
-		}
-		if(d.get(m).geomType == geomType.line){
-			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
-			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
-			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";
-				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			}
-			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
-			str += '</gml:MultiLineString>';
-		}
-		if(d.get(m).geomType == geomType.polygon){
-			str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
-			for (var k = 0; k < d.get(m).count(); k++) {
-				str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
-	
-				for(var l = 0; l < d.getGeometry(m, k).count(); l++){
-					if (l > 0) {
-						str += " ";
-					}	
-					str += d.getPoint(m,k,l).x + "," + d.getPoint(m,k,l).y;
-				}
-
-				str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
-				
-				if (d.getGeometry(m, k).innerRings) {
-					for(var ii = 0; ii < d.getGeometry(m, k).innerRings.count(); ii++){
-						str += '<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>';
-						for(var l = 0; l < d.getGeometry(m, k).innerRings.get(ii).count(); l++){
-							if (l > 0) {
-								str += " ";
-							}	
-							str += d.getPoint(m,k,ii,l).x + "," + d.getPoint(m,k,ii,l).y;
-						}
-						str += '</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>';
-					}
-				}
-
-				str += '</gml:Polygon></gml:polygonMember>';
-			}
-			str += '</gml:MultiPolygon>';
-		}
-		str += '</' + el_geom + '></'+ myconf['featuretype_name']+'></wfs:Insert>';
-	}
-	//
-	// --------------------------------------- UPDATE ------------------------------------------------
-	//
-	else if (type == "update") {
-		str += '<wfs:Update typeName="'+ myconf['featuretype_name']+'">';
-		for(var i=0; i<d.get(m).e.count(); i++){
-			if(d.get(m).e.getValue(i) != "" && d.get(m).e.getName(i) != "fid"){
-				str += '<wfs:Property>';
-				str += '<wfs:Name>'+d.get(m).e.getName(i)+'</wfs:Name>';
-				str += '<wfs:Value><![CDATA['+d.get(m).e.getValue(i)+']]></wfs:Value>';
-				str += '</wfs:Property>';
-			}
-		}
-		for(var j=0; j<myconf['element'].length; j++){
-			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];
-			}
-		}
-		str += '<wfs:Property><wfs:Name>' + el_geom + '</wfs:Name><wfs:Value>';
-		if(d.get(m).geomType == geomType.point){
-			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '"><gml:coordinates>';
-			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
-			str += '</gml:coordinates></gml:Point>';
-		}
-		if(d.get(m).geomType == geomType.line){
-			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
-			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
-			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";
-				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			}
-			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
-			str += '</gml:MultiLineString>';
-		}
-		if(d.get(m).geomType == geomType.polygon){
-			str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
-			for (var l = 0; l < d.get(m).count(); l++) {
-				str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
-				for(var k=0; k<d.getGeometry(m,l).count(); k++){
-					if(k>0)	str += " ";
-					str += d.getPoint(m,l,k).x + "," + d.getPoint(m,l,k).y;
-				}
-				str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
-				if (d.getGeometry(m, l).innerRings) {
-					for(var ii = 0; ii < d.getGeometry(m, l).innerRings.count(); ii++){
-						str += '<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>';
-						for(var p = 0; p < d.getGeometry(m, l).innerRings.get(ii).count(); p++){
-							if (p > 0) {
-								str += " ";
-							}	
-							str += d.getPoint(m,l,ii,p).x + "," + d.getPoint(m,l,ii,p).y;
-						}
-						str += '</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>';
-					}
-				}
-				str += '</gml:Polygon></gml:polygonMember>';
-			}
-		}
-		str += '</gml:MultiPolygon>';
-		str += '</wfs:Value></wfs:Property>';
-		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
-		str += '</wfs:Update>';
-	}
-	//
-	// --------------------------------------- DELETE ------------------------------------------------
-	//
-	else if (type == "delete") {
-		str += '<wfs:Delete typeName="'+ myconf['featuretype_name']+'">';
-		for(var j=0; j<myconf['element'].length; j++){
-			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];
-			}
-		}
-		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
-		str += '</wfs:Delete>';
-	}
-
-	str += '</wfs:Transaction>';
-	return str;
-}
+<?php
+# $Id$
+# 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.
+
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+
+?>
+// ---------------------------------------------------------------------------------------------------------------
+// --- usemap (begin) --------------------------------------------------------------------------------------------
+
+function mod_usemap(wfs_name) {
+	if (wfs_name == "") {
+		usemap = "";
+	}
+	var ind = getMapObjIndexByName(mb_wfs_targets[0]);
+	var myImg = window.frames[mb_wfs_targets[0]].document.getElementById("um_img").style; 
+	myImg.width = mb_mapObj[ind].width;
+	myImg.height = mb_mapObj[ind].height;
+
+	for (var i = 0 ; i < mb_wfs_fetch.count() ; i ++) {
+		if (mb_wfs_fetch.get(i).wfs_conf == wfs_name || wfs_name == "") {
+		
+			if (mb_wfs_fetch.get(i).geomType == geomType.polygon) {
+				usemap += mod_usemap_polygon(i);
+			}
+			else if (mb_wfs_fetch.get(i).geomType == geomType.point) {
+				usemap += mod_usemap_circle(i);
+			}
+			else if (mb_wfs_fetch.get(i).geomType == geomType.line) {
+				usemap += mod_usemap_line(i);
+			}
+		}
+	}
+	writeUsemap(usemap);
+}
+
+function mod_usemap_circle(ind){
+	var str = "";
+	var coord = "";
+	
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var p = mb_wfs_fetch.getPoint(ind, i, 0);
+		var pos = realToMap(mb_wfs_targets[0],p);
+		coord += pos.x + ", " + pos.y;
+		
+		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
+		str += coord + ", " + mod_usemap_radius + "' href='#'>";
+	}
+	
+	return str;
+}
+
+function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
+	var coord = "";
+
+	var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
+	var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
+
+	var vec = p2.minus(p1);
+	
+	if (vec.x != 0 || vec.y != 0) {
+		var n_vec;
+		if (vec.x != 0) {
+			if (vec.x > 0) n_vec = new Point((-vec.y)/vec.x, -1);
+			else n_vec = new Point(vec.y/vec.x, 1);
+		}
+		else {
+			if (vec.y > 0) n_vec = new Point(1,0);
+			else n_vec = new Point(-1,0);
+		}
+		n_vec = n_vec.times(mod_usemap_line_tolerance).dividedBy(n_vec.dist(new Point(0,0)))
+
+		lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
+
+		if (cnt > 0) coord += ", ";
+
+		coord += parseInt(lp.x) + ", " + parseInt(lp.y);
+		coord += ", " + parseInt(lp.x+vec.x) + ", " + parseInt(lp.y+vec.y);
+	}
+	return coord;
+}
+
+function mod_usemap_line(ind){
+	var str = "";
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var coord = "";
+		var cnt = 0;
+
+		for (var j = 0 ; j < mb_wfs_fetch.getGeometry(ind,i).count() - 1  ; j ++) {
+			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, 1, cnt);
+			if (result != "") {
+				coord += result;
+				cnt++;
+			}
+		}
+		
+		for (var j = (mb_wfs_fetch.getGeometry(ind,i).count() - 1) ; j > 0 ; j--) {
+			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, -1, cnt);
+			if (result != "") {
+				coord += result;
+				cnt++;
+			}
+		}
+		
+		if (coord != "") {
+			str += "<AREA title='"+title+"'";
+			str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' ";
+			str += "shape='poly'  coords='";
+			str += coord + "' href='#'>";
+		}
+		else {
+			//display circle
+			var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
+			coord += pos.x + ", " + pos.y;
+			
+			str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
+			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
+			str += coord + ", " + mod_usemap_radius + "' href='#'>";
+		}
+	}
+	
+	return str;
+}
+
+function mod_usemap_polygon(ind){
+	var str = "";
+	var coord = "";
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, 0));
+		coord += pos.x + ", " + pos.y;
+		
+		for (var j = 1 ; j < mb_wfs_fetch.getGeometry(ind,i).count() ; j ++) {
+			pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, j));
+			coord += ", " + pos.x + ", " + pos.y;
+		}
+		
+		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='poly'  coords='";
+		str += coord + "' href='#'>";
+	}
+	
+	return str;
+}
+
+function writeUsemap(str) {
+	writeTag(mb_wfs_targets[0], 'um', str);
+}
+// --- usemap (end) ----------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------------------------
+
+
+var highlight_tag_id = "wfs_highlight_tag";
+var mb_wfs_fetched = [];
+
+var mb_wfs_objwin = null;
+var mb_wfs_objwin_left = 800;
+var mb_wfs_objwin_top = 200;
+var mb_wfs_objwin_width = 200;
+var mb_wfs_objwin_height = 200;
+var mb_wfs_targetString = "<?php echo implode(",", $e_target); ?>";
+var mb_wfs_targets = mb_wfs_targetString.split(",");
+var mb_wfs_fillColor = "#ff0000";
+var usemap = "";
+var mod_usemap_radius = 10;
+var mod_usemap_line_tolerance = 5;
+var useCheckboxForHighlighting = false;
+
+var mb_wfs_fetch = new GeometryArray();
+
+var highlight;
+
+try {if(generalHighlightZIndex){}}catch(e) {generalHighlightZIndex = 90;}
+try {if(generalHighlightLineWidth){}}catch(e) {generalHighlightLineWidth = 2;}
+try {if(useUsemap){}}catch(e) {useUsemap = 0;}
+
+mb_registerInitFunctions('initHighlight()');
+
+function initHighlight() {
+	var styleObj = {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex};
+	highlight = new Highlight(mb_wfs_targets, highlight_tag_id, styleObj, generalHighlightLineWidth);
+}
+try {if(displayWfsResultList){}}catch(e) {displayWfsResultList = 0;};
+
+if (displayWfsResultList == 1) {
+	//mb_registerWfsReadSubFunctions(function(geom){mb_wfs_listMember(geom)});
+}
+
+
+if (parseInt(useUsemap) == 1) {
+	mb_registerSubFunctions('mod_usemap("")');
+}
+
+if (useCheckboxForHighlighting) {
+	eventInit.register(function() {
+		mb_registerSubFunctions('highlight.paint()');
+	});
+}
+
+/*
+if (useExtentIsSet()) {
+	mb_registerSubFunctions("mb_setwfsrequest_extent()");
+}
+function mb_setwfsrequest_extent() {
+
+	if (useExtentIsSet()) {
+		var ind = getMapObjIndexByName(mb_wfs_targets[0]);
+		var pos_a = makeClickPos2RealWorldPos(mb_wfs_targets[0],0,0);
+		var pos_b = makeClickPos2RealWorldPos(mb_wfs_targets[0],mb_mapObj[ind].width,mb_mapObj[ind].height);
+
+		var x = [];
+		var y = [];
+		x[0] = pos_a[0];
+		x[1] = pos_b[0];
+		y[0] = pos_a[1];
+		y[1] = pos_b[1];
+
+		mb_setwfsrequest(mb_wfs_targets[0],'rectangle',x,y);
+	}
+}
+*/
+
+function mb_wfs_listMember(geomArray){
+	mb_wfs_fetch.union(geomArray);
+	var wfs_conf = get_complete_wfs_conf();
+	var str = "<table>";
+	for(var i=0; i<mb_wfs_fetch.count(); i++){
+		var t = wfs_conf[mb_wfs_fetch.get(i).wfs_conf];
+		for(var j=0; j<t['element'].length; j++){
+			if(t['element'][j]['f_show'] > 0){
+				var k = mb_wfs_fetch.get(i).e.getElementIndexByName(t['element'][j]['element_name']);
+				//alert(k);
+				if(k != -1){
+					str += "<tr><td>";
+					if (useCheckboxForHighlighting) {
+						str += "<input type=checkbox id=highlightCheckbox" + i + " onChange='highlightGeometry(" + i + ")'></td><td>";
+					}
+					str += "<div";
+					if (!useCheckboxForHighlighting) {
+						str += " onmouseover='mb_wfs_perform(\"over\",mb_wfs_fetch.get("+i+"))' ";
+						str += " onmouseout='mb_wfs_perform(\"out\",mb_wfs_fetch.get("+i+"))' ";
+					}
+					str += " onclick='mb_wfs_perform(\"click\",mb_wfs_fetch.get("+i+"))' ";
+					str += ">" + mb_wfs_fetch.get(i).e.getValue(k)+ "</div></td></tr>";
+				}
+			}
+		}
+	}
+	str += "</table>";
+	mb_wfs_objwin.innerHTML = str;
+//	if (parseInt(useUsemap) == 1) mod_usemap(wfs_name);
+}
+
+function mb_wfs_reset(){
+	mb_wfs_fetch = new parent.GeometryArray();
+	usemap = "";
+
+	if(mb_wfs_objwin == null){
+		var iframe=document.createElement('div');
+		iframe.setAttribute("style","position:absolute;left:"+mb_wfs_objwin_left+"px;top:"+mb_wfs_objwin_top+"px;width:"+mb_wfs_objwin_width+"px;height:"+mb_wfs_objwin_height+"px");
+		mb_wfs_objwin = document.body.appendChild(iframe);
+		mb_wfs_objwin.id = "mb_wfs_objwin";
+		mb_wfs_objwin.name = "mb_wfs_objwin";
+		mb_wfs_objwin.style.position = 'absolute';
+		mb_wfs_objwin.style.left = mb_wfs_objwin_left+"px";
+		mb_wfs_objwin.style.top = mb_wfs_objwin_top+"px";
+		mb_wfs_objwin.style.width = mb_wfs_objwin_width+"px";
+		mb_wfs_objwin.style.height = mb_wfs_objwin_height+"px";
+	}
+	for(var i=0; i<mb_wfsreq; i++){
+		if(document.getElementById("mb_wfs_win_"+mb_wfsreq)){
+			document.removeChild("mb_wfs_win_"+mb_wfsreq);
+		}
+	}
+	mb_wfsreq = 0;
+	return true;
+}
+
+function get_complete_wfs_conf() {
+	var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
+	return wfs_conf;
+}
+
+function highlightGeometry(i) {
+	var id = "highlightCheckbox"+i;
+	if (document.getElementById(id).checked) {
+		highlight.add(mb_wfs_fetch.get(i), '#00ff00');
+		highlight.paint();
+	}
+	else {
+		highlight.del(mb_wfs_fetch.get(i), '#00ff00');
+		highlight.paint();
+	}
+}
+
+function mb_wfs_perform(type,m){
+
+	var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
+	if(type=='over') {
+		highlight.add(m, '#ff0000');
+		highlight.paint();
+	}
+	else if (type == 'out') {
+		highlight.del(m, '#ff0000');
+		highlight.paint();
+	}
+	else
+		if (type == 'click') {
+			var tmp = m.getBBox();
+			if (m.geomType == geomType.point) {
+				var b = 1;
+			}
+			else {
+				var b = 0;
+			}
+			if (typeof(m.wfs_conf) != "undefined") {
+				b = parseFloat(wfs_conf[m.wfs_conf]['g_buffer']);
+			}
+			var buffer = new Point(b, b);
+			var bbox_ll = tmp[0].minus(buffer);
+			var bbox_ru = tmp[1].plus(buffer);
+			mb_calcExtent(mb_wfs_targets[0], bbox_ll, bbox_ru);
+			highlight.del(m, '#ff0000');
+			zoom(mb_wfs_targets[0], 'true', 1.0);
+			highlight.add(m, '#ff0000');
+			highlight.paint();
+		}
+}
+
+function get_wfs_str(myconf, d, m, type, fid) {
+
+	var featureTypeArray = myconf['featuretype_name'].split(':')
+	var featureNS = featureTypeArray[0];
+
+	var str = '<wfs:Transaction version="1.0.0" service="WFS" ';
+
+	var ns_gml = false;	var ns_ogc = false;	var ns_xsi = false;	var ns_wfs = false;	var ns_featureNS = false;
+
+	for (var q = 0 ; q < myconf['namespaces'].length ; q++) {
+
+		if (myconf['namespaces'][q]['name'] == "gml"){
+			 ns_gml = true;
+			 str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == "ogc") {
+			ns_ogc = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == "xsi") {
+			ns_xsi = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == "wfs") {
+			ns_wfs = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
+		} else if (myconf['namespaces'][q]['name'] == featureNS) {
+			ns_featureNS = true;
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" '
+			strForSchemaLocation = myconf['namespaces'][q]['location'];
+		}
+	}
+
+	if (ns_gml == false) str += 'xmlns:gml="http://www.opengis.net/gml" ';
+	if (ns_ogc == false) str += 'xmlns:ogc="http://www.opengis.net/ogc" ';
+	if (ns_xsi == false) str += 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
+	if (ns_featureNS == false) str += 'xmlns:"+featureNS+"="http://www.someserver.com/"+featureNS+"" ';
+	if (ns_wfs == false) str += 'xmlns:wfs="http://www.opengis.net/wfs" ';
+
+	str += 'xsi:schemaLocation="http://www.opengis.net/wfs';
+	str += ' http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd';
+	str += ' ' + strForSchemaLocation;
+	str += ' '+ myconf['wfs_describefeaturetype'];
+	//str += mb_getConjunctionCharacter(myconf['wfs_describefeaturetype']);
+	//str += 'typename=' + myconf['featuretype_name'];
+	str += '">';
+
+	//
+	// ---------------------------------------- SAVE -------------------------------------------------
+	//
+	if (type == "save") {
+		str += '<wfs:Insert><'+ myconf['featuretype_name']+'>';
+		for(var i=0; i<d.get(m).e.count(); i++){
+			if(d.get(m).e.getValue(i) != "" && d.get(m).e.getName(i) != "fid"){
+				var tmp = d.get(m).e.getName(i);
+				str += '<' + tmp  + '><![CDATA[' + d.get(m).e.getValue(i) + ']]></' + tmp  + '>';
+			}
+		}
+		for(var j=0; j<myconf['element'].length; j++){
+			if(myconf['element'][j]['f_geom'] == 1){
+				var el_geom = myconf['element'][j]['element_name'];
+			}
+		}
+		str += '<' + el_geom + '>';
+		if(d.get(m).geomType == geomType.point){
+			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '">';
+			str += '<gml:coordinates>';
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
+			str += '</gml:coordinates>';
+			str += '</gml:Point>';
+		}
+		if(d.get(m).geomType == geomType.line){
+			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
+			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
+			for(var k=0; k<d.getGeometry(m,0).count(); k++){
+				if(k>0)	str += " ";
+				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
+			}
+			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
+			str += '</gml:MultiLineString>';
+		}
+		if(d.get(m).geomType == geomType.polygon){
+			str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
+			for (var k = 0; k < d.get(m).count(); k++) {
+				str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
+	
+				for(var l = 0; l < d.getGeometry(m, k).count(); l++){
+					if (l > 0) {
+						str += " ";
+					}	
+					str += d.getPoint(m,k,l).x + "," + d.getPoint(m,k,l).y;
+				}
+
+				str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
+				
+				if (d.getGeometry(m, k).innerRings) {
+					for(var ii = 0; ii < d.getGeometry(m, k).innerRings.count(); ii++){
+						str += '<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>';
+						for(var l = 0; l < d.getGeometry(m, k).innerRings.get(ii).count(); l++){
+							if (l > 0) {
+								str += " ";
+							}	
+							str += d.getPoint(m,k,ii,l).x + "," + d.getPoint(m,k,ii,l).y;
+						}
+						str += '</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>';
+					}
+				}
+
+				str += '</gml:Polygon></gml:polygonMember>';
+			}
+			str += '</gml:MultiPolygon>';
+		}
+		str += '</' + el_geom + '></'+ myconf['featuretype_name']+'></wfs:Insert>';
+	}
+	//
+	// --------------------------------------- UPDATE ------------------------------------------------
+	//
+	else if (type == "update") {
+		str += '<wfs:Update typeName="'+ myconf['featuretype_name']+'">';
+		for(var i=0; i<d.get(m).e.count(); i++){
+			if(d.get(m).e.getValue(i) != "" && d.get(m).e.getName(i) != "fid"){
+				str += '<wfs:Property>';
+				str += '<wfs:Name>'+d.get(m).e.getName(i)+'</wfs:Name>';
+				str += '<wfs:Value><![CDATA['+d.get(m).e.getValue(i)+']]></wfs:Value>';
+				str += '</wfs:Property>';
+			}
+		}
+		for(var j=0; j<myconf['element'].length; j++){
+			if(myconf['element'][j]['f_geom'] == 1){
+				var el_geom = myconf['element'][j]['element_name'];
+			}
+		}
+		str += '<wfs:Property><wfs:Name>' + el_geom + '</wfs:Name><wfs:Value>';
+		if(d.get(m).geomType == geomType.point){
+			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '"><gml:coordinates>';
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
+			str += '</gml:coordinates></gml:Point>';
+		}
+		if(d.get(m).geomType == geomType.line){
+			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
+			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
+			for(var k=0; k<d.getGeometry(m,0).count(); k++){
+				if(k>0)	str += " ";
+				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
+			}
+			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
+			str += '</gml:MultiLineString>';
+		}
+		if(d.get(m).geomType == geomType.polygon){
+			str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
+			for (var l = 0; l < d.get(m).count(); l++) {
+				str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
+				for(var k=0; k<d.getGeometry(m,l).count(); k++){
+					if(k>0)	str += " ";
+					str += d.getPoint(m,l,k).x + "," + d.getPoint(m,l,k).y;
+				}
+				str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
+				if (d.getGeometry(m, l).innerRings) {
+					for(var ii = 0; ii < d.getGeometry(m, l).innerRings.count(); ii++){
+						str += '<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>';
+						for(var p = 0; p < d.getGeometry(m, l).innerRings.get(ii).count(); p++){
+							if (p > 0) {
+								str += " ";
+							}	
+							str += d.getPoint(m,l,ii,p).x + "," + d.getPoint(m,l,ii,p).y;
+						}
+						str += '</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>';
+					}
+				}
+				str += '</gml:Polygon></gml:polygonMember>';
+			}
+		}
+		str += '</gml:MultiPolygon>';
+		str += '</wfs:Value></wfs:Property>';
+		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
+		str += '</wfs:Update>';
+	}
+	//
+	// --------------------------------------- DELETE ------------------------------------------------
+	//
+	else if (type == "delete") {
+		str += '<wfs:Delete typeName="'+ myconf['featuretype_name']+'">';
+		for(var j=0; j<myconf['element'].length; j++){
+			if(myconf['element'][j]['f_geom'] == 1){
+				var el_geom = myconf['element'][j]['element_name'];
+			}
+		}
+		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
+		str += '</wfs:Delete>';
+	}
+
+	str += '</wfs:Transaction>';
+	return str;
+}

Modified: branches/print_dev/http/javascripts/wfs_obj.js
===================================================================
--- branches/print_dev/http/javascripts/wfs_obj.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/javascripts/wfs_obj.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,75 +1,75 @@
-//$Id$
-//$Header: /cvsroot/mapbender/mapbender/http/javascripts/wfs_obj.js,v 1.3 2005/09/13 14:38:11 bjoern_heuser Exp $
-//global variables
-var wfs = [];
-var wfs_featuretype_count = 0;
-var wfs_element_count = 0;
-//list of all wms-objects
-function add_wfs(
-			wfs_id,
-			wfs_version,
-			wfs_title,
-			wfs_abstract,
-			wfs_getcapabilities,
-			wfs_describefeaturetype){
-					wfs[wfs.length] = new wfs_const( 
-					wfs_id,
-			      wfs_version,
-			      wfs_title,
-			      wfs_abstract,
-			      wfs_getcapabilities,
-			      wfs_describefeaturetype);
-					//wfs_featuretype[wfs.length - 1] = [];
-}
-//the wms constructor
-function wfs_const(  
-			wfs_id,
-			wfs_version,
-			wfs_title,
-			wfs_abstract,
-			wfs_getcapabilities,
-			wfs_describefeaturetype){
-   
-	this.wfs_id = wfs_id;
-	this.wfs_version = wfs_version;
-	this.wfs_title = wfs_title;
-	this.wfs_abstract = wfs_abstract;
-	this.wfs_getcapabilities = wfs_getcapabilities;
-	this.wfs_describefeaturetype = wfs_describefeaturetype;
-
-	this.wfs_featuretype = [];
-   //alert(wfs_id + " , " +wfs_title + " , " +wfs_abstract + " , " +wfs_getcapabilities + " , " +wfs_describefeaturetype);
-}
-//featuretype
-function wfs_add_featuretype(
-			featuretype_name,
-			featuretype_title,
-			featuretype_srs,
-			featuretype_geomtype){
-                      
-	      wfs[wfs.length-1].wfs_featuretype[wfs[wfs.length-1].wfs_featuretype.length] = new featuretype(
-											featuretype_name,
-											featuretype_title,
-											featuretype_srs,
-											featuretype_geomtype);
-//alert(featuretype_name + " , " +featuretype_title + " , " +featuretype_srs + " , " +featuretype_geomtype);
-}
-function featuretype(
-			featuretype_name,
-			featuretype_title,
-			featuretype_srs,
-			featuretype_geomtype){
-	this.featuretype_name = featuretype_name;
-	this.featuretype_title = featuretype_title;
-	this.featuretype_srs = featuretype_srs;
-	this.featuretype_geomtype = featuretype_geomtype;
-	this.element = [];
-	wfs_featuretype_count++; 
-}
-//elements
-function wfs_add_featuretype_element(element_name, element_type, element_count, featuretype_count){
-	wfs[wfs.length-1].wfs_featuretype[featuretype_count].element[element_count] = [];
-	wfs[wfs.length-1].wfs_featuretype[featuretype_count].element[element_count].name = element_name;
-	wfs[wfs.length-1].wfs_featuretype[featuretype_count].element[element_count].type = element_type;
-   //alert(element_name +" , "+element_type);
-}
+//$Id$
+//$Header: /cvsroot/mapbender/mapbender/http/javascripts/wfs_obj.js,v 1.3 2005/09/13 14:38:11 bjoern_heuser Exp $
+//global variables
+var wfs = [];
+var wfs_featuretype_count = 0;
+var wfs_element_count = 0;
+//list of all wms-objects
+function add_wfs(
+			wfs_id,
+			wfs_version,
+			wfs_title,
+			wfs_abstract,
+			wfs_getcapabilities,
+			wfs_describefeaturetype){
+					wfs[wfs.length] = new wfs_const( 
+					wfs_id,
+			      wfs_version,
+			      wfs_title,
+			      wfs_abstract,
+			      wfs_getcapabilities,
+			      wfs_describefeaturetype);
+					//wfs_featuretype[wfs.length - 1] = [];
+}
+//the wms constructor
+function wfs_const(  
+			wfs_id,
+			wfs_version,
+			wfs_title,
+			wfs_abstract,
+			wfs_getcapabilities,
+			wfs_describefeaturetype){
+   
+	this.wfs_id = wfs_id;
+	this.wfs_version = wfs_version;
+	this.wfs_title = wfs_title;
+	this.wfs_abstract = wfs_abstract;
+	this.wfs_getcapabilities = wfs_getcapabilities;
+	this.wfs_describefeaturetype = wfs_describefeaturetype;
+
+	this.wfs_featuretype = [];
+   //alert(wfs_id + " , " +wfs_title + " , " +wfs_abstract + " , " +wfs_getcapabilities + " , " +wfs_describefeaturetype);
+}
+//featuretype
+function wfs_add_featuretype(
+			featuretype_name,
+			featuretype_title,
+			featuretype_srs,
+			featuretype_geomtype){
+                      
+	      wfs[wfs.length-1].wfs_featuretype[wfs[wfs.length-1].wfs_featuretype.length] = new featuretype(
+											featuretype_name,
+											featuretype_title,
+											featuretype_srs,
+											featuretype_geomtype);
+//alert(featuretype_name + " , " +featuretype_title + " , " +featuretype_srs + " , " +featuretype_geomtype);
+}
+function featuretype(
+			featuretype_name,
+			featuretype_title,
+			featuretype_srs,
+			featuretype_geomtype){
+	this.featuretype_name = featuretype_name;
+	this.featuretype_title = featuretype_title;
+	this.featuretype_srs = featuretype_srs;
+	this.featuretype_geomtype = featuretype_geomtype;
+	this.element = [];
+	wfs_featuretype_count++; 
+}
+//elements
+function wfs_add_featuretype_element(element_name, element_type, element_count, featuretype_count){
+	wfs[wfs.length-1].wfs_featuretype[featuretype_count].element[element_count] = [];
+	wfs[wfs.length-1].wfs_featuretype[featuretype_count].element[element_count].name = element_name;
+	wfs[wfs.length-1].wfs_featuretype[featuretype_count].element[element_count].type = element_type;
+   //alert(element_name +" , "+element_type);
+}

Modified: branches/print_dev/http/php/createImageFromText.php
===================================================================
--- branches/print_dev/http/php/createImageFromText.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/createImageFromText.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,38 +1,38 @@
-<?php
-# $Id$
-# Modul Maintainer Christoph Baudson
-# http://www.mapbender.org/index.php/createImageFromText
-# 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.
-
-$text = $_GET["text"];
-$angle = intval($_GET["angle"]);
-
-$text_x = 4;
-$text_y = 0;
-$rect_w = 7 * mb_strlen($text) + $text_x;
-$rect_h = 14 + $text_y;
-
-$im = imagecreate($rect_w, $rect_h);
-$white = imagecolorallocate($im, 255, 255, 255);
-$black = imagecolorallocate($im, 0, 0, 0);
-imagestring($im, 2, $text_x, $text_y, $text, $black);
-$im = imagerotate($im, $angle, -1);
-
-Header("Content-type:image/png");
-imagepng($im);
-imagedestroy($im);
-?>
+<?php
+# $Id$
+# Modul Maintainer Christoph Baudson
+# http://www.mapbender.org/index.php/createImageFromText
+# 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.
+
+$text = $_GET["text"];
+$angle = intval($_GET["angle"]);
+
+$text_x = 4;
+$text_y = 0;
+$rect_w = 7 * mb_strlen($text) + $text_x;
+$rect_h = 14 + $text_y;
+
+$im = imagecreate($rect_w, $rect_h);
+$white = imagecolorallocate($im, 255, 255, 255);
+$black = imagecolorallocate($im, 0, 0, 0);
+imagestring($im, 2, $text_x, $text_y, $text, $black);
+$im = imagerotate($im, $angle, -1);
+
+Header("Content-type:image/png");
+imagepng($im);
+imagedestroy($im);
+?>

Modified: branches/print_dev/http/php/mod_SelectKeyword.php
===================================================================
--- branches/print_dev/http/php/mod_SelectKeyword.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_SelectKeyword.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,61 +1,61 @@
-<?php
-# $Id$
-# ttp://www.mapbender.org/index.php/mod_SelectKeyword
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<html>
-<head>
-<title>Select Keyword</title>
+<?php
+# $Id$
+# ttp://www.mapbender.org/index.php/mod_SelectKeyword
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+<html>
+<head>
+<title>Select Keyword</title>
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="expires" content="0">
 <?php
 echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-
-<script language='JavaScript'>
-<!--
+?>
+
+<script language='JavaScript'>
+<!--
 function insertValue(val){
-   window.opener.document.form1.search.value = val;
+   window.opener.document.form1.search.value = val;
    window.close();
-}
--->
-</script>
-</head>
-
-<body  >
-
-<?php
+}
+-->
+</script>
+</head>
+
+<body  >
+
+<?php
 $sql = "Select keyword_id, ltrim(keyword) as keyword from keyword order by upper(ltrim(keyword));";
 $res = db_query($sql);
-
-echo "<select size='20' name='keywordlist' ondblClick='insertValue(this.value)' title='double click to select a keyword'>\n";
- 
-$cnt = 0;
-while($row = db_fetch_array($res)){    
-	echo "<option value='". $row["keyword"]."' >";
+
+echo "<select size='20' name='keywordlist' ondblClick='insertValue(this.value)' title='double click to select a keyword'>\n";
+ 
+$cnt = 0;
+while($row = db_fetch_array($res)){    
+	echo "<option value='". $row["keyword"]."' >";
 	echo $row["keyword"];
-	$cnt++;
-	echo "</option>";
-}
-echo "</select>";
-
-?>
-</body>
+	$cnt++;
+	echo "</option>";
+}
+echo "</select>";
+
+?>
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_WMSpreferences.php
===================================================================
--- branches/print_dev/http/php/mod_WMSpreferences.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_WMSpreferences.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,64 +1,64 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>WMS Preferences</title>
-<?php
-include '../include/dyn_css.php';
-?>
-<STYLE TYPE="text/css">
-		<!--
-   body{
-   	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-   	color:#0066cc;
-      font-size:10pt
-   }    
-   
-   table{
-   	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
-   	color:#808080;;
-      font-size:9pt
-   } 
-   
-   th{
-   	background-color:#F0F0F0;
-   }  
-   
-   select{
-		width:240px;
-   }    
-   
-	-->
-</STYLE>
-<?php
-echo '<script type="text/javascript">';
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>WMS Preferences</title>
+<?php
+include '../include/dyn_css.php';
+?>
+<STYLE TYPE="text/css">
+		<!--
+   body{
+   	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+   	color:#0066cc;
+      font-size:10pt
+   }    
+   
+   table{
+   	font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
+   	color:#808080;;
+      font-size:9pt
+   } 
+   
+   th{
+   	background-color:#F0F0F0;
+   }  
+   
+   select{
+		width:240px;
+   }    
+   
+	-->
+</STYLE>
+<?php
+echo '<script type="text/javascript">';
 $sql = "SELECT * FROM gui_element WHERE e_id = 'WMS_preferences' AND fkey_gui_id = $1";
 $v = array($_SESSION["mb_user_gui"]);
 $t = array("s");
@@ -73,215 +73,215 @@
 }
 if($cnt > 1){ echo "alert('WMS_preferences: ID not unique!');";}
 $e_target = explode(",", $e_target);
-echo "var mod_WMSpreferences_target1 = '".trim($e_target[0])."';";
-echo "var mod_WMSpreferences_target2 = '".trim($e_target[1])."';";
-echo "</script>";
-
-$sql_visible = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1";
-$v = array($_SESSION["mb_user_gui"]);
-$t = array("s"); 
-$res_visible = db_prep_query($sql_visible, $v, $t); 
-$cnt_visible = 0; 
-
-while($row = db_fetch_array($res_visible)){
-	$gui_wms_visible[$cnt_visible] = $row["gui_wms_visible"];
-	$fkey_wms_id_visible[$cnt_visible] = $row["fkey_wms_id"];
-	if($cnt_visible>0){
-		$vis .= ",";
-		$wmsid .= ",";		
-	}
-	$vis .= $gui_wms_visible[$cnt_visible];
-	$wmsid .= $fkey_wms_id_visible[$cnt_visible];
-	$cnt_visible++;
-}
-
-echo '<script type="text/javascript">';
-echo "var mod_gui_wms_visible = '".$vis."';";
-echo "var mod_fkey_wms_id_visible = '".$wmsid."';";
-echo "</script>";
-?>
-
-<script type="text/javascript">
-<!--
-var ind = window.opener.getMapObjIndexByName(mod_WMSpreferences_target1);
-var my = window.opener.mb_mapObj[ind];
-
+echo "var mod_WMSpreferences_target1 = '".trim($e_target[0])."';";
+echo "var mod_WMSpreferences_target2 = '".trim($e_target[1])."';";
+echo "</script>";
+
+$sql_visible = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1";
+$v = array($_SESSION["mb_user_gui"]);
+$t = array("s"); 
+$res_visible = db_prep_query($sql_visible, $v, $t); 
+$cnt_visible = 0; 
+
+while($row = db_fetch_array($res_visible)){
+	$gui_wms_visible[$cnt_visible] = $row["gui_wms_visible"];
+	$fkey_wms_id_visible[$cnt_visible] = $row["fkey_wms_id"];
+	if($cnt_visible>0){
+		$vis .= ",";
+		$wmsid .= ",";		
+	}
+	$vis .= $gui_wms_visible[$cnt_visible];
+	$wmsid .= $fkey_wms_id_visible[$cnt_visible];
+	$cnt_visible++;
+}
+
+echo '<script type="text/javascript">';
+echo "var mod_gui_wms_visible = '".$vis."';";
+echo "var mod_fkey_wms_id_visible = '".$wmsid."';";
+echo "</script>";
+?>
+
+<script type="text/javascript">
+<!--
+var ind = window.opener.getMapObjIndexByName(mod_WMSpreferences_target1);
+var my = window.opener.mb_mapObj[ind];
+
  function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
- 	var myMapObj = window.opener.mb_mapObj[mapObj_ind];
-	if (indexA != indexB && indexA >= 0 && indexA < myMapObj.wms.length && indexB >= 0 && indexB < myMapObj.wms.length) {
-		upper = myMapObj.wms[indexA];
-		myMapObj.wms[indexA] = myMapObj.wms[indexB];
-		myMapObj.wms[indexB] = upper;
-		var upperLayers = myMapObj.layers[indexA];
-		var upperStyles = myMapObj.styles[indexA];
-		var upperQuerylayers = myMapObj.querylayers[indexA];
-		myMapObj.layers[indexA] = myMapObj.layers[indexB];
-		myMapObj.styles[indexA] = myMapObj.styles[indexB];
-		myMapObj.querylayers[indexA] = myMapObj.querylayers[indexB];
-		myMapObj.layers[indexB] = upperLayers;
-		myMapObj.styles[indexB] = upperStyles;
-		myMapObj.querylayers[indexB] = upperQuerylayers;
-		return true;
-	}
-	else {
-		return false;
-	}
-}
-
- 
-
-// Opacity version
-
+ 	var myMapObj = window.opener.mb_mapObj[mapObj_ind];
+	if (indexA != indexB && indexA >= 0 && indexA < myMapObj.wms.length && indexB >= 0 && indexB < myMapObj.wms.length) {
+		upper = myMapObj.wms[indexA];
+		myMapObj.wms[indexA] = myMapObj.wms[indexB];
+		myMapObj.wms[indexB] = upper;
+		var upperLayers = myMapObj.layers[indexA];
+		var upperStyles = myMapObj.styles[indexA];
+		var upperQuerylayers = myMapObj.querylayers[indexA];
+		myMapObj.layers[indexA] = myMapObj.layers[indexB];
+		myMapObj.styles[indexA] = myMapObj.styles[indexB];
+		myMapObj.querylayers[indexA] = myMapObj.querylayers[indexB];
+		myMapObj.layers[indexB] = upperLayers;
+		myMapObj.styles[indexB] = upperStyles;
+		myMapObj.querylayers[indexB] = upperQuerylayers;
+		return true;
+	}
+	else {
+		return false;
+	}
+}
+
+ 
+
+// Opacity version
+
 function cambia_opacity(id,incremento){
 	opacity = my.wms[id].gui_wms_mapopacity*100 + parseInt(incremento);
 	my.wms[id].setOpacity(opacity);
 	loadWMS();
-}
-
-
-
-
-function setMapformat(val){
-	var tmp = val.split(",");
-	my.wms[tmp[0]].gui_wms_mapformat = tmp[1];
-	loadWMS();
-}
-
-function setFeatureformat(val){
-	var tmp = val.split(",");
-	my.wms[tmp[0]].gui_wms_featureinfoformat = tmp[1];
-	loadWMS();
-}
-
-function setExceptionformat(val){
-	var tmp = val.split(",");
-	my.wms[tmp[0]].gui_wms_exceptionformat = tmp[1];
-	loadWMS();
-}
-
-function swap(index1, index2){
-	if (mb_swapWmsByIndex(ind, index1, index2) == true) {
-		loadWMS();
-		window.opener.zoom(mod_WMSpreferences_target1, true, 1.0);
-		window.opener.mb_execloadWmsSubFunctions();
-	}
-}
-
-function remove_wms(num){
-	var cnt_vis=0;
-	var wms_visible_down = mod_gui_wms_visible.split(",");
-	var wms_vis_down = wms_visible_down.length;
-	
-	//check if there are more than two visible wms's
-	for(var i=0; i < wms_visible_down.length; i++){
-		var my_wms_visible = wms_visible_down[i];
-		if(my_wms_visible == 0){
-  			var cnt_vis = cnt_vis+1;		
-		}
-	}	
-
-	if(my.wms.length - cnt_vis>1){
-	  	var ind = window.opener.getMapObjIndexByName(mod_WMSpreferences_target1);  
-  		window.opener.mb_mapObjremoveWMS(ind,num) 
-		window.opener.mb_execloadWmsSubFunctions();
-//  	window.opener.frames[mod_WMSpreferences_target2].document.location.reload();
-  		window.location.reload();
-	}
-	else{
-		alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
-	}	
-}
-
-function loadWMS(){
-	var str = "";
-	var wms_visible = mod_gui_wms_visible.split(",");
-	var wms_id_visible = mod_fkey_wms_id_visible.split(",");
-	var visibleWmsIndexArray = new Array();
-	
-	for(var i=0; i < my.wms.length; i++){
-		var found = false;
-		for(var j=0; j < wms_id_visible.length; j++){
-			if (wms_visible[j] == 1 && wms_id_visible[j] == my.wms[i].wms_id){
-				visibleWmsIndexArray[visibleWmsIndexArray.length] = i;
-				found = true;
-			}
-		}
-		if (found == false && my.wms[i].gui_wms_visible == 1) {
-			visibleWmsIndexArray[visibleWmsIndexArray.length] = i;
-		}
-	}
-	
-	for (var i = 0 ; i < visibleWmsIndexArray.length ; i++) {
-		z = visibleWmsIndexArray[i];
-		var mapString = "";
-		var featureinfoString = "";
-		var exceptionString = "";
-				
-		for(var j=0; j<my.wms[z].data_type.length; j++){
-			if(my.wms[z].data_type[j] == 'map'){
-				mapString += "<option value='"+z+","+my.wms[z].data_format[j]+"'";
-				if(my.wms[z].data_format[j] == my.wms[z].gui_wms_mapformat){
-					mapString += "selected";
-				}
-				mapString += ">"+my.wms[z].data_format[j]+"</option>";
-			}
-			else if(my.wms[z].data_type[j] == 'featureinfo'){
-				featureinfoString += "<option value='"+z+","+my.wms[z].data_format[j]+"'";
-				if(my.wms[z].data_format[j] == my.wms[z].gui_wms_featureinfoformat){
-					featureinfoString += "selected";
-				}
-				featureinfoString += ">"+my.wms[z].data_format[j]+"</option>";
-			}
-			else if(my.wms[z].data_type[j] == 'exception'){
-				exceptionString += "<option value='"+z+","+my.wms[z].data_format[j]+"'";
-				if(my.wms[z].data_format[j] == my.wms[z].gui_wms_exceptionformat){
-					exceptionString += "selected";
-				}
-				exceptionString += ">"+my.wms[z].data_format[j]+"</option>";
-			}
-		}
-
-		str += "<table border='1' rules='rows'>";  
-		str += "<tr><th>";
-		str += "<img src='../img/button_gray/up.png' style='filter:Chroma(color=#C2CBCF);' onclick='swap("+visibleWmsIndexArray[i-1]+","+z+")' value='up' title='move WMS up'>&nbsp;";
-		str += "<img src='../img/button_gray/down.png' style='filter:Chroma(color=#C2CBCF);' onclick='swap("+z+", "+visibleWmsIndexArray[i+1]+")'value='down'title='move WMS down'>&nbsp;</td>";
-		str += "<img src='../img/button_gray/del.png' onclick='remove_wms("+z+")' value='remove' title='remove WMS from GUI'>&nbsp;";	
-		str += "</th><th  width='300'><div id ='id_"+my.wms[z].wms_id+"' style='cursor:pointer' onmouseover = 'title=\""+"id:"+my.wms[z].wms_id+" "+my.wms[z].wms_abstract+"\"'><b>"+my.wms[z].wms_title+"</b>";
-		str += "</div></th></tr>";
-		//str += "<tr><td>ID:</td><td>"+my.wms[z].wms_id+"</td></tr>";
-		str += "<tr><td>MapImageFormat: </td><td>";
-		str += "<select onchange='setMapformat(this.value)'>"
-		str += mapString;
-		str += "</select></td></tr>";
-		str += "<tr><td>FeatureInfoFormat: </td><td>";
-		str += "<select onchange='setFeatureformat(this.value)'>";
-		str += featureinfoString;
-		str += "</select></td></tr>";
-		str += "<tr><td>ExceptionFormat: </td><td>";
-		str += "<select onchange='setExceptionformat(this.value)'>"
-		str += exceptionString;
-		str += "</select></td></tr></table>";	
-		str += "<table><tr>";
-
-		//opacity version
-		str += "<tr><td>Opacity:</td><td><input type=\"button\" onclick=\"cambia_opacity('"+visibleWmsIndexArray[i]+"','-10')\" value=\"-\">";
-		str += "<input id=\"valor_opacity_"+visibleWmsIndexArray[i]+"\" type=\"text\" disabled=\"disabled\" size=\"3\" value=\""+my.wms[visibleWmsIndexArray[i]].gui_wms_mapopacity*100+" %\">";
-		str += "<input type=\"button\" onclick=\"cambia_opacity('"+visibleWmsIndexArray[i]+"','+10')\" value=\"+\">";
-		str += "</td></tr>";
-
-		str += "</tr></table><br>";
-	}
-	
-	document.getElementById('data').innerHTML = str;
-}
-
-// -->
-</script>
-</head>
-<body onload='loadWMS()'>
-<div id='data'><div>
-<form>
-<input type='hidden' name='visibility' value=''>
-</form>
-</body>
-</html>
+}
+
+
+
+
+function setMapformat(val){
+	var tmp = val.split(",");
+	my.wms[tmp[0]].gui_wms_mapformat = tmp[1];
+	loadWMS();
+}
+
+function setFeatureformat(val){
+	var tmp = val.split(",");
+	my.wms[tmp[0]].gui_wms_featureinfoformat = tmp[1];
+	loadWMS();
+}
+
+function setExceptionformat(val){
+	var tmp = val.split(",");
+	my.wms[tmp[0]].gui_wms_exceptionformat = tmp[1];
+	loadWMS();
+}
+
+function swap(index1, index2){
+	if (mb_swapWmsByIndex(ind, index1, index2) == true) {
+		loadWMS();
+		window.opener.zoom(mod_WMSpreferences_target1, true, 1.0);
+		window.opener.mb_execloadWmsSubFunctions();
+	}
+}
+
+function remove_wms(num){
+	var cnt_vis=0;
+	var wms_visible_down = mod_gui_wms_visible.split(",");
+	var wms_vis_down = wms_visible_down.length;
+	
+	//check if there are more than two visible wms's
+	for(var i=0; i < wms_visible_down.length; i++){
+		var my_wms_visible = wms_visible_down[i];
+		if(my_wms_visible == 0){
+  			var cnt_vis = cnt_vis+1;		
+		}
+	}	
+
+	if(my.wms.length - cnt_vis>1){
+	  	var ind = window.opener.getMapObjIndexByName(mod_WMSpreferences_target1);  
+  		window.opener.mb_mapObjremoveWMS(ind,num) 
+		window.opener.mb_execloadWmsSubFunctions();
+//  	window.opener.frames[mod_WMSpreferences_target2].document.location.reload();
+  		window.location.reload();
+	}
+	else{
+		alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
+	}	
+}
+
+function loadWMS(){
+	var str = "";
+	var wms_visible = mod_gui_wms_visible.split(",");
+	var wms_id_visible = mod_fkey_wms_id_visible.split(",");
+	var visibleWmsIndexArray = new Array();
+	
+	for(var i=0; i < my.wms.length; i++){
+		var found = false;
+		for(var j=0; j < wms_id_visible.length; j++){
+			if (wms_visible[j] == 1 && wms_id_visible[j] == my.wms[i].wms_id){
+				visibleWmsIndexArray[visibleWmsIndexArray.length] = i;
+				found = true;
+			}
+		}
+		if (found == false && my.wms[i].gui_wms_visible == 1) {
+			visibleWmsIndexArray[visibleWmsIndexArray.length] = i;
+		}
+	}
+	
+	for (var i = 0 ; i < visibleWmsIndexArray.length ; i++) {
+		z = visibleWmsIndexArray[i];
+		var mapString = "";
+		var featureinfoString = "";
+		var exceptionString = "";
+				
+		for(var j=0; j<my.wms[z].data_type.length; j++){
+			if(my.wms[z].data_type[j] == 'map'){
+				mapString += "<option value='"+z+","+my.wms[z].data_format[j]+"'";
+				if(my.wms[z].data_format[j] == my.wms[z].gui_wms_mapformat){
+					mapString += "selected";
+				}
+				mapString += ">"+my.wms[z].data_format[j]+"</option>";
+			}
+			else if(my.wms[z].data_type[j] == 'featureinfo'){
+				featureinfoString += "<option value='"+z+","+my.wms[z].data_format[j]+"'";
+				if(my.wms[z].data_format[j] == my.wms[z].gui_wms_featureinfoformat){
+					featureinfoString += "selected";
+				}
+				featureinfoString += ">"+my.wms[z].data_format[j]+"</option>";
+			}
+			else if(my.wms[z].data_type[j] == 'exception'){
+				exceptionString += "<option value='"+z+","+my.wms[z].data_format[j]+"'";
+				if(my.wms[z].data_format[j] == my.wms[z].gui_wms_exceptionformat){
+					exceptionString += "selected";
+				}
+				exceptionString += ">"+my.wms[z].data_format[j]+"</option>";
+			}
+		}
+
+		str += "<table border='1' rules='rows'>";  
+		str += "<tr><th>";
+		str += "<img src='../img/button_gray/up.png' style='filter:Chroma(color=#C2CBCF);' onclick='swap("+visibleWmsIndexArray[i-1]+","+z+")' value='up' title='move WMS up'>&nbsp;";
+		str += "<img src='../img/button_gray/down.png' style='filter:Chroma(color=#C2CBCF);' onclick='swap("+z+", "+visibleWmsIndexArray[i+1]+")'value='down'title='move WMS down'>&nbsp;</td>";
+		str += "<img src='../img/button_gray/del.png' onclick='remove_wms("+z+")' value='remove' title='remove WMS from GUI'>&nbsp;";	
+		str += "</th><th  width='300'><div id ='id_"+my.wms[z].wms_id+"' style='cursor:pointer' onmouseover = 'title=\""+"id:"+my.wms[z].wms_id+" "+my.wms[z].wms_abstract+"\"'><b>"+my.wms[z].wms_title+"</b>";
+		str += "</div></th></tr>";
+		//str += "<tr><td>ID:</td><td>"+my.wms[z].wms_id+"</td></tr>";
+		str += "<tr><td>MapImageFormat: </td><td>";
+		str += "<select onchange='setMapformat(this.value)'>"
+		str += mapString;
+		str += "</select></td></tr>";
+		str += "<tr><td>FeatureInfoFormat: </td><td>";
+		str += "<select onchange='setFeatureformat(this.value)'>";
+		str += featureinfoString;
+		str += "</select></td></tr>";
+		str += "<tr><td>ExceptionFormat: </td><td>";
+		str += "<select onchange='setExceptionformat(this.value)'>"
+		str += exceptionString;
+		str += "</select></td></tr></table>";	
+		str += "<table><tr>";
+
+		//opacity version
+		str += "<tr><td>Opacity:</td><td><input type=\"button\" onclick=\"cambia_opacity('"+visibleWmsIndexArray[i]+"','-10')\" value=\"-\">";
+		str += "<input id=\"valor_opacity_"+visibleWmsIndexArray[i]+"\" type=\"text\" disabled=\"disabled\" size=\"3\" value=\""+my.wms[visibleWmsIndexArray[i]].gui_wms_mapopacity*100+" %\">";
+		str += "<input type=\"button\" onclick=\"cambia_opacity('"+visibleWmsIndexArray[i]+"','+10')\" value=\"+\">";
+		str += "</td></tr>";
+
+		str += "</tr></table><br>";
+	}
+	
+	document.getElementById('data').innerHTML = str;
+}
+
+// -->
+</script>
+</head>
+<body onload='loadWMS()'>
+<div id='data'><div>
+<form>
+<input type='hidden' name='visibility' value=''>
+</form>
+</body>
+</html>

Modified: branches/print_dev/http/php/mod_addWmsFromFeatureInfo.php
===================================================================
--- branches/print_dev/http/php/mod_addWmsFromFeatureInfo.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_addWmsFromFeatureInfo.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,108 +1,108 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/addWMSFromFeatureInfo.php
-# 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.
-
-import_request_variables("PG");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include(dirname(__FILE__).'/../include/dyn_js.php');
-
-echo "var mod_target = '".$e_target[0]."';";
-?>
-function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
-	if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
-		upper = mb_mapObj[mapObj_ind].wms[indexA];
-		mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
-		mb_mapObj[mapObj_ind].wms[indexB] = upper;
-		var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
-		var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
-		var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
-		mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
-		mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
-		mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
-		mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
-		mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
-		mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
-		return true;
-	}
-	else {
-		return false;
-	}
-}
-
-
-function mb_wmsMoveByIndex(mapObj_ind, fromIndex, toIndex) {
-	if (fromIndex != toIndex && fromIndex >= 0 && fromIndex < mb_mapObj[mapObj_ind].wms.length && toIndex >= 0 && toIndex < mb_mapObj[mapObj_ind].wms.length) {
-		var changed = false;
-		var i;
-		var result;
-		if (fromIndex > toIndex) {
-			for (i = fromIndex; i > toIndex ; i--) {
-				result = mb_swapWmsByIndex(mapObj_ind, i-1, i);
-				if (result === true) {
-					changed = true;
-				}
-			}
-		}
-		else {
-			for (i = fromIndex; i < toIndex ; i++) {
-				result = mb_swapWmsByIndex(mapObj_ind, i, i+1);
-				if (result === true) {
-					changed = true;
-				}
-			}
-		}
-		return changed;
-	}
-	else {
-		return false;
-	}
-}
-
-function addWmsFromFeatureInfo(pointer_name, version) {
-	mb_registerloadWmsSubFunctions("addWmsFromInfo_pos()");
-	var mywms = pointer_name; 
-	if(mywms.indexOf("?") > -1){pointer_name += "&";}
-	if(mywms.indexOf("?") == -1){pointer_name += "?";}
-	if (version == '1.0.0'){
-		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
-		var load = cap;
-	}
-	else if (version == '1.1.0'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
-		var load = cap;
-	}
-	else if (version == '1.1.1'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
-		var load = cap;
-	}
-	if(load){
-		//if the mapfile WMS ONLINE RESOURCE is set relative, without any host
-		if(load.charAt(0) == '/' && load.charAt(1) == 'c') {
-			mod_addWMS_load('http://localhost' + load);
-        	}
-		else{
-			mod_addWMS_load(load);
-		}
-	}
-}
-function addWmsFromInfo_pos(){
-	if (mod_addWmsFromFeatureInfo_position > 0 && mod_addWmsFromFeatureInfo_position < mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1) {
-		mb_wmsMoveByIndex(getMapObjIndexByName(mod_target), mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1, mod_addWmsFromFeatureInfo_position-1);
-	}
-	eventAfterLoadWMS.unregister("addWmsFromInfo_pos()");
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/addWMSFromFeatureInfo.php
+# 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.
+
+import_request_variables("PG");
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include(dirname(__FILE__).'/../include/dyn_js.php');
+
+echo "var mod_target = '".$e_target[0]."';";
+?>
+function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
+	if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
+		upper = mb_mapObj[mapObj_ind].wms[indexA];
+		mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
+		mb_mapObj[mapObj_ind].wms[indexB] = upper;
+		var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
+		var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
+		var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
+		mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
+		mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
+		mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
+		mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
+		mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
+		mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
+		return true;
+	}
+	else {
+		return false;
+	}
+}
+
+
+function mb_wmsMoveByIndex(mapObj_ind, fromIndex, toIndex) {
+	if (fromIndex != toIndex && fromIndex >= 0 && fromIndex < mb_mapObj[mapObj_ind].wms.length && toIndex >= 0 && toIndex < mb_mapObj[mapObj_ind].wms.length) {
+		var changed = false;
+		var i;
+		var result;
+		if (fromIndex > toIndex) {
+			for (i = fromIndex; i > toIndex ; i--) {
+				result = mb_swapWmsByIndex(mapObj_ind, i-1, i);
+				if (result === true) {
+					changed = true;
+				}
+			}
+		}
+		else {
+			for (i = fromIndex; i < toIndex ; i++) {
+				result = mb_swapWmsByIndex(mapObj_ind, i, i+1);
+				if (result === true) {
+					changed = true;
+				}
+			}
+		}
+		return changed;
+	}
+	else {
+		return false;
+	}
+}
+
+function addWmsFromFeatureInfo(pointer_name, version) {
+	mb_registerloadWmsSubFunctions("addWmsFromInfo_pos()");
+	var mywms = pointer_name; 
+	if(mywms.indexOf("?") > -1){pointer_name += "&";}
+	if(mywms.indexOf("?") == -1){pointer_name += "?";}
+	if (version == '1.0.0'){
+		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
+		var load = cap;
+	}
+	else if (version == '1.1.0'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
+		var load = cap;
+	}
+	else if (version == '1.1.1'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
+		var load = cap;
+	}
+	if(load){
+		//if the mapfile WMS ONLINE RESOURCE is set relative, without any host
+		if(load.charAt(0) == '/' && load.charAt(1) == 'c') {
+			mod_addWMS_load('http://localhost' + load);
+        	}
+		else{
+			mod_addWMS_load(load);
+		}
+	}
+}
+function addWmsFromInfo_pos(){
+	if (mod_addWmsFromFeatureInfo_position > 0 && mod_addWmsFromFeatureInfo_position < mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1) {
+		mb_wmsMoveByIndex(getMapObjIndexByName(mod_target), mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1, mod_addWmsFromFeatureInfo_position-1);
+	}
+	eventAfterLoadWMS.unregister("addWmsFromInfo_pos()");
 }
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_createJSObjFromXML.php
===================================================================
--- branches/print_dev/http/php/mod_createJSObjFromXML.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_createJSObjFromXML.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,52 +1,52 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_createJSObjFromXML.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_wms.php");
-
-$capabilitiesURL = html_entity_decode($_REQUEST['caps']);
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>Load WMS</title>
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<meta http-equiv="Content-Type" content="text/html; charset='<?php echo CHARSET;?>'">	
-<script type='text/javascript'>
-<?php
-
-$mywms = new wms();
-$mywms->createObjFromXML($capabilitiesURL);
-
-$errorMessage = "Error: The Capabilities Document could not be accessed. Please check whether the server is responding and accessible to Mapbender.";
-if (!$mywms->wms_status) { 
-	echo "prompt('" . $errorMessage . "', '" . $capabilitiesURL . "');"; 
-	die; 
-}
-$mywms->createJsObjFromWMS(true);
-?>
-
-parent.mod_addWMS_refresh();
-</script>
-</head>
-<body bgcolor='#ffffff'>
-</body>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_createJSObjFromXML.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_wms.php");
+
+$capabilitiesURL = html_entity_decode($_REQUEST['caps']);
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Load WMS</title>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<meta http-equiv="Content-Type" content="text/html; charset='<?php echo CHARSET;?>'">	
+<script type='text/javascript'>
+<?php
+
+$mywms = new wms();
+$mywms->createObjFromXML($capabilitiesURL);
+
+$errorMessage = "Error: The Capabilities Document could not be accessed. Please check whether the server is responding and accessible to Mapbender.";
+if (!$mywms->wms_status) { 
+	echo "prompt('" . $errorMessage . "', '" . $capabilitiesURL . "');"; 
+	die; 
+}
+$mywms->createJsObjFromWMS(true);
+?>
+
+parent.mod_addWMS_refresh();
+</script>
+</head>
+<body bgcolor='#ffffff'>
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_deleteWFS.php
===================================================================
--- branches/print_dev/http/php/mod_deleteWFS.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_deleteWFS.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,96 +1,96 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/DeleteWFS
-# 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.
-
-import_request_variables("PG");
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Delete WFS - All Users</title>
-<?php
-include '../include/dyn_css.php';
-?>
-<script type="text/javascript">
-function validate(){
-	var ind = document.form1.wfsList.selectedIndex;
-	if(ind > -1){
-		var permission =  confirm("delete: "  + document.form1.wfsList.options[ind].text + " ?");
-		if(permission === true){
-			document.form1.del.value = 1;
-			document.form1.submit();
-		}
-	}
-}
-</script>
-
-<style type="text/css">
-  	<!--
-  	body{
-      background-color: #ffffff;
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080
-  	}
-  	
-  	-->
-</style>
-</head>
-<body>
-
-<?php
-$logged_user_name=$_SESSION["mb_user_name"];
-$logged_user_id=$_SESSION["mb_user_id"];
-
-###delete
-if($wfsList){
-	 $sql = "DELETE FROM wfs WHERE wfs_id = $1";
-	 $v = array($wfsList);
-	 $t = array("i");
-	 $res = db_prep_query($sql, $v, $t);
-}
-
-$sql_wfs = "SELECT * FROM wfs ORDER BY wfs_id";
-$res_wfs = db_query($sql_wfs);
-$cnt_wfs = 0;
-
-echo "<form name='form1' action='" . $self ."' method='post'>"; 
-echo "<br><b>WFS List: <b><br><br>";
-echo "<select class='wfsList' size='20' name='wfsList' >";
-
-while($row = db_fetch_array($res_wfs)){
-	echo "<option value='".$row["wfs_id"]."'>".$row["wfs_id"]." ".$row["wfs_name"]." - ".$row["wfs_title"]."</option>";
-	$cnt_wfs++;
-}
-echo "</select><br><br>";
-echo "<input class='button_del' type='button' value='delete' onclick='validate()'>";
-?>
-<input type='hidden' name='del'>
-</form>
-</body>
-</html>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/DeleteWFS
+# 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.
+
+import_request_variables("PG");
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>Delete WFS - All Users</title>
+<?php
+include '../include/dyn_css.php';
+?>
+<script type="text/javascript">
+function validate(){
+	var ind = document.form1.wfsList.selectedIndex;
+	if(ind > -1){
+		var permission =  confirm("delete: "  + document.form1.wfsList.options[ind].text + " ?");
+		if(permission === true){
+			document.form1.del.value = 1;
+			document.form1.submit();
+		}
+	}
+}
+</script>
+
+<style type="text/css">
+  	<!--
+  	body{
+      background-color: #ffffff;
+  		font-family: Arial, Helvetica, sans-serif;
+  		font-size : 12px;
+  		color: #808080
+  	}
+  	
+  	-->
+</style>
+</head>
+<body>
+
+<?php
+$logged_user_name=$_SESSION["mb_user_name"];
+$logged_user_id=$_SESSION["mb_user_id"];
+
+###delete
+if($wfsList){
+	 $sql = "DELETE FROM wfs WHERE wfs_id = $1";
+	 $v = array($wfsList);
+	 $t = array("i");
+	 $res = db_prep_query($sql, $v, $t);
+}
+
+$sql_wfs = "SELECT * FROM wfs ORDER BY wfs_id";
+$res_wfs = db_query($sql_wfs);
+$cnt_wfs = 0;
+
+echo "<form name='form1' action='" . $self ."' method='post'>"; 
+echo "<br><b>WFS List: <b><br><br>";
+echo "<select class='wfsList' size='20' name='wfsList' >";
+
+while($row = db_fetch_array($res_wfs)){
+	echo "<option value='".$row["wfs_id"]."'>".$row["wfs_id"]." ".$row["wfs_name"]." - ".$row["wfs_title"]."</option>";
+	$cnt_wfs++;
+}
+echo "</select><br><br>";
+echo "<input class='button_del' type='button' value='delete' onclick='validate()'>";
+?>
+<input type='hidden' name='del'>
+</form>
+</body>
+</html>

Modified: branches/print_dev/http/php/mod_digitize_messages.php
===================================================================
--- branches/print_dev/http/php/mod_digitize_messages.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_digitize_messages.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,84 +1,84 @@
-<?php
-#$Id: mod_insertWmcIntoDb.php 507 2006-11-20 10:55:57Z christoph $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
-$e = new mb_notice("locale: " . $_SESSION["mb_locale"] . "; lang: " . $_SESSION["mb_lang"]);
-$e = new mb_notice(setlocale(LC_ALL, $_SESSION["mb_locale"]));
-
-//
-// Messages
-//
-$msg_obj = array();
-$msg_obj["messageDescriptionPolygon"] = _mb("polygon");
-$msg_obj["messageDescriptionLine"] = _mb("line");
-$msg_obj["messageDescriptionPoint"] = _mb("point");
-$msg_obj["messageErrorNotAnInteger"] = _mb("Not an integer value.");
-$msg_obj["messageErrorNotAFloat"] = _mb("Not a double value.");
-$msg_obj["messageErrorFieldIsEmpty"] = _mb("This field may not be empty.");
-$msg_obj["messageErrorFormEvaluation"] = _mb("Failure during form evaluation.");
-$msg_obj["messageErrorWfsWrite"] = _mb("An error occured.");
-$msg_obj["messageErrorMergeNotApplicable"] = _mb("At least two geometries must be available. Only polygons are allowed in the geometry list.");
-$msg_obj["messageErrorSplitNotApplicable"] = _mb("Exactly two geometries must be available. The first geometry shall be a polygon, the second geometry shall be a line.");
-$msg_obj["messageErrorDifferenceNotApplicable"] = _mb("Exactly two polygons must be available.");
-$msg_obj["messageSuccessWfsWrite"] = _mb("Success.");
-$msg_obj["messageConfirmDeleteGeomFromDb"] = _mb("Delete geometry from database?");
-$msg_obj["messageConfirmDeleteAllGeomFromList"] = _mb("Clear list of geometries?");
-$msg_obj["messageSelectAnOption"] = _mb("Please select an entry.");
-$msg_obj["buttonLabelSaveGeometry"] = _mb("Save");
-$msg_obj["buttonLabelUpdateGeometry"] = _mb("Update");
-$msg_obj["buttonLabelDeleteGeometry"] = _mb("Delete");
-$msg_obj["buttonLabelAbort"] = _mb("Abort");
-$msg_obj["errorMessageEpsgMismatch"] = _mb("Fatal error: EPSG mismatch. ");
-$msg_obj["errorMessageNoGeometrySelected"] = _mb("No geometry selected!");
-$msg_obj["buttonLabelPointOff"] = _mb("add point");
-$msg_obj["buttonLabelPointOn"] = _mb("cancel editing");
-$msg_obj["buttonLabelLineOff"] = _mb("add line");
-$msg_obj["buttonLabelLineOn"] = _mb("finish line");
-$msg_obj["buttonLabelPolygonOff"] = _mb("add polygon");
-$msg_obj["buttonLabelPolygonOn"] = _mb("close polygon");
-$msg_obj["buttonLabelMoveBasepointOff"] = _mb("move basepoint");
-$msg_obj["buttonLabelMoveBasepointOn"] = _mb("move basepoint");
-$msg_obj["buttonLabelInsertBasepointOff"] = _mb("Insert basepoint");
-$msg_obj["buttonLabelInsertBasepointOn"] = _mb("Insert basepoint");
-$msg_obj["buttonLabelDeleteBasepointOff"] = _mb("Delete basepoint");
-$msg_obj["buttonLabelDeleteBasepointOn"] = _mb("Delete basepoint");
-$msg_obj["buttonLabelClearListOff"] = _mb("clear list of geometries");
-$msg_obj["buttonLabelClearListOn"] = _mb("clear list of geometries");
-$msg_obj["buttonLabelMergeOff"] = _mb("Merge two polygons into a single polygon (will be added to the geometry list)");
-$msg_obj["buttonLabelMergeOn"] = _mb("Merge two polygons into a single polygon (will be added to the geometry list)");
-$msg_obj["buttonLabelSplitOff"] = _mb("Split a polygon by a line (the new polygons will be added to the geometry list)");
-$msg_obj["buttonLabelSplitOn"] = _mb("Split a polygon by a line (the new polygons will be added to the geometry list)");
-$msg_obj["buttonLabelDifferenceOff"] = _mb("Combine two polygons (to create en- and exclave or to compute the difference)");
-$msg_obj["buttonLabelDifferenceOn"] = _mb("Split geometries");
-$msg_obj["buttonDig_wfs_title"] = _mb("save / update / delete");
-$msg_obj["buttonDig_remove_title"] = _mb("remove from workspace");
-$msg_obj["buttonDig_removeDb_title"] = _mb("remove from database");
-$msg_obj["closePolygon_title"] = _mb("click the first basepoint to close the polygon");
-$msg_obj["measureTagLabelCurrent"] = _mb("Current: ");
-$msg_obj["measureTagLabelTotal"] = _mb("Total: ");
-$msg_obj["digitizeDefaultGeometryName"] = _mb("new");
-
-$json = new Mapbender_JSON();
-$output = $json->encode($msg_obj);
-
-header("Content-type:application/x-json; charset=utf-8");
-echo $output;
+<?php
+#$Id: mod_insertWmcIntoDb.php 507 2006-11-20 10:55:57Z christoph $
+#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+$e = new mb_notice("locale: " . $_SESSION["mb_locale"] . "; lang: " . $_SESSION["mb_lang"]);
+$e = new mb_notice(setlocale(LC_ALL, $_SESSION["mb_locale"]));
+
+//
+// Messages
+//
+$msg_obj = array();
+$msg_obj["messageDescriptionPolygon"] = _mb("polygon");
+$msg_obj["messageDescriptionLine"] = _mb("line");
+$msg_obj["messageDescriptionPoint"] = _mb("point");
+$msg_obj["messageErrorNotAnInteger"] = _mb("Not an integer value.");
+$msg_obj["messageErrorNotAFloat"] = _mb("Not a double value.");
+$msg_obj["messageErrorFieldIsEmpty"] = _mb("This field may not be empty.");
+$msg_obj["messageErrorFormEvaluation"] = _mb("Failure during form evaluation.");
+$msg_obj["messageErrorWfsWrite"] = _mb("An error occured.");
+$msg_obj["messageErrorMergeNotApplicable"] = _mb("At least two geometries must be available. Only polygons are allowed in the geometry list.");
+$msg_obj["messageErrorSplitNotApplicable"] = _mb("Exactly two geometries must be available. The first geometry shall be a polygon, the second geometry shall be a line.");
+$msg_obj["messageErrorDifferenceNotApplicable"] = _mb("Exactly two polygons must be available.");
+$msg_obj["messageSuccessWfsWrite"] = _mb("Success.");
+$msg_obj["messageConfirmDeleteGeomFromDb"] = _mb("Delete geometry from database?");
+$msg_obj["messageConfirmDeleteAllGeomFromList"] = _mb("Clear list of geometries?");
+$msg_obj["messageSelectAnOption"] = _mb("Please select an entry.");
+$msg_obj["buttonLabelSaveGeometry"] = _mb("Save");
+$msg_obj["buttonLabelUpdateGeometry"] = _mb("Update");
+$msg_obj["buttonLabelDeleteGeometry"] = _mb("Delete");
+$msg_obj["buttonLabelAbort"] = _mb("Abort");
+$msg_obj["errorMessageEpsgMismatch"] = _mb("Fatal error: EPSG mismatch. ");
+$msg_obj["errorMessageNoGeometrySelected"] = _mb("No geometry selected!");
+$msg_obj["buttonLabelPointOff"] = _mb("add point");
+$msg_obj["buttonLabelPointOn"] = _mb("cancel editing");
+$msg_obj["buttonLabelLineOff"] = _mb("add line");
+$msg_obj["buttonLabelLineOn"] = _mb("finish line");
+$msg_obj["buttonLabelPolygonOff"] = _mb("add polygon");
+$msg_obj["buttonLabelPolygonOn"] = _mb("close polygon");
+$msg_obj["buttonLabelMoveBasepointOff"] = _mb("move basepoint");
+$msg_obj["buttonLabelMoveBasepointOn"] = _mb("move basepoint");
+$msg_obj["buttonLabelInsertBasepointOff"] = _mb("Insert basepoint");
+$msg_obj["buttonLabelInsertBasepointOn"] = _mb("Insert basepoint");
+$msg_obj["buttonLabelDeleteBasepointOff"] = _mb("Delete basepoint");
+$msg_obj["buttonLabelDeleteBasepointOn"] = _mb("Delete basepoint");
+$msg_obj["buttonLabelClearListOff"] = _mb("clear list of geometries");
+$msg_obj["buttonLabelClearListOn"] = _mb("clear list of geometries");
+$msg_obj["buttonLabelMergeOff"] = _mb("Merge two polygons into a single polygon (will be added to the geometry list)");
+$msg_obj["buttonLabelMergeOn"] = _mb("Merge two polygons into a single polygon (will be added to the geometry list)");
+$msg_obj["buttonLabelSplitOff"] = _mb("Split a polygon by a line (the new polygons will be added to the geometry list)");
+$msg_obj["buttonLabelSplitOn"] = _mb("Split a polygon by a line (the new polygons will be added to the geometry list)");
+$msg_obj["buttonLabelDifferenceOff"] = _mb("Combine two polygons (to create en- and exclave or to compute the difference)");
+$msg_obj["buttonLabelDifferenceOn"] = _mb("Split geometries");
+$msg_obj["buttonDig_wfs_title"] = _mb("save / update / delete");
+$msg_obj["buttonDig_remove_title"] = _mb("remove from workspace");
+$msg_obj["buttonDig_removeDb_title"] = _mb("remove from database");
+$msg_obj["closePolygon_title"] = _mb("click the first basepoint to close the polygon");
+$msg_obj["measureTagLabelCurrent"] = _mb("Current: ");
+$msg_obj["measureTagLabelTotal"] = _mb("Total: ");
+$msg_obj["digitizeDefaultGeometryName"] = _mb("new");
+
+$json = new Mapbender_JSON();
+$output = $json->encode($msg_obj);
+
+header("Content-type:application/x-json; charset=utf-8");
+echo $output;
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_editApplication_server.php
===================================================================
--- branches/print_dev/http/php/mod_editApplication_server.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_editApplication_server.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,58 +1,58 @@
-<?php
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../classes/class_user.php");
-require_once(dirname(__FILE__) . "/../classes/class_json.php");
-
-/**
- * encodes and delivers the data
- * 
- * @param object the un-encoded object 
- */
-function sendOutput($out){
-	global $json;
-	$output = $json->encode($out);
-	header("Content-Type: text/x-json");
-	echo $output;
-}
-
-
-$json = new Mapbender_JSON();
-$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
-$resultObj = array();
-
-$e = new mb_exception("command: " . $queryObj->command);
-
-$userId = $_SESSION[mb_user_id];
-
-switch($queryObj->command){
-
-	// gets available WMCs
-	case 'update':
-		$elementArray = $queryObj->parameters->data;		
-		for ($i = 0; $i < count($elementArray); $i++) {
-			$currentElement = $elementArray[$i];
-			$id = $currentElement->id;
-			$top = $currentElement->top;
-			$left = $currentElement->left;
-			$width = $currentElement->width;
-			$height = $currentElement->height;
-			$app = $queryObj->parameters->applicationId;
-			$sql = "UPDATE gui_element SET e_left = $1, e_top = $2, " .
-					"e_width = $3, e_height = $4 " .  
-					"WHERE e_id = $5 AND fkey_gui_id = $6"; 
-			$v = array($left, $top, $width, $height, $id, $app);
-			$t = array("i", "i", "i", "i", "s", "s");
-			$res = db_prep_query($sql, $v, $t);
-			$e = new mb_notice("updating element '" . $id . "'");
-		}
-		$resultObj["success"] = "Elements have been updated in the database.";
-	break;
-	
-
-	// Invalid command
-	default:
-		$resultObj["error"] = "no action specified...";
-}
-
-sendOutput($resultObj);
+<?php
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+
+/**
+ * encodes and delivers the data
+ * 
+ * @param object the un-encoded object 
+ */
+function sendOutput($out){
+	global $json;
+	$output = $json->encode($out);
+	header("Content-Type: text/x-json");
+	echo $output;
+}
+
+
+$json = new Mapbender_JSON();
+$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
+$resultObj = array();
+
+$e = new mb_exception("command: " . $queryObj->command);
+
+$userId = $_SESSION[mb_user_id];
+
+switch($queryObj->command){
+
+	// gets available WMCs
+	case 'update':
+		$elementArray = $queryObj->parameters->data;		
+		for ($i = 0; $i < count($elementArray); $i++) {
+			$currentElement = $elementArray[$i];
+			$id = $currentElement->id;
+			$top = $currentElement->top;
+			$left = $currentElement->left;
+			$width = $currentElement->width;
+			$height = $currentElement->height;
+			$app = $queryObj->parameters->applicationId;
+			$sql = "UPDATE gui_element SET e_left = $1, e_top = $2, " .
+					"e_width = $3, e_height = $4 " .  
+					"WHERE e_id = $5 AND fkey_gui_id = $6"; 
+			$v = array($left, $top, $width, $height, $id, $app);
+			$t = array("i", "i", "i", "i", "s", "s");
+			$res = db_prep_query($sql, $v, $t);
+			$e = new mb_notice("updating element '" . $id . "'");
+		}
+		$resultObj["success"] = "Elements have been updated in the database.";
+	break;
+	
+
+	// Invalid command
+	default:
+		$resultObj["error"] = "no action specified...";
+}
+
+sendOutput($resultObj);
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_editGuiWms.php
===================================================================
--- branches/print_dev/http/php/mod_editGuiWms.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_editGuiWms.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,743 +1,743 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_editGuiWms.php
-# 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.
-
-import_request_variables("PG");
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-require_once(dirname(__FILE__)."/../classes/class_wms.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
-?>
-<title>Edit GUI WMS</title>
-<?php
-include_once '../include/dyn_css.php';
-
-
-function toImage($text) {
-	$angle = 90;
-	if (extension_loaded("gd2")) {
-		return "<img src='../php/createImageFromText.php?text=" . urlencode($text) . "&angle=" . $angle . "'>";
-	}
-	return $text;
-}
-?>
-
-<script language="JavaScript">
-
-
-function edit_gaz(gui,wms,layer){
-	window.open("../php/mod_wfsLayerObj_conf.php?gui="+gui+"&wms="+wms+"&layer="+layer);
-}
-function validate(wert){
-	if(wert == 'delete_wms'){
-		if(document.form1.wmsList.selectedIndex == -1){
-			document.form1.wmsList.style.background = '#ff0000';
-		}else{
-
-			var secure = confirm("Remove WMS in this GUI ?");
-			if(secure == true){
-				document.form1.del.value='true';
-				document.form1.submit();
-			}
-		}
-	}
-
-	if(wert == 'up_wms'){
-		if(document.form1.wmsList.selectedIndex == -1){
-			document.form1.wmsList.style.background = '#ff0000';
-		}else{
-			if (document.form1.wmsList.selectedIndex>0){
-				document.form1.up.value='true';
-				document.form1.submit();
-			}
-		}
-	}
-
-	if(wert == 'down_wms'){
-		if(document.form1.wmsList.selectedIndex == -1){
-			document.form1.wmsList.style.background = '#ff0000';
-		}else{
-			if (document.form1.wmsList.selectedIndex<document.form1.wmsList.length-1){
-				document.form1.down.value='true';
-				document.form1.submit();
-			}
-		}
-	}
-}
-function checkBoxValue(){
-   for(var i=0; i<document.forms[0].elements.length; i++){
-      if(document.forms[0].elements[i].type == 'checkbox'){
-         if(document.forms[0].elements[i].checked == true){
-            document.forms[0].elements[i].value = '1';
-         }
-         else{
-            document.forms[0].elements[i].value = '0';
-            document.forms[0].elements[i].checked = true;
-         }
-      }
-      if(document.forms[0].elements[i].type == 'text' && ( document.forms[0].elements[i].name.indexOf("minscale") > -1 || document.forms[0].elements[i].name.indexOf("maxscale") > -1 )){
-         var nr = parseInt(document.forms[0].elements[i].value);
-         if(isNaN(nr) == true){document.forms[0].elements[i].value = 0;}
-         else{document.forms[0].elements[i].value = nr;}
-      }
-   }
-   document.forms[0].update_content.value=1;
-   document.forms[0].submit();
-}
-function getAllLayer(){
-   var arrayLayer = new Array();
-   var cntLayer = 0;
-   for(var i=0; i<document.forms[0].elements.length; i++){
-      if(document.forms[0].elements[i].name.indexOf("layer_id") > -1){
-         arrayLayer[cntLayer] = document.forms[0].elements[i].value;
-         cntLayer++;
-      }
-   }
-   return arrayLayer;
-}
-function setSubs(){
-   var arrayLayer = getAllLayer();
-   for(var i=0; i<arrayLayer.length; i++){
-      if(parseInt(eval("document.forms[0].L_" + arrayLayer[i] + "___layer_parent.value")) > 0){
-         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_status.checked = false");
-      }
-   }
-}
-function setLayer(def,status){
-   var arrayLayer = getAllLayer();
-   if(def == 'querylayer'){
-      for(var i=1; i<arrayLayer.length; i++){
-         if(eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.disabled == false")){
-            eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.checked = " + status);
-         }
-      }
-   }
-   if(def == 'visible'){
-      for(var i=1; i<arrayLayer.length; i++){
-         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_visible.checked = " + status);
-      }
-   }
-}
-function showSld(origUrl){
-	var url = document.getElementById("this_gui_wms_sldurl").value;
-	if(url==""){
-		if(origUrl=="")
-			return;
-		url=origUrl;
-	}
-	window.open(url);
-}
-</script>
-
-</head>
-<body>
-<?php
-
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-$con = db_connect($DBSERVER,$OWNER,$PW);
-db_select_db(DB,$con);
-
-$mb_user_id=$_SESSION["mb_user_id"];
-
-#delete gui_wms from gui
-if($del && $del == 'true'){
-	$sql="SELECT DISTINCT gui_wms_position from gui_wms WHERE fkey_gui_id = $1 and fkey_wms_id = $2";
-	$v = array($guiList,$wmsList);
-	$t = array('s','i');
-	$res = db_prep_query($sql,$v,$t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$wms_position = $row["gui_wms_position"];
-		$cnt++;
-	}
-	#if($cnt > 1){die("Error: WMS (ID) not unique!");}
-		$sql = "Delete from gui_wms where fkey_gui_id = $1 and fkey_wms_id = $2 ";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		$sql = "Delete from gui_layer where fkey_gui_id = $1 and gui_layer_wms_id = $2";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		$del='false';
-		$sql = "UPDATE gui_wms SET gui_wms_position = (gui_wms_position - 1) WHERE gui_wms_position > $1";
-		$sql .= " AND fkey_gui_id = $2 ";
-		$v = array($wms_position,$guiList);
-		$t = array('i','s');
-		$res = db_prep_query($sql,$v,$t);
-
-	unset($wmsList);
-}
-
-#update gui_wms_position
-if($up && $up == 'true'){
-	if ($wmsList!=""){
-		$sql = "SELECT gui_wms_position ";
-		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		if($row = db_fetch_array($res)){
-			$wms_position = $row["gui_wms_position"];
-		}
-	}
-	if($wms_position > 0){
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
-		$v = array(($wms_position - 1),$guiList,$wmsList);
-		$t = array('i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4 ";
-		$v = array($wms_position,($wms_position - 1),$guiList,$wmsList);
-		$t = array('i','i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-	}
-}
-
-if($down && $down == 'true'){
-	$max = 0;
-	if ($wmsList!=""){
-		$sql = "SELECT gui_wms_position ";
-		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-		$v = array($guiList,$wmsList);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		if($row = db_fetch_array($res)){
-			$wms_position = $row["gui_wms_position"];
-		}
-		$sql = "SELECT MAX(gui_wms_position) as max FROM gui_wms WHERE fkey_gui_id = $1 ";
-		$v = array($guiList);
-		$t = array('s');
-		$res = db_prep_query($sql,$v,$t);
-		if($row = db_fetch_array($res)){
-			$max = $row["max"];
-		}
-	}
-	if($wms_position < $max){
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
-		$v = array(($wms_position + 1),$guiList,$wmsList);
-		$t = array('i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-		$sql = "UPDATE gui_wms SET ";
-		$sql .= "gui_wms_position = $1";
-		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4";
-		$v = array($wms_position,($wms_position + 1),$guiList,$wmsList);
-		$t = array('i','i','s','i');
-		$res = db_prep_query($sql,$v,$t);
-	}
-}
-
-/*handle Updates*/
-if(isset($update_content) && $update_content == "1"){
-   if(isset($this_gui_wms_epsg)){
-      $sql = "UPDATE gui_wms set gui_wms_epsg = $1, gui_wms_mapformat = $2, ";
-      $sql .= "gui_wms_featureinfoformat = $3, gui_wms_exceptionformat = $4, ";
-      $sql .= "gui_wms_visible = $5, gui_wms_opacity = $6, gui_wms_sldurl = $7 ";
-      $sql .= "WHERE fkey_gui_id = $8 AND fkey_wms_id = $9";
-		$v = array($this_gui_wms_epsg,$this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
-		$t = array('s','s','s','s','i','i','s','s','i');
-		$res = db_prep_query($sql,$v,$t);
-   }
-   else{
-		$sql = "UPDATE gui_wms set gui_wms_mapformat = $1, ";
-		$sql .= "gui_wms_featureinfoformat = $2, gui_wms_exceptionformat = $3, ";
-		$sql .= "gui_wms_visible = $4, gui_wms_opacity = $5, gui_wms_sldurl = $6 ";
-		$sql .= "WHERE fkey_gui_id = $7 AND fkey_wms_id = $8";
-		$v = array($this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
-		$t = array('s','s','s','i','i','s','s','i');
-		$res = db_prep_query($sql,$v,$t);
-   }
-
-   /**/
-
-   $cnt = 0;
-   while(list($key,$val) = each($_REQUEST)){
-		if(preg_match("/___/", $key)){
-			$myKey = explode("___", $key);
-			if($myKey[1]!="layer_parent" && $myKey[1]!='layer_id' ){
-				$sql = "UPDATE gui_layer SET ".$myKey[1]." = $1 WHERE fkey_gui_id = $2 AND fkey_layer_id = $3";
-				$v = array($val,$this_gui,preg_replace("/L_/","",$myKey[0]));
-				if($myKey[1]=='gui_layer_style'){
-					$t = array('s','s','i');
-				}
-				else{
-					$t = array('i','s','i');
-				}
-				if(!$res = db_prep_query($sql,$v,$t)){
-					echo "FEHLER in ZEILE 288";
-				}
-			}
-		}
-	}
-}
-
-echo "<form name='form1' action='" . $self ."' method='post'>";
-echo "<table cellpadding='3' cellspacing='3' border='0' class='table_top'>";
-
-echo "<tr>";
-echo "<td>";
-echo "GUI";
-echo "</td>";
-echo "<td>";
-echo "WMS-TITLE";
-echo "</td>";
-echo "<td>";
-echo "</td>";
-echo "<tr>";
-
-echo "<td>";
-
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-$admin = new administration();
-$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
-
-$gui_id =array();
-if (count($ownguis)>0){
-	for($i=0; $i<count($ownguis); $i++){
-		$gui_id[$i]=$ownguis[$i];
-	}
-}
-
-echo"<select size='8' name='guiList' onchange='document.form1.wmsList.selectedIndex = -1;submit()'>";
-$selected_gui_id="";
-
-for ($i=0; $i<count($ownguis);$i++){
-   echo "<option value='".$gui_id[$i]."' ";
-   if($guiList && $guiList == $gui_id[$i]){
-      echo "selected";
-      $selected_gui_id=$gui_id[$i];
-   }
-   else{
-      if ($i==0){
-         echo "selected";
-         $selected_gui_id=$gui_id[$i];
-		}
-   }
-   echo ">".$gui_id[$i]."</option>";
-}
-
-echo "</select>";
-echo "</td>";
-echo "<td>";
-
-$sql = "SELECT * from gui_wms JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON ";
-$sql .= "gui_wms.fkey_wms_id = wms.wms_id AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_id = $1 ORDER BY gui_wms_position";
-$v = array($selected_gui_id);
-$t = array('s');
-$res = db_prep_query($sql,$v,$t);
-$count_wms = 0;
-echo "<select size='8' name='wmsList' style='width:200px' onchange='submit()'>";
-
-while($row = db_fetch_array($res)){
-	echo "<option value='".$row["wms_id"]."' ";
-	if(isset($wmsList) && $wmsList == $row["wms_id"]){
-		echo "selected";
-	}
-	echo ">".$row["gui_wms_position"]." - ".$row["wms_title"]."</option>";
-	$count_wms++;
-}
-echo "</select>";
-echo "</td><td>";
-echo "<input class='myButton' type='button' name='up_wms' value=' up ' onClick='validate(\"up_wms\")'>";
-echo "<input type='hidden' name='up' value=''><br><br>";
-
-echo "<input class='myButton' type='button' name='down_wms' value='down'  onClick='validate(\"down_wms\")'>";
-echo "<input type='hidden' name='down' value=''><br><br>";
-
-echo "<input class='myButton' type='button' name='delete_wms' value='remove'  onClick='validate(\"delete_wms\")'>";
-echo "<input type='hidden' name='del' value=''>";
-
-echo "</td>";
-echo "</tr>";
-echo "</table>";
-
-
-if(isset($wmsList)){
-#gui_wms
-$sql_gw = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-$v = array($guiList,$wmsList);
-$t = array('s','i');
-$res_gw = db_prep_query($sql_gw,$v,$t);
-$cnt_gw = 0;
-while($row = db_fetch_array($res_gw)){
-   $gui_wms_position[$cnt_gw] = $row["gui_wms_position"];
-   $gui_wms_mapformat[$cnt_gw] = $row["gui_wms_mapformat"];
-   $gui_wms_featureinfoformat[$cnt_gw] = $row["gui_wms_featureinfoformat"];
-   $gui_wms_exceptionformat[$cnt_gw] = $row["gui_wms_exceptionformat"];
-   $gui_wms_epsg[$cnt_gw] = $row["gui_wms_epsg"];
-   $gui_wms_visible[$cnt_gw] = $row["gui_wms_visible"];
-   $gui_wms_opacity[$cnt_gw] = $row["gui_wms_opacity"];
-   $gui_wms_sldurl[$cnt_gw] = $row["gui_wms_sldurl"]; # sld url
-   $cnt_gw++;
-}
-#wms
-$sql_w = "SELECT * FROM wms WHERE wms_id = $1";
-$v = array($wmsList);
-$t = array('i');
-$res_w = db_prep_query($sql_w,$v,$t);
-$cnt_w = 0;
-while($row = db_fetch_array($res_w)){
-   $wms_id[$cnt_w] = $row["wms_id"];
-   $wms_version[$cnt_w] = $row["wms_version"];
-   $wms_title[$cnt_w] = $row["wms_title"];
-   $wms_abstract[$cnt_w] = $row["wms_abstract"];
-   $wms_getcapabilities[$cnt_w] = $row["wms_getcapabilities"];
-   $wms_supportsld[$cnt_w] = $row["wms_supportsld"];  # Buttons zum sld support anzeigen?
-   $cnt_w++;
- }
-#wms_format
-$sql_wf = "SELECT * FROM  wms_format WHERE  fkey_wms_id = $1";
-$v = array($wmsList);
-$t = array('i');
-$res_wf = db_prep_query($sql_wf,$v,$t);
-$cnt_wf = 0;
-while($row = db_fetch_array($res_wf)){
-   $data_type[$cnt_wf] = $row["data_type"];
-   $data_format[$cnt_wf] = $row["data_format"];
-   $cnt_wf++;
- }
-#gui_layer
-$sql_gl = "SELECT l.*, gl.*, sld.sld_user_layer_id, sld.use_sld FROM layer AS l, gui_layer AS gl left outer join sld_user_layer AS sld on sld.fkey_layer_id = gl.fkey_layer_id WHERE l.layer_id = gl.fkey_layer_id AND gl.gui_layer_wms_id = $1 AND gl.fkey_gui_id = $2 AND (sld.fkey_gui_id = $3 or sld.fkey_gui_id is NULL) AND (sld.fkey_mb_user_id = $4 or sld.fkey_mb_user_id is NULL) ORDER BY l.layer_pos";
-$v = array($wmsList,$guiList,$guiList,$mb_user_id);
-$t = array('i','s','s','i');
-
-$res_gl = db_prep_query($sql_gl,$v,$t);
-$gui_layer_status = array();
-$gui_layer_selectable = array();
-$gui_layer_visible = array();
-$gui_layer_queryable = array();
-$gui_layer_querylayer = array();
-$gui_layer_minscale = array();
-$gui_layer_maxscale = array();
-$gui_layer_priority = array();
-$gui_layer_style = array();
-$gui_layer_wfs_featuretype = array();
-$layer_maxscale = array();
-$layer_id = array();
-$layer_parent = array();
-$layer_name = array();
-$layer_title = array();
-$layer_queryable = array();
-$layer_minscale = array();
-$layer_maxscale = array();
-$sld_user_layer_id = array();
-$use_sld = array();
-while($row = db_fetch_array($res_gl)){
-	array_push($gui_layer_status, $row["gui_layer_status"]);
-	array_push($gui_layer_selectable, $row["gui_layer_selectable"]);
-	array_push($gui_layer_visible, $row["gui_layer_visible"]);
-	array_push($gui_layer_queryable, $row["gui_layer_queryable"]);
-	array_push($gui_layer_querylayer, $row["gui_layer_querylayer"]);
-	array_push($gui_layer_minscale, $row["gui_layer_minscale"]);
-	array_push($gui_layer_maxscale, $row["gui_layer_maxscale"]);
-	array_push($gui_layer_priority, $row["gui_layer_priority"]);
-	array_push($gui_layer_style, $row["gui_layer_style"]);
-	array_push($gui_layer_wfs_featuretype, $row["gui_layer_wfs_featuretype"]);
-	array_push($layer_id, $row["layer_id"]);
-	array_push($layer_parent, $row["layer_parent"]);
-	array_push($layer_name, $row["layer_name"]);
-	array_push($layer_title, $row["layer_title"]);
-	array_push($layer_queryable, $row["layer_queryable"]);
-	array_push($layer_minscale, $row["layer_minscale"]);
-	array_push($layer_maxscale, $row["layer_maxscale"]);
-	array_push($sld_user_layer_id, $row["sld_user_layer_id"]);
-	array_push($use_sld, $row["use_sld"]);
-}
-
-#layer_epsg
-$sql_le = "SELECT * FROM layer_epsg WHERE  fkey_layer_id = $1";
-$v = array($layer_id[0]);
-$t = array('i');
-$res_le = db_prep_query($sql_le,$v,$t);
-$cnt_le = 0;
-while($row = db_fetch_array($res_le)){
-   $epsg[$cnt_le] = $row["epsg"];
-   $cnt_le++;
-}
-
-echo "<div style='position:absolute;left:590px; top:180px;' ><input type='button' style='width:100px;height:100px;background-color:#0066cc' value='save' onclick='checkBoxValue()'></div>";
-echo "<table class='table_top'>";
-echo "<tr>";
-echo "<td colspan='2'>";
-echo "<a href='".$wms_getcapabilities[0];
-echo wms::getConjunctionCharacter($wms_getcapabilities[0]);
-if ($wms_version[0] == "1.0.0") { 
-	echo "WMTVER=". $wms_version[0]."&REQUEST=capabilities";
-}
-else {
-	echo "VERSION=". $wms_version[0]."&REQUEST=GetCapabilities&SERVICE=WMS";
-}
-echo "' style='font-size:14px' target='_blank'>LINK: Capabilities</a>";
-echo "</td>";
-echo "<td align = right>WMS ID: " . $wms_id[0] . "</td>";
-echo "<tr>";
-#epsg
-if($gui_wms_position[0] == 0){
-  echo "<tr>";
-     echo "<td>EPSG: </td><td>";
-     echo "<select class='mySelect'  name='this_gui_wms_epsg'>";
-        for($i=0; $i<count($epsg); $i++){
-           echo "<option value='".$epsg[$i]."' ";
-           if($epsg[$i] == $gui_wms_epsg[0]){ echo "selected";}
-           echo ">".$epsg[$i]."</option>";
-        }
-     echo "</select>";
-     echo "</td>";
-  echo "</tr>";
-}
-#format
-echo "<tr>";
-   echo "<td>Mapformat: </td><td>";
-        echo "<select class='mySelect'  name='this_gui_wms_mapformat'>";
-        for($i=0; $i<count($data_format); $i++){
-           if($data_type[$i] == 'map'){
-              echo "<option value='".$data_format[$i]."' ";
-              if($data_format[$i] == $gui_wms_mapformat[0]){ echo "selected";}
-              echo ">".$data_format[$i]."</option>";
-           }
-        }
-     echo "</select>";
-   echo "</td>";
-
-echo "</tr>";
-
-echo "<tr>";
-   echo "<td>Infoformat: </td><td>";
-        echo "<select class='mySelect'  name='this_gui_wms_featureinfoformat'>";
-        echo "<option value='text/html'>text/html</option>";
-        for($i=0; $i<count($data_format); $i++){
-           if($data_type[$i] == 'featureinfo'){
-              echo "<option value='".$data_format[$i]."' ";
-              if($data_format[$i] == $gui_wms_featureinfoformat[0]){ echo "selected";}
-              echo ">".$data_format[$i]."</option>";
-           }
-        }
-     echo "</select>";
-   echo "</td>";
-echo "</tr>";
-
-echo "<tr>";
-   echo "<td>Exceptionformat: </td><td>";
-        echo "<select class='mySelect' name='this_gui_wms_exceptionformat'>";
-        for($i=0; $i<count($data_format); $i++){
-           if($data_type[$i] == 'exception'){
-              echo "<option value='".$data_format[$i]."' ";
-              if($data_format[$i] == $gui_wms_exceptionformat[0]){ echo "selected";}
-              echo ">".$data_format[$i]."</option>";
-           }
-        }
-     echo "</select>";
-   echo "</td>";
-echo "</tr><br>";
-
-# visibility
-echo "<tr>";
-	echo "<td>Visibility: </td><td>";
-	echo "<select class='mySelect' name='this_gui_wms_visible'>";
-	for($i=0; $i<3; $i++){
-		echo "<option value='".$i."' ";
-		if($i == $gui_wms_visible[0]){ echo "selected";}
-		echo ">";
-		if($i == '0'){
-			echo "hidden";
-		}
-		if($i == '1'){
-			echo "visible";
-		}
-		echo "</option>";
-	}
-	echo "</select>";
-	echo "</td>";
-echo "</tr>";
-
-# opacity
-echo "<tr>";
-	echo "<td>Opacity: </td><td>";
-	echo "<select class='mySelect' name='this_gui_wms_opacity'>";
-	for($i=0; $i<=100; $i+=10){
-		echo "<option value='".$i."' ";
-		if($i - $gui_wms_opacity[0]<=5&&$i - $gui_wms_opacity[0]>=-4){ echo "selected";}
-		echo ">";
-		echo $i."%";
-		echo "</option>";
-	}
-	echo "</select>";
-	echo "</td>";
-echo "</tr>";
-
-# sld support
-if($wms_supportsld[0]) {
-		echo "<tr>";
-		echo "<td>SLD-URL: </td><td>";
-		echo "<input type='text' class='myText' name='this_gui_wms_sldurl' id='this_gui_wms_sldurl' title='".$gui_wms_sldurl[0]."' value='".$gui_wms_sldurl[0]."'>";
-		#echo "<a href='' onclick='return window.open(\"editor-start.php\");'><img src='sld_editor.png' border=0></a>";
-		#$layer_names = implode(",", $layer_name);
-        echo " <a href='javascript:showSld(\"".$gui_wms_sldurl[0]."\");'>SLD laden/anzeigen</a>";
-		echo "</td>";
-	echo "</tr>";
-} else {
-	echo "<input type='hidden' value='' name='this_gui_wms_sldurl'>";
-}
-
-echo "</table><br>";
-
-echo "<table border='1' cellpadding='1'>";
-		echo "<tr>";
-
-                echo "<td>Nr.</td>";
-                echo "<td>ID</td>";
-                echo "<td>" . toImage('Parent') . "</td>";
-                echo "<td>Name</td>";
-                echo "<td>Title</td>";
-                echo "<td>" . toImage('on/off') . "</td>";
-                echo "<td>" . toImage('sel') . "</td>";
-                echo "<td>" . toImage('sel_default') . "</td>";
-                echo "<td>" . toImage('info') . "</td>";
-                echo "<td>" . toImage('info_default') . "</td>";
-                echo "<td>" . toImage('minScale 1:') . "</td>";
-                echo "<td>" . toImage('maxScale 1:') . "</td>";
-                echo "<td>" . toImage('Style') . "</td>";
-                echo "<td>" . toImage('Prio') . "</td>";
-                echo "<td>" . toImage('setWFS') . "</td>";
-                if($wms_supportsld[0]) {echo "<td>" . toImage('SLD') . "</td>";}
-        echo "</tr>";
-
-#echo "<tr><td>Nr.</td><td>ID</td><td>Parent</td><td>Name</td><td>Title</td><td>on/off</td><td>sel</td><td>sel_default</td><td>info</td><td>info_default</td><td>minScale 1:</td><td>maxScale 1:</td><td>Prio</td><td>setWFS</td></tr>";
-echo "<tr><td></td><td></td><td></td><td></td><td></td><td>";
-echo "<input type='button' class='LButton' value='Sublayer\noff' onclick='setSubs()'>";
-echo "</td><td></td><td>";
-echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"visible\",false)'>&nbsp;";
-echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"visible\",true)'></nobr>";
-echo"</td><td></td><td>";
-echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"querylayer\",false)'>&nbsp;";
-echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"querylayer\",true)'></nobr>";
-echo "</td><td></td><td></td><td></td></tr>";
-
-for($i=0; $i<count($layer_id); $i++){
-#layer_styles
-$sql_styles = "SELECT * FROM layer_style WHERE  fkey_layer_id = $1";
-$v = array($layer_id[$i]);
-$t = array('i');
-$res_styles = db_prep_query($sql_styles,$v,$t);
-$cnt_styles= 0;
-$style = array();
-while($row = db_fetch_array($res_styles)){
-   $style[$cnt_styles] = $row["name"];
-   $cnt_styles++;
-}
-
- echo "<tr align='center'>";
-  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_nr' disabled value='".$i."'></td>";
-  echo "<td style='background:lightgrey'><input type='text' size='2' name='L_".$layer_id[$i]."___layer_id' value='".$layer_id[$i]."' readonly></td>";
-  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_parent' value='".$layer_parent[$i]."' readonly></td>";
-  echo "<td style='background:lightgrey'><input type='text' size='7' value='".$layer_name[$i]."' readonly></td>";
-  echo "<td><input type='text' name='".$layer_title[$i]."' size='12' value='".$layer_title[$i]."' ></td>";
-
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_status' type='checkbox' ";
-  if($gui_layer_status[$i] == 1){ echo "checked";}
-  echo "></td>";
-
-  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_selectable' type='checkbox' ";
-  if($gui_layer_selectable[$i] == 1){ echo "checked";}
-  echo "></td>";
-
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_visible' type='checkbox' ";
-  if($gui_layer_visible[$i] == 1){ echo "checked";}
-  echo "></td>";
-
-  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_queryable' type='checkbox' ";
-  if($gui_layer_queryable[$i] == 1){ echo "checked";}
-  if($layer_queryable[$i] == 0){ echo "disabled";}
-  echo "></td>";
-
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_querylayer' type='checkbox' ";
-  if($gui_layer_querylayer[$i] == 1){ echo "checked";}
-  if($layer_queryable[$i] == 0){ echo "disabled";}
-  echo "></td>";
-
-  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_minscale' type='text' size='5' value='".$gui_layer_minscale[$i]."'></td>";
-  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_maxscale' type='text' size='5' value='".$gui_layer_maxscale[$i]."'></td>";
-  /**/
-  echo "<td>\n";
-  echo "<select class='select_short' name='L_".$layer_id[$i]."___gui_layer_style'>\n";
-  	   echo "<option value=''";
-  	   if(count($style) ==0){ echo "selected";}
-  	   echo ">---</option>\n";
-  for($j=0;$j<count($style); $j++){
-       echo "<option value='".$style[$j]."'";
-       if($style[$j] == $gui_layer_style[$i]){ echo "selected";}
-       echo ">".$style[$j]."</option>\n";
- }
-  echo "</select></td>\n";
-  /**/
-  echo "<td><select class='select_auto' name='L_".$layer_id[$i]."___gui_layer_priority'>";
-  for($j=0; $j<count($gui_layer_priority); $j++){
-     echo "<option value='".$j."'";
-     if($j == $gui_layer_priority[$i]){echo "selected";}
-     echo ">".$j;
-     echo "</option>";
-  }
-  echo "</select></td>\n";
-  /* wfs configuration */
-	echo "<td>";
-	if ($i > 0) {
-		echo "<input class='button_wfs'name='gui_layer_gaz' type='button' onclick='edit_gaz(\"".$guiList."\",".$wmsList.",".$layer_id[$i].")' value='";
-		if($gui_layer_wfs_featuretype[$i] == ""){
-			echo "setWFS";
-		}
-		else{
-			echo "wfs ".$gui_layer_wfs_featuretype[$i];
-		}
-		echo "'>";
-	}
-	echo "</td>";
-	if($wms_supportsld[0]) {
-		echo "<td>";
-		if ($i > 0) {
-			echo "<input class='button3' name='gui_layer_sld' type='button' onclick='window.open(\"../sld/sld_main.php?".$urlParameters."&sld_gui_id=".$guiList."&sld_wms_id=".$wms_id[0]."&sld_layer_name=".$layer_name[$i]."\");' value='";
-			if ($sld_user_layer_id[$i] != "")
-				echo "sld:".$sld_user_layer_id[$i]."(".$use_sld[$i].")";
-			else
-				echo "SLD";
-			echo "'>";
-		}
-		echo "</td>";
-	}
- echo "</tr>\n";
- if($i == 0){ echo "<tr><td colspan='16'><hr></td></tr>";}
-}
-echo "</table>\n";
-echo "<input type='hidden' name='this_gui' value='".$guiList."'>\n";
-echo "<input type='hidden' name='this_wms' value='".$wmsList."'>\n";
-echo "<input type='hidden' name='this_layer_count' value='".$cnt_l."'>\n";
-echo "<input type='hidden' name='update_content' value=''>\n";
-echo "</form>\n";
-}
-?>
-</body>
-</html>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_editGuiWms.php
+# 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.
+
+import_request_variables("PG");
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_wms.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+?>
+<title>Edit GUI WMS</title>
+<?php
+include_once '../include/dyn_css.php';
+
+
+function toImage($text) {
+	$angle = 90;
+	if (extension_loaded("gd2")) {
+		return "<img src='../php/createImageFromText.php?text=" . urlencode($text) . "&angle=" . $angle . "'>";
+	}
+	return $text;
+}
+?>
+
+<script language="JavaScript">
+
+
+function edit_gaz(gui,wms,layer){
+	window.open("../php/mod_wfsLayerObj_conf.php?gui="+gui+"&wms="+wms+"&layer="+layer);
+}
+function validate(wert){
+	if(wert == 'delete_wms'){
+		if(document.form1.wmsList.selectedIndex == -1){
+			document.form1.wmsList.style.background = '#ff0000';
+		}else{
+
+			var secure = confirm("Remove WMS in this GUI ?");
+			if(secure == true){
+				document.form1.del.value='true';
+				document.form1.submit();
+			}
+		}
+	}
+
+	if(wert == 'up_wms'){
+		if(document.form1.wmsList.selectedIndex == -1){
+			document.form1.wmsList.style.background = '#ff0000';
+		}else{
+			if (document.form1.wmsList.selectedIndex>0){
+				document.form1.up.value='true';
+				document.form1.submit();
+			}
+		}
+	}
+
+	if(wert == 'down_wms'){
+		if(document.form1.wmsList.selectedIndex == -1){
+			document.form1.wmsList.style.background = '#ff0000';
+		}else{
+			if (document.form1.wmsList.selectedIndex<document.form1.wmsList.length-1){
+				document.form1.down.value='true';
+				document.form1.submit();
+			}
+		}
+	}
+}
+function checkBoxValue(){
+   for(var i=0; i<document.forms[0].elements.length; i++){
+      if(document.forms[0].elements[i].type == 'checkbox'){
+         if(document.forms[0].elements[i].checked == true){
+            document.forms[0].elements[i].value = '1';
+         }
+         else{
+            document.forms[0].elements[i].value = '0';
+            document.forms[0].elements[i].checked = true;
+         }
+      }
+      if(document.forms[0].elements[i].type == 'text' && ( document.forms[0].elements[i].name.indexOf("minscale") > -1 || document.forms[0].elements[i].name.indexOf("maxscale") > -1 )){
+         var nr = parseInt(document.forms[0].elements[i].value);
+         if(isNaN(nr) == true){document.forms[0].elements[i].value = 0;}
+         else{document.forms[0].elements[i].value = nr;}
+      }
+   }
+   document.forms[0].update_content.value=1;
+   document.forms[0].submit();
+}
+function getAllLayer(){
+   var arrayLayer = new Array();
+   var cntLayer = 0;
+   for(var i=0; i<document.forms[0].elements.length; i++){
+      if(document.forms[0].elements[i].name.indexOf("layer_id") > -1){
+         arrayLayer[cntLayer] = document.forms[0].elements[i].value;
+         cntLayer++;
+      }
+   }
+   return arrayLayer;
+}
+function setSubs(){
+   var arrayLayer = getAllLayer();
+   for(var i=0; i<arrayLayer.length; i++){
+      if(parseInt(eval("document.forms[0].L_" + arrayLayer[i] + "___layer_parent.value")) > 0){
+         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_status.checked = false");
+      }
+   }
+}
+function setLayer(def,status){
+   var arrayLayer = getAllLayer();
+   if(def == 'querylayer'){
+      for(var i=1; i<arrayLayer.length; i++){
+         if(eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.disabled == false")){
+            eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_querylayer.checked = " + status);
+         }
+      }
+   }
+   if(def == 'visible'){
+      for(var i=1; i<arrayLayer.length; i++){
+         eval("document.forms[0].L_" + arrayLayer[i] + "___gui_layer_visible.checked = " + status);
+      }
+   }
+}
+function showSld(origUrl){
+	var url = document.getElementById("this_gui_wms_sldurl").value;
+	if(url==""){
+		if(origUrl=="")
+			return;
+		url=origUrl;
+	}
+	window.open(url);
+}
+</script>
+
+</head>
+<body>
+<?php
+
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db(DB,$con);
+
+$mb_user_id=$_SESSION["mb_user_id"];
+
+#delete gui_wms from gui
+if($del && $del == 'true'){
+	$sql="SELECT DISTINCT gui_wms_position from gui_wms WHERE fkey_gui_id = $1 and fkey_wms_id = $2";
+	$v = array($guiList,$wmsList);
+	$t = array('s','i');
+	$res = db_prep_query($sql,$v,$t);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		$wms_position = $row["gui_wms_position"];
+		$cnt++;
+	}
+	#if($cnt > 1){die("Error: WMS (ID) not unique!");}
+		$sql = "Delete from gui_wms where fkey_gui_id = $1 and fkey_wms_id = $2 ";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$sql = "Delete from gui_layer where fkey_gui_id = $1 and gui_layer_wms_id = $2";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$del='false';
+		$sql = "UPDATE gui_wms SET gui_wms_position = (gui_wms_position - 1) WHERE gui_wms_position > $1";
+		$sql .= " AND fkey_gui_id = $2 ";
+		$v = array($wms_position,$guiList);
+		$t = array('i','s');
+		$res = db_prep_query($sql,$v,$t);
+
+	unset($wmsList);
+}
+
+#update gui_wms_position
+if($up && $up == 'true'){
+	if ($wmsList!=""){
+		$sql = "SELECT gui_wms_position ";
+		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+			$wms_position = $row["gui_wms_position"];
+		}
+	}
+	if($wms_position > 0){
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
+		$v = array(($wms_position - 1),$guiList,$wmsList);
+		$t = array('i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4 ";
+		$v = array($wms_position,($wms_position - 1),$guiList,$wmsList);
+		$t = array('i','i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+	}
+}
+
+if($down && $down == 'true'){
+	$max = 0;
+	if ($wmsList!=""){
+		$sql = "SELECT gui_wms_position ";
+		$sql .= "FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+		$v = array($guiList,$wmsList);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+			$wms_position = $row["gui_wms_position"];
+		}
+		$sql = "SELECT MAX(gui_wms_position) as max FROM gui_wms WHERE fkey_gui_id = $1 ";
+		$v = array($guiList);
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+			$max = $row["max"];
+		}
+	}
+	if($wms_position < $max){
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE fkey_gui_id = $2 AND fkey_wms_id = $3";
+		$v = array(($wms_position + 1),$guiList,$wmsList);
+		$t = array('i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+		$sql = "UPDATE gui_wms SET ";
+		$sql .= "gui_wms_position = $1";
+		$sql .= " WHERE gui_wms_position = $2 AND fkey_gui_id = $3 AND fkey_wms_id <> $4";
+		$v = array($wms_position,($wms_position + 1),$guiList,$wmsList);
+		$t = array('i','i','s','i');
+		$res = db_prep_query($sql,$v,$t);
+	}
+}
+
+/*handle Updates*/
+if(isset($update_content) && $update_content == "1"){
+   if(isset($this_gui_wms_epsg)){
+      $sql = "UPDATE gui_wms set gui_wms_epsg = $1, gui_wms_mapformat = $2, ";
+      $sql .= "gui_wms_featureinfoformat = $3, gui_wms_exceptionformat = $4, ";
+      $sql .= "gui_wms_visible = $5, gui_wms_opacity = $6, gui_wms_sldurl = $7 ";
+      $sql .= "WHERE fkey_gui_id = $8 AND fkey_wms_id = $9";
+		$v = array($this_gui_wms_epsg,$this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
+		$t = array('s','s','s','s','i','i','s','s','i');
+		$res = db_prep_query($sql,$v,$t);
+   }
+   else{
+		$sql = "UPDATE gui_wms set gui_wms_mapformat = $1, ";
+		$sql .= "gui_wms_featureinfoformat = $2, gui_wms_exceptionformat = $3, ";
+		$sql .= "gui_wms_visible = $4, gui_wms_opacity = $5, gui_wms_sldurl = $6 ";
+		$sql .= "WHERE fkey_gui_id = $7 AND fkey_wms_id = $8";
+		$v = array($this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui_wms_sldurl,$this_gui,$this_wms);
+		$t = array('s','s','s','i','i','s','s','i');
+		$res = db_prep_query($sql,$v,$t);
+   }
+
+   /**/
+
+   $cnt = 0;
+   while(list($key,$val) = each($_REQUEST)){
+		if(preg_match("/___/", $key)){
+			$myKey = explode("___", $key);
+			if($myKey[1]!="layer_parent" && $myKey[1]!='layer_id' ){
+				$sql = "UPDATE gui_layer SET ".$myKey[1]." = $1 WHERE fkey_gui_id = $2 AND fkey_layer_id = $3";
+				$v = array($val,$this_gui,preg_replace("/L_/","",$myKey[0]));
+				if($myKey[1]=='gui_layer_style'){
+					$t = array('s','s','i');
+				}
+				else{
+					$t = array('i','s','i');
+				}
+				if(!$res = db_prep_query($sql,$v,$t)){
+					echo "FEHLER in ZEILE 288";
+				}
+			}
+		}
+	}
+}
+
+echo "<form name='form1' action='" . $self ."' method='post'>";
+echo "<table cellpadding='3' cellspacing='3' border='0' class='table_top'>";
+
+echo "<tr>";
+echo "<td>";
+echo "GUI";
+echo "</td>";
+echo "<td>";
+echo "WMS-TITLE";
+echo "</td>";
+echo "<td>";
+echo "</td>";
+echo "<tr>";
+
+echo "<td>";
+
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$admin = new administration();
+$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
+
+$gui_id =array();
+if (count($ownguis)>0){
+	for($i=0; $i<count($ownguis); $i++){
+		$gui_id[$i]=$ownguis[$i];
+	}
+}
+
+echo"<select size='8' name='guiList' onchange='document.form1.wmsList.selectedIndex = -1;submit()'>";
+$selected_gui_id="";
+
+for ($i=0; $i<count($ownguis);$i++){
+   echo "<option value='".$gui_id[$i]."' ";
+   if($guiList && $guiList == $gui_id[$i]){
+      echo "selected";
+      $selected_gui_id=$gui_id[$i];
+   }
+   else{
+      if ($i==0){
+         echo "selected";
+         $selected_gui_id=$gui_id[$i];
+		}
+   }
+   echo ">".$gui_id[$i]."</option>";
+}
+
+echo "</select>";
+echo "</td>";
+echo "<td>";
+
+$sql = "SELECT * from gui_wms JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON ";
+$sql .= "gui_wms.fkey_wms_id = wms.wms_id AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_id = $1 ORDER BY gui_wms_position";
+$v = array($selected_gui_id);
+$t = array('s');
+$res = db_prep_query($sql,$v,$t);
+$count_wms = 0;
+echo "<select size='8' name='wmsList' style='width:200px' onchange='submit()'>";
+
+while($row = db_fetch_array($res)){
+	echo "<option value='".$row["wms_id"]."' ";
+	if(isset($wmsList) && $wmsList == $row["wms_id"]){
+		echo "selected";
+	}
+	echo ">".$row["gui_wms_position"]." - ".$row["wms_title"]."</option>";
+	$count_wms++;
+}
+echo "</select>";
+echo "</td><td>";
+echo "<input class='myButton' type='button' name='up_wms' value=' up ' onClick='validate(\"up_wms\")'>";
+echo "<input type='hidden' name='up' value=''><br><br>";
+
+echo "<input class='myButton' type='button' name='down_wms' value='down'  onClick='validate(\"down_wms\")'>";
+echo "<input type='hidden' name='down' value=''><br><br>";
+
+echo "<input class='myButton' type='button' name='delete_wms' value='remove'  onClick='validate(\"delete_wms\")'>";
+echo "<input type='hidden' name='del' value=''>";
+
+echo "</td>";
+echo "</tr>";
+echo "</table>";
+
+
+if(isset($wmsList)){
+#gui_wms
+$sql_gw = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+$v = array($guiList,$wmsList);
+$t = array('s','i');
+$res_gw = db_prep_query($sql_gw,$v,$t);
+$cnt_gw = 0;
+while($row = db_fetch_array($res_gw)){
+   $gui_wms_position[$cnt_gw] = $row["gui_wms_position"];
+   $gui_wms_mapformat[$cnt_gw] = $row["gui_wms_mapformat"];
+   $gui_wms_featureinfoformat[$cnt_gw] = $row["gui_wms_featureinfoformat"];
+   $gui_wms_exceptionformat[$cnt_gw] = $row["gui_wms_exceptionformat"];
+   $gui_wms_epsg[$cnt_gw] = $row["gui_wms_epsg"];
+   $gui_wms_visible[$cnt_gw] = $row["gui_wms_visible"];
+   $gui_wms_opacity[$cnt_gw] = $row["gui_wms_opacity"];
+   $gui_wms_sldurl[$cnt_gw] = $row["gui_wms_sldurl"]; # sld url
+   $cnt_gw++;
+}
+#wms
+$sql_w = "SELECT * FROM wms WHERE wms_id = $1";
+$v = array($wmsList);
+$t = array('i');
+$res_w = db_prep_query($sql_w,$v,$t);
+$cnt_w = 0;
+while($row = db_fetch_array($res_w)){
+   $wms_id[$cnt_w] = $row["wms_id"];
+   $wms_version[$cnt_w] = $row["wms_version"];
+   $wms_title[$cnt_w] = $row["wms_title"];
+   $wms_abstract[$cnt_w] = $row["wms_abstract"];
+   $wms_getcapabilities[$cnt_w] = $row["wms_getcapabilities"];
+   $wms_supportsld[$cnt_w] = $row["wms_supportsld"];  # Buttons zum sld support anzeigen?
+   $cnt_w++;
+ }
+#wms_format
+$sql_wf = "SELECT * FROM  wms_format WHERE  fkey_wms_id = $1";
+$v = array($wmsList);
+$t = array('i');
+$res_wf = db_prep_query($sql_wf,$v,$t);
+$cnt_wf = 0;
+while($row = db_fetch_array($res_wf)){
+   $data_type[$cnt_wf] = $row["data_type"];
+   $data_format[$cnt_wf] = $row["data_format"];
+   $cnt_wf++;
+ }
+#gui_layer
+$sql_gl = "SELECT l.*, gl.*, sld.sld_user_layer_id, sld.use_sld FROM layer AS l, gui_layer AS gl left outer join sld_user_layer AS sld on sld.fkey_layer_id = gl.fkey_layer_id WHERE l.layer_id = gl.fkey_layer_id AND gl.gui_layer_wms_id = $1 AND gl.fkey_gui_id = $2 AND (sld.fkey_gui_id = $3 or sld.fkey_gui_id is NULL) AND (sld.fkey_mb_user_id = $4 or sld.fkey_mb_user_id is NULL) ORDER BY l.layer_pos";
+$v = array($wmsList,$guiList,$guiList,$mb_user_id);
+$t = array('i','s','s','i');
+
+$res_gl = db_prep_query($sql_gl,$v,$t);
+$gui_layer_status = array();
+$gui_layer_selectable = array();
+$gui_layer_visible = array();
+$gui_layer_queryable = array();
+$gui_layer_querylayer = array();
+$gui_layer_minscale = array();
+$gui_layer_maxscale = array();
+$gui_layer_priority = array();
+$gui_layer_style = array();
+$gui_layer_wfs_featuretype = array();
+$layer_maxscale = array();
+$layer_id = array();
+$layer_parent = array();
+$layer_name = array();
+$layer_title = array();
+$layer_queryable = array();
+$layer_minscale = array();
+$layer_maxscale = array();
+$sld_user_layer_id = array();
+$use_sld = array();
+while($row = db_fetch_array($res_gl)){
+	array_push($gui_layer_status, $row["gui_layer_status"]);
+	array_push($gui_layer_selectable, $row["gui_layer_selectable"]);
+	array_push($gui_layer_visible, $row["gui_layer_visible"]);
+	array_push($gui_layer_queryable, $row["gui_layer_queryable"]);
+	array_push($gui_layer_querylayer, $row["gui_layer_querylayer"]);
+	array_push($gui_layer_minscale, $row["gui_layer_minscale"]);
+	array_push($gui_layer_maxscale, $row["gui_layer_maxscale"]);
+	array_push($gui_layer_priority, $row["gui_layer_priority"]);
+	array_push($gui_layer_style, $row["gui_layer_style"]);
+	array_push($gui_layer_wfs_featuretype, $row["gui_layer_wfs_featuretype"]);
+	array_push($layer_id, $row["layer_id"]);
+	array_push($layer_parent, $row["layer_parent"]);
+	array_push($layer_name, $row["layer_name"]);
+	array_push($layer_title, $row["layer_title"]);
+	array_push($layer_queryable, $row["layer_queryable"]);
+	array_push($layer_minscale, $row["layer_minscale"]);
+	array_push($layer_maxscale, $row["layer_maxscale"]);
+	array_push($sld_user_layer_id, $row["sld_user_layer_id"]);
+	array_push($use_sld, $row["use_sld"]);
+}
+
+#layer_epsg
+$sql_le = "SELECT * FROM layer_epsg WHERE  fkey_layer_id = $1";
+$v = array($layer_id[0]);
+$t = array('i');
+$res_le = db_prep_query($sql_le,$v,$t);
+$cnt_le = 0;
+while($row = db_fetch_array($res_le)){
+   $epsg[$cnt_le] = $row["epsg"];
+   $cnt_le++;
+}
+
+echo "<div style='position:absolute;left:590px; top:180px;' ><input type='button' style='width:100px;height:100px;background-color:#0066cc' value='save' onclick='checkBoxValue()'></div>";
+echo "<table class='table_top'>";
+echo "<tr>";
+echo "<td colspan='2'>";
+echo "<a href='".$wms_getcapabilities[0];
+echo wms::getConjunctionCharacter($wms_getcapabilities[0]);
+if ($wms_version[0] == "1.0.0") { 
+	echo "WMTVER=". $wms_version[0]."&REQUEST=capabilities";
+}
+else {
+	echo "VERSION=". $wms_version[0]."&REQUEST=GetCapabilities&SERVICE=WMS";
+}
+echo "' style='font-size:14px' target='_blank'>LINK: Capabilities</a>";
+echo "</td>";
+echo "<td align = right>WMS ID: " . $wms_id[0] . "</td>";
+echo "<tr>";
+#epsg
+if($gui_wms_position[0] == 0){
+  echo "<tr>";
+     echo "<td>EPSG: </td><td>";
+     echo "<select class='mySelect'  name='this_gui_wms_epsg'>";
+        for($i=0; $i<count($epsg); $i++){
+           echo "<option value='".$epsg[$i]."' ";
+           if($epsg[$i] == $gui_wms_epsg[0]){ echo "selected";}
+           echo ">".$epsg[$i]."</option>";
+        }
+     echo "</select>";
+     echo "</td>";
+  echo "</tr>";
+}
+#format
+echo "<tr>";
+   echo "<td>Mapformat: </td><td>";
+        echo "<select class='mySelect'  name='this_gui_wms_mapformat'>";
+        for($i=0; $i<count($data_format); $i++){
+           if($data_type[$i] == 'map'){
+              echo "<option value='".$data_format[$i]."' ";
+              if($data_format[$i] == $gui_wms_mapformat[0]){ echo "selected";}
+              echo ">".$data_format[$i]."</option>";
+           }
+        }
+     echo "</select>";
+   echo "</td>";
+
+echo "</tr>";
+
+echo "<tr>";
+   echo "<td>Infoformat: </td><td>";
+        echo "<select class='mySelect'  name='this_gui_wms_featureinfoformat'>";
+        echo "<option value='text/html'>text/html</option>";
+        for($i=0; $i<count($data_format); $i++){
+           if($data_type[$i] == 'featureinfo'){
+              echo "<option value='".$data_format[$i]."' ";
+              if($data_format[$i] == $gui_wms_featureinfoformat[0]){ echo "selected";}
+              echo ">".$data_format[$i]."</option>";
+           }
+        }
+     echo "</select>";
+   echo "</td>";
+echo "</tr>";
+
+echo "<tr>";
+   echo "<td>Exceptionformat: </td><td>";
+        echo "<select class='mySelect' name='this_gui_wms_exceptionformat'>";
+        for($i=0; $i<count($data_format); $i++){
+           if($data_type[$i] == 'exception'){
+              echo "<option value='".$data_format[$i]."' ";
+              if($data_format[$i] == $gui_wms_exceptionformat[0]){ echo "selected";}
+              echo ">".$data_format[$i]."</option>";
+           }
+        }
+     echo "</select>";
+   echo "</td>";
+echo "</tr><br>";
+
+# visibility
+echo "<tr>";
+	echo "<td>Visibility: </td><td>";
+	echo "<select class='mySelect' name='this_gui_wms_visible'>";
+	for($i=0; $i<3; $i++){
+		echo "<option value='".$i."' ";
+		if($i == $gui_wms_visible[0]){ echo "selected";}
+		echo ">";
+		if($i == '0'){
+			echo "hidden";
+		}
+		if($i == '1'){
+			echo "visible";
+		}
+		echo "</option>";
+	}
+	echo "</select>";
+	echo "</td>";
+echo "</tr>";
+
+# opacity
+echo "<tr>";
+	echo "<td>Opacity: </td><td>";
+	echo "<select class='mySelect' name='this_gui_wms_opacity'>";
+	for($i=0; $i<=100; $i+=10){
+		echo "<option value='".$i."' ";
+		if($i - $gui_wms_opacity[0]<=5&&$i - $gui_wms_opacity[0]>=-4){ echo "selected";}
+		echo ">";
+		echo $i."%";
+		echo "</option>";
+	}
+	echo "</select>";
+	echo "</td>";
+echo "</tr>";
+
+# sld support
+if($wms_supportsld[0]) {
+		echo "<tr>";
+		echo "<td>SLD-URL: </td><td>";
+		echo "<input type='text' class='myText' name='this_gui_wms_sldurl' id='this_gui_wms_sldurl' title='".$gui_wms_sldurl[0]."' value='".$gui_wms_sldurl[0]."'>";
+		#echo "<a href='' onclick='return window.open(\"editor-start.php\");'><img src='sld_editor.png' border=0></a>";
+		#$layer_names = implode(",", $layer_name);
+        echo " <a href='javascript:showSld(\"".$gui_wms_sldurl[0]."\");'>SLD laden/anzeigen</a>";
+		echo "</td>";
+	echo "</tr>";
+} else {
+	echo "<input type='hidden' value='' name='this_gui_wms_sldurl'>";
+}
+
+echo "</table><br>";
+
+echo "<table border='1' cellpadding='1'>";
+		echo "<tr>";
+
+                echo "<td>Nr.</td>";
+                echo "<td>ID</td>";
+                echo "<td>" . toImage('Parent') . "</td>";
+                echo "<td>Name</td>";
+                echo "<td>Title</td>";
+                echo "<td>" . toImage('on/off') . "</td>";
+                echo "<td>" . toImage('sel') . "</td>";
+                echo "<td>" . toImage('sel_default') . "</td>";
+                echo "<td>" . toImage('info') . "</td>";
+                echo "<td>" . toImage('info_default') . "</td>";
+                echo "<td>" . toImage('minScale 1:') . "</td>";
+                echo "<td>" . toImage('maxScale 1:') . "</td>";
+                echo "<td>" . toImage('Style') . "</td>";
+                echo "<td>" . toImage('Prio') . "</td>";
+                echo "<td>" . toImage('setWFS') . "</td>";
+                if($wms_supportsld[0]) {echo "<td>" . toImage('SLD') . "</td>";}
+        echo "</tr>";
+
+#echo "<tr><td>Nr.</td><td>ID</td><td>Parent</td><td>Name</td><td>Title</td><td>on/off</td><td>sel</td><td>sel_default</td><td>info</td><td>info_default</td><td>minScale 1:</td><td>maxScale 1:</td><td>Prio</td><td>setWFS</td></tr>";
+echo "<tr><td></td><td></td><td></td><td></td><td></td><td>";
+echo "<input type='button' class='LButton' value='Sublayer\noff' onclick='setSubs()'>";
+echo "</td><td></td><td>";
+echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"visible\",false)'>&nbsp;";
+echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"visible\",true)'></nobr>";
+echo"</td><td></td><td>";
+echo "<nobr><input type='button' class='button_on_off' value='off' onclick='setLayer(\"querylayer\",false)'>&nbsp;";
+echo "<input type='button' class='button_on_off' value='on' onclick='setLayer(\"querylayer\",true)'></nobr>";
+echo "</td><td></td><td></td><td></td></tr>";
+
+for($i=0; $i<count($layer_id); $i++){
+#layer_styles
+$sql_styles = "SELECT * FROM layer_style WHERE  fkey_layer_id = $1";
+$v = array($layer_id[$i]);
+$t = array('i');
+$res_styles = db_prep_query($sql_styles,$v,$t);
+$cnt_styles= 0;
+$style = array();
+while($row = db_fetch_array($res_styles)){
+   $style[$cnt_styles] = $row["name"];
+   $cnt_styles++;
+}
+
+ echo "<tr align='center'>";
+  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_nr' disabled value='".$i."'></td>";
+  echo "<td style='background:lightgrey'><input type='text' size='2' name='L_".$layer_id[$i]."___layer_id' value='".$layer_id[$i]."' readonly></td>";
+  echo "<td><input type='text' size='1' name='L_".$layer_id[$i]."___layer_parent' value='".$layer_parent[$i]."' readonly></td>";
+  echo "<td style='background:lightgrey'><input type='text' size='7' value='".$layer_name[$i]."' readonly></td>";
+  echo "<td><input type='text' name='".$layer_title[$i]."' size='12' value='".$layer_title[$i]."' ></td>";
+
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_status' type='checkbox' ";
+  if($gui_layer_status[$i] == 1){ echo "checked";}
+  echo "></td>";
+
+  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_selectable' type='checkbox' ";
+  if($gui_layer_selectable[$i] == 1){ echo "checked";}
+  echo "></td>";
+
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_visible' type='checkbox' ";
+  if($gui_layer_visible[$i] == 1){ echo "checked";}
+  echo "></td>";
+
+  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_queryable' type='checkbox' ";
+  if($gui_layer_queryable[$i] == 1){ echo "checked";}
+  if($layer_queryable[$i] == 0){ echo "disabled";}
+  echo "></td>";
+
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_querylayer' type='checkbox' ";
+  if($gui_layer_querylayer[$i] == 1){ echo "checked";}
+  if($layer_queryable[$i] == 0){ echo "disabled";}
+  echo "></td>";
+
+  echo "<td><input name='L_".$layer_id[$i]."___gui_layer_minscale' type='text' size='5' value='".$gui_layer_minscale[$i]."'></td>";
+  echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_maxscale' type='text' size='5' value='".$gui_layer_maxscale[$i]."'></td>";
+  /**/
+  echo "<td>\n";
+  echo "<select class='select_short' name='L_".$layer_id[$i]."___gui_layer_style'>\n";
+  	   echo "<option value=''";
+  	   if(count($style) ==0){ echo "selected";}
+  	   echo ">---</option>\n";
+  for($j=0;$j<count($style); $j++){
+       echo "<option value='".$style[$j]."'";
+       if($style[$j] == $gui_layer_style[$i]){ echo "selected";}
+       echo ">".$style[$j]."</option>\n";
+ }
+  echo "</select></td>\n";
+  /**/
+  echo "<td><select class='select_auto' name='L_".$layer_id[$i]."___gui_layer_priority'>";
+  for($j=0; $j<count($gui_layer_priority); $j++){
+     echo "<option value='".$j."'";
+     if($j == $gui_layer_priority[$i]){echo "selected";}
+     echo ">".$j;
+     echo "</option>";
+  }
+  echo "</select></td>\n";
+  /* wfs configuration */
+	echo "<td>";
+	if ($i > 0) {
+		echo "<input class='button_wfs'name='gui_layer_gaz' type='button' onclick='edit_gaz(\"".$guiList."\",".$wmsList.",".$layer_id[$i].")' value='";
+		if($gui_layer_wfs_featuretype[$i] == ""){
+			echo "setWFS";
+		}
+		else{
+			echo "wfs ".$gui_layer_wfs_featuretype[$i];
+		}
+		echo "'>";
+	}
+	echo "</td>";
+	if($wms_supportsld[0]) {
+		echo "<td>";
+		if ($i > 0) {
+			echo "<input class='button3' name='gui_layer_sld' type='button' onclick='window.open(\"../sld/sld_main.php?".$urlParameters."&sld_gui_id=".$guiList."&sld_wms_id=".$wms_id[0]."&sld_layer_name=".$layer_name[$i]."\");' value='";
+			if ($sld_user_layer_id[$i] != "")
+				echo "sld:".$sld_user_layer_id[$i]."(".$use_sld[$i].")";
+			else
+				echo "SLD";
+			echo "'>";
+		}
+		echo "</td>";
+	}
+ echo "</tr>\n";
+ if($i == 0){ echo "<tr><td colspan='16'><hr></td></tr>";}
+}
+echo "</table>\n";
+echo "<input type='hidden' name='this_gui' value='".$guiList."'>\n";
+echo "<input type='hidden' name='this_wms' value='".$wmsList."'>\n";
+echo "<input type='hidden' name='this_layer_count' value='".$cnt_l."'>\n";
+echo "<input type='hidden' name='update_content' value=''>\n";
+echo "</form>\n";
+}
+?>
+</body>
+</html>

Modified: branches/print_dev/http/php/mod_editWMS_Metadata.php
===================================================================
--- branches/print_dev/http/php/mod_editWMS_Metadata.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_editWMS_Metadata.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,497 +1,497 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php?title=Edit_WMS_Metadata
-# 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.
-
-require_once(dirname(__FILE__)."/mb_validatePermission.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-
-include_once '../include/dyn_css.php';
-
-$adm = new administration();
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>Edit WMS Metadata</title>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">   
-<script language="JavaScript">
-var dTarget;
-function save() {
-   document.forms[0].update_content.value=1;
-   document.forms[0].submit();
-}
-
-function deletepreview(layer_id) {
-	var url = String(document.location);
-	url = url.substr(0, url.indexOf('?'));
-	window.open(url+"?<?php echo $urlParameters; ?>&delete_preview=1&layer_id="+layer_id,'delete preview', 'height=50, width=150, dependent=yes');
-	document.getElementById(layer_id+"_dp").style.display="none";
-}
-
-function pick_the_date(obj) {
-    dTarget = obj;
-	var datePickerParameters = "m=Jan_Feb_Mrz_Apr_Mai_Jun_Jul_Aug_Sep_Okt_Nov_Dez&d=Mo_Di_Mi_Do_Fr_Sa_So&t=heute";
-	var datePickerStyle = "left=200,top=200,width=230,height=210,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0"
-    var dp = window.open('../extensions/datepicker/datepicker.php?' + datePickerParameters,'dp',datePickerStyle);
-    dp.focus();
-    return false;
-}
-</script>
-</head>
-<body>
-<?php
-
-function guessTimestamp($timestr) {
-	
-     if (mb_strpos($timestr, '.')) {
-        list($day, $month, $year) = explode(".", $timestr);
-     }
-     elseif (mb_strpos($timestr, '/')) {
-        list($month, $day, $year) = explode("/", $timestr);
-     }
-     elseif (mb_strpos($timestr, '-')) {
-        list($year, $month, $day) = explode("-", $timestr);
-     }
-     else {
-     	$year = 0;
-        $month = 0;
-        $day = 0;
-     }
-     return mktime(0, 0, 0, $month, $day, intval($year));
-}
-
-#Update handling
-
-if (isset($_REQUEST['update_content']) && $_REQUEST['update_content'] == true) {
-	
-	$update_wms_sql = "UPDATE wms SET "; 
-	$update_wms_sql .= "wms_title = $1, wms_abstract = $2, fees = $3, ";
-	$update_wms_sql .= "accessconstraints = $4, contactperson = $5, ";
-	$update_wms_sql .= "contactposition = $6, contactorganization = $7, ";
-	$update_wms_sql .= "address = $8, city = $9, stateorprovince = $10, ";
-	$update_wms_sql .= "postcode = $11, country = $12, ";
-	$update_wms_sql .= "contactvoicetelephone = $13, ";
-	$update_wms_sql .= "contactfacsimiletelephone = $14, ";
-	$update_wms_sql .= "contactelectronicmailaddress = $15 ";
-
-	$v = array();
-	array_push($v, $_REQUEST['wms_title_box']);
-	array_push($v, $_REQUEST['wms_abstract_box']);
-	array_push($v, $_REQUEST['fees_box']);
-	array_push($v, $_REQUEST['accessconstraints_box']);
-	array_push($v, $_REQUEST['contactperson_box']);
-	array_push($v, $_REQUEST['contactposition_box']);
-	array_push($v, $_REQUEST['contactorganization_box']);
-	array_push($v, $_REQUEST['address_box']);
-	array_push($v, $_REQUEST['city_box']);
-	array_push($v, $_REQUEST['stateorprovince_box']);
-	array_push($v, $_REQUEST['postcode_box']);
-	array_push($v, $_REQUEST['country_box']);
-	array_push($v, $_REQUEST['contactvoicetelephone_box']);
-	array_push($v, $_REQUEST['contactfacsimiletelephone_box']);
-	array_push($v, $_REQUEST['contactelectronicmailaddress_box']);
-	$t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s");
-
-	if (isset($_REQUEST['wms_timestamp_box']) && $_REQUEST['wms_timestamp_box'] <> "") {
-        $update_wms_sql .= ", wms_timestamp = $16 ";
-		array_push($v, guessTimestamp($_REQUEST['wms_timestamp_box']));
-		array_push($t, "s");
-
-		$update_wms_sql .= "WHERE wms_id = $17";
-	}
-	else {
-		$update_wms_sql .= "WHERE wms_id = $16";
-	}
-	array_push($v, 	$_REQUEST['wms_id']);
-	array_push($t, "s");
-
-    $res_update_wms_sql = db_prep_query($update_wms_sql, $v, $t);
-
-    while(list($key,$val) = each($_REQUEST)) {
-        if(preg_match("/___/", $key)) {
-            $myKey = explode("___", $key);
-            $layer_id = preg_replace("/L_/","",$myKey[0]);
-            if($myKey[1]=="layer_abstract") {
-				$layer_sql = "UPDATE layer SET layer_abstract = $1 ";
-				$layer_sql .= "WHERE layer_id = $2 AND fkey_wms_id = $3";  
-                $v = array($val, $layer_id, $_REQUEST['wms_id']);
-                $t = array("s", "i", "s");
-                $res_keyword_sql = db_prep_query($layer_sql, $v, $t);
-            }
-            if($myKey[1]=="layer_keywords") {
-                #Get all keywords depending on the given layer after user modification
-                $keywords  = explode(",",$val);
-                #delete all blanks from the keywords list
-                for ($j = 0; $j < count($keywords); $j++) {
-                    $word = $keywords[$j];
-                    $word = trim($word);
-                    $keywords[$j] = $word;
-                }
-                #echo "1: Keywords eines Layers: id des Layers: ", $layer_id, ", �bergebener String: ", $val, ";<br>";
-                #Get all keywords depending on this layer from database
-                $keyword_sql = "SELECT keyword_id, keyword FROM keyword, layer_keyword, layer " .
-                               "WHERE keyword.keyword_id = layer_keyword.fkey_keyword_id " .
-                               "AND layer_keyword.fkey_layer_id = layer.layer_id " .
-                               "AND layer.fkey_wms_id = $1 " .
-                               "AND layer.layer_id = $2";
-                
-                $v = array($_REQUEST['wms_id'], $layer_id); 
-                $t = array("s", "i");
-                $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
-                while($keyword_row = db_fetch_array($res_keyword_sql))
-                {
-                    $keyword = $keyword_row['keyword'];
-                    $keyword_id = $keyword_row['keyword_id'];
-                    #keyword has been deleted or has been modified
-                    #keyword exists in database but not in user data
-                    $index = -1;
-                    #echo "1a: Abfrage ob DB Keywords in User Liste: Keyword: ", $keyword, ";<br>";
-                    if(in_array($keyword, $keywords) == false)
-                    {
-                        #echo "1c: Keyword nicht in User Liste: Keyword: ", $keyword, ";<br>";
-                        #Deleting reference to the keyword from the layer_keyword table.
-                        $keyword_sql = "DELETE FROM layer_keyword " .
-                                       "WHERE fkey_layer_id = $1 " .
-                                       "AND fkey_keyword_id = $2";
-                        $v = array($layer_id, $keyword_id);
-                        $t = array("i", "i");
-                        db_prep_query($keyword_sql, $v, $t);
-                        #Checking, if the keyword is in use by any layer
-                        $layer_sql = "SELECT * FROM layer_keyword " .
-                                       "WHERE fkey_keyword_id = $1";
-                        $v = array($keyword_id);
-                        $t = array("i");
-                        $res_layer_sql = db_prep_query($layer_sql, $v, $t);
-                        if(!($row = db_fetch_array($res_layer_sql)))
-                        {
-                            #If keyword will not longer be in use, delete it from keyword table
-                            $keyword_sql = "DELETE FROM keyword " .
-                                           "WHERE keyword_id = $1";
-                            $v = array($keyword_id);
-                            $t = array("i");
-                            db_prep_query($keyword_sql, $v, $t);
-                        }
-                    }
-                    #Keyword exists in the database and in the user data
-                    else
-                    {
-                        #echo "1d: Keyword ist in User Liste: Keyword: ", $keyword, ";<br>";
-                        for($i = 0; $i < count($keywords); $i++)
-                        {
-                            #Delete keyword from the user data list, because the data
-                            #have not to be updated within the database
-                            if($keywords[$i] == $keyword)
-                            {
-                                $keywords[$i] = null;
-                            }
-                        }
-                    }
-                }
-                #Inserting keyword, that are not existing in the database
-                for($i = 0; $i < count($keywords); $i++)
-                {
-                    #echo "2: Alle Eintr�ge des Keyword arrays: Keyword: ", $keywords[$i], "; Index: ", $i, ";<br>";
-                    if($keywords[$i] != null)
-                    {
-                        #echo "3: Eintr�ge ungleich null: Keyword: ", $keywords[$i], "; Index: ", $i, ";<nr>";
-                        $keyword = trim($keywords[$i]);
-                        #Check, if the keyword is exsiting in the database
-                        $keyword_sql = "SELECT keyword_id FROM keyword " .
-                                       "WHERE UPPER(keyword) = UPPER($1)";
-                        $v = array($keyword);
-                        $t = array("s");
-                        $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
-                        $keyword_row = db_fetch_array($res_keyword_sql);
-                        #Keyword exists in the database
-                        if($keyword_row != null)
-                        {
-                            $keyword_id = $keyword_row[0];
-                            #echo "4: Keyword in Datenbank vorhanden: id des Keywords: ", $keyword_id, ";<br>";
-                        }
-                        #Keyword does not exist in the database
-                        else
-                        {
-                            $keyword_sql = "INSERT INTO keyword (keyword) VALUES ($1)";
-                            $v = array($keyword);
-                            $t = array("s");
-                            $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
-                            
-                            $keyword_sql = "SELECT keyword_id FROM keyword WHERE keyword = $1";
-                            $v = array($keyword);
-                            $t = array("s");
-                            $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
-                            $keyword_row = db_fetch_array($res_keyword_sql);
-                            if($keyword_row != null)
-                            {
-                                $keyword_id = $keyword_row[0];
-                                #echo "4: Keyword in der Datenbank nicht vorhanden: id des Keywords: ", $keyword_id, ";<br>";
-                            }
-                        }
-                        #Inserting the reference between layer and keyword in the layer_keyword table
-                        $keyword_sql = "INSERT INTO layer_keyword (fkey_layer_id, fkey_keyword_id) " .
-                                       "VALUES ($1, $2)";
-                        $v = array($layer_id, $keyword_id);
-                        $t = array("s", "s");
-                        $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
-                    }
-                }
-                #Delete all elements from array
-                unset($keywords);
-            }
-        }
-    }
-}
-unset($update_content);
-
-#delete preview
-
-if(isset($_REQUEST['delete_preview']) && $_REQUEST['delete_preview']=='1'
-	&& isset($_REQUEST['layer_id']))
-{
-    $preview_sql = "DELETE FROM layer_preview WHERE fkey_layer_id = $1";
-    $v = array($_REQUEST['layer_id']);
-    $t = array("s");
-    $res_preview_sql = db_prep_query($preview_sql, $v, $t);
-    die("Preview has been deleted!</body></html>");
-}
-?>
-<form name='form1' action='<?php echo $self . "&show_wms_list=true"; ?>' method='post'>
-
-<table border='0'>
-<tr>
-<td WIDTH="300" align="left">
-<B>WMS Metadaten<B/>
-<td/>
-<td WIDTH="160">
-<td/>
-</tr>
-
-<?php  
-
-#Use select box to select a wms
-
-if (isset($_REQUEST['show_wms_list']) && $_REQUEST['show_wms_list'] == true)
-{
-
-    #Querying information from wms data table 
-    $wms_sql = "SELECT wms_id, wms_title FROM wms WHERE wms_owner = $1 ORDER BY wms_title";
-    $v = array($_SESSION["mb_user_id"]);
-    $t = array("i");
-    $res_wms_sql = db_prep_query($wms_sql, $v, $t);
-    #wms-selection
-
-    $selectBox = "";
-    while($row = db_fetch_array($res_wms_sql)) {
-        if ($adm->getWmsPermission($row["wms_id"], $_SESSION['mb_user_id'])) {
-	        $selectBox .= "<option value='".$row["wms_id"]."' ";
-	        if(isset($_REQUEST['wmsList']) && $_REQUEST['wmsList'] == $row["wms_id"]) {
-	            $selectBox .= "selected";
-	        }
-	        $selectBox .= "> ".$row["wms_title"]."</option>";
-        }
-    }
-    
-    if ($selectBox != "") {
-	    echo "<tr><td>";
-	    echo "<select size=6 name='wmsList' onchange='submit()'>".$selectBox."</select>";
-	    echo "</td><td width='160px' align='right'>";
-	    echo "<input type='button' class='sbutton' value='save' onclick='save()'>";
-		echo "</td></tr>";
-    }
-    else {
-    	echo "<div>no wms owner.</div>";
-    	die;
-    }
-
-    if(isset($_REQUEST['wmsList']) == true && $_REQUEST['wmsList'] <>0)
-    editWMSByWMSID ($_REQUEST['wmsList']);
-}
-
-echo "</table>";
-
-//$wms_id;
-function editWMSByWMSID($param_wms_id)
-{
-    global $wms_id;
-    $wms_id = $param_wms_id;
-
-}
-
-
-if(isset($wms_id) == true && $wms_id <>0)
-{ 
-	$selected_wms_sql = "SELECT * FROM wms WHERE wms_id = $1";
-	$v = array($wms_id);
-	$t = array("s");
-    $res_selected_wms_sql = db_prep_query($selected_wms_sql, $v, $t);
-    $selected_row = db_fetch_array($res_selected_wms_sql);
-
-?>
-    
-    <table border='0' class='table_top' >
-    <tr>
-    <td>WMS-Titel:<td><td/>
-    <input type='text' name='wms_title_box' value='<?php echo $selected_row["wms_title"];?>' /><td/>
-
-    <td>WMS- Abstract:<td><td/>
-    <input type='text' name='wms_abstract_box' value='<?php echo $selected_row["wms_abstract"];?>' /><td/>
-
-    <td >Fees:<td><td/>
-    <input type='text' name='fees_box' value='<?php echo $selected_row["fees"]?>'/><td/>
-    <tr/>
-       
-    <tr>
-    <td>Access Constraints:<td><td/>
-    <input type='text' name='accessconstraints_box' value='<?php echo $selected_row["accessconstraints"]?>'/><td/>
-
-    <td>Contact Person:<td><td/>
-    <input type='text' name='contactperson_box' value='<?php echo $selected_row["contactperson"]?>'/><td/>
-
-    <td>Contact Position:<td><td/>
-    <input type='text' name='contactposition_box' value='<?php echo $selected_row["contactposition"]?>'/><td/>
-    <tr/>
-    
-    <tr>
-    <td>Contact Organization:<td><td/>
-    <input type='text' name='contactorganization_box' value='<?php echo $selected_row["contactorganization"]?>'/><td/>
- 
-    <td>Address:<td><td/>
-    <input type='text' name='address_box' value='<?php echo $selected_row["address"]?>'/><td/>
-
-    <td style="width:">City:<td><td/>
-    <input type='text' name='city_box' value='<?php echo $selected_row["city"]?>'/><td/>
-    <tr/>
-    
-    <tr>
-    <td>State or Province:<td><td/>
-    <input type='text' name='stateorprovince_box' value='<?php echo $selected_row["stateorprovince"]?>'/><td/>
-
-    <td>Postcode:<td><td/>
-    <input type='text' name='postcode_box' value='<?php echo $selected_row["postcode"]?>'/><td/>
-    
-    <td>Country:<td><td/>
-    <input type='text' name='country_box' value='<?php echo $selected_row["country"]?>'/><td/>
-    <tr/>
-    
-    <tr>
-    <td>Telephone:<td><td/>
-    <input type='text' name='contactvoicetelephone_box' 
-        value='<?php echo $selected_row["contactvoicetelephone"]?>'/><td/>
-    
-    <td>Fax:<td><td/>
-    <input type='text' name='contactfacsimiletelephone_box' value='<?php echo $selected_row["contactfacsimiletelephone"]?>'/><td/>
-    
-    <td>E-Mail:<td><td/>
-    <input type='text' name='contactelectronicmailaddress_box' value='<?php echo $selected_row["contactelectronicmailaddress"]?>'/><td/>
-    <tr/>
-    <tr>
-    <?php
-  if (isset($selected_row["wms_timestamp"]) && $selected_row["wms_timestamp"] <> "") {
-    $datum = date("d.m.Y",$selected_row["wms_timestamp"]);
-  }
-  else $datum = ""
-?>
-    <td>Date:<td><td/>
-    <input type='text' name='wms_timestamp_box' value='<?php echo $datum?>' onClick='pick_the_date(document.form1.wms_timestamp_box)'/><td/>
-    <tr/>
-    
-    <table class="table_layer">
-    <tr><td>Nr.</td><td>Title</td><td>Abstract</td><td>Keywords</td><td></td></tr>
-
-    
-<?php
-   
-    $layer_sql = "SELECT * FROM layer WHERE layer.fkey_wms_id = $1" .
-                 " ORDER BY layer_pos";
-    $v = array($wms_id);
-    $t = array("s");
-    $res_layer_sql = db_prep_query($layer_sql, $v, $t);
-    
-    while($layer_row = db_fetch_array($res_layer_sql))
-    {
-    ?>
-        <tr align='center'>
-        <td><input type='text' size='1' name='L_<?php echo $layer_row['layer_id']?>___layer_nr' 
-            value='<?php echo $layer_row['layer_pos']?>' readonly></td>
-        <td><input type='text' size='15' name='L_<?php echo $layer_row['layer_id']?>___layer_title' 
-            value='<?php echo $layer_row['layer_title']?>' readonly></td>
-        <td><input type='text' size='42' name='L_<?php echo $layer_row['layer_id']?>___layer_abstract'
-            value='<?php echo $layer_row['layer_abstract']?>'>
-
-    <?php
-        $keyword_sql = "SELECT keyword FROM keyword, layer_keyword, layer " .
-                       "WHERE keyword.keyword_id = layer_keyword.fkey_keyword_id " .
-                       "AND layer_keyword.fkey_layer_id = layer.layer_id " .
-                       "AND layer.fkey_wms_id = $1 " .
-                       "AND layer.layer_id = $2";
-        $v = array($wms_id, $layer_row['layer_id']);
-        $t = array("s", "i");
-        $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
-        $keywordList = "";
-        $seperator = "";
-        while($keyword_row = db_fetch_array($res_keyword_sql))
-        {
-            if($keywordList != "")
-            {    
-                $seperator = ",";
-            }
-            $keywordList .= $seperator.$keyword_row["keyword"];
-        }
-        ?>
-        <td><input type='text' size='42' name='L_<?php echo $layer_row['layer_id']?>___layer_keywords' 
-             value='<?php echo $keywordList?>'>        
-        </td>
-        <td>
-        <!--
-        <input type="button" value='preview' onclick="window.open('../frames/index.php?&gui_id=layer_preview&layer_preview=1&portal_services=<?php echo $layer_row['layer_id'];?>', 'mini_mapbender', 'height=370, width=370, dependent=yes');">
-        -->
-        </td>
-        <td>
-<?php 
-/*
-    $preview_sql = "SELECT * FROM layer_preview " .
-                   "WHERE fkey_layer_id = ".$layer_row['layer_id']."";
-    $res_preview_sql = db_query($preview_sql);
-	if(db_numrows($res_preview_sql)>0){?>
-        <!--
-        <input id="<?php echo $layer_row['layer_id'];?>_dp" type="button" value='delete preview' onclick="deletepreview('<?php echo $layer_row['layer_id'];?>');">
-        -->
-<?php }else{?>
-		<!--
-        <input id="<?php echo $layer_row['layer_id'];?>_dp" type="button" value='delete preview' style="display:none;" onclick="deletepreview('<?php echo $layer_row['layer_id'];?>');">
-        -->
-<?php }*/?>
-        </td>
-        </tr>
-    <?php
-    }
-    #editWMSByWMSID(961);
-    ?>
-    </table>
-    <input type='hidden' name='update_content' value=''/>
-    <input type='hidden' name='wms_id' value='<?php echo $wms_id ?>'/>
-	<!--
-    <input type="hidden" value='' name='delete_preview'>
-    -->
-    <input type="hidden" value='' name='layer_id'>
-    </form>
-    </body>
-    </html>
-<?php
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php?title=Edit_WMS_Metadata
+# 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.
+
+require_once(dirname(__FILE__)."/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+include_once '../include/dyn_css.php';
+
+$adm = new administration();
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Edit WMS Metadata</title>
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">   
+<script language="JavaScript">
+var dTarget;
+function save() {
+   document.forms[0].update_content.value=1;
+   document.forms[0].submit();
+}
+
+function deletepreview(layer_id) {
+	var url = String(document.location);
+	url = url.substr(0, url.indexOf('?'));
+	window.open(url+"?<?php echo $urlParameters; ?>&delete_preview=1&layer_id="+layer_id,'delete preview', 'height=50, width=150, dependent=yes');
+	document.getElementById(layer_id+"_dp").style.display="none";
+}
+
+function pick_the_date(obj) {
+    dTarget = obj;
+	var datePickerParameters = "m=Jan_Feb_Mrz_Apr_Mai_Jun_Jul_Aug_Sep_Okt_Nov_Dez&d=Mo_Di_Mi_Do_Fr_Sa_So&t=heute";
+	var datePickerStyle = "left=200,top=200,width=230,height=210,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0"
+    var dp = window.open('../extensions/datepicker/datepicker.php?' + datePickerParameters,'dp',datePickerStyle);
+    dp.focus();
+    return false;
+}
+</script>
+</head>
+<body>
+<?php
+
+function guessTimestamp($timestr) {
+	
+     if (mb_strpos($timestr, '.')) {
+        list($day, $month, $year) = explode(".", $timestr);
+     }
+     elseif (mb_strpos($timestr, '/')) {
+        list($month, $day, $year) = explode("/", $timestr);
+     }
+     elseif (mb_strpos($timestr, '-')) {
+        list($year, $month, $day) = explode("-", $timestr);
+     }
+     else {
+     	$year = 0;
+        $month = 0;
+        $day = 0;
+     }
+     return mktime(0, 0, 0, $month, $day, intval($year));
+}
+
+#Update handling
+
+if (isset($_REQUEST['update_content']) && $_REQUEST['update_content'] == true) {
+	
+	$update_wms_sql = "UPDATE wms SET "; 
+	$update_wms_sql .= "wms_title = $1, wms_abstract = $2, fees = $3, ";
+	$update_wms_sql .= "accessconstraints = $4, contactperson = $5, ";
+	$update_wms_sql .= "contactposition = $6, contactorganization = $7, ";
+	$update_wms_sql .= "address = $8, city = $9, stateorprovince = $10, ";
+	$update_wms_sql .= "postcode = $11, country = $12, ";
+	$update_wms_sql .= "contactvoicetelephone = $13, ";
+	$update_wms_sql .= "contactfacsimiletelephone = $14, ";
+	$update_wms_sql .= "contactelectronicmailaddress = $15 ";
+
+	$v = array();
+	array_push($v, $_REQUEST['wms_title_box']);
+	array_push($v, $_REQUEST['wms_abstract_box']);
+	array_push($v, $_REQUEST['fees_box']);
+	array_push($v, $_REQUEST['accessconstraints_box']);
+	array_push($v, $_REQUEST['contactperson_box']);
+	array_push($v, $_REQUEST['contactposition_box']);
+	array_push($v, $_REQUEST['contactorganization_box']);
+	array_push($v, $_REQUEST['address_box']);
+	array_push($v, $_REQUEST['city_box']);
+	array_push($v, $_REQUEST['stateorprovince_box']);
+	array_push($v, $_REQUEST['postcode_box']);
+	array_push($v, $_REQUEST['country_box']);
+	array_push($v, $_REQUEST['contactvoicetelephone_box']);
+	array_push($v, $_REQUEST['contactfacsimiletelephone_box']);
+	array_push($v, $_REQUEST['contactelectronicmailaddress_box']);
+	$t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s");
+
+	if (isset($_REQUEST['wms_timestamp_box']) && $_REQUEST['wms_timestamp_box'] <> "") {
+        $update_wms_sql .= ", wms_timestamp = $16 ";
+		array_push($v, guessTimestamp($_REQUEST['wms_timestamp_box']));
+		array_push($t, "s");
+
+		$update_wms_sql .= "WHERE wms_id = $17";
+	}
+	else {
+		$update_wms_sql .= "WHERE wms_id = $16";
+	}
+	array_push($v, 	$_REQUEST['wms_id']);
+	array_push($t, "s");
+
+    $res_update_wms_sql = db_prep_query($update_wms_sql, $v, $t);
+
+    while(list($key,$val) = each($_REQUEST)) {
+        if(preg_match("/___/", $key)) {
+            $myKey = explode("___", $key);
+            $layer_id = preg_replace("/L_/","",$myKey[0]);
+            if($myKey[1]=="layer_abstract") {
+				$layer_sql = "UPDATE layer SET layer_abstract = $1 ";
+				$layer_sql .= "WHERE layer_id = $2 AND fkey_wms_id = $3";  
+                $v = array($val, $layer_id, $_REQUEST['wms_id']);
+                $t = array("s", "i", "s");
+                $res_keyword_sql = db_prep_query($layer_sql, $v, $t);
+            }
+            if($myKey[1]=="layer_keywords") {
+                #Get all keywords depending on the given layer after user modification
+                $keywords  = explode(",",$val);
+                #delete all blanks from the keywords list
+                for ($j = 0; $j < count($keywords); $j++) {
+                    $word = $keywords[$j];
+                    $word = trim($word);
+                    $keywords[$j] = $word;
+                }
+                #echo "1: Keywords eines Layers: id des Layers: ", $layer_id, ", �bergebener String: ", $val, ";<br>";
+                #Get all keywords depending on this layer from database
+                $keyword_sql = "SELECT keyword_id, keyword FROM keyword, layer_keyword, layer " .
+                               "WHERE keyword.keyword_id = layer_keyword.fkey_keyword_id " .
+                               "AND layer_keyword.fkey_layer_id = layer.layer_id " .
+                               "AND layer.fkey_wms_id = $1 " .
+                               "AND layer.layer_id = $2";
+                
+                $v = array($_REQUEST['wms_id'], $layer_id); 
+                $t = array("s", "i");
+                $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
+                while($keyword_row = db_fetch_array($res_keyword_sql))
+                {
+                    $keyword = $keyword_row['keyword'];
+                    $keyword_id = $keyword_row['keyword_id'];
+                    #keyword has been deleted or has been modified
+                    #keyword exists in database but not in user data
+                    $index = -1;
+                    #echo "1a: Abfrage ob DB Keywords in User Liste: Keyword: ", $keyword, ";<br>";
+                    if(in_array($keyword, $keywords) == false)
+                    {
+                        #echo "1c: Keyword nicht in User Liste: Keyword: ", $keyword, ";<br>";
+                        #Deleting reference to the keyword from the layer_keyword table.
+                        $keyword_sql = "DELETE FROM layer_keyword " .
+                                       "WHERE fkey_layer_id = $1 " .
+                                       "AND fkey_keyword_id = $2";
+                        $v = array($layer_id, $keyword_id);
+                        $t = array("i", "i");
+                        db_prep_query($keyword_sql, $v, $t);
+                        #Checking, if the keyword is in use by any layer
+                        $layer_sql = "SELECT * FROM layer_keyword " .
+                                       "WHERE fkey_keyword_id = $1";
+                        $v = array($keyword_id);
+                        $t = array("i");
+                        $res_layer_sql = db_prep_query($layer_sql, $v, $t);
+                        if(!($row = db_fetch_array($res_layer_sql)))
+                        {
+                            #If keyword will not longer be in use, delete it from keyword table
+                            $keyword_sql = "DELETE FROM keyword " .
+                                           "WHERE keyword_id = $1";
+                            $v = array($keyword_id);
+                            $t = array("i");
+                            db_prep_query($keyword_sql, $v, $t);
+                        }
+                    }
+                    #Keyword exists in the database and in the user data
+                    else
+                    {
+                        #echo "1d: Keyword ist in User Liste: Keyword: ", $keyword, ";<br>";
+                        for($i = 0; $i < count($keywords); $i++)
+                        {
+                            #Delete keyword from the user data list, because the data
+                            #have not to be updated within the database
+                            if($keywords[$i] == $keyword)
+                            {
+                                $keywords[$i] = null;
+                            }
+                        }
+                    }
+                }
+                #Inserting keyword, that are not existing in the database
+                for($i = 0; $i < count($keywords); $i++)
+                {
+                    #echo "2: Alle Eintr�ge des Keyword arrays: Keyword: ", $keywords[$i], "; Index: ", $i, ";<br>";
+                    if($keywords[$i] != null)
+                    {
+                        #echo "3: Eintr�ge ungleich null: Keyword: ", $keywords[$i], "; Index: ", $i, ";<nr>";
+                        $keyword = trim($keywords[$i]);
+                        #Check, if the keyword is exsiting in the database
+                        $keyword_sql = "SELECT keyword_id FROM keyword " .
+                                       "WHERE UPPER(keyword) = UPPER($1)";
+                        $v = array($keyword);
+                        $t = array("s");
+                        $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
+                        $keyword_row = db_fetch_array($res_keyword_sql);
+                        #Keyword exists in the database
+                        if($keyword_row != null)
+                        {
+                            $keyword_id = $keyword_row[0];
+                            #echo "4: Keyword in Datenbank vorhanden: id des Keywords: ", $keyword_id, ";<br>";
+                        }
+                        #Keyword does not exist in the database
+                        else
+                        {
+                            $keyword_sql = "INSERT INTO keyword (keyword) VALUES ($1)";
+                            $v = array($keyword);
+                            $t = array("s");
+                            $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
+                            
+                            $keyword_sql = "SELECT keyword_id FROM keyword WHERE keyword = $1";
+                            $v = array($keyword);
+                            $t = array("s");
+                            $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
+                            $keyword_row = db_fetch_array($res_keyword_sql);
+                            if($keyword_row != null)
+                            {
+                                $keyword_id = $keyword_row[0];
+                                #echo "4: Keyword in der Datenbank nicht vorhanden: id des Keywords: ", $keyword_id, ";<br>";
+                            }
+                        }
+                        #Inserting the reference between layer and keyword in the layer_keyword table
+                        $keyword_sql = "INSERT INTO layer_keyword (fkey_layer_id, fkey_keyword_id) " .
+                                       "VALUES ($1, $2)";
+                        $v = array($layer_id, $keyword_id);
+                        $t = array("s", "s");
+                        $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
+                    }
+                }
+                #Delete all elements from array
+                unset($keywords);
+            }
+        }
+    }
+}
+unset($update_content);
+
+#delete preview
+
+if(isset($_REQUEST['delete_preview']) && $_REQUEST['delete_preview']=='1'
+	&& isset($_REQUEST['layer_id']))
+{
+    $preview_sql = "DELETE FROM layer_preview WHERE fkey_layer_id = $1";
+    $v = array($_REQUEST['layer_id']);
+    $t = array("s");
+    $res_preview_sql = db_prep_query($preview_sql, $v, $t);
+    die("Preview has been deleted!</body></html>");
+}
+?>
+<form name='form1' action='<?php echo $self . "&show_wms_list=true"; ?>' method='post'>
+
+<table border='0'>
+<tr>
+<td WIDTH="300" align="left">
+<B>WMS Metadaten<B/>
+<td/>
+<td WIDTH="160">
+<td/>
+</tr>
+
+<?php  
+
+#Use select box to select a wms
+
+if (isset($_REQUEST['show_wms_list']) && $_REQUEST['show_wms_list'] == true)
+{
+
+    #Querying information from wms data table 
+    $wms_sql = "SELECT wms_id, wms_title FROM wms WHERE wms_owner = $1 ORDER BY wms_title";
+    $v = array($_SESSION["mb_user_id"]);
+    $t = array("i");
+    $res_wms_sql = db_prep_query($wms_sql, $v, $t);
+    #wms-selection
+
+    $selectBox = "";
+    while($row = db_fetch_array($res_wms_sql)) {
+        if ($adm->getWmsPermission($row["wms_id"], $_SESSION['mb_user_id'])) {
+	        $selectBox .= "<option value='".$row["wms_id"]."' ";
+	        if(isset($_REQUEST['wmsList']) && $_REQUEST['wmsList'] == $row["wms_id"]) {
+	            $selectBox .= "selected";
+	        }
+	        $selectBox .= "> ".$row["wms_title"]."</option>";
+        }
+    }
+    
+    if ($selectBox != "") {
+	    echo "<tr><td>";
+	    echo "<select size=6 name='wmsList' onchange='submit()'>".$selectBox."</select>";
+	    echo "</td><td width='160px' align='right'>";
+	    echo "<input type='button' class='sbutton' value='save' onclick='save()'>";
+		echo "</td></tr>";
+    }
+    else {
+    	echo "<div>no wms owner.</div>";
+    	die;
+    }
+
+    if(isset($_REQUEST['wmsList']) == true && $_REQUEST['wmsList'] <>0)
+    editWMSByWMSID ($_REQUEST['wmsList']);
+}
+
+echo "</table>";
+
+//$wms_id;
+function editWMSByWMSID($param_wms_id)
+{
+    global $wms_id;
+    $wms_id = $param_wms_id;
+
+}
+
+
+if(isset($wms_id) == true && $wms_id <>0)
+{ 
+	$selected_wms_sql = "SELECT * FROM wms WHERE wms_id = $1";
+	$v = array($wms_id);
+	$t = array("s");
+    $res_selected_wms_sql = db_prep_query($selected_wms_sql, $v, $t);
+    $selected_row = db_fetch_array($res_selected_wms_sql);
+
+?>
+    
+    <table border='0' class='table_top' >
+    <tr>
+    <td>WMS-Titel:<td><td/>
+    <input type='text' name='wms_title_box' value='<?php echo $selected_row["wms_title"];?>' /><td/>
+
+    <td>WMS- Abstract:<td><td/>
+    <input type='text' name='wms_abstract_box' value='<?php echo $selected_row["wms_abstract"];?>' /><td/>
+
+    <td >Fees:<td><td/>
+    <input type='text' name='fees_box' value='<?php echo $selected_row["fees"]?>'/><td/>
+    <tr/>
+       
+    <tr>
+    <td>Access Constraints:<td><td/>
+    <input type='text' name='accessconstraints_box' value='<?php echo $selected_row["accessconstraints"]?>'/><td/>
+
+    <td>Contact Person:<td><td/>
+    <input type='text' name='contactperson_box' value='<?php echo $selected_row["contactperson"]?>'/><td/>
+
+    <td>Contact Position:<td><td/>
+    <input type='text' name='contactposition_box' value='<?php echo $selected_row["contactposition"]?>'/><td/>
+    <tr/>
+    
+    <tr>
+    <td>Contact Organization:<td><td/>
+    <input type='text' name='contactorganization_box' value='<?php echo $selected_row["contactorganization"]?>'/><td/>
+ 
+    <td>Address:<td><td/>
+    <input type='text' name='address_box' value='<?php echo $selected_row["address"]?>'/><td/>
+
+    <td style="width:">City:<td><td/>
+    <input type='text' name='city_box' value='<?php echo $selected_row["city"]?>'/><td/>
+    <tr/>
+    
+    <tr>
+    <td>State or Province:<td><td/>
+    <input type='text' name='stateorprovince_box' value='<?php echo $selected_row["stateorprovince"]?>'/><td/>
+
+    <td>Postcode:<td><td/>
+    <input type='text' name='postcode_box' value='<?php echo $selected_row["postcode"]?>'/><td/>
+    
+    <td>Country:<td><td/>
+    <input type='text' name='country_box' value='<?php echo $selected_row["country"]?>'/><td/>
+    <tr/>
+    
+    <tr>
+    <td>Telephone:<td><td/>
+    <input type='text' name='contactvoicetelephone_box' 
+        value='<?php echo $selected_row["contactvoicetelephone"]?>'/><td/>
+    
+    <td>Fax:<td><td/>
+    <input type='text' name='contactfacsimiletelephone_box' value='<?php echo $selected_row["contactfacsimiletelephone"]?>'/><td/>
+    
+    <td>E-Mail:<td><td/>
+    <input type='text' name='contactelectronicmailaddress_box' value='<?php echo $selected_row["contactelectronicmailaddress"]?>'/><td/>
+    <tr/>
+    <tr>
+    <?php
+  if (isset($selected_row["wms_timestamp"]) && $selected_row["wms_timestamp"] <> "") {
+    $datum = date("d.m.Y",$selected_row["wms_timestamp"]);
+  }
+  else $datum = ""
+?>
+    <td>Date:<td><td/>
+    <input type='text' name='wms_timestamp_box' value='<?php echo $datum?>' onClick='pick_the_date(document.form1.wms_timestamp_box)'/><td/>
+    <tr/>
+    
+    <table class="table_layer">
+    <tr><td>Nr.</td><td>Title</td><td>Abstract</td><td>Keywords</td><td></td></tr>
+
+    
+<?php
+   
+    $layer_sql = "SELECT * FROM layer WHERE layer.fkey_wms_id = $1" .
+                 " ORDER BY layer_pos";
+    $v = array($wms_id);
+    $t = array("s");
+    $res_layer_sql = db_prep_query($layer_sql, $v, $t);
+    
+    while($layer_row = db_fetch_array($res_layer_sql))
+    {
+    ?>
+        <tr align='center'>
+        <td><input type='text' size='1' name='L_<?php echo $layer_row['layer_id']?>___layer_nr' 
+            value='<?php echo $layer_row['layer_pos']?>' readonly></td>
+        <td><input type='text' size='15' name='L_<?php echo $layer_row['layer_id']?>___layer_title' 
+            value='<?php echo $layer_row['layer_title']?>' readonly></td>
+        <td><input type='text' size='42' name='L_<?php echo $layer_row['layer_id']?>___layer_abstract'
+            value='<?php echo $layer_row['layer_abstract']?>'>
+
+    <?php
+        $keyword_sql = "SELECT keyword FROM keyword, layer_keyword, layer " .
+                       "WHERE keyword.keyword_id = layer_keyword.fkey_keyword_id " .
+                       "AND layer_keyword.fkey_layer_id = layer.layer_id " .
+                       "AND layer.fkey_wms_id = $1 " .
+                       "AND layer.layer_id = $2";
+        $v = array($wms_id, $layer_row['layer_id']);
+        $t = array("s", "i");
+        $res_keyword_sql = db_prep_query($keyword_sql, $v, $t);
+        $keywordList = "";
+        $seperator = "";
+        while($keyword_row = db_fetch_array($res_keyword_sql))
+        {
+            if($keywordList != "")
+            {    
+                $seperator = ",";
+            }
+            $keywordList .= $seperator.$keyword_row["keyword"];
+        }
+        ?>
+        <td><input type='text' size='42' name='L_<?php echo $layer_row['layer_id']?>___layer_keywords' 
+             value='<?php echo $keywordList?>'>        
+        </td>
+        <td>
+        <!--
+        <input type="button" value='preview' onclick="window.open('../frames/index.php?&gui_id=layer_preview&layer_preview=1&portal_services=<?php echo $layer_row['layer_id'];?>', 'mini_mapbender', 'height=370, width=370, dependent=yes');">
+        -->
+        </td>
+        <td>
+<?php 
+/*
+    $preview_sql = "SELECT * FROM layer_preview " .
+                   "WHERE fkey_layer_id = ".$layer_row['layer_id']."";
+    $res_preview_sql = db_query($preview_sql);
+	if(db_numrows($res_preview_sql)>0){?>
+        <!--
+        <input id="<?php echo $layer_row['layer_id'];?>_dp" type="button" value='delete preview' onclick="deletepreview('<?php echo $layer_row['layer_id'];?>');">
+        -->
+<?php }else{?>
+		<!--
+        <input id="<?php echo $layer_row['layer_id'];?>_dp" type="button" value='delete preview' style="display:none;" onclick="deletepreview('<?php echo $layer_row['layer_id'];?>');">
+        -->
+<?php }*/?>
+        </td>
+        </tr>
+    <?php
+    }
+    #editWMSByWMSID(961);
+    ?>
+    </table>
+    <input type='hidden' name='update_content' value=''/>
+    <input type='hidden' name='wms_id' value='<?php echo $wms_id ?>'/>
+	<!--
+    <input type="hidden" value='' name='delete_preview'>
+    -->
+    <input type="hidden" value='' name='layer_id'>
+    </form>
+    </body>
+    </html>
+<?php
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_exportMapImage_server.php
===================================================================
--- branches/print_dev/http/php/mod_exportMapImage_server.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_exportMapImage_server.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,54 +1,54 @@
-<?php
-# $Id$
-# http://www.mapbender.org/ExportMapimage
-# 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.
-
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-include_once(dirname(__FILE__)."/../classes/class_weldMaps2Image.php");
-
-$imageType = "";
-if(isset($_REQUEST["imagetype"])){
-	
-	$imageType = $_REQUEST["imagetype"];
-	
-}
-
-$urls = "";
-if(isset($_REQUEST["wms_urls"])){
-	
-	$wms_urls = $_REQUEST["wms_urls"];
-	
-}
-
-$array_file = array();
-$array_file["dir"]  = TMPDIR; 
-$array_file["filename"] = "image"; 
-
-$array_urls = explode("___", $wms_urls);
-foreach ($array_urls as $key => $value) {
-      if (is_null($value) || $value=="") {
-        unset($array_urls[$key]);
-      }
-}
-
-$new_array = array_values($array_urls); 
-		
-$image = new weldMaps2Image($new_array, $array_file);
-$image->getImage($imageType, 'file');
-
- 
+<?php
+# $Id$
+# http://www.mapbender.org/ExportMapimage
+# 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.
+
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+include_once(dirname(__FILE__)."/../classes/class_weldMaps2Image.php");
+
+$imageType = "";
+if(isset($_REQUEST["imagetype"])){
+	
+	$imageType = $_REQUEST["imagetype"];
+	
+}
+
+$urls = "";
+if(isset($_REQUEST["wms_urls"])){
+	
+	$wms_urls = $_REQUEST["wms_urls"];
+	
+}
+
+$array_file = array();
+$array_file["dir"]  = TMPDIR; 
+$array_file["filename"] = "image"; 
+
+$array_urls = explode("___", $wms_urls);
+foreach ($array_urls as $key => $value) {
+      if (is_null($value) || $value=="") {
+        unset($array_urls[$key]);
+      }
+}
+
+$new_array = array_values($array_urls); 
+		
+$image = new weldMaps2Image($new_array, $array_file);
+$image->getImage($imageType, 'file');
+
+ 
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_featuretypeMetadata.php
===================================================================
--- branches/print_dev/http/php/mod_featuretypeMetadata.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_featuretypeMetadata.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,136 +1,136 @@
-<?php
-# $Id: mod_featuretypeMetadata.php 235 2007-09-20 verenadiewald $
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-function display_text($string) {
-    $string = eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);   
-    $string = eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);   
-    $string = eregi_replace("\n", "<br>", $string);
-    return $string;
-}  
-
-?>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
-	<head>
-		<title>WFS Metadata</title>
-		<meta name="description" content="Metadata" xml:lang="en" />
-		<meta name="keywords" content="Metadaten" xml:lang="en" />		
-		<meta http-equiv="cache-control" content="no-cache">
-		<meta http-equiv="pragma" content="no-cache">
-		<meta http-equiv="expires" content="0">
-		<meta http-equiv="content-language" content="de" />
-		<meta http-equiv="content-style-type" content="text/css" />	
-		<link rel="stylesheet" type="text/css" href="../css/metadata.css" />		
-<?php
-	echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-	</head>
-	<body id="top">
-
-	
-
-<?php
-	$wfs_conf_id = $_GET['wfs_conf_id'];
-	//for testing only
-	#$wfs_conf_id = 1;
-	
-	$sql_id = "SELECT fkey_wfs_id, fkey_featuretype_id FROM wfs_conf WHERE wfs_conf_id = $1";
-	$v_id = array($wfs_conf_id);
-	$t_id = array('i');
-	$res_id = db_prep_query($sql_id,$v_id,$t_id);
-	$row_id = db_fetch_array($res_id);
-	$wfs_id = $row_id['fkey_wfs_id'];
-	$featuretype_id = $row_id['fkey_featuretype_id'];
-		
-	// retrieve the geometry type
-	$sql_geom = "SELECT a.element_type AS geom_type ";
-	$sql_geom .= "FROM wfs_element AS a, wfs_conf AS b, wfs_conf_element AS c ";
-	$sql_geom .= "WHERE a.fkey_featuretype_id = b.fkey_featuretype_id AND b.wfs_conf_id = $1 ";
-	$sql_geom .= "AND b.wfs_conf_id = c.fkey_wfs_conf_id AND c.f_geom = 1 AND c.f_id = a.element_id";
-	$v_geom = array($wfs_conf_id);
-	$t_geom = array('i');
-	$res_geom = db_prep_query($sql_geom, $v_geom, $t_geom);
-	$row_geom = db_fetch_array($res_geom);
-	$geomType = $row_geom['geom_type'];
-
-	$sql = "SELECT ";
-	$sql .= "ft.featuretype_id, ft.featuretype_title, ft.featuretype_srs, ft.featuretype_abstract, ";
-	$sql .= "wfs.wfs_title, wfs.wfs_abstract, wfs.wfs_id, wfs.fees, wfs.accessconstraints, wfs.individualname, ";
-	$sql .= "wfs.positionname, wfs.providername, wfs.deliverypoint, wfs.city, wfs.wfs_timestamp, wfs.wfs_owner, ";
-	$sql .= "wfs.country, wfs.postalcode, wfs.voice, wfs.facsimile, ";
-	$sql .= "wfs.electronicmailaddress, wfs.wfs_getcapabilities ";
-	$sql .= "FROM wfs, wfs_featuretype ft WHERE wfs.wfs_id = $1 AND ft.featuretype_id = $2 AND wfs.wfs_id = ft.fkey_wfs_id LIMIT 1";
-	$v = array($wfs_id,$featuretype_id);
-	$t = array('i','i');
-	$res = db_prep_query($sql,$v,$t);
-	echo db_error();
-	$wfs = array();
-	$row = db_fetch_array($res);
-	
-	$sql_dep = "SELECT mb_group_name FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1  AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND b.mb_user_department = a.mb_group_description LIMIT 1";
-	$v_dep = array($row['wfs_owner']);
-	$t_dep = array('i');
-	$res_dep = db_prep_query($sql_dep, $v_dep, $t_dep);
-	$row_dep = db_fetch_array($res_dep);
-	
-	$featuretype['ID'] = $featuretype_id;
-	$featuretype['Titel'] = $row['featuretype_title'];
-	$featuretype['Zusammenfassung'] = $row['featuretype_abstract'];
-	$featuretype['Koordinatensysteme'] = $row['featuretype_srs'];
-	$featuretype['Geometrietyp'] = $geomType;
-	$featuretype['Capabilities-Dokument'] = $row['wfs_getcapabilities'];
-	#$featuretype['Capabilities-Dokument'] = "<a href='".$row['wfs_getcapabilities']."' target=_blank>Capabilities-Dokument</a>";
-	if ($row['wfs_timestamp']) {
-		$layer['Datum der Registrierung'] = date("d.m.Y",$row['wfs_timestamp']); 
-	}
-	else {
-		$layer['Datum der Registrierung'] = "Keine Angabe"; 
-	}
-	$featuretype['Registrierende Stelle'] = $row_dep['mb_group_name'];
-	$featuretype['WFS ID'] = $row['wfs_id'];
-	$featuretype['WFS Titel'] = $row['wfs_title'];
-	$featuretype['WFS Zusammenfassung'] = $row['wfs_abstract'];
-	$featuretype['Geb&uuml;hren'] = $row['fees'];
-	$featuretype['Zugriffsbeschr&auml;nkung'] = $row['accessconstraints'];
-	$featuretype['Ansprechpartner'] = $row['individualname'];
-	$featuretype['Organisation'] = $row['providername'];
-	$featuretype['Adresse'] = $row['deliverypoint'];
-	$featuretype['Stadt'] = $row['city'];
-	$featuretype['PLZ'] = $row['postalcode'];
-	$featuretype['Telefon'] = $row['voice'];
-	$featuretype['Fax'] = $row['facsimile'];
-	$featuretype['E-Mail'] = $row['electronicmailaddress'];
-	$featuretype['Land'] = $row['country'];
-	
-	echo "<table >\n";
-	$t_a = "\t<tr>\n\t\t<th>\n\t\t\t";
-	$t_b = "\n\t\t</th>\n\t\t<td>\n\t\t\t";
-	$t_c = "\n\t\t</td>\n\t</tr>\n";
-
-	$keys = array_keys($featuretype);
-	for ($j=0; $j<count($featuretype); $j++) {
-		echo $t_a . utf8_encode($keys[$j]) . $t_b . display_text($featuretype[$keys[$j]]) . $t_c;
-	}
-	
-	echo "</td></tr></table>\n";
-?>
-
-	</body>
-</html>
+<?php
+# $Id: mod_featuretypeMetadata.php 235 2007-09-20 verenadiewald $
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+function display_text($string) {
+    $string = eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);   
+    $string = eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);   
+    $string = eregi_replace("\n", "<br>", $string);
+    return $string;
+}  
+
+?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
+	<head>
+		<title>WFS Metadata</title>
+		<meta name="description" content="Metadata" xml:lang="en" />
+		<meta name="keywords" content="Metadaten" xml:lang="en" />		
+		<meta http-equiv="cache-control" content="no-cache">
+		<meta http-equiv="pragma" content="no-cache">
+		<meta http-equiv="expires" content="0">
+		<meta http-equiv="content-language" content="de" />
+		<meta http-equiv="content-style-type" content="text/css" />	
+		<link rel="stylesheet" type="text/css" href="../css/metadata.css" />		
+<?php
+	echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+	</head>
+	<body id="top">
+
+	
+
+<?php
+	$wfs_conf_id = $_GET['wfs_conf_id'];
+	//for testing only
+	#$wfs_conf_id = 1;
+	
+	$sql_id = "SELECT fkey_wfs_id, fkey_featuretype_id FROM wfs_conf WHERE wfs_conf_id = $1";
+	$v_id = array($wfs_conf_id);
+	$t_id = array('i');
+	$res_id = db_prep_query($sql_id,$v_id,$t_id);
+	$row_id = db_fetch_array($res_id);
+	$wfs_id = $row_id['fkey_wfs_id'];
+	$featuretype_id = $row_id['fkey_featuretype_id'];
+		
+	// retrieve the geometry type
+	$sql_geom = "SELECT a.element_type AS geom_type ";
+	$sql_geom .= "FROM wfs_element AS a, wfs_conf AS b, wfs_conf_element AS c ";
+	$sql_geom .= "WHERE a.fkey_featuretype_id = b.fkey_featuretype_id AND b.wfs_conf_id = $1 ";
+	$sql_geom .= "AND b.wfs_conf_id = c.fkey_wfs_conf_id AND c.f_geom = 1 AND c.f_id = a.element_id";
+	$v_geom = array($wfs_conf_id);
+	$t_geom = array('i');
+	$res_geom = db_prep_query($sql_geom, $v_geom, $t_geom);
+	$row_geom = db_fetch_array($res_geom);
+	$geomType = $row_geom['geom_type'];
+
+	$sql = "SELECT ";
+	$sql .= "ft.featuretype_id, ft.featuretype_title, ft.featuretype_srs, ft.featuretype_abstract, ";
+	$sql .= "wfs.wfs_title, wfs.wfs_abstract, wfs.wfs_id, wfs.fees, wfs.accessconstraints, wfs.individualname, ";
+	$sql .= "wfs.positionname, wfs.providername, wfs.deliverypoint, wfs.city, wfs.wfs_timestamp, wfs.wfs_owner, ";
+	$sql .= "wfs.country, wfs.postalcode, wfs.voice, wfs.facsimile, ";
+	$sql .= "wfs.electronicmailaddress, wfs.wfs_getcapabilities ";
+	$sql .= "FROM wfs, wfs_featuretype ft WHERE wfs.wfs_id = $1 AND ft.featuretype_id = $2 AND wfs.wfs_id = ft.fkey_wfs_id LIMIT 1";
+	$v = array($wfs_id,$featuretype_id);
+	$t = array('i','i');
+	$res = db_prep_query($sql,$v,$t);
+	echo db_error();
+	$wfs = array();
+	$row = db_fetch_array($res);
+	
+	$sql_dep = "SELECT mb_group_name FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1  AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND b.mb_user_department = a.mb_group_description LIMIT 1";
+	$v_dep = array($row['wfs_owner']);
+	$t_dep = array('i');
+	$res_dep = db_prep_query($sql_dep, $v_dep, $t_dep);
+	$row_dep = db_fetch_array($res_dep);
+	
+	$featuretype['ID'] = $featuretype_id;
+	$featuretype['Titel'] = $row['featuretype_title'];
+	$featuretype['Zusammenfassung'] = $row['featuretype_abstract'];
+	$featuretype['Koordinatensysteme'] = $row['featuretype_srs'];
+	$featuretype['Geometrietyp'] = $geomType;
+	$featuretype['Capabilities-Dokument'] = $row['wfs_getcapabilities'];
+	#$featuretype['Capabilities-Dokument'] = "<a href='".$row['wfs_getcapabilities']."' target=_blank>Capabilities-Dokument</a>";
+	if ($row['wfs_timestamp']) {
+		$layer['Datum der Registrierung'] = date("d.m.Y",$row['wfs_timestamp']); 
+	}
+	else {
+		$layer['Datum der Registrierung'] = "Keine Angabe"; 
+	}
+	$featuretype['Registrierende Stelle'] = $row_dep['mb_group_name'];
+	$featuretype['WFS ID'] = $row['wfs_id'];
+	$featuretype['WFS Titel'] = $row['wfs_title'];
+	$featuretype['WFS Zusammenfassung'] = $row['wfs_abstract'];
+	$featuretype['Geb&uuml;hren'] = $row['fees'];
+	$featuretype['Zugriffsbeschr&auml;nkung'] = $row['accessconstraints'];
+	$featuretype['Ansprechpartner'] = $row['individualname'];
+	$featuretype['Organisation'] = $row['providername'];
+	$featuretype['Adresse'] = $row['deliverypoint'];
+	$featuretype['Stadt'] = $row['city'];
+	$featuretype['PLZ'] = $row['postalcode'];
+	$featuretype['Telefon'] = $row['voice'];
+	$featuretype['Fax'] = $row['facsimile'];
+	$featuretype['E-Mail'] = $row['electronicmailaddress'];
+	$featuretype['Land'] = $row['country'];
+	
+	echo "<table >\n";
+	$t_a = "\t<tr>\n\t\t<th>\n\t\t\t";
+	$t_b = "\n\t\t</th>\n\t\t<td>\n\t\t\t";
+	$t_c = "\n\t\t</td>\n\t</tr>\n";
+
+	$keys = array_keys($featuretype);
+	for ($j=0; $j<count($featuretype); $j++) {
+		echo $t_a . utf8_encode($keys[$j]) . $t_b . display_text($featuretype[$keys[$j]]) . $t_c;
+	}
+	
+	echo "</td></tr></table>\n";
+?>
+
+	</body>
+</html>

Modified: branches/print_dev/http/php/mod_gazetteerMetadata.php
===================================================================
--- branches/print_dev/http/php/mod_gazetteerMetadata.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_gazetteerMetadata.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,268 +1,268 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/gazetteerMetadata
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-
-$user_id = $_SESSION["mb_user_id"]; 
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta name="author" content="V. Diewald">
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<meta name="DC.Rights" content="WhereGroup GmbH & Co.KG, Bonn">
-<title>Metadata search</title>
-<?
-include_once(dirname(__FILE__) . "/../include/dyn_css.php");
-?>
-<style type="text/css">
-<!--
-	body{
-		font-family : Arial, Helvetica, sans-serif;
-		font-size : 12px;
-		font-weight : bold;
-		color: #808080;
-	}
-
-	a:link{
-		font-family : Arial, Helvetica, sans-serif;
-		text-decoration : none;
-		color: #808080;
-		font-size : 12px;
-		font-weight : normal;
-	}
-	a:visited{
-		font-family : Arial, Helvetica, sans-serif;
-		text-decoration : none;
-		color: #808080;
-		font-size : 12px;
-		font-weight : normal;
-	}
-	a:hover{
-		font-family : Arial, Helvetica, sans-serif;
-		color: #808080;
-		text-decoration : none;
-		font-weight : normal;
-	}
-	a:active{
-		font-family : Arial, Helvetica, sans-serif;
-		color: #808080;
-		text-decoration : none;
-		font-weight : normal;
-	}
-
-	.textfield{
-		border : 2 solid #D3D3D3;
-		font-family : Arial, Helvetica, sans-serif;
-		font-size : 12px;
-		font-weight : normal;
-		color: #000000;
-		width: 120px;
-	}
-	
-	.result{
-		position: absolute;
-		top: 40px;
-		left: 0px;
-	}
--->
-</style>
-<script type="text/javascript">
-<!--
-
-function validate(){
-
-   if(document.form1.search.value.length < 1){
-      alert("Please insert a keyword!");
-      document.form1.search.focus();
-      return false;
-   }
-   else{   
-		document.getElementById("resultDivTag").innerHTML = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
-		var ind = parent.getMapObjIndexByName('mapframe1');
-		
-		parent.mb_ajax_json(
-			"../php/mod_gazetteerMetadata_search.php", 
-			{
-				"search" : document.form1.search.value,
-				"srs" : parent.mb_mapObj[ind].epsg
-			}, 
-			function(jsonObj, status){
-				document.getElementById("resultDivTag").innerHTML = displayTable(jsonObj);
-			}
-		);
-		return false;
-   }
-}
-
-function displayTable(obj) {
-	var text = "<table>";
-	for (var attr in obj) {
-		var resultObj = obj[attr];
-		if (typeof(resultObj) != 'function') {
-			text += "<tr><td valign='top'>";
-			var imgUrl = "";
-			var onclickFunction = "";
-			if (typeof(resultObj.layer_name) !== "undefined") {
-				imgUrl = "../img/button_gray/metadata_layer.gif";
-				onclickFunction = "mod_addWMSLayerfromfilteredList(\"" + 
-					resultObj.wms_getcapabilities + "\",\"" + 
-					resultObj.wms_version + "\", \"" + 
-					resultObj.layer_name+"\");";
-			}
-			else {
-				imgUrl = "../img/button_gray/metadata_wms.gif";
-				onclickFunction = "mod_addWMSfromfilteredList(\"" + 
-					resultObj.wms_getcapabilities + "\",\"" + 
-					resultObj.wms_version+"\");";
-			}
-			text += "<img name='add_wms' src='" + imgUrl + "' ";
-			text += "border='0' title='Load' ";
-			text += "onclick='" + onclickFunction + "'>";
-			if (resultObj.extent && resultObj.extent[0] !== null) {
-				text += "<img src='../img/tree_new/zoom.png' " + 
-					"onclick='" + 
-					"parent.mb_calculateExtent(\"mapframe1\", " + 
-					resultObj.extent[0] + "," + 
-					resultObj.extent[1] + "," + 
-					resultObj.extent[2] + "," + 
-					resultObj.extent[3] + ");" + 
-					"parent.zoom(\"mapframe1\", \"true\", 1.0);" + 
-					"'>";
-			}
-			text += "</td><td>";
-			text += "<a href='#' ";
-			text += "onclick='javascript:window.open(\"mod_layerMetadata.php?id=" + 
-				resultObj.layer_id + 
-				"\", \"metadata\", \"width=450, height=600\");' title='Info'>"; 
-			text += resultObj.title+"</a>";	
-			text += "</td></tr>";
-		}
-	}
-	text += "</table>";
-	return text;
-}
-
-
-function handleLayer(sel_lay, wms_title){
-    
-	//var wms_title = document.forms[0].wmsTitle.value
-
-	var x = new Array();
-
-    x[0] = sel_lay;
-
-    var y = new Array();
-    
-    if (backlink =='parent'){
-		var wms_ID = parent.parent.getWMSIDByTitle('mapframe1',wms_title);
-	}
-	else{
-		var wms_ID = parent.getWMSIDByTitle('mapframe1',wms_title);
-	}
-
-    y[0] = wms_ID;
-    
-	//alert(wms_title + " -- X "+ x + "wms_id" + wms_ID);
-	
-	if (backlink =='parent'){
-		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
-		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);
-	}
-	else{
-		parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
-		parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);		
-	}
-
-}
-
-function mod_addWMSfromfilteredList(pointer_name,version){
-
-	pointer_name=pointer_name + parent.parent.mb_getConjunctionCharacter(pointer_name);
-	if (version == '1.0.0'){
-		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
-		var load = cap;
-	}
-	else if (version == '1.1.0'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
-		var load = cap;
-	}
-	else if (version == '1.1.1'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
-		var load = cap;
-	}  
-	//alert (load);
-
-	if(load){
-		if(load.charAt(0) == '/' && load.charAt(1) == 'c'){
-			parent.parent.mod_addWMS_load('http://localhost' + load);
-		}
-		else{
-			parent.parent.mod_addWMS_load(load);
-		}  
-	}
-}
-
-function mod_addWMSLayerfromfilteredList(pointer_name,version,layer_name){
-
-	pointer_name=pointer_name + parent.parent.mb_getConjunctionCharacter(pointer_name);
-	if (version == '1.0.0'){
-		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
-		var load = cap;
-		var layer_name = layer_name;
-	}
-	else if (version == '1.1.0'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
-		var load = cap;
-		var layer_name = layer_name;
-	}
-	else if (version == '1.1.1'){
-		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
-		var load = cap;
-		var layer_name = layer_name;
-	}  
-	//alert (load);
-
-	if(load){
-		if(load.charAt(0) == '/' && load.charAt(1) == 'c'){
-			parent.parent.mod_addLayer_load('http://localhost' + load, layer_name);
-		}
-		else{
-			parent.parent.mod_addLayer_load(load, layer_name);
-		}  
-	}
-}
-// -->
-</script>
-</head>
-<body leftmargin="2" topmargin="0" bgcolor="#ffffff">
-<form name='form1' target='result' onsubmit='return validate();'>
-<p>
-<input class='textfield' name='search' type='text' style='width:110px'>
-<img src="../img/add.png" title="keywords" onclick="window.open('mod_SelectKeyword.php','SelectKeyword','width=600,height=400,status=no');">
-<input type='submit' name='send' value='ok'>
-</p>
-</form>
-<div id='resultDivTag' class='result'></div>
-</body>
-</html>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/gazetteerMetadata
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+$user_id = $_SESSION["mb_user_id"]; 
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta name="author" content="V. Diewald">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="DC.Rights" content="WhereGroup GmbH & Co.KG, Bonn">
+<title>Metadata search</title>
+<?
+include_once(dirname(__FILE__) . "/../include/dyn_css.php");
+?>
+<style type="text/css">
+<!--
+	body{
+		font-family : Arial, Helvetica, sans-serif;
+		font-size : 12px;
+		font-weight : bold;
+		color: #808080;
+	}
+
+	a:link{
+		font-family : Arial, Helvetica, sans-serif;
+		text-decoration : none;
+		color: #808080;
+		font-size : 12px;
+		font-weight : normal;
+	}
+	a:visited{
+		font-family : Arial, Helvetica, sans-serif;
+		text-decoration : none;
+		color: #808080;
+		font-size : 12px;
+		font-weight : normal;
+	}
+	a:hover{
+		font-family : Arial, Helvetica, sans-serif;
+		color: #808080;
+		text-decoration : none;
+		font-weight : normal;
+	}
+	a:active{
+		font-family : Arial, Helvetica, sans-serif;
+		color: #808080;
+		text-decoration : none;
+		font-weight : normal;
+	}
+
+	.textfield{
+		border : 2 solid #D3D3D3;
+		font-family : Arial, Helvetica, sans-serif;
+		font-size : 12px;
+		font-weight : normal;
+		color: #000000;
+		width: 120px;
+	}
+	
+	.result{
+		position: absolute;
+		top: 40px;
+		left: 0px;
+	}
+-->
+</style>
+<script type="text/javascript">
+<!--
+
+function validate(){
+
+   if(document.form1.search.value.length < 1){
+      alert("Please insert a keyword!");
+      document.form1.search.focus();
+      return false;
+   }
+   else{   
+		document.getElementById("resultDivTag").innerHTML = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
+		var ind = parent.getMapObjIndexByName('mapframe1');
+		
+		parent.mb_ajax_json(
+			"../php/mod_gazetteerMetadata_search.php", 
+			{
+				"search" : document.form1.search.value,
+				"srs" : parent.mb_mapObj[ind].epsg
+			}, 
+			function(jsonObj, status){
+				document.getElementById("resultDivTag").innerHTML = displayTable(jsonObj);
+			}
+		);
+		return false;
+   }
+}
+
+function displayTable(obj) {
+	var text = "<table>";
+	for (var attr in obj) {
+		var resultObj = obj[attr];
+		if (typeof(resultObj) != 'function') {
+			text += "<tr><td valign='top'>";
+			var imgUrl = "";
+			var onclickFunction = "";
+			if (typeof(resultObj.layer_name) !== "undefined") {
+				imgUrl = "../img/button_gray/metadata_layer.gif";
+				onclickFunction = "mod_addWMSLayerfromfilteredList(\"" + 
+					resultObj.wms_getcapabilities + "\",\"" + 
+					resultObj.wms_version + "\", \"" + 
+					resultObj.layer_name+"\");";
+			}
+			else {
+				imgUrl = "../img/button_gray/metadata_wms.gif";
+				onclickFunction = "mod_addWMSfromfilteredList(\"" + 
+					resultObj.wms_getcapabilities + "\",\"" + 
+					resultObj.wms_version+"\");";
+			}
+			text += "<img name='add_wms' src='" + imgUrl + "' ";
+			text += "border='0' title='Load' ";
+			text += "onclick='" + onclickFunction + "'>";
+			if (resultObj.extent && resultObj.extent[0] !== null) {
+				text += "<img src='../img/tree_new/zoom.png' " + 
+					"onclick='" + 
+					"parent.mb_calculateExtent(\"mapframe1\", " + 
+					resultObj.extent[0] + "," + 
+					resultObj.extent[1] + "," + 
+					resultObj.extent[2] + "," + 
+					resultObj.extent[3] + ");" + 
+					"parent.zoom(\"mapframe1\", \"true\", 1.0);" + 
+					"'>";
+			}
+			text += "</td><td>";
+			text += "<a href='#' ";
+			text += "onclick='javascript:window.open(\"mod_layerMetadata.php?id=" + 
+				resultObj.layer_id + 
+				"\", \"metadata\", \"width=450, height=600\");' title='Info'>"; 
+			text += resultObj.title+"</a>";	
+			text += "</td></tr>";
+		}
+	}
+	text += "</table>";
+	return text;
+}
+
+
+function handleLayer(sel_lay, wms_title){
+    
+	//var wms_title = document.forms[0].wmsTitle.value
+
+	var x = new Array();
+
+    x[0] = sel_lay;
+
+    var y = new Array();
+    
+    if (backlink =='parent'){
+		var wms_ID = parent.parent.getWMSIDByTitle('mapframe1',wms_title);
+	}
+	else{
+		var wms_ID = parent.getWMSIDByTitle('mapframe1',wms_title);
+	}
+
+    y[0] = wms_ID;
+    
+	//alert(wms_title + " -- X "+ x + "wms_id" + wms_ID);
+	
+	if (backlink =='parent'){
+		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
+		parent.parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);
+	}
+	else{
+		parent.handleSelectedLayer_array('mapframe1',y,x,'querylayer',1);
+		parent.handleSelectedLayer_array('mapframe1',y,x,'visible',1);		
+	}
+
+}
+
+function mod_addWMSfromfilteredList(pointer_name,version){
+
+	pointer_name=pointer_name + parent.parent.mb_getConjunctionCharacter(pointer_name);
+	if (version == '1.0.0'){
+		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
+		var load = cap;
+	}
+	else if (version == '1.1.0'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
+		var load = cap;
+	}
+	else if (version == '1.1.1'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
+		var load = cap;
+	}  
+	//alert (load);
+
+	if(load){
+		if(load.charAt(0) == '/' && load.charAt(1) == 'c'){
+			parent.parent.mod_addWMS_load('http://localhost' + load);
+		}
+		else{
+			parent.parent.mod_addWMS_load(load);
+		}  
+	}
+}
+
+function mod_addWMSLayerfromfilteredList(pointer_name,version,layer_name){
+
+	pointer_name=pointer_name + parent.parent.mb_getConjunctionCharacter(pointer_name);
+	if (version == '1.0.0'){
+		var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0";
+		var load = cap;
+		var layer_name = layer_name;
+	}
+	else if (version == '1.1.0'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0";
+		var load = cap;
+		var layer_name = layer_name;
+	}
+	else if (version == '1.1.1'){
+		var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1";
+		var load = cap;
+		var layer_name = layer_name;
+	}  
+	//alert (load);
+
+	if(load){
+		if(load.charAt(0) == '/' && load.charAt(1) == 'c'){
+			parent.parent.mod_addLayer_load('http://localhost' + load, layer_name);
+		}
+		else{
+			parent.parent.mod_addLayer_load(load, layer_name);
+		}  
+	}
+}
+// -->
+</script>
+</head>
+<body leftmargin="2" topmargin="0" bgcolor="#ffffff">
+<form name='form1' target='result' onsubmit='return validate();'>
+<p>
+<input class='textfield' name='search' type='text' style='width:110px'>
+<img src="../img/add.png" title="keywords" onclick="window.open('mod_SelectKeyword.php','SelectKeyword','width=600,height=400,status=no');">
+<input type='submit' name='send' value='ok'>
+</p>
+</form>
+<div id='resultDivTag' class='result'></div>
+</body>
+</html>

Modified: branches/print_dev/http/php/mod_gazetteerMetadata_search.php
===================================================================
--- branches/print_dev/http/php/mod_gazetteerMetadata_search.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_gazetteerMetadata_search.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,125 +1,125 @@
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
-$json = new Mapbender_JSON();
-
-$user_id = $_SESSION["mb_user_id"];
-$query = stripslashes($_REQUEST["search"]);
-$srs = stripslashes($_REQUEST["srs"]);
-
-if (!preg_match("/^[a-zA-Z_\- ]+$/", $query)) {
-	echo "[]"; die;
-}
-
-if (!preg_match("/^[a-zA-Z_\-:0-9 ]+$/", $srs)) {
-	echo "[]"; die;
-}
-
-$n = new administration();
-$myguis = $n->getGuisByPermission($user_id, true);
-$mywms = $n->getWmsByOwnGuis($myguis);
-
-if($mywms == false){
-	$mywms = array();	
-}
-$mylayer = array();
-
-for($i = 0; $i < count($mywms); $i++){
-	$mylayer = array_merge($mylayer,$n->getLayerByWms($mywms[$i]));
-}
-
-$res_container_wms = array();
-$res_container_layer = array();
-$obj = array();
-
-if(preg_match("/\*/",$_REQUEST["search"])){
-	$search = trim(preg_replace("/\*/i","", $_REQUEST["search"]));
-}
-
-if (count($mywms) > 0) {
-	$v = array();   
-	$t = array();   
-
-	$sql_wms = "SELECT DISTINCT layer.layer_id, wms.wms_title, " . 
-		"wms.wms_getcapabilities, wms.wms_version, " . 
-		"e.minx, e.miny, e.maxx, e.maxy " . 
-		"FROM wms LEFT JOIN layer ON wms.wms_id = layer.fkey_wms_id " . 
-		"LEFT JOIN layer_epsg e ON layer.layer_id = e.fkey_layer_id " . 
-		"AND e.epsg = '$srs' " . 
-		"WHERE layer.layer_pos = 0 AND wms.wms_id IN ("; 
-	for($i=0; $i<count($mywms); $i++){
-		if ($i > 0) {$sql_wms .= ",";}
-		$sql_wms .= "$".($i+1);
-		array_push($v, $mywms[$i]);
-		array_push($t, 'i');   
-	}
-	$sql_wms .= ") AND (wms_title ILIKE '%".$query."%' OR wms_abstract ILIKE '%".$query."%') ORDER BY wms_title";
-	$res_wms = db_prep_query($sql_wms,$v,$t);
-
-	while ($row = db_fetch_array($res_wms)) {
-		array_push($obj, array(
-			'wms_getcapabilities' => $row['wms_getcapabilities'], 
-			'wms_version' => $row['wms_version'], 
-			'layer_id' => $row['layer_id'], 
-			'title' => $row['wms_title'],
-			'extent' => array(
-				$row['minx'],
-				$row['miny'],
-				$row['maxx'],
-				$row['maxy']
-			)
-		));
-	}
-}
-
-if (count($mylayer) > 0) {
-	$v = array();   
-	$t = array();   
-	$sql_layer = "SELECT DISTINCT l.layer_id, l.fkey_wms_id, l.layer_title, " . 
-		"l.layer_name, w.wms_getcapabilities, w.wms_version, " . 
-		"e.minx, e.miny, e.maxx, e.maxy " . 
-		"FROM layer l LEFT JOIN layer_keyword lkw " . 
-		"LEFT JOIN keyword kw ON kw.keyword_id = lkw.fkey_keyword_id " . 
-		"ON l.layer_id = lkw.fkey_layer_id " . 
-		"LEFT JOIN wms w ON l.fkey_wms_id = w.wms_id " . 
-		"LEFT JOIN layer_epsg e ON l.layer_id = e.fkey_layer_id " . 
-		"AND e.epsg = '$srs' " . 
-		"WHERE l.layer_id IN (";
-
-	for($i = 0; $i < count($mylayer); $i++){
-		if ($i > 0) {$sql_layer .= ",";}
-		$sql_layer .= "$".($i+1);
-		array_push($v, $mylayer[$i]);
-		array_push($t, 'i');   
-	}
-
-	$sql_layer .= ") AND (" . 
-		"layer_title ILIKE '%".$query."%' OR " . 
-		"layer_name ILIKE '%".$query."%' OR " . 
-		"layer_abstract ILIKE '%".$query."%' OR " . 
-		"kw.keyword ILIKE '%".$query."%') ";
-	$sql_layer .= "ORDER BY l.layer_title;";
-	$res_layer = db_prep_query($sql_layer,$v,$t);
-
-
-	while ($row = db_fetch_array($res_layer)) {
-		array_push($obj, array(
-			'wms_getcapabilities' => $row['wms_getcapabilities'], 
-			'wms_version' => $row['wms_version'], 
-			'layer_name' => $row['layer_name'], 
-			'layer_id' => $row['layer_id'], 
-			'title' => $row['layer_title'],
-			'extent' => array(
-				$row['minx'],
-				$row['miny'],
-				$row['maxx'],
-				$row['maxy']
-			)
-		));
-	}
-}
-$output = $json->encode($obj);
-echo $output;
-?>
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+$json = new Mapbender_JSON();
+
+$user_id = $_SESSION["mb_user_id"];
+$query = stripslashes($_REQUEST["search"]);
+$srs = stripslashes($_REQUEST["srs"]);
+
+if (!preg_match("/^[a-zA-Z_\- ]+$/", $query)) {
+	echo "[]"; die;
+}
+
+if (!preg_match("/^[a-zA-Z_\-:0-9 ]+$/", $srs)) {
+	echo "[]"; die;
+}
+
+$n = new administration();
+$myguis = $n->getGuisByPermission($user_id, true);
+$mywms = $n->getWmsByOwnGuis($myguis);
+
+if($mywms == false){
+	$mywms = array();	
+}
+$mylayer = array();
+
+for($i = 0; $i < count($mywms); $i++){
+	$mylayer = array_merge($mylayer,$n->getLayerByWms($mywms[$i]));
+}
+
+$res_container_wms = array();
+$res_container_layer = array();
+$obj = array();
+
+if(preg_match("/\*/",$_REQUEST["search"])){
+	$search = trim(preg_replace("/\*/i","", $_REQUEST["search"]));
+}
+
+if (count($mywms) > 0) {
+	$v = array();   
+	$t = array();   
+
+	$sql_wms = "SELECT DISTINCT layer.layer_id, wms.wms_title, " . 
+		"wms.wms_getcapabilities, wms.wms_version, " . 
+		"e.minx, e.miny, e.maxx, e.maxy " . 
+		"FROM wms LEFT JOIN layer ON wms.wms_id = layer.fkey_wms_id " . 
+		"LEFT JOIN layer_epsg e ON layer.layer_id = e.fkey_layer_id " . 
+		"AND e.epsg = '$srs' " . 
+		"WHERE layer.layer_pos = 0 AND wms.wms_id IN ("; 
+	for($i=0; $i<count($mywms); $i++){
+		if ($i > 0) {$sql_wms .= ",";}
+		$sql_wms .= "$".($i+1);
+		array_push($v, $mywms[$i]);
+		array_push($t, 'i');   
+	}
+	$sql_wms .= ") AND (wms_title ILIKE '%".$query."%' OR wms_abstract ILIKE '%".$query."%') ORDER BY wms_title";
+	$res_wms = db_prep_query($sql_wms,$v,$t);
+
+	while ($row = db_fetch_array($res_wms)) {
+		array_push($obj, array(
+			'wms_getcapabilities' => $row['wms_getcapabilities'], 
+			'wms_version' => $row['wms_version'], 
+			'layer_id' => $row['layer_id'], 
+			'title' => $row['wms_title'],
+			'extent' => array(
+				$row['minx'],
+				$row['miny'],
+				$row['maxx'],
+				$row['maxy']
+			)
+		));
+	}
+}
+
+if (count($mylayer) > 0) {
+	$v = array();   
+	$t = array();   
+	$sql_layer = "SELECT DISTINCT l.layer_id, l.fkey_wms_id, l.layer_title, " . 
+		"l.layer_name, w.wms_getcapabilities, w.wms_version, " . 
+		"e.minx, e.miny, e.maxx, e.maxy " . 
+		"FROM layer l LEFT JOIN layer_keyword lkw " . 
+		"LEFT JOIN keyword kw ON kw.keyword_id = lkw.fkey_keyword_id " . 
+		"ON l.layer_id = lkw.fkey_layer_id " . 
+		"LEFT JOIN wms w ON l.fkey_wms_id = w.wms_id " . 
+		"LEFT JOIN layer_epsg e ON l.layer_id = e.fkey_layer_id " . 
+		"AND e.epsg = '$srs' " . 
+		"WHERE l.layer_id IN (";
+
+	for($i = 0; $i < count($mylayer); $i++){
+		if ($i > 0) {$sql_layer .= ",";}
+		$sql_layer .= "$".($i+1);
+		array_push($v, $mylayer[$i]);
+		array_push($t, 'i');   
+	}
+
+	$sql_layer .= ") AND (" . 
+		"layer_title ILIKE '%".$query."%' OR " . 
+		"layer_name ILIKE '%".$query."%' OR " . 
+		"layer_abstract ILIKE '%".$query."%' OR " . 
+		"kw.keyword ILIKE '%".$query."%') ";
+	$sql_layer .= "ORDER BY l.layer_title;";
+	$res_layer = db_prep_query($sql_layer,$v,$t);
+
+
+	while ($row = db_fetch_array($res_layer)) {
+		array_push($obj, array(
+			'wms_getcapabilities' => $row['wms_getcapabilities'], 
+			'wms_version' => $row['wms_version'], 
+			'layer_name' => $row['layer_name'], 
+			'layer_id' => $row['layer_id'], 
+			'title' => $row['layer_title'],
+			'extent' => array(
+				$row['minx'],
+				$row['miny'],
+				$row['maxx'],
+				$row['maxy']
+			)
+		));
+	}
+}
+$output = $json->encode($obj);
+echo $output;
+?>

Modified: branches/print_dev/http/php/mod_gazetteerSQL_server.php
===================================================================
--- branches/print_dev/http/php/mod_gazetteerSQL_server.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_gazetteerSQL_server.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,199 +1,199 @@
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../../conf/gazetteerSQL.conf");
-
-$con = 	pg_connect($connstring);		
-
-$command = $_GET["command"];
-$communeId = $_GET["communeId"];
-$streetName = $_GET["streetName"];
-$districtId = $_GET["districtId"];
-$parcelNumber1 = $_GET["parcelNumber1"];
-$parcelNumber2 = $_GET["parcelNumber2"];
-$ownerQueryString = $_GET["ownerQueryString"];
-$numberOfResults = $_GET["numberOfResults"];
-
-if (isLimited($numberOfResults)) {
-	$limit = $numberOfResults + 1; 
-}
-else {
-	$limit = 0;
-}
-
-$obj = array();
-
-function isLimited($numberOfResults) {
-	if (isset($numberOfResults) && $numberOfResults > 0) {
-		return true;
-	}
-	return false;
-}
-
-function isUnderLimit($counter, $numberOfResults, $max) {
-	return (!isLimited($numberOfResults) || $counter <= $max);
-}
-
-function isOverLimit($counter, $numberOfResults, $max) {
-	return (isLimited($numberOfResults) && $counter > $max);
-}
-
-if ($command == "getCommunes") {
-	$obj["communes"] = array();
-
-	$sql = "SELECT DISTINCT gkz, name FROM public.gemeinden ORDER BY name";
-	$v = array();
-	$t = array();
-	$res = db_prep_query($sql, $v, $t);
-	while($row = db_fetch_array($res)){
-		$communeId = trim($row["gkz"]);
-		$communeName = trim($row["name"]);
-		$obj["communes"][$communeId] = $communeName;
-	}
-	$obj["limited"] = false;
-}
-else if ($command == "getStreets") {
-	$obj["streets"] = array();
-
-	if (!empty($communeId)) {
-		$sql = "SELECT DISTINCT strk_schl, str_name FROM alb.navigation WHERE gkz = $1 ORDER BY str_name";
-		$v = array($communeId);
-		$t = array("i");
-	}
-	else {
-		$sql = "SELECT DISTINCT strk_schl, str_name FROM alb.navigation ORDER BY str_name";
-		$v = array();
-		$t = array();
-	}
-	$res = db_prep_query($sql, $v, $t);
-	while($row = db_fetch_array($res)){
-		$streetId = trim($row["strk_schl"]);
-		$streetName = trim($row["str_name"]);
-		$obj["streets"][$streetId] = $streetName;
-	}
-	$obj["limited"] = false;
-}
-else if ($command == "getNumbers") {
-	$obj["houseNumbers"] = array();
-	$paramCounter = 0;
-	
-	if (!empty($communeId)) {
-		$sql = "SELECT DISTINCT hnr, hnrzu, rw, hw FROM alb.navigation WHERE gkz = $". ++$paramCount ." AND str_name ILIKE $". ++$paramCount ." ORDER BY hnr, hnrzu";
-		$v = array($communeId, $streetName."%");
-		$t = array("i", "s");
-	}
-	else {
-		$sql = "SELECT DISTINCT hnr, hnrzu, rw, hw FROM alb.navigation WHERE str_name ILIKE $". ++$paramCount ." ORDER BY hnr, hnrzu";
-		$v = array($streetName."%");
-		$t = array("s");
-	}
-
-	if (isLimited($numberOfResults)) {
-		$sql .= " LIMIT $". ++$paramCount;
-		array_push($v, $limit);
-		array_push($t, "i");
-	}
-
-	$res = db_prep_query($sql, $v, $t);
-
-	$counter = 0;
-	while($row = db_fetch_array($res)){
-		$counter++;
-		if (isUnderLimit($counter, $numberOfResults, $numberOfResults)) {
-			$houseNumber = trim($row["hnr"] . $row["hnrzu"]);
-			$x = trim(floatval($row["rw"]));
-			$y = trim(floatval($row["hw"]));
-			$obj["houseNumbers"][$houseNumber] = array("x" => $x, "y" => $y);
-		}
-	}
-	$obj["limited"] = isOverLimit($counter, $numberOfResults, $numberOfResults);
-}
-else if ($command == "getLandparcelsByOwner") {
-	$obj["landparcels"] = array();
-
-	$sql = "SELECT DISTINCT eig.e_name, flst.flst_kennz, flst.rechtsw, flst.hochw FROM alb.albflst AS flst JOIN alb.albeig AS eig ON (flst.gemschl = eig.gemschl AND flst.flur = eig.flur AND flst.flstz = eig.flstz AND flst.flstn = eig.flstn) JOIN public.gemarkungen AS gem ON (flst.gemschl = gem.gemschl) WHERE gem.gkz = $1 AND eig.e_name ILIKE $2 ORDER BY flst.flst_kennz";
-	$v = array($communeId, "%".$ownerQueryString."%");
-	$t = array("i", "s");
-
-	if (isLimited($numberOfResults)) {
-		$sql .= " LIMIT $3";
-		array_push($v, $limit);
-		array_push($t, "i");
-	}
-	$res = db_prep_query($sql, $v, $t);
-
-	$counter = 0;
-	while($row = db_fetch_array($res)){
-		$counter++;
-		if (isUnderLimit($counter, $numberOfResults, $numberOfResults)) {
-			$landparcelId = $row["flst_kennz"];
-			$x = trim(floatval($row["rechtsw"]));
-			$y = trim(floatval($row["hochw"]));
-			$owner = trim($row["e_name"]);
-			array_push($obj["landparcels"], array("landparcelId" => $landparcelId, "owner" => $owner, "x" => $x, "y" => $y));
-		}
-	}
-	$obj["limited"] = isOverLimit($counter, $numberOfResults, $numberOfResults);
-}
-else if ($command == "getLandparcelsByDistrict") {
-	$obj["landparcels"] = array();
-	$paramCounter = 0;
-
-	$sql = "SELECT DISTINCT flst_kennz, rechtsw, hochw FROM alb.albflst WHERE gemschl = $" . ++$paramCounter;
-	$v = array($districtId);
-	$t = array("i");
-	if (!empty($parcelNumber1)) {
-		$sql .= " AND flur = $" . ++$paramCounter;
-		array_push($v, $parcelNumber1);
-		array_push($t, "i");
-	}
-	if (!empty($parcelNumber2)) {
-		$sql .= " AND flstz = $" . ++$paramCounter;
-		array_push($v, $parcelNumber2);
-		array_push($t, "i");
-	}
-	$sql .= " ORDER BY flst_kennz";
-	if (isLimited($numberOfResults)) {
-		$sql .= " LIMIT $" . ++$paramCounter;
-		array_push($v, $limit);
-		array_push($t, "i");
-	}
-	$res = db_prep_query($sql, $v, $t);
-
-	$counter = 0;
-	while($row = db_fetch_array($res)){
-		$counter++;
-		if (isUnderLimit($counter, $numberOfResults, $numberOfResults)) {
-			$landparcelId = $row["flst_kennz"];
-			$x = trim(floatval($row["rechtsw"]));
-			$y = trim(floatval($row["hochw"]));
-
-			$obj["landparcels"][$landparcelId] = array("x" => $x, "y" => $y);
-		}
-	}
-	$obj["limited"] = isOverLimit($counter, $numberOfResults, $numberOfResults);
-}
-else if ($command == "getDistricts") {
-	$obj["districts"] = array();
-
-	$sql = "SELECT DISTINCT gemschl, name FROM public.gemarkungen WHERE gkz = $1 ORDER BY name";
-	$v = array($communeId);
-	$t = array("i");
-	$res = db_prep_query($sql, $v, $t);
-
-	while($row = db_fetch_array($res)){
-		$districtID = trim($row["gemschl"]);
-		$districtName = trim($row["name"]);
-		$obj["districts"][$districtID] = $districtName;
-	}
-	$obj["limited"] = false;
-}
-else {
-	// unknown command
-	$e = new mb_exception("unknown command: " . $command);
-}
-
-$json = new Mapbender_JSON();
-$output = $json->encode($obj);
-echo $output;
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../../conf/gazetteerSQL.conf");
+
+$con = 	pg_connect($connstring);		
+
+$command = $_GET["command"];
+$communeId = $_GET["communeId"];
+$streetName = $_GET["streetName"];
+$districtId = $_GET["districtId"];
+$parcelNumber1 = $_GET["parcelNumber1"];
+$parcelNumber2 = $_GET["parcelNumber2"];
+$ownerQueryString = $_GET["ownerQueryString"];
+$numberOfResults = $_GET["numberOfResults"];
+
+if (isLimited($numberOfResults)) {
+	$limit = $numberOfResults + 1; 
+}
+else {
+	$limit = 0;
+}
+
+$obj = array();
+
+function isLimited($numberOfResults) {
+	if (isset($numberOfResults) && $numberOfResults > 0) {
+		return true;
+	}
+	return false;
+}
+
+function isUnderLimit($counter, $numberOfResults, $max) {
+	return (!isLimited($numberOfResults) || $counter <= $max);
+}
+
+function isOverLimit($counter, $numberOfResults, $max) {
+	return (isLimited($numberOfResults) && $counter > $max);
+}
+
+if ($command == "getCommunes") {
+	$obj["communes"] = array();
+
+	$sql = "SELECT DISTINCT gkz, name FROM public.gemeinden ORDER BY name";
+	$v = array();
+	$t = array();
+	$res = db_prep_query($sql, $v, $t);
+	while($row = db_fetch_array($res)){
+		$communeId = trim($row["gkz"]);
+		$communeName = trim($row["name"]);
+		$obj["communes"][$communeId] = $communeName;
+	}
+	$obj["limited"] = false;
+}
+else if ($command == "getStreets") {
+	$obj["streets"] = array();
+
+	if (!empty($communeId)) {
+		$sql = "SELECT DISTINCT strk_schl, str_name FROM alb.navigation WHERE gkz = $1 ORDER BY str_name";
+		$v = array($communeId);
+		$t = array("i");
+	}
+	else {
+		$sql = "SELECT DISTINCT strk_schl, str_name FROM alb.navigation ORDER BY str_name";
+		$v = array();
+		$t = array();
+	}
+	$res = db_prep_query($sql, $v, $t);
+	while($row = db_fetch_array($res)){
+		$streetId = trim($row["strk_schl"]);
+		$streetName = trim($row["str_name"]);
+		$obj["streets"][$streetId] = $streetName;
+	}
+	$obj["limited"] = false;
+}
+else if ($command == "getNumbers") {
+	$obj["houseNumbers"] = array();
+	$paramCounter = 0;
+	
+	if (!empty($communeId)) {
+		$sql = "SELECT DISTINCT hnr, hnrzu, rw, hw FROM alb.navigation WHERE gkz = $". ++$paramCount ." AND str_name ILIKE $". ++$paramCount ." ORDER BY hnr, hnrzu";
+		$v = array($communeId, $streetName."%");
+		$t = array("i", "s");
+	}
+	else {
+		$sql = "SELECT DISTINCT hnr, hnrzu, rw, hw FROM alb.navigation WHERE str_name ILIKE $". ++$paramCount ." ORDER BY hnr, hnrzu";
+		$v = array($streetName."%");
+		$t = array("s");
+	}
+
+	if (isLimited($numberOfResults)) {
+		$sql .= " LIMIT $". ++$paramCount;
+		array_push($v, $limit);
+		array_push($t, "i");
+	}
+
+	$res = db_prep_query($sql, $v, $t);
+
+	$counter = 0;
+	while($row = db_fetch_array($res)){
+		$counter++;
+		if (isUnderLimit($counter, $numberOfResults, $numberOfResults)) {
+			$houseNumber = trim($row["hnr"] . $row["hnrzu"]);
+			$x = trim(floatval($row["rw"]));
+			$y = trim(floatval($row["hw"]));
+			$obj["houseNumbers"][$houseNumber] = array("x" => $x, "y" => $y);
+		}
+	}
+	$obj["limited"] = isOverLimit($counter, $numberOfResults, $numberOfResults);
+}
+else if ($command == "getLandparcelsByOwner") {
+	$obj["landparcels"] = array();
+
+	$sql = "SELECT DISTINCT eig.e_name, flst.flst_kennz, flst.rechtsw, flst.hochw FROM alb.albflst AS flst JOIN alb.albeig AS eig ON (flst.gemschl = eig.gemschl AND flst.flur = eig.flur AND flst.flstz = eig.flstz AND flst.flstn = eig.flstn) JOIN public.gemarkungen AS gem ON (flst.gemschl = gem.gemschl) WHERE gem.gkz = $1 AND eig.e_name ILIKE $2 ORDER BY flst.flst_kennz";
+	$v = array($communeId, "%".$ownerQueryString."%");
+	$t = array("i", "s");
+
+	if (isLimited($numberOfResults)) {
+		$sql .= " LIMIT $3";
+		array_push($v, $limit);
+		array_push($t, "i");
+	}
+	$res = db_prep_query($sql, $v, $t);
+
+	$counter = 0;
+	while($row = db_fetch_array($res)){
+		$counter++;
+		if (isUnderLimit($counter, $numberOfResults, $numberOfResults)) {
+			$landparcelId = $row["flst_kennz"];
+			$x = trim(floatval($row["rechtsw"]));
+			$y = trim(floatval($row["hochw"]));
+			$owner = trim($row["e_name"]);
+			array_push($obj["landparcels"], array("landparcelId" => $landparcelId, "owner" => $owner, "x" => $x, "y" => $y));
+		}
+	}
+	$obj["limited"] = isOverLimit($counter, $numberOfResults, $numberOfResults);
+}
+else if ($command == "getLandparcelsByDistrict") {
+	$obj["landparcels"] = array();
+	$paramCounter = 0;
+
+	$sql = "SELECT DISTINCT flst_kennz, rechtsw, hochw FROM alb.albflst WHERE gemschl = $" . ++$paramCounter;
+	$v = array($districtId);
+	$t = array("i");
+	if (!empty($parcelNumber1)) {
+		$sql .= " AND flur = $" . ++$paramCounter;
+		array_push($v, $parcelNumber1);
+		array_push($t, "i");
+	}
+	if (!empty($parcelNumber2)) {
+		$sql .= " AND flstz = $" . ++$paramCounter;
+		array_push($v, $parcelNumber2);
+		array_push($t, "i");
+	}
+	$sql .= " ORDER BY flst_kennz";
+	if (isLimited($numberOfResults)) {
+		$sql .= " LIMIT $" . ++$paramCounter;
+		array_push($v, $limit);
+		array_push($t, "i");
+	}
+	$res = db_prep_query($sql, $v, $t);
+
+	$counter = 0;
+	while($row = db_fetch_array($res)){
+		$counter++;
+		if (isUnderLimit($counter, $numberOfResults, $numberOfResults)) {
+			$landparcelId = $row["flst_kennz"];
+			$x = trim(floatval($row["rechtsw"]));
+			$y = trim(floatval($row["hochw"]));
+
+			$obj["landparcels"][$landparcelId] = array("x" => $x, "y" => $y);
+		}
+	}
+	$obj["limited"] = isOverLimit($counter, $numberOfResults, $numberOfResults);
+}
+else if ($command == "getDistricts") {
+	$obj["districts"] = array();
+
+	$sql = "SELECT DISTINCT gemschl, name FROM public.gemarkungen WHERE gkz = $1 ORDER BY name";
+	$v = array($communeId);
+	$t = array("i");
+	$res = db_prep_query($sql, $v, $t);
+
+	while($row = db_fetch_array($res)){
+		$districtID = trim($row["gemschl"]);
+		$districtName = trim($row["name"]);
+		$obj["districts"][$districtID] = $districtName;
+	}
+	$obj["limited"] = false;
+}
+else {
+	// unknown command
+	$e = new mb_exception("unknown command: " . $command);
+}
+
+$json = new Mapbender_JSON();
+$output = $json->encode($obj);
+echo $output;
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_layerMetadata.php
===================================================================
--- branches/print_dev/http/php/mod_layerMetadata.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_layerMetadata.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,181 +1,181 @@
-<?php
-# $Id: mod_layerMetadata.php 235 2006-05-11 08:34:48Z uli $
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-$redirectToMetadataUrl = $_GET["redirectToMetadataUrl"];
-
-function display_text($string) {
-    $string = mb_eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);   
-    $string = mb_eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);   
-    $string = mb_eregi_replace("\n", "<br>", $string);
-    return $string;
-}  
-
-function getEpsgByLayerId ($layer_id) { // from merge_layer.php
-	$epsg_list = "";
-	$sql = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id = $1";
-	$v = array($layer_id);
-	$t = array('i');
-	$res = db_prep_query($sql, $v, $t);
-	while($row = db_fetch_array($res)){
-		$epsg_list .= $row['epsg'] . " ";
-	}
-	return trim($epsg_list);
-}
-$metadataStr = "";
-$metadataStr .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">' . 
-	'<head>' . 
-		'<title>Metadaten</title>' . 
-		'<meta name="description" content="Metadaten" xml:lang="de" />'.
-		'<meta name="keywords" content="Metadaten" xml:lang="de" />'	.	
-		'<meta http-equiv="cache-control" content="no-cache">'.
-		'<meta http-equiv="pragma" content="no-cache">'.
-		'<meta http-equiv="expires" content="0">'.
-		'<meta http-equiv="content-language" content="de" />'.
-		'<meta http-equiv="content-style-type" content="text/css" />'.
-		'<link rel="stylesheet" type="text/css" href="../css/metadata.css" />' .
-		'<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">' . 	
-	'</head>'.
-	'<body>';
-	$layer_id = $_GET['id'];
-	$wms_getmap = urldecode($_GET['wms']); 
-	$layer_name = urldecode($_GET['name']); 
-	
-	if ($layer_id) {
-		$sql = "SELECT ";
-		$sql .= "layer.layer_id, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, ";
-		$sql .= "layer.layer_minscale, layer.layer_maxscale, layer_dataurl, layer_metadataurl, ";
-		$sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
-		$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp, wms_owner, ";
-		$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
-		$sql .= "wms.contactelectronicmailaddress, wms.country ";
-		$sql .= "FROM layer, wms WHERE layer.layer_id = $1 AND layer.fkey_wms_id = wms.wms_id LIMIT 1";
-		$v = array($layer_id);
-		$t = array('i');
-	}
-	else if ($wms_getmap && $layer_name) {
-		$sql = "SELECT ";
-		$sql .= "layer.layer_id, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, ";
-		$sql .= "layer.layer_minscale, layer.layer_maxscale, layer_dataurl, layer_metadataurl, ";
-		$sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
-		$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp, wms_owner, ";
-		$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
-		$sql .= "wms.contactelectronicmailaddress, wms.country ";
-		$sql .= "FROM layer, wms WHERE layer.layer_pos <> 0 AND layer.layer_name = $1 AND layer.fkey_wms_id = wms.wms_id AND wms.wms_getmap LIKE $2 LIMIT 1";
-		$v = array($layer_name, $wms_getmap."%");
-		$t = array('s', 's');
-	}
-	else die("layer not specified!");
-	$res = db_prep_query($sql,$v,$t);
-	$metadataStr .=  db_error();
-	$layer = array();
-	$row = db_fetch_array($res);
-	$layer_id = $row['layer_id'];
-
-	$sql_dep = "SELECT mb_group_name FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1  AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND b.mb_user_department = a.mb_group_description LIMIT 1";
-	$v_dep = array($row['wms_owner']);
-	$t_dep = array('i');
-	$res_dep = db_prep_query($sql_dep, $v_dep, $t_dep);
-	$row_dep = db_fetch_array($res_dep);
-	
-
-	$layer['ID'] = $row['layer_id'];
-	$layer['Titel'] = $row['layer_title'];
-	$layer['Zusammenfassung'] = $row['layer_abstract'];
-	if ($row['layer_pos'] || $row['layer_parent']) {
-	  if ($row['layer_minscale'] > 0)
-		{
-		$layer['Minscale'] = "1 : ". $row['layer_minscale'];
-		}
-		else
-		{$layer['Minscale'] = "-";}
-		if ($row['layer_maxscale'] > 0)
-		{
-		$layer['Maxscale'] = "1 : ". $row['layer_maxscale'];
-		}
-		else
-		{$layer['Maxscale'] = "-";}
-	}
-	$layer['Koordinatensysteme'] = preg_replace("/ /", ", ", getEpsgByLayerId($row['layer_id']));
-//	$layer['Capabilities-Dokument'] = "<a href = '../x_geoportal/getCapabilities_document.php?wms_request=".$row['wms_id']."&layer_request=".$row['layer_pos']."' target=_blank>Capabilities-Dokument</a>";
-	if ($row['wms_timestamp']) {
-		$layer['Datum der Registrierung'] = date("d.m.Y",$row['wms_timestamp']); 
-	}
-	else {
-		$layer['Datum der Registrierung'] = "Keine Angabe"; 
-	}
-	$layer['Registrierende Stelle'] = $row_dep['mb_group_name'];
-	$layer['WMS ID'] = $row['wms_id'];
-	$layer['WMS Titel'] = $row['wms_title'];
-	$layer['WMS Zusammenfassung'] = $row['wms_abstract'];
-	$layer['Geb&uuml;hren'] = $row['fees'];
-	$layer['Zugriffsbeschr&auml;nkung'] = $row['accessconstraints'];
-	$layer['Ansprechpartner'] = $row['contactperson'];
-	$layer['Organisation'] = $row['contactorganization'];
-	$layer['Adresse'] = $row['address'];
-	$layer['Stadt'] = $row['city'];
-	$layer['Bundesland'] = $row['stateorprovince'];
-	$layer['PLZ'] = $row['postcode'];
-	$layer['Telefon'] = $row['contactvoicetelephone'];
-	$layer['Fax'] = $row['contactfacsimiletelephone'];
-	$layer['E-Mail'] = $row['contactelectronicmailaddress'];
-	$layer['Land'] = $row['country'];
-	$layer['Metadaten'] = $row['layer_metadataurl'];
-	$metadataUrl = $row['layer_metadataurl'];
-
-	if ($layer['Metadaten'] && $redirectToMetadataUrl) {
-		header("Location: " . $layer['Metadaten']);		
-	}	
-	else {
-		$metadataStr .=  "<table >\n";
-		$t_a = "\t<tr>\n\t\t<th>\n\t\t\t";
-		$t_b = "\n\t\t</th>\n\t\t<td>\n\t\t\t";
-		$t_c = "\n\t\t</td>\n\t</tr>\n";
-	
-		$keys = array_keys($layer);
-		for ($j=0; $j<count($layer); $j++) {
-			$metadataStr .=  $t_a . $keys[$j] . $t_b . display_text($layer[$keys[$j]]) . $t_c;
-		}
-	
-		if (!$row['layer_pos'] && !$row['layer_parent']) {
-			$wms_id = $row['wms_id'];
-			$sql = "SELECT layer.layer_title, layer.layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_pos <> 0";
-			$v = array($wms_id);
-			$t = array('i');
-			$res = db_prep_query($sql,$v,$t);
-			$i=0;
-			$layer = array();
-			while ($row = db_fetch_array($res)) {
-				$layer[$i] = array();
-				$layer[$i]['Titel'] = $row['layer_title'];
-				$layer[$i]['id'] = $row['layer_id'];
-				$i++;
-			}
-			$metadataStr .=  "<tr><th>Ebenen</th><td>";
-			for ($i=0; $i<count($layer); $i++) {
-				if ($i >0) $metadataStr .=  ", ";
-				$metadataStr .=  "<a href='mod_layerMetadata.php?id=".$layer[$i]['id']."'>" . $layer[$i]['Titel'] . "</a>";
-			}
-		}	
-		$metadataStr .=  "</td></tr></table>\n";
-		$metadataStr .=  '</div></body></html>';
-		echo $metadataStr;
-	}
-?>
+<?php
+# $Id: mod_layerMetadata.php 235 2006-05-11 08:34:48Z uli $
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+$redirectToMetadataUrl = $_GET["redirectToMetadataUrl"];
+
+function display_text($string) {
+    $string = mb_eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);   
+    $string = mb_eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);   
+    $string = mb_eregi_replace("\n", "<br>", $string);
+    return $string;
+}  
+
+function getEpsgByLayerId ($layer_id) { // from merge_layer.php
+	$epsg_list = "";
+	$sql = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id = $1";
+	$v = array($layer_id);
+	$t = array('i');
+	$res = db_prep_query($sql, $v, $t);
+	while($row = db_fetch_array($res)){
+		$epsg_list .= $row['epsg'] . " ";
+	}
+	return trim($epsg_list);
+}
+$metadataStr = "";
+$metadataStr .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">' . 
+	'<head>' . 
+		'<title>Metadaten</title>' . 
+		'<meta name="description" content="Metadaten" xml:lang="de" />'.
+		'<meta name="keywords" content="Metadaten" xml:lang="de" />'	.	
+		'<meta http-equiv="cache-control" content="no-cache">'.
+		'<meta http-equiv="pragma" content="no-cache">'.
+		'<meta http-equiv="expires" content="0">'.
+		'<meta http-equiv="content-language" content="de" />'.
+		'<meta http-equiv="content-style-type" content="text/css" />'.
+		'<link rel="stylesheet" type="text/css" href="../css/metadata.css" />' .
+		'<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">' . 	
+	'</head>'.
+	'<body>';
+	$layer_id = $_GET['id'];
+	$wms_getmap = urldecode($_GET['wms']); 
+	$layer_name = urldecode($_GET['name']); 
+	
+	if ($layer_id) {
+		$sql = "SELECT ";
+		$sql .= "layer.layer_id, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, ";
+		$sql .= "layer.layer_minscale, layer.layer_maxscale, layer_dataurl, layer_metadataurl, ";
+		$sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
+		$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp, wms_owner, ";
+		$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
+		$sql .= "wms.contactelectronicmailaddress, wms.country ";
+		$sql .= "FROM layer, wms WHERE layer.layer_id = $1 AND layer.fkey_wms_id = wms.wms_id LIMIT 1";
+		$v = array($layer_id);
+		$t = array('i');
+	}
+	else if ($wms_getmap && $layer_name) {
+		$sql = "SELECT ";
+		$sql .= "layer.layer_id, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, ";
+		$sql .= "layer.layer_minscale, layer.layer_maxscale, layer_dataurl, layer_metadataurl, ";
+		$sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
+		$sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, wms_timestamp, wms_owner, ";
+		$sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
+		$sql .= "wms.contactelectronicmailaddress, wms.country ";
+		$sql .= "FROM layer, wms WHERE layer.layer_pos <> 0 AND layer.layer_name = $1 AND layer.fkey_wms_id = wms.wms_id AND wms.wms_getmap LIKE $2 LIMIT 1";
+		$v = array($layer_name, $wms_getmap."%");
+		$t = array('s', 's');
+	}
+	else die("layer not specified!");
+	$res = db_prep_query($sql,$v,$t);
+	$metadataStr .=  db_error();
+	$layer = array();
+	$row = db_fetch_array($res);
+	$layer_id = $row['layer_id'];
+
+	$sql_dep = "SELECT mb_group_name FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1  AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND b.mb_user_department = a.mb_group_description LIMIT 1";
+	$v_dep = array($row['wms_owner']);
+	$t_dep = array('i');
+	$res_dep = db_prep_query($sql_dep, $v_dep, $t_dep);
+	$row_dep = db_fetch_array($res_dep);
+	
+
+	$layer['ID'] = $row['layer_id'];
+	$layer['Titel'] = $row['layer_title'];
+	$layer['Zusammenfassung'] = $row['layer_abstract'];
+	if ($row['layer_pos'] || $row['layer_parent']) {
+	  if ($row['layer_minscale'] > 0)
+		{
+		$layer['Minscale'] = "1 : ". $row['layer_minscale'];
+		}
+		else
+		{$layer['Minscale'] = "-";}
+		if ($row['layer_maxscale'] > 0)
+		{
+		$layer['Maxscale'] = "1 : ". $row['layer_maxscale'];
+		}
+		else
+		{$layer['Maxscale'] = "-";}
+	}
+	$layer['Koordinatensysteme'] = preg_replace("/ /", ", ", getEpsgByLayerId($row['layer_id']));
+//	$layer['Capabilities-Dokument'] = "<a href = '../x_geoportal/getCapabilities_document.php?wms_request=".$row['wms_id']."&layer_request=".$row['layer_pos']."' target=_blank>Capabilities-Dokument</a>";
+	if ($row['wms_timestamp']) {
+		$layer['Datum der Registrierung'] = date("d.m.Y",$row['wms_timestamp']); 
+	}
+	else {
+		$layer['Datum der Registrierung'] = "Keine Angabe"; 
+	}
+	$layer['Registrierende Stelle'] = $row_dep['mb_group_name'];
+	$layer['WMS ID'] = $row['wms_id'];
+	$layer['WMS Titel'] = $row['wms_title'];
+	$layer['WMS Zusammenfassung'] = $row['wms_abstract'];
+	$layer['Geb&uuml;hren'] = $row['fees'];
+	$layer['Zugriffsbeschr&auml;nkung'] = $row['accessconstraints'];
+	$layer['Ansprechpartner'] = $row['contactperson'];
+	$layer['Organisation'] = $row['contactorganization'];
+	$layer['Adresse'] = $row['address'];
+	$layer['Stadt'] = $row['city'];
+	$layer['Bundesland'] = $row['stateorprovince'];
+	$layer['PLZ'] = $row['postcode'];
+	$layer['Telefon'] = $row['contactvoicetelephone'];
+	$layer['Fax'] = $row['contactfacsimiletelephone'];
+	$layer['E-Mail'] = $row['contactelectronicmailaddress'];
+	$layer['Land'] = $row['country'];
+	$layer['Metadaten'] = $row['layer_metadataurl'];
+	$metadataUrl = $row['layer_metadataurl'];
+
+	if ($layer['Metadaten'] && $redirectToMetadataUrl) {
+		header("Location: " . $layer['Metadaten']);		
+	}	
+	else {
+		$metadataStr .=  "<table >\n";
+		$t_a = "\t<tr>\n\t\t<th>\n\t\t\t";
+		$t_b = "\n\t\t</th>\n\t\t<td>\n\t\t\t";
+		$t_c = "\n\t\t</td>\n\t</tr>\n";
+	
+		$keys = array_keys($layer);
+		for ($j=0; $j<count($layer); $j++) {
+			$metadataStr .=  $t_a . $keys[$j] . $t_b . display_text($layer[$keys[$j]]) . $t_c;
+		}
+	
+		if (!$row['layer_pos'] && !$row['layer_parent']) {
+			$wms_id = $row['wms_id'];
+			$sql = "SELECT layer.layer_title, layer.layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_pos <> 0";
+			$v = array($wms_id);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			$i=0;
+			$layer = array();
+			while ($row = db_fetch_array($res)) {
+				$layer[$i] = array();
+				$layer[$i]['Titel'] = $row['layer_title'];
+				$layer[$i]['id'] = $row['layer_id'];
+				$i++;
+			}
+			$metadataStr .=  "<tr><th>Ebenen</th><td>";
+			for ($i=0; $i<count($layer); $i++) {
+				if ($i >0) $metadataStr .=  ", ";
+				$metadataStr .=  "<a href='mod_layerMetadata.php?id=".$layer[$i]['id']."'>" . $layer[$i]['Titel'] . "</a>";
+			}
+		}	
+		$metadataStr .=  "</td></tr></table>\n";
+		$metadataStr .=  '</div></body></html>';
+		echo $metadataStr;
+	}
+?>

Modified: branches/print_dev/http/php/mod_loadCapabilitiesList.php
===================================================================
--- branches/print_dev/http/php/mod_loadCapabilitiesList.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_loadCapabilitiesList.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,307 +1,307 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-import_request_variables("PG");
-require(dirname(__FILE__)."/../php/mb_validatePermission.php");
-?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Load WMS from Catalog</title>
-<?php
-include '../include/dyn_css.php';
-?>
-<style type="text/css">
-  	<!--
-  	body{
-      background-color: #ffffff;
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080
-  	}
-  	.list_guis{
-  		font-family: Arial, Helvetica, sans-serif;
-  		font-size : 12px;
-  		color: #808080;
-  	}
-.text1{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:190px;
-}
-.select1{
-   position:absolute;
-   top:210px;
-   width:270px;
-}
-.text2{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:190px;
-   left:300px;
-}
-.select2{
-   position:absolute;
-   top:210px;
-   left:300px;
-}
-.getcapabilities{
-   font-family: Arial, Helvetica, sans-serif;
-   font-size : 15px;
-   position:absolute;
-   top:570px;
-}
-
-  	-->
-</style>
-<script language="JavaScript">
-function validate(wert){
-   if(wert == 'guiList'){
-      var listIndex = document.form1.guiList.selectedIndex;
-      if(listIndex<0){
-		   alert("Please select a GUI.");
-			return false;
-      }
-      else{
-         var gui_id=document.form1.guiList.options[listIndex].value;
-			document.form1.action='../php/mod_loadwms.php<?php echo SID;?>';
-			document.form1.submit();
-      }
-   }
-}
-function load(){
-      if(document.form1.guiList.selectedIndex<0){
-		   alert("Please select a GUI.");
-			return false;
-      }
-      var gui_ind = document.form1.guiList.selectedIndex;
-      var ind = document.form1.wmsID.selectedIndex;
-      var ind2 = document.form1.guiID_.selectedIndex;
-			var indexWMSList = document.form1.wmsID.selectedIndex;
-			var permission = true;
-
-			var selectedWmsId = document.form1.wmsID.options[document.form1.wmsID.selectedIndex].value;
-			for (i = 0; i < document.form1.wmsList.length; i++) {
-						if (document.form1.wmsList.options[i].value == selectedWmsId){
-							 permission = false;							 
-							 alert ('The WMS (' + selectedWmsId + ') is already loaded in this application.');
-							 break;
-						}
-			}			 
-			
-  			if (permission) { // only check if permission is not false 
-        	var loadConfirmed = confirm("Load " + document.form1.wmsID.options[ind].text + " FROM " + document.form1.guiID_.options[ind2].value + " INTO "+document.form1.guiList.options[gui_ind].value+" ?");
-          if(loadConfirmed){
-             document.form1.submit();
-          }
-          else{
-             document.form1.guiID_.selectedIndex = -1;
-          }
-			}	
-			
-}
-</script>
-</head>
-<body>
-
-<?php
-
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-$admin = new administration();
-$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
-
-
-
-###INSERT
-if(isset($wmsID) && isset($guiID_)){
-	$sql_pos = "SELECT MAX(gui_wms_position) AS my_gui_wms_position FROM gui_wms WHERE fkey_gui_id = $1";
-	$v = array($guiList);
-	$t = array('s');
-	$res_pos = db_prep_query($sql_pos,$v,$t);
-	if(db_result($res_pos,0,"my_gui_wms_position") > -1){
-		$gui_wms_position = db_result($res_pos,0,"my_gui_wms_position") + 1;
-	}
-	else{
-		$gui_wms_position = 0;
-	}
-
-	$sql = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
-	$v = array($guiID_,$wmsID);
-	$t = array('s','i');
-	$res = db_prep_query($sql,$v,$t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$sql_ins = "INSERT INTO gui_wms (fkey_gui_id,fkey_wms_id,gui_wms_position,gui_wms_mapformat,";
-		$sql_ins .= "gui_wms_featureinfoformat,gui_wms_exceptionformat,gui_wms_epsg,gui_wms_visible,gui_wms_opacity,gui_wms_sldurl) ";
-		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)";
-		$v = array($guiList,$wmsID,$gui_wms_position,$row["gui_wms_mapformat"],$row["gui_wms_featureinfoformat"],
-		$row["gui_wms_exceptionformat"],$row["gui_wms_epsg"],$row["gui_wms_visible"],$row["gui_wms_opacity"],$row["gui_wms_sldurl"]);
-		$t = array('s','i','i','s','s','s','s','i','i','s');
-		db_prep_query($sql_ins,$v,$t);
-		$cnt++;
-	}
-
-	$sql = "SELECT * FROM gui_layer WHERE fkey_gui_id = $1 AND gui_layer_wms_id = $2";
-	$v = array($guiID_, $wmsID);
-	$t = array("s", "i");
-	$res = db_prep_query($sql, $v, $t);
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		$sql_ins = "INSERT INTO gui_layer (fkey_gui_id,fkey_layer_id,gui_layer_wms_id,gui_layer_status,gui_layer_selectable,";
-		$sql_ins .= "gui_layer_visible,gui_layer_queryable,gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale,gui_layer_priority,gui_layer_style,gui_layer_wfs_featuretype) ";
-		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)";
-		$v = array($guiList,$row["fkey_layer_id"],$wmsID,$row["gui_layer_status"],$row["gui_layer_selectable"],
-		$row["gui_layer_visible"],$row["gui_layer_queryable"],$row["gui_layer_querylayer"],$row["gui_layer_minscale"],
-		$row["gui_layer_maxscale"],$row["gui_layer_priority"],$row["gui_layer_style"],$row["gui_layer_wfs_featuretype"]);
-		$t = array('s','i','i','i','i','i','i','i','i','i','i','s','s');
-		db_prep_query($sql_ins,$v,$t);
-		$cnt++;
-	}
-}
-
-echo "<form name='form1' action='" . $self."' method='post'>";
-
-echo "<table cellpadding='0' cellspacing='0' border='0'>";
-echo "<tr>";
-echo "<td>";
-if (count($ownguis)>0){
-	echo"GUI";
-	echo"<br>";
-	 
-	$sql = "SELECT * FROM gui WHERE gui_id IN (";
-	$v = $ownguis;
-	$t = array();
-	for ($i = 1; $i <= count($ownguis); $i++){
-		if ($i > 1) { 
-			$sql .= ",";
-		}
-		$sql .= "$".$i;
-		array_push($t, "s");
-	}
-	$sql .= ") ORDER BY gui_name";	
-	$res = db_prep_query($sql, $v, $t);
-	$count=0;
-	echo"<select size='8' name='guiList' style='width:200px' onClick='submit()'>";
-	while($row = db_fetch_array($res)){
-		$gui_name[$count]=$row["gui_name"];
-		$gui_description[$count]=$row["gui_description"];
-		$count++;
-		echo "<option value='".$row["gui_id"]."' ";
-		if($guiList && $guiList == $row["gui_name"]){
-			echo "selected";
-		}
-		echo ">".$row["gui_name"]."</option>";
-	}
-	
-	$arrayGUIs=$_SESSION["mb_user_guis"];
-	echo count($arrayGUIs);
-	echo "</select><br><br>";
-	
-	echo "</td>";
-	echo "<td>";
-	echo"WMS";
-	echo"<br>";
-	if(isset($guiList) && $guiList!=""){
-		$sql = "SELECT DISTINCT wms_id, wms.wms_title, gui_wms_position FROM gui_wms ";
-		$sql .= "JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON gui_wms.fkey_wms_id=wms.wms_id ";
-		$sql .= "AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_name = $1 ORDER BY gui_wms_position";
-		$v = array($guiList);
-		$t = array('s');
-		$res = db_prep_query($sql,$v,$t);	
-		$count=0;
-		echo"<select size='8' name='wmsList' style='width:200px'>";
-	
-		while($row = db_fetch_array($res)){
-			if ($row["wms_title"]!=""){
-				echo "<option value='".$row["wms_id"]."' ";
-				echo ">".$row["wms_title"]."</option>";
-			}
-			$count++;
-		}
-		echo "</select><br><br>";
-	}else{
-		echo"<select size='8' name='wmsList' style='width:200px' on Click='submit()'>";
-		echo "</select><br><br>";
-	}
-	echo "</td>";
-	echo "<tr></table><br>";
-	
-	echo"<div class='text1'>Load WMS</div>";
-	$sql = "SELECT DISTINCT wms.wms_id,wms.wms_title,wms.wms_abstract,wms.wms_owner FROM gui_wms JOIN wms ON ";
-	$sql .= "wms.wms_id = gui_wms.fkey_wms_id WHERE gui_wms.fkey_gui_id IN(";
-	$v = $arrayGUIs;
-	$t = array();
-	for ($i = 1; $i <= count($arrayGUIs); $i++){
-		if ($i > 1) {
-			$sql .= ",";
-		}
-		$sql .= "$" . $i;
-		array_push($t, "s");
-	}
-	$sql .= ") ORDER BY wms.wms_title";
-	$res = db_prep_query($sql, $v, $t);
-	echo "<select class='select1' name='wmsID' size='20' onchange='submit()'>";
-	$cnt = 0;
-	while($row = db_fetch_array($res)){
-		echo "<option value='".$row["wms_id"]."' ";
-		if($row["wms_owner"] == $_SESSION["mb_user_id"]){
-			echo "style='color:green' ";	
-		}
-		else{
-			echo "style='color:red' ";
-		}
-		if(isset($wmsID) && $wmsID == $row["wms_id"]){
-			echo "selected";
-			$wms_getcapabilities = $row["wms_getcapabilities"];
-		}
-		echo ">".$row["wms_title"]."</option>";
-		$cnt++;
-	}
-	echo "</select>";
-	
-	if(isset($wmsID)){
-		echo "<div class='text2'>FROM:</div>";
-		$sql = "SELECT * from gui_wms WHERE fkey_wms_id = $1 ORDER BY fkey_gui_id";
-		$v = array($wmsID);
-		$t = array("s");
-		$res = db_prep_query($sql, $v, $t);
-		echo "<select class='select2' name='guiID_' size='20' onchange='load()'>";
-		$cnt = 0;
-		while($row = db_fetch_array($res)){
-			echo "<option value='".$row["fkey_gui_id"]."' ";
-			echo ">".$row["fkey_gui_id"]."</option>";
-			$cnt++;
-		}
-	echo "</select>";
-}
-echo "</form>";
-}else{
-	echo "There are no guis available for this user. Please create a gui first.";
-}
-echo "<div class='getcapabilities'>" . $wms_getcapabilities . "</div>";
-?>
-</body>
-</html>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+import_request_variables("PG");
+require(dirname(__FILE__)."/../php/mb_validatePermission.php");
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>Load WMS from Catalog</title>
+<?php
+include '../include/dyn_css.php';
+?>
+<style type="text/css">
+  	<!--
+  	body{
+      background-color: #ffffff;
+  		font-family: Arial, Helvetica, sans-serif;
+  		font-size : 12px;
+  		color: #808080
+  	}
+  	.list_guis{
+  		font-family: Arial, Helvetica, sans-serif;
+  		font-size : 12px;
+  		color: #808080;
+  	}
+.text1{
+   font-family: Arial, Helvetica, sans-serif;
+   font-size : 15px;
+   position:absolute;
+   top:190px;
+}
+.select1{
+   position:absolute;
+   top:210px;
+   width:270px;
+}
+.text2{
+   font-family: Arial, Helvetica, sans-serif;
+   font-size : 15px;
+   position:absolute;
+   top:190px;
+   left:300px;
+}
+.select2{
+   position:absolute;
+   top:210px;
+   left:300px;
+}
+.getcapabilities{
+   font-family: Arial, Helvetica, sans-serif;
+   font-size : 15px;
+   position:absolute;
+   top:570px;
+}
+
+  	-->
+</style>
+<script language="JavaScript">
+function validate(wert){
+   if(wert == 'guiList'){
+      var listIndex = document.form1.guiList.selectedIndex;
+      if(listIndex<0){
+		   alert("Please select a GUI.");
+			return false;
+      }
+      else{
+         var gui_id=document.form1.guiList.options[listIndex].value;
+			document.form1.action='../php/mod_loadwms.php<?php echo SID;?>';
+			document.form1.submit();
+      }
+   }
+}
+function load(){
+      if(document.form1.guiList.selectedIndex<0){
+		   alert("Please select a GUI.");
+			return false;
+      }
+      var gui_ind = document.form1.guiList.selectedIndex;
+      var ind = document.form1.wmsID.selectedIndex;
+      var ind2 = document.form1.guiID_.selectedIndex;
+			var indexWMSList = document.form1.wmsID.selectedIndex;
+			var permission = true;
+
+			var selectedWmsId = document.form1.wmsID.options[document.form1.wmsID.selectedIndex].value;
+			for (i = 0; i < document.form1.wmsList.length; i++) {
+						if (document.form1.wmsList.options[i].value == selectedWmsId){
+							 permission = false;							 
+							 alert ('The WMS (' + selectedWmsId + ') is already loaded in this application.');
+							 break;
+						}
+			}			 
+			
+  			if (permission) { // only check if permission is not false 
+        	var loadConfirmed = confirm("Load " + document.form1.wmsID.options[ind].text + " FROM " + document.form1.guiID_.options[ind2].value + " INTO "+document.form1.guiList.options[gui_ind].value+" ?");
+          if(loadConfirmed){
+             document.form1.submit();
+          }
+          else{
+             document.form1.guiID_.selectedIndex = -1;
+          }
+			}	
+			
+}
+</script>
+</head>
+<body>
+
+<?php
+
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$admin = new administration();
+$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
+
+
+
+###INSERT
+if(isset($wmsID) && isset($guiID_)){
+	$sql_pos = "SELECT MAX(gui_wms_position) AS my_gui_wms_position FROM gui_wms WHERE fkey_gui_id = $1";
+	$v = array($guiList);
+	$t = array('s');
+	$res_pos = db_prep_query($sql_pos,$v,$t);
+	if(db_result($res_pos,0,"my_gui_wms_position") > -1){
+		$gui_wms_position = db_result($res_pos,0,"my_gui_wms_position") + 1;
+	}
+	else{
+		$gui_wms_position = 0;
+	}
+
+	$sql = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+	$v = array($guiID_,$wmsID);
+	$t = array('s','i');
+	$res = db_prep_query($sql,$v,$t);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		$sql_ins = "INSERT INTO gui_wms (fkey_gui_id,fkey_wms_id,gui_wms_position,gui_wms_mapformat,";
+		$sql_ins .= "gui_wms_featureinfoformat,gui_wms_exceptionformat,gui_wms_epsg,gui_wms_visible,gui_wms_opacity,gui_wms_sldurl) ";
+		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)";
+		$v = array($guiList,$wmsID,$gui_wms_position,$row["gui_wms_mapformat"],$row["gui_wms_featureinfoformat"],
+		$row["gui_wms_exceptionformat"],$row["gui_wms_epsg"],$row["gui_wms_visible"],$row["gui_wms_opacity"],$row["gui_wms_sldurl"]);
+		$t = array('s','i','i','s','s','s','s','i','i','s');
+		db_prep_query($sql_ins,$v,$t);
+		$cnt++;
+	}
+
+	$sql = "SELECT * FROM gui_layer WHERE fkey_gui_id = $1 AND gui_layer_wms_id = $2";
+	$v = array($guiID_, $wmsID);
+	$t = array("s", "i");
+	$res = db_prep_query($sql, $v, $t);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		$sql_ins = "INSERT INTO gui_layer (fkey_gui_id,fkey_layer_id,gui_layer_wms_id,gui_layer_status,gui_layer_selectable,";
+		$sql_ins .= "gui_layer_visible,gui_layer_queryable,gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale,gui_layer_priority,gui_layer_style,gui_layer_wfs_featuretype) ";
+		$sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)";
+		$v = array($guiList,$row["fkey_layer_id"],$wmsID,$row["gui_layer_status"],$row["gui_layer_selectable"],
+		$row["gui_layer_visible"],$row["gui_layer_queryable"],$row["gui_layer_querylayer"],$row["gui_layer_minscale"],
+		$row["gui_layer_maxscale"],$row["gui_layer_priority"],$row["gui_layer_style"],$row["gui_layer_wfs_featuretype"]);
+		$t = array('s','i','i','i','i','i','i','i','i','i','i','s','s');
+		db_prep_query($sql_ins,$v,$t);
+		$cnt++;
+	}
+}
+
+echo "<form name='form1' action='" . $self."' method='post'>";
+
+echo "<table cellpadding='0' cellspacing='0' border='0'>";
+echo "<tr>";
+echo "<td>";
+if (count($ownguis)>0){
+	echo"GUI";
+	echo"<br>";
+	 
+	$sql = "SELECT * FROM gui WHERE gui_id IN (";
+	$v = $ownguis;
+	$t = array();
+	for ($i = 1; $i <= count($ownguis); $i++){
+		if ($i > 1) { 
+			$sql .= ",";
+		}
+		$sql .= "$".$i;
+		array_push($t, "s");
+	}
+	$sql .= ") ORDER BY gui_name";	
+	$res = db_prep_query($sql, $v, $t);
+	$count=0;
+	echo"<select size='8' name='guiList' style='width:200px' onClick='submit()'>";
+	while($row = db_fetch_array($res)){
+		$gui_name[$count]=$row["gui_name"];
+		$gui_description[$count]=$row["gui_description"];
+		$count++;
+		echo "<option value='".$row["gui_id"]."' ";
+		if($guiList && $guiList == $row["gui_name"]){
+			echo "selected";
+		}
+		echo ">".$row["gui_name"]."</option>";
+	}
+	
+	$arrayGUIs=$_SESSION["mb_user_guis"];
+	echo count($arrayGUIs);
+	echo "</select><br><br>";
+	
+	echo "</td>";
+	echo "<td>";
+	echo"WMS";
+	echo"<br>";
+	if(isset($guiList) && $guiList!=""){
+		$sql = "SELECT DISTINCT wms_id, wms.wms_title, gui_wms_position FROM gui_wms ";
+		$sql .= "JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON gui_wms.fkey_wms_id=wms.wms_id ";
+		$sql .= "AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_name = $1 ORDER BY gui_wms_position";
+		$v = array($guiList);
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);	
+		$count=0;
+		echo"<select size='8' name='wmsList' style='width:200px'>";
+	
+		while($row = db_fetch_array($res)){
+			if ($row["wms_title"]!=""){
+				echo "<option value='".$row["wms_id"]."' ";
+				echo ">".$row["wms_title"]."</option>";
+			}
+			$count++;
+		}
+		echo "</select><br><br>";
+	}else{
+		echo"<select size='8' name='wmsList' style='width:200px' on Click='submit()'>";
+		echo "</select><br><br>";
+	}
+	echo "</td>";
+	echo "<tr></table><br>";
+	
+	echo"<div class='text1'>Load WMS</div>";
+	$sql = "SELECT DISTINCT wms.wms_id,wms.wms_title,wms.wms_abstract,wms.wms_owner FROM gui_wms JOIN wms ON ";
+	$sql .= "wms.wms_id = gui_wms.fkey_wms_id WHERE gui_wms.fkey_gui_id IN(";
+	$v = $arrayGUIs;
+	$t = array();
+	for ($i = 1; $i <= count($arrayGUIs); $i++){
+		if ($i > 1) {
+			$sql .= ",";
+		}
+		$sql .= "$" . $i;
+		array_push($t, "s");
+	}
+	$sql .= ") ORDER BY wms.wms_title";
+	$res = db_prep_query($sql, $v, $t);
+	echo "<select class='select1' name='wmsID' size='20' onchange='submit()'>";
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		echo "<option value='".$row["wms_id"]."' ";
+		if($row["wms_owner"] == $_SESSION["mb_user_id"]){
+			echo "style='color:green' ";	
+		}
+		else{
+			echo "style='color:red' ";
+		}
+		if(isset($wmsID) && $wmsID == $row["wms_id"]){
+			echo "selected";
+			$wms_getcapabilities = $row["wms_getcapabilities"];
+		}
+		echo ">".$row["wms_title"]."</option>";
+		$cnt++;
+	}
+	echo "</select>";
+	
+	if(isset($wmsID)){
+		echo "<div class='text2'>FROM:</div>";
+		$sql = "SELECT * from gui_wms WHERE fkey_wms_id = $1 ORDER BY fkey_gui_id";
+		$v = array($wmsID);
+		$t = array("s");
+		$res = db_prep_query($sql, $v, $t);
+		echo "<select class='select2' name='guiID_' size='20' onchange='load()'>";
+		$cnt = 0;
+		while($row = db_fetch_array($res)){
+			echo "<option value='".$row["fkey_gui_id"]."' ";
+			echo ">".$row["fkey_gui_id"]."</option>";
+			$cnt++;
+		}
+	echo "</select>";
+}
+echo "</form>";
+}else{
+	echo "There are no guis available for this user. Please create a gui first.";
+}
+echo "<div class='getcapabilities'>" . $wms_getcapabilities . "</div>";
+?>
+</body>
+</html>

Modified: branches/print_dev/http/php/mod_loadwmc_server.php
===================================================================
--- branches/print_dev/http/php/mod_loadwmc_server.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_loadwmc_server.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,174 +1,174 @@
-<?php
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../classes/class_user.php");
-require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
-require_once(dirname(__FILE__) . "/../classes/class_json.php");
-
-/**
- * encodes and delivers the data
- * 
- * @param object the un-encoded object 
- */
-function sendOutput($out){
-	global $json;
-	$output = $json->encode($out);
-	header("Content-Type: text/x-json");
-	echo $output;
-}
-
-/**
- * Get all available WMC documents from the database
- * 
- * @return mixed[] an array of wmcs 
- * 					(wmc = assoc. array of "id", "title", "timestamp")
- */
-function getWmc(){
-	global $con;
-	global $userId;
-	
-	$wmcArray = array();
-	
-	// get WMC ids 
-	$currentUser = new User($userId);
-	$wmcIdArray = $currentUser->getWmcByOwner();
-	
-	// get WMC data
-	$v = array();
-	$t = array();
-	$wmcIdList = "";
-
-	for ($i = 0; $i < count($wmcIdArray); $i++) {
-		if ($i > 0) { 
-			$wmcIdList .= ",";
-		}
-		$wmcIdList .= "$".($i+1);
-		array_push($v, $wmcIdArray[$i]);
-		array_push($t, 's');
-	}
-
-	$sql = "SELECT DISTINCT wmc_id, wmc_title, wmc_timestamp " . 
-		"FROM mb_user_wmc WHERE wmc_id IN (" . $wmcIdList . ") " .
-		"ORDER BY wmc_timestamp DESC";
-	
-	$res = db_prep_query($sql, $v, $t);
-	while($row = db_fetch_array($res)){
-		$currentResult = array();
-		$currentResult["id"] = $row["wmc_id"];
-		$currentResult["title"] = $row["wmc_title"];
-		$currentResult["timestamp"] = date("M d Y H:i:s", $row["wmc_timestamp"]); 
-		array_push($wmcArray, $currentResult);
-	}
-	return $wmcArray;
-}
-
-$json = new Mapbender_JSON();
-$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
-$resultObj = array();
-
-$e = new mb_exception("command: " . $queryObj->command);
-
-$wmc = new wmc();
-$userId = $_SESSION[mb_user_id];
-
-switch($queryObj->command){
-
-	// gets available WMCs
-	case 'getWmc':
-		$resultObj["wmc"] = getWmc();
-	break;
-
-	// gets XML document of a WMC
-	case 'getWmcDocument':
-		$wmcId = $queryObj->parameters->id;
-		$doc = $wmc->getDocument($wmcId);
-		if (!$doc) {
-			$resultObj["error"] = "The WMC document could not be found.";
-		}
-		else {
-			$resultObj["wmc"] = array("document" => $doc);
-		}
-	break;
-
-	// deletes a WMC
-	case 'deleteWmc':
-		$wmcId = $queryObj->parameters->id;
-		if ($wmc->delete($wmcId)) {
-			$resultObj["success"] = "WMC has been deleted from the database.";
-		}
-		else {
-			$resultObj["error"] = "WMC could not be deleted.";
-		}
-	break;
-	
-	// loads a WMC (returns array of JS code)
-	case 'loadWmc':
-		$wmcId = $queryObj->parameters->id;
-		$wmc->createFromDb($wmcId);
-		$jsArray = $wmc->toJavaScript();
-		if ($jsArray) {
-			$resultObj["javascript"] = $jsArray;
-		}
-		else {
-			$resultObj["error"] = "WMC could not be loaded.";
-		}
-	break;
-
-	// merges data with WMC and loads it (returns array of JS code)
-	case 'mergeWmc':
-		$params = $queryObj->parameters;
-		
-		// generate a WMC for the current client state
-		$currentWmc = new wmc();
-		$currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
-
-		// get the desired WMC from the database
-		$wmcId = $queryObj->parameters->id;
-		$wmcXml = wmc::getDocument($wmcId);
-
-		// merge the two WMCs
-		$currentWmc->merge($wmcXml);
-		
-		// load the merged WMC
-		$jsArray = $currentWmc->toJavaScript();
-
-		if (is_array($jsArray) && count($jsArray) > 0) {
-			$resultObj["javascript"] = $jsArray;
-		}
-		else {
-			$resultObj["error"] = "WMC could not be loaded.";
-		}
-	break;
-	
-	// appends a WMC (returns JS code)
-	case 'appendWmc':
-		$params = $queryObj->parameters;
-		// generate a WMC for the current client state
-		$currentWmc = new wmc();
-		$currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
-
-		// get the desired WMC from the database
-		$wmcId = $queryObj->parameters->id;
-		$wmcXml = wmc::getDocument($wmcId);
-
-		// merge the two WMCs
-		$currentWmc->append($wmcXml);
-		
-		// load the merged WMC
-		$jsArray = $currentWmc->toJavaScript();
-
-		if (is_array($jsArray) && count($jsArray) > 0) {
-			$resultObj["javascript"] = $jsArray;
-		}
-		else {
-			$resultObj["error"] = "WMC could not be appended.";
-		}
-	break;
-	
-
-	// Invalid command
-	default:
-		$resultObj["error"] = "no action specified...";
-}
-
-sendOutput($resultObj);
+<?php
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+
+/**
+ * encodes and delivers the data
+ * 
+ * @param object the un-encoded object 
+ */
+function sendOutput($out){
+	global $json;
+	$output = $json->encode($out);
+	header("Content-Type: text/x-json");
+	echo $output;
+}
+
+/**
+ * Get all available WMC documents from the database
+ * 
+ * @return mixed[] an array of wmcs 
+ * 					(wmc = assoc. array of "id", "title", "timestamp")
+ */
+function getWmc(){
+	global $con;
+	global $userId;
+	
+	$wmcArray = array();
+	
+	// get WMC ids 
+	$currentUser = new User($userId);
+	$wmcIdArray = $currentUser->getWmcByOwner();
+	
+	// get WMC data
+	$v = array();
+	$t = array();
+	$wmcIdList = "";
+
+	for ($i = 0; $i < count($wmcIdArray); $i++) {
+		if ($i > 0) { 
+			$wmcIdList .= ",";
+		}
+		$wmcIdList .= "$".($i+1);
+		array_push($v, $wmcIdArray[$i]);
+		array_push($t, 's');
+	}
+
+	$sql = "SELECT DISTINCT wmc_id, wmc_title, wmc_timestamp " . 
+		"FROM mb_user_wmc WHERE wmc_id IN (" . $wmcIdList . ") " .
+		"ORDER BY wmc_timestamp DESC";
+	
+	$res = db_prep_query($sql, $v, $t);
+	while($row = db_fetch_array($res)){
+		$currentResult = array();
+		$currentResult["id"] = $row["wmc_id"];
+		$currentResult["title"] = $row["wmc_title"];
+		$currentResult["timestamp"] = date("M d Y H:i:s", $row["wmc_timestamp"]); 
+		array_push($wmcArray, $currentResult);
+	}
+	return $wmcArray;
+}
+
+$json = new Mapbender_JSON();
+$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
+$resultObj = array();
+
+$e = new mb_exception("command: " . $queryObj->command);
+
+$wmc = new wmc();
+$userId = $_SESSION[mb_user_id];
+
+switch($queryObj->command){
+
+	// gets available WMCs
+	case 'getWmc':
+		$resultObj["wmc"] = getWmc();
+	break;
+
+	// gets XML document of a WMC
+	case 'getWmcDocument':
+		$wmcId = $queryObj->parameters->id;
+		$doc = $wmc->getDocument($wmcId);
+		if (!$doc) {
+			$resultObj["error"] = "The WMC document could not be found.";
+		}
+		else {
+			$resultObj["wmc"] = array("document" => $doc);
+		}
+	break;
+
+	// deletes a WMC
+	case 'deleteWmc':
+		$wmcId = $queryObj->parameters->id;
+		if ($wmc->delete($wmcId)) {
+			$resultObj["success"] = "WMC has been deleted from the database.";
+		}
+		else {
+			$resultObj["error"] = "WMC could not be deleted.";
+		}
+	break;
+	
+	// loads a WMC (returns array of JS code)
+	case 'loadWmc':
+		$wmcId = $queryObj->parameters->id;
+		$wmc->createFromDb($wmcId);
+		$jsArray = $wmc->toJavaScript();
+		if ($jsArray) {
+			$resultObj["javascript"] = $jsArray;
+		}
+		else {
+			$resultObj["error"] = "WMC could not be loaded.";
+		}
+	break;
+
+	// merges data with WMC and loads it (returns array of JS code)
+	case 'mergeWmc':
+		$params = $queryObj->parameters;
+		
+		// generate a WMC for the current client state
+		$currentWmc = new wmc();
+		$currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
+
+		// get the desired WMC from the database
+		$wmcId = $queryObj->parameters->id;
+		$wmcXml = wmc::getDocument($wmcId);
+
+		// merge the two WMCs
+		$currentWmc->merge($wmcXml);
+		
+		// load the merged WMC
+		$jsArray = $currentWmc->toJavaScript();
+
+		if (is_array($jsArray) && count($jsArray) > 0) {
+			$resultObj["javascript"] = $jsArray;
+		}
+		else {
+			$resultObj["error"] = "WMC could not be loaded.";
+		}
+	break;
+	
+	// appends a WMC (returns JS code)
+	case 'appendWmc':
+		$params = $queryObj->parameters;
+		// generate a WMC for the current client state
+		$currentWmc = new wmc();
+		$currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
+
+		// get the desired WMC from the database
+		$wmcId = $queryObj->parameters->id;
+		$wmcXml = wmc::getDocument($wmcId);
+
+		// merge the two WMCs
+		$currentWmc->append($wmcXml);
+		
+		// load the merged WMC
+		$jsArray = $currentWmc->toJavaScript();
+
+		if (is_array($jsArray) && count($jsArray) > 0) {
+			$resultObj["javascript"] = $jsArray;
+		}
+		else {
+			$resultObj["error"] = "WMC could not be appended.";
+		}
+	break;
+	
+
+	// Invalid command
+	default:
+		$resultObj["error"] = "no action specified...";
+}
+
+sendOutput($resultObj);
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_log.php
===================================================================
--- branches/print_dev/http/php/mod_log.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_log.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,34 +1,34 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require(dirname(__FILE__)."/../include/dyn_php.php");
-
-if($_REQUEST['req']){
-	ignore_user_abort();
-	$req = array();
-	$req[0] = urldecode($_REQUEST['req']);
-	$time_client = $_REQUEST['time_client'];
-	
-	if(empty($req)){$req = "init";}
-	include(dirname(__FILE__)."/../classes/class_log.php");
-	$log = new log("default", $req, $time_client, $logtype);
-}
-echo "log into $logtype successful!";
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require(dirname(__FILE__)."/../include/dyn_php.php");
+
+if($_REQUEST['req']){
+	ignore_user_abort();
+	$req = array();
+	$req[0] = urldecode($_REQUEST['req']);
+	$time_client = $_REQUEST['time_client'];
+	
+	if(empty($req)){$req = "init";}
+	include(dirname(__FILE__)."/../classes/class_log.php");
+	$log = new log("default", $req, $time_client, $logtype);
+}
+echo "log into $logtype successful!";
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_meetingPoint.php
===================================================================
--- branches/print_dev/http/php/mod_meetingPoint.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_meetingPoint.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,291 +1,291 @@
-<?PHP
-# $Id$
-# http://www.mapbender.org/index.php/MeetingPoint
-# 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.
-
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>meetingPoint</title>
-<?php
-include '../include/dyn_css.php';
-?>
-<script language='JavaScript'>
-<!--
-<?php
-include('../include/dyn_js.php');
-echo "var mod_meetingPoint_target = '" . $_REQUEST["e_target"] . "';";
-echo "var meetingPoint_write_to = 'meetingPoint';";
-?>
-try{
-	if (meetingPoint_export_subject){}
-}
-catch(e){
-	meetingPoint_export_subject = 'Your meeting point. Follow the link!';
-}
-
-try{
-	if (meetingPoint_export_format){}
-}
-catch(e){
-	meetingPoint_export_format = 'prompt';
-}
-
-try{
-	if (meetingPoint_max_characters){}
-}
-catch(e){
-	meetingPoint_max_characters = 100;
-}
-
-try{
-	if (meetingPoint_image){}
-}
-catch(e){
-	meetingPoint_image = "../img/button_digitize/point_off.png";
-}
-
-try{
-	if (meetingPoint_icon){}
-}
-catch(e){
-	meetingPoint_icon = '../img/redball.gif';
-}
-
-try{
-	if (meetingPoint_width){}
-}
-catch(e){
-	meetingPoint_width = 14;
-}
-
-try{
-	if (meetingPoint_height){}
-}
-catch(e){
-	meetingPoint_height = 14;
-}
-
-try{
-	if (meetingPoint_style){}
-}
-catch(e){
-	meetingPoint_style = 'background-color:white;font-weight: bold;color:black;font-family:Arial;';
-}
-
-try{
-	if (meetingPoint_please_click){}
-}
-catch(e){
-	meetingPoint_please_click = 'Please click for the meeting point position!';
-}
-
-parent.mb_registerSubFunctions("window.frames['meetingPoint'].mod_meetingPoint_draw()");
-
-var ie = document.all?1:0;
-var mod_meetingPoint_win = null;
-var mod_meetingPoint_elName = "meetingPoint";
-var mod_meetingPoint_frameName = "meetingPoint";
-
-var mod_meetingPoint_img_on = new Image(); mod_meetingPoint_img_on.src = meetingPoint_image.replace(/_off/,"_on") ;
-var mod_meetingPoint_img_off = new Image(); mod_meetingPoint_img_off.src = meetingPoint_image;
-var mod_meetingPoint_img_over = new Image(); mod_meetingPoint_img_over.src = meetingPoint_image.replace(/_off/,"_over") ;
-var mod_meetingPoint_fix = "";
-
-
-function init_mod_meetingPoint(ind){
-	parent.mb_button[ind] = window.document.getElementById("my_getCoords");
-	parent.mb_button[ind].img_over = mod_meetingPoint_img_over.src;
-	parent.mb_button[ind].img_on = mod_meetingPoint_img_on.src;
-	parent.mb_button[ind].img_off = mod_meetingPoint_img_off.src;
-	parent.mb_button[ind].status = 0;
-	parent.mb_button[ind].elName = "my_getCoords";
-	parent.mb_button[ind].go = new Function ("mod_meetingPoint_run()");
-	parent.mb_button[ind].stop = new Function ("mod_meetingPoint_disable()");
-}
-
-function mod_meetingPoint_run(){   
-	parent.frames[mod_meetingPoint_target].document.onclick = mod_meetingPoint_click;
-}
-
-function mod_meetingPoint_disable(){
-	parent.frames[mod_meetingPoint_target].document.onclick = null;
-}
-
-function mod_meetingPoint_click(e){
-	if(ie){
-		clickX = parent.frames[mod_meetingPoint_target].event.clientX;
-		clickY = parent.frames[mod_meetingPoint_target].event.clientY;
-	}
-	else{
-		clickX = e.pageX;
-		clickY = e.pageY;
-	}
-	
-	var pos = parent.makeClickPos2RealWorldPos(mod_meetingPoint_target, clickX, clickY);
-    
-	mod_meetingPoint_write(pos[0],pos[1]);
-	mod_meetingPoint_draw();	
-}
-
-function mod_meetingPoint_write(x,y){	
-   document.forms[0].x.value =x;
-   document.forms[0].y.value =y;	   
-}
-
-function mod_meetingPoint_hide(){
-	var ind = parent.getMapObjIndexByName(mod_meetingPoint_target);
-	parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.visibility = 'hidden';
-}
-
-function mod_meetingPoint_draw(){
-	var ind = parent.getMapObjIndexByName(mod_meetingPoint_target);
-	if (document.forms[0].x.value!='' && document.forms[0].y.value != ''){
-		//alert(document.forms[0].x.value +" -- "+ document.forms[0].y.value + " - " + parent.mb_mapObj[ind].width +" iii: "+ ind);
-		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.width = parent.mb_mapObj[ind].width;
-		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.height = parent.mb_mapObj[ind].height;
-		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.top = 0;
-		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.left = 0;
-		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.visibility = 'visible';
-		var tagSource = "";
-		var pos = parent.makeRealWorld2mapPos(mod_meetingPoint_target,document.forms[0].x.value, document.forms[0].y.value);
-		tagSource += "<div style='z-index:13;position:absolute;left:"+(pos[0]- Math.round(0.5*meetingPoint_width))+"px;top:"+(pos[1]-Math.round(0.5*meetingPoint_height))+"px'>";
-		tagSource += "<img src='"+meetingPoint_icon+"'>";
-		tagSource += "<span style='"+meetingPoint_style+"'>"+document.forms[0].mytext.value+"<span>";
-		tagSource += "</div>";
-		//prompt("meetingPoint",tagSource);
-	    parent.writeTag(mod_meetingPoint_target, "permanent", tagSource);
-	}	 
-}
--->
-</script>
-
-<script language='JavaScript'>
-<!--
-<?php
-echo "var used_charset = '".CHARSET ."';";
-?>
-
-function validate(){
-	var mycheck = true;
-	var checkObj= document.forms[0].mytext.value;
-	if(checkObj == '') {
-    	alert ("Bitte geben Sie einen Text an!");
-    	checkObj.focus();
-        mycheck=false;
-    }
-    
-    var checkObj= document.forms[0].x.value;
-    if(checkObj == '') {
-    	alert (meetingPoint_please_click);
-        mycheck = false;
-    }
-
-    if(mycheck == true){
-    	my_meetingPoint = document.forms[0].myurl.value + "?";
-    	my_meetingPoint += "name=" + encodeURIComponent(document.forms[0].myuser.value);
-    	my_meetingPoint += "&password=" + encodeURIComponent(document.forms[0].mypw.value);
-    	my_meetingPoint += "&mb_user_myGui=" + encodeURIComponent(document.forms[0].mygui.value);
-    	
-    	var ind = parent.getMapObjIndexByName('mapframe1');
-    	var coord = parent.mb_mapObj[ind].extent.split(",");
-    	
-    	my_meetingPoint += "&mb_myBBOX=" + parseFloat(coord[0]) + ",";
-		my_meetingPoint +=  parseFloat(coord[1]) + ",";
-		my_meetingPoint +=  parseFloat(coord[2]) + ",";
-		my_meetingPoint +=  parseFloat(coord[3]) ;
-
-    	my_meetingPoint += "&mb_myPOI=";
-    	
-    	var splitext  = document.forms[0].mytext.value;
-    	document.forms[0].mytext.value = splitext.substring(0, meetingPoint_max_characters);
-    	
-
-    	my_meetingPoint += encodeURIComponent(document.forms[0].mytext.value);
-
-    	
-    	my_meetingPoint += "|" + document.forms[0].x.value + "|";
-    	my_meetingPoint += document.forms[0].y.value;
-
-    	if(meetingPoint_export_format == 'email'){
-    		createEmail(my_meetingPoint,meetingPoint_export_subject);
-		}else{			
-			prompt(meetingPoint_export_subject,my_meetingPoint);			
-		}
-    }
-}
-
-function emptyfields(){
-	document.forms[0].mytext.value ='';
-	document.forms[0].x.value ='';
-	document.forms[0].y.value =  '';
-	 mod_meetingPoint_hide();
-}
-
-function createEmail (url,subject) {
-  var email = "mailto:"
-  email  += "";
-  email  += "?subject=";
-  email  += subject;
-  email  += "&body=";
-  email  += escape(url);
-
-  var win = window.open(email, 'email', 'top=120,left=120');
-  win.close();
-}
-
-function goBack(where){
-    document.location.href=where;
-}
-
-function init(){
-	parent.mb_regButton_frame("init_mod_meetingPoint","meetingPoint",null);
-}
-
--->
-</script>
-
-</head>
-<body>
-
-<form action="" >
-
-<img  id='my_getCoords' name='my_getCoords' onclick="mod_meetingPoint_run()" onmouseover ="parent.mb_regButton_frame('init_mod_meetingPoint','meetingPoint',null)"  title="Treffpunkt setzen"  src = '../img/button_digitize/point_off.png'>
-<br>
-<input class='strinput' type="hidden" name='myurl' value='<?php  echo LOGIN;  ?>'>
-
-<input class='strinput' type="hidden" name='mygui' value='<?php  echo $_SESSION["mb_user_gui"];  ?>'>
-
-<input class='strinput' type="hidden" name='myuser' value='<?php  echo $_SESSION["mb_user_name"];  ?>'>
-
-<input class='strinput' type="hidden" name='mypw' value='<?php  echo $_SESSION["mb_user_password"];  ?>'>
-<br>
-<!--<input class='strinput' type="textarea" size=2 name='mytext' value='' "maxlength=70" title="max. 70 Zeichen">-->
-<textarea class='strinput' rows="3" name='mytext' title='maximal 70 Zeichen'></textarea>
-<br>
-<input class="okbutton" name="Send"   type="button" value="ok" onclick="validate();">
-<input class="ibutton" type="button" value="cancel" onClick="emptyfields();">
-<br>
-<input class="coord" type="hidden" name='x' value='' readonly>
-<input class="coord" type="hidden" name='y' value='' readonly>
-<br>
-</form>
-</body>
+<?PHP
+# $Id$
+# http://www.mapbender.org/index.php/MeetingPoint
+# 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.
+
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>meetingPoint</title>
+<?php
+include '../include/dyn_css.php';
+?>
+<script language='JavaScript'>
+<!--
+<?php
+include('../include/dyn_js.php');
+echo "var mod_meetingPoint_target = '" . $_REQUEST["e_target"] . "';";
+echo "var meetingPoint_write_to = 'meetingPoint';";
+?>
+try{
+	if (meetingPoint_export_subject){}
+}
+catch(e){
+	meetingPoint_export_subject = 'Your meeting point. Follow the link!';
+}
+
+try{
+	if (meetingPoint_export_format){}
+}
+catch(e){
+	meetingPoint_export_format = 'prompt';
+}
+
+try{
+	if (meetingPoint_max_characters){}
+}
+catch(e){
+	meetingPoint_max_characters = 100;
+}
+
+try{
+	if (meetingPoint_image){}
+}
+catch(e){
+	meetingPoint_image = "../img/button_digitize/point_off.png";
+}
+
+try{
+	if (meetingPoint_icon){}
+}
+catch(e){
+	meetingPoint_icon = '../img/redball.gif';
+}
+
+try{
+	if (meetingPoint_width){}
+}
+catch(e){
+	meetingPoint_width = 14;
+}
+
+try{
+	if (meetingPoint_height){}
+}
+catch(e){
+	meetingPoint_height = 14;
+}
+
+try{
+	if (meetingPoint_style){}
+}
+catch(e){
+	meetingPoint_style = 'background-color:white;font-weight: bold;color:black;font-family:Arial;';
+}
+
+try{
+	if (meetingPoint_please_click){}
+}
+catch(e){
+	meetingPoint_please_click = 'Please click for the meeting point position!';
+}
+
+parent.mb_registerSubFunctions("window.frames['meetingPoint'].mod_meetingPoint_draw()");
+
+var ie = document.all?1:0;
+var mod_meetingPoint_win = null;
+var mod_meetingPoint_elName = "meetingPoint";
+var mod_meetingPoint_frameName = "meetingPoint";
+
+var mod_meetingPoint_img_on = new Image(); mod_meetingPoint_img_on.src = meetingPoint_image.replace(/_off/,"_on") ;
+var mod_meetingPoint_img_off = new Image(); mod_meetingPoint_img_off.src = meetingPoint_image;
+var mod_meetingPoint_img_over = new Image(); mod_meetingPoint_img_over.src = meetingPoint_image.replace(/_off/,"_over") ;
+var mod_meetingPoint_fix = "";
+
+
+function init_mod_meetingPoint(ind){
+	parent.mb_button[ind] = window.document.getElementById("my_getCoords");
+	parent.mb_button[ind].img_over = mod_meetingPoint_img_over.src;
+	parent.mb_button[ind].img_on = mod_meetingPoint_img_on.src;
+	parent.mb_button[ind].img_off = mod_meetingPoint_img_off.src;
+	parent.mb_button[ind].status = 0;
+	parent.mb_button[ind].elName = "my_getCoords";
+	parent.mb_button[ind].go = new Function ("mod_meetingPoint_run()");
+	parent.mb_button[ind].stop = new Function ("mod_meetingPoint_disable()");
+}
+
+function mod_meetingPoint_run(){   
+	parent.frames[mod_meetingPoint_target].document.onclick = mod_meetingPoint_click;
+}
+
+function mod_meetingPoint_disable(){
+	parent.frames[mod_meetingPoint_target].document.onclick = null;
+}
+
+function mod_meetingPoint_click(e){
+	if(ie){
+		clickX = parent.frames[mod_meetingPoint_target].event.clientX;
+		clickY = parent.frames[mod_meetingPoint_target].event.clientY;
+	}
+	else{
+		clickX = e.pageX;
+		clickY = e.pageY;
+	}
+	
+	var pos = parent.makeClickPos2RealWorldPos(mod_meetingPoint_target, clickX, clickY);
+    
+	mod_meetingPoint_write(pos[0],pos[1]);
+	mod_meetingPoint_draw();	
+}
+
+function mod_meetingPoint_write(x,y){	
+   document.forms[0].x.value =x;
+   document.forms[0].y.value =y;	   
+}
+
+function mod_meetingPoint_hide(){
+	var ind = parent.getMapObjIndexByName(mod_meetingPoint_target);
+	parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.visibility = 'hidden';
+}
+
+function mod_meetingPoint_draw(){
+	var ind = parent.getMapObjIndexByName(mod_meetingPoint_target);
+	if (document.forms[0].x.value!='' && document.forms[0].y.value != ''){
+		//alert(document.forms[0].x.value +" -- "+ document.forms[0].y.value + " - " + parent.mb_mapObj[ind].width +" iii: "+ ind);
+		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.width = parent.mb_mapObj[ind].width;
+		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.height = parent.mb_mapObj[ind].height;
+		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.top = 0;
+		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.left = 0;
+		parent.frames[mod_meetingPoint_target].document.getElementById('permanent').style.visibility = 'visible';
+		var tagSource = "";
+		var pos = parent.makeRealWorld2mapPos(mod_meetingPoint_target,document.forms[0].x.value, document.forms[0].y.value);
+		tagSource += "<div style='z-index:13;position:absolute;left:"+(pos[0]- Math.round(0.5*meetingPoint_width))+"px;top:"+(pos[1]-Math.round(0.5*meetingPoint_height))+"px'>";
+		tagSource += "<img src='"+meetingPoint_icon+"'>";
+		tagSource += "<span style='"+meetingPoint_style+"'>"+document.forms[0].mytext.value+"<span>";
+		tagSource += "</div>";
+		//prompt("meetingPoint",tagSource);
+	    parent.writeTag(mod_meetingPoint_target, "permanent", tagSource);
+	}	 
+}
+-->
+</script>
+
+<script language='JavaScript'>
+<!--
+<?php
+echo "var used_charset = '".CHARSET ."';";
+?>
+
+function validate(){
+	var mycheck = true;
+	var checkObj= document.forms[0].mytext.value;
+	if(checkObj == '') {
+    	alert ("Bitte geben Sie einen Text an!");
+    	checkObj.focus();
+        mycheck=false;
+    }
+    
+    var checkObj= document.forms[0].x.value;
+    if(checkObj == '') {
+    	alert (meetingPoint_please_click);
+        mycheck = false;
+    }
+
+    if(mycheck == true){
+    	my_meetingPoint = document.forms[0].myurl.value + "?";
+    	my_meetingPoint += "name=" + encodeURIComponent(document.forms[0].myuser.value);
+    	my_meetingPoint += "&password=" + encodeURIComponent(document.forms[0].mypw.value);
+    	my_meetingPoint += "&mb_user_myGui=" + encodeURIComponent(document.forms[0].mygui.value);
+    	
+    	var ind = parent.getMapObjIndexByName('mapframe1');
+    	var coord = parent.mb_mapObj[ind].extent.split(",");
+    	
+    	my_meetingPoint += "&mb_myBBOX=" + parseFloat(coord[0]) + ",";
+		my_meetingPoint +=  parseFloat(coord[1]) + ",";
+		my_meetingPoint +=  parseFloat(coord[2]) + ",";
+		my_meetingPoint +=  parseFloat(coord[3]) ;
+
+    	my_meetingPoint += "&mb_myPOI=";
+    	
+    	var splitext  = document.forms[0].mytext.value;
+    	document.forms[0].mytext.value = splitext.substring(0, meetingPoint_max_characters);
+    	
+
+    	my_meetingPoint += encodeURIComponent(document.forms[0].mytext.value);
+
+    	
+    	my_meetingPoint += "|" + document.forms[0].x.value + "|";
+    	my_meetingPoint += document.forms[0].y.value;
+
+    	if(meetingPoint_export_format == 'email'){
+    		createEmail(my_meetingPoint,meetingPoint_export_subject);
+		}else{			
+			prompt(meetingPoint_export_subject,my_meetingPoint);			
+		}
+    }
+}
+
+function emptyfields(){
+	document.forms[0].mytext.value ='';
+	document.forms[0].x.value ='';
+	document.forms[0].y.value =  '';
+	 mod_meetingPoint_hide();
+}
+
+function createEmail (url,subject) {
+  var email = "mailto:"
+  email  += "";
+  email  += "?subject=";
+  email  += subject;
+  email  += "&body=";
+  email  += escape(url);
+
+  var win = window.open(email, 'email', 'top=120,left=120');
+  win.close();
+}
+
+function goBack(where){
+    document.location.href=where;
+}
+
+function init(){
+	parent.mb_regButton_frame("init_mod_meetingPoint","meetingPoint",null);
+}
+
+-->
+</script>
+
+</head>
+<body>
+
+<form action="" >
+
+<img  id='my_getCoords' name='my_getCoords' onclick="mod_meetingPoint_run()" onmouseover ="parent.mb_regButton_frame('init_mod_meetingPoint','meetingPoint',null)"  title="Treffpunkt setzen"  src = '../img/button_digitize/point_off.png'>
+<br>
+<input class='strinput' type="hidden" name='myurl' value='<?php  echo LOGIN;  ?>'>
+
+<input class='strinput' type="hidden" name='mygui' value='<?php  echo $_SESSION["mb_user_gui"];  ?>'>
+
+<input class='strinput' type="hidden" name='myuser' value='<?php  echo $_SESSION["mb_user_name"];  ?>'>
+
+<input class='strinput' type="hidden" name='mypw' value='<?php  echo $_SESSION["mb_user_password"];  ?>'>
+<br>
+<!--<input class='strinput' type="textarea" size=2 name='mytext' value='' "maxlength=70" title="max. 70 Zeichen">-->
+<textarea class='strinput' rows="3" name='mytext' title='maximal 70 Zeichen'></textarea>
+<br>
+<input class="okbutton" name="Send"   type="button" value="ok" onclick="validate();">
+<input class="ibutton" type="button" value="cancel" onClick="emptyfields();">
+<br>
+<input class="coord" type="hidden" name='x' value='' readonly>
+<input class="coord" type="hidden" name='y' value='' readonly>
+<br>
+</form>
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_owsproxy_conf.php
===================================================================
--- branches/print_dev/http/php/mod_owsproxy_conf.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_owsproxy_conf.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,66 +1,66 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_owsproxy_conf.php
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-$admin = new administration();
-$ownwms = $admin->getWmsByOwner($_SESSION["mb_user_id"]);
-if(isset($_REQUEST["wms_id"]) && isset($_REQUEST["status"])){
-	$admin->setWMSOWSstring(intval($_REQUEST["wms_id"]),$_REQUEST["status"]);	
-}
-?>
-<html>
-<head>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>OWS Security Proxy</title>
-<style type="text/css">
-
-body{
-	font-family: Arial, Helvetica, sans-serif;	
-}
-</style>
-<script language="JavaScript" type="text/javascript">
-function set(wms_id, status){
-	document.location.href = "<?php echo $self; ?>&wms_id="+wms_id+"&status="+status; 
-}
-</script>
-  
-</head>
-<body>
-<form>
-<table>
-<?php
-for($i=0; $i<count($ownwms); $i++){
-	echo "<tr>";
-	echo "<td>";
-	echo "<input type='checkbox' onclick='if(this.checked){set(\"".$ownwms[$i]."\",\"on\")}else{set(\"".$ownwms[$i]."\",\"off\")}' ";
-	if($admin->getWMSOWSstring($ownwms[$i]) != false){ echo "checked";  }
-	echo ">";
-	echo "</td>";
-	echo "<td>".$ownwms[$i]."</td>";
-	echo "<td>".$admin->getWmsTitleByWmsId($ownwms[$i])."</td>";
-	echo "</tr>";	
-}
-?>
-</table>
-</form>
-</body>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_owsproxy_conf.php
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$admin = new administration();
+$ownwms = $admin->getWmsByOwner($_SESSION["mb_user_id"]);
+if(isset($_REQUEST["wms_id"]) && isset($_REQUEST["status"])){
+	$admin->setWMSOWSstring(intval($_REQUEST["wms_id"]),$_REQUEST["status"]);	
+}
+?>
+<html>
+<head>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>OWS Security Proxy</title>
+<style type="text/css">
+
+body{
+	font-family: Arial, Helvetica, sans-serif;	
+}
+</style>
+<script language="JavaScript" type="text/javascript">
+function set(wms_id, status){
+	document.location.href = "<?php echo $self; ?>&wms_id="+wms_id+"&status="+status; 
+}
+</script>
+  
+</head>
+<body>
+<form>
+<table>
+<?php
+for($i=0; $i<count($ownwms); $i++){
+	echo "<tr>";
+	echo "<td>";
+	echo "<input type='checkbox' onclick='if(this.checked){set(\"".$ownwms[$i]."\",\"on\")}else{set(\"".$ownwms[$i]."\",\"off\")}' ";
+	if($admin->getWMSOWSstring($ownwms[$i]) != false){ echo "checked";  }
+	echo ">";
+	echo "</td>";
+	echo "<td>".$ownwms[$i]."</td>";
+	echo "<td>".$admin->getWmsTitleByWmsId($ownwms[$i])."</td>";
+	echo "</tr>";	
+}
+?>
+</table>
+</form>
+</body>
 </html>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_wfs.php
===================================================================
--- branches/print_dev/http/php/mod_wfs.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_wfs.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,180 +1,180 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
-<title>mod_wfs</title>
-<script language='JavaScript' type='text/javascript'>
-var wfs_conf = new Array();
-/*
-function register(){
-	var isReg = false;
-	for(var i=0; i<parent.mb_InitFunctions.length; i++){
-		if(parent.mb_InitFunctions[i] == (window.name+".fetchInf()")){
-			isReg = true;
-		}
-	}
-	if(isReg == false){
-		parent.mb_registerInitFunctions(window.name+".fetchInf()");
-	}
-}
-*/
-function register() {
-	var functionStatement = window.name+".fetchInf()";
-	
-	if(!parent.eventInit.isRegistered(functionStatement)){
-		parent.mb_registerInitFunctions(functionStatement);
-	}
-}
-function fetchInf(){
-	var wfs = new Array();
-	var l;
-	var ind = parent.getMapObjIndexByName('mapframe1');
-	for(var i=0; i<parent.mb_mapObj[ind].wms.length; i++){
-		for(var j=0; j<parent.mb_mapObj[ind].wms[i].objLayer.length; j++){
-			l = parent.mb_mapObj[ind].wms[i].objLayer[j];			
-			if(l.gui_layer_wfs_featuretype != ""){
-				wfs[wfs.length] = l.gui_layer_wfs_featuretype; 
-			}
-		}	
-	}	
-	document.location.href = "../php/mod_wfs.php?id=" + wfs.join(",");
-}
-function get_wfs_conf(){
-	return wfs_conf;
-}
-var iamready = false;
-</script>
-<?php
-echo "<script language='JavaScript' type='text/javascript'>";
-if(isset($_REQUEST['id']) && $_REQUEST['id']!=""){
-	$wfs = mb_split(",",$_REQUEST['id']);
-	
-	$con = db_connect($DBSERVER,$OWNER,$PW);
-	db_select_db($DB,$con);
-	
-	for($i=0; $i<count($wfs); $i++){	
-		
-		/* wfs_conf */
-		$sql = "SELECT * FROM wfs_conf ";
-		$sql .= "JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
-		$sql .= "WHERE wfs_conf.wfs_conf_id = $1";
-		
-		$v = array($wfs[$i]);
-		$t = array('i');
-		$res = db_prep_query($sql,$v,$t);
-	
-		if($row = db_fetch_array($res)){
-			$wfs_id  = $row["fkey_wfs_id"];
-			$featuretype_id  = $row["fkey_featuretype_id"];
-			echo "var len = wfs_conf.length;";
-			echo "wfs_conf[".$i."] = new Array();";
-			echo "wfs_conf[".$i."]['wfs_conf_id']  = '".$row["wfs_conf_id"]."';";
-			echo "wfs_conf[".$i."]['wfs_conf_abstract']  = '".$row["wfs_conf_abstract"]."';";
-			echo "wfs_conf[".$i."]['g_label']  = '".$row["g_label"]."';";
-			echo "wfs_conf[".$i."]['g_label_id']  = '".$row["g_label_id"]."';";
-			echo "wfs_conf[".$i."]['g_style']  = \"".preg_replace("/\n/", "", preg_replace("/\r/", "", $row["g_style"]))."\";";
-			echo "wfs_conf[".$i."]['g_button']  = '".$row["g_button"]."';";
-			echo "wfs_conf[".$i."]['g_button_id']  = '".$row["g_button_id"]."';";
-			echo "wfs_conf[".$i."]['g_buffer']  = '".$row["g_buffer"]."';";
-			echo "wfs_conf[".$i."]['g_res_style']  = \"".preg_replace("/\n/", "", preg_replace("/\r/", "", $row["g_res_style"]))."\";";
-			echo "wfs_conf[".$i."]['g_use_wzgraphics']  = '".$row["g_use_wzgraphics"]."';";
-			echo "wfs_conf[".$i."]['fkey_featuretype_id']  = '".$row["fkey_featuretype_id"]."';";
-			echo "wfs_conf[".$i."]['wfs_getfeature']  = '".$row["wfs_getfeature"]."';";
-			echo "wfs_conf[".$i."]['wfs_describefeaturetype']  = '".$row["wfs_describefeaturetype"]."';";
-			echo "wfs_conf[".$i."]['wfs_transaction']  = '".$row["wfs_transaction"]."';";
-			#wfs_describefeaturetype - wfs_describefeaturetype
-			
-		}else{die("wfs_conf data not available");}
-		
-		$sql = "SELECT * FROM wfs_featuretype_namespace";
-		$sql .= " WHERE fkey_wfs_id = $1 AND fkey_featuretype_id = $2";
-		$v = array($wfs_id,$featuretype_id);
-		$t = array('i','i');
-		$res = db_prep_query($sql,$v,$t);
-		echo "wfs_conf[".$i."]['namespaces'] = new Array();";
-		$counter = 0;
-		while($row = db_fetch_array($res)){
-			echo "wfs_conf[".$i."]['namespaces'][".$counter."] = new Array();";
-			echo "wfs_conf[".$i."]['namespaces'][".$counter."]['name']  = '".$row["namespace"]."';";
-			echo "wfs_conf[".$i."]['namespaces'][".$counter."]['location']  = '".$row["namespace_location"]."';";
-			$counter++;
-		}
-		
-		
-		$sql = "SELECT * FROM wfs_featuretype ";
-		$sql .= "WHERE fkey_wfs_id = $1 AND featuretype_id = $2";
-		$v = array($wfs_id,$featuretype_id);
-		$t = array('i','i');
-		$res = db_prep_query($sql,$v,$t);
-		if($row = db_fetch_array($res)){
-			echo "wfs_conf[".$i."]['featuretype_name']  = '".$row["featuretype_name"]."';";
-			echo "wfs_conf[".$i."]['featuretype_srs']  = '".$row["featuretype_srs"]."';";
-		}else{die("wfs_featuretype data not available");}
-		
-		/* wfs_conf_element */
-		$sql = "SELECT * FROM wfs_conf_element ";
-		$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
-		$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1";
-		$sql .= " ORDER BY wfs_conf_element.f_respos";
-		#$sql .= "AND wfs_conf_element.f_search = 1 ORDER BY wfs_conf_element.f_search;";
-				
-		$v = array($wfs[$i]);
-		$t = array('i');
-		$res = db_prep_query($sql,$v,$t);
-		
-		echo "wfs_conf[".$i."]['element']  = new Array();";
-		$cnt = 0;
-		
-		while($row = db_fetch_array($res)){
-			echo "wfs_conf[".$i."]['element'][".$cnt."] = new Array();";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_search'] = ".$row["f_search"].";";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_style_id'] = '".$row["f_style_id"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_toupper'] = '".$row["f_toupper"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_label'] = '".htmlentities($row["f_label"], ENT_QUOTES)."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_label_id'] = '".$row["f_label_id"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_show'] = '".$row["f_show"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_show_detail'] = '".$row["f_show_detail"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_respos'] = '".$row["f_respos"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_name'] = '".htmlentities($row["element_name"], ENT_QUOTES)."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_type'] = '".htmlentities($row["element_type"], ENT_QUOTES)."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_geom'] = '".$row["f_geom"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_gid'] = '".$row["f_gid"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"".(preg_replace("/\n/", "", preg_replace("/\r/", "", $row["f_form_element_html"])))."\";";
-//			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"\";";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_edit'] = '".$row["f_edit"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_mandatory'] = '".$row["f_mandatory"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_auth_varname'] = '".htmlentities($row["f_auth_varname"], ENT_QUOTES)."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_operator'] = '".$row["f_operator"]."';";
-			$cnt++;
-		}
-		if($cnt == 0){die("wfs_conf data not available");}		
-	}
-	echo "iamready = true;";
-}
-?>
-</script>
-</head>
-<body leftmargin='0' topmargin='10'  bgcolor='#ffffff' onload='register()'>
-</body>
-</html>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
+<title>mod_wfs</title>
+<script language='JavaScript' type='text/javascript'>
+var wfs_conf = new Array();
+/*
+function register(){
+	var isReg = false;
+	for(var i=0; i<parent.mb_InitFunctions.length; i++){
+		if(parent.mb_InitFunctions[i] == (window.name+".fetchInf()")){
+			isReg = true;
+		}
+	}
+	if(isReg == false){
+		parent.mb_registerInitFunctions(window.name+".fetchInf()");
+	}
+}
+*/
+function register() {
+	var functionStatement = window.name+".fetchInf()";
+	
+	if(!parent.eventInit.isRegistered(functionStatement)){
+		parent.mb_registerInitFunctions(functionStatement);
+	}
+}
+function fetchInf(){
+	var wfs = new Array();
+	var l;
+	var ind = parent.getMapObjIndexByName('mapframe1');
+	for(var i=0; i<parent.mb_mapObj[ind].wms.length; i++){
+		for(var j=0; j<parent.mb_mapObj[ind].wms[i].objLayer.length; j++){
+			l = parent.mb_mapObj[ind].wms[i].objLayer[j];			
+			if(l.gui_layer_wfs_featuretype != ""){
+				wfs[wfs.length] = l.gui_layer_wfs_featuretype; 
+			}
+		}	
+	}	
+	document.location.href = "../php/mod_wfs.php?id=" + wfs.join(",");
+}
+function get_wfs_conf(){
+	return wfs_conf;
+}
+var iamready = false;
+</script>
+<?php
+echo "<script language='JavaScript' type='text/javascript'>";
+if(isset($_REQUEST['id']) && $_REQUEST['id']!=""){
+	$wfs = mb_split(",",$_REQUEST['id']);
+	
+	$con = db_connect($DBSERVER,$OWNER,$PW);
+	db_select_db($DB,$con);
+	
+	for($i=0; $i<count($wfs); $i++){	
+		
+		/* wfs_conf */
+		$sql = "SELECT * FROM wfs_conf ";
+		$sql .= "JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
+		$sql .= "WHERE wfs_conf.wfs_conf_id = $1";
+		
+		$v = array($wfs[$i]);
+		$t = array('i');
+		$res = db_prep_query($sql,$v,$t);
+	
+		if($row = db_fetch_array($res)){
+			$wfs_id  = $row["fkey_wfs_id"];
+			$featuretype_id  = $row["fkey_featuretype_id"];
+			echo "var len = wfs_conf.length;";
+			echo "wfs_conf[".$i."] = new Array();";
+			echo "wfs_conf[".$i."]['wfs_conf_id']  = '".$row["wfs_conf_id"]."';";
+			echo "wfs_conf[".$i."]['wfs_conf_abstract']  = '".$row["wfs_conf_abstract"]."';";
+			echo "wfs_conf[".$i."]['g_label']  = '".$row["g_label"]."';";
+			echo "wfs_conf[".$i."]['g_label_id']  = '".$row["g_label_id"]."';";
+			echo "wfs_conf[".$i."]['g_style']  = \"".preg_replace("/\n/", "", preg_replace("/\r/", "", $row["g_style"]))."\";";
+			echo "wfs_conf[".$i."]['g_button']  = '".$row["g_button"]."';";
+			echo "wfs_conf[".$i."]['g_button_id']  = '".$row["g_button_id"]."';";
+			echo "wfs_conf[".$i."]['g_buffer']  = '".$row["g_buffer"]."';";
+			echo "wfs_conf[".$i."]['g_res_style']  = \"".preg_replace("/\n/", "", preg_replace("/\r/", "", $row["g_res_style"]))."\";";
+			echo "wfs_conf[".$i."]['g_use_wzgraphics']  = '".$row["g_use_wzgraphics"]."';";
+			echo "wfs_conf[".$i."]['fkey_featuretype_id']  = '".$row["fkey_featuretype_id"]."';";
+			echo "wfs_conf[".$i."]['wfs_getfeature']  = '".$row["wfs_getfeature"]."';";
+			echo "wfs_conf[".$i."]['wfs_describefeaturetype']  = '".$row["wfs_describefeaturetype"]."';";
+			echo "wfs_conf[".$i."]['wfs_transaction']  = '".$row["wfs_transaction"]."';";
+			#wfs_describefeaturetype - wfs_describefeaturetype
+			
+		}else{die("wfs_conf data not available");}
+		
+		$sql = "SELECT * FROM wfs_featuretype_namespace";
+		$sql .= " WHERE fkey_wfs_id = $1 AND fkey_featuretype_id = $2";
+		$v = array($wfs_id,$featuretype_id);
+		$t = array('i','i');
+		$res = db_prep_query($sql,$v,$t);
+		echo "wfs_conf[".$i."]['namespaces'] = new Array();";
+		$counter = 0;
+		while($row = db_fetch_array($res)){
+			echo "wfs_conf[".$i."]['namespaces'][".$counter."] = new Array();";
+			echo "wfs_conf[".$i."]['namespaces'][".$counter."]['name']  = '".$row["namespace"]."';";
+			echo "wfs_conf[".$i."]['namespaces'][".$counter."]['location']  = '".$row["namespace_location"]."';";
+			$counter++;
+		}
+		
+		
+		$sql = "SELECT * FROM wfs_featuretype ";
+		$sql .= "WHERE fkey_wfs_id = $1 AND featuretype_id = $2";
+		$v = array($wfs_id,$featuretype_id);
+		$t = array('i','i');
+		$res = db_prep_query($sql,$v,$t);
+		if($row = db_fetch_array($res)){
+			echo "wfs_conf[".$i."]['featuretype_name']  = '".$row["featuretype_name"]."';";
+			echo "wfs_conf[".$i."]['featuretype_srs']  = '".$row["featuretype_srs"]."';";
+		}else{die("wfs_featuretype data not available");}
+		
+		/* wfs_conf_element */
+		$sql = "SELECT * FROM wfs_conf_element ";
+		$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
+		$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1";
+		$sql .= " ORDER BY wfs_conf_element.f_respos";
+		#$sql .= "AND wfs_conf_element.f_search = 1 ORDER BY wfs_conf_element.f_search;";
+				
+		$v = array($wfs[$i]);
+		$t = array('i');
+		$res = db_prep_query($sql,$v,$t);
+		
+		echo "wfs_conf[".$i."]['element']  = new Array();";
+		$cnt = 0;
+		
+		while($row = db_fetch_array($res)){
+			echo "wfs_conf[".$i."]['element'][".$cnt."] = new Array();";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_search'] = ".$row["f_search"].";";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_style_id'] = '".$row["f_style_id"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_toupper'] = '".$row["f_toupper"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_label'] = '".htmlentities($row["f_label"], ENT_QUOTES)."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_label_id'] = '".$row["f_label_id"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_show'] = '".$row["f_show"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_show_detail'] = '".$row["f_show_detail"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_respos'] = '".$row["f_respos"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_name'] = '".htmlentities($row["element_name"], ENT_QUOTES)."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_type'] = '".htmlentities($row["element_type"], ENT_QUOTES)."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_geom'] = '".$row["f_geom"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_gid'] = '".$row["f_gid"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"".(preg_replace("/\n/", "", preg_replace("/\r/", "", $row["f_form_element_html"])))."\";";
+//			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"\";";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_edit'] = '".$row["f_edit"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_mandatory'] = '".$row["f_mandatory"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_auth_varname'] = '".htmlentities($row["f_auth_varname"], ENT_QUOTES)."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_operator'] = '".$row["f_operator"]."';";
+			$cnt++;
+		}
+		if($cnt == 0){die("wfs_conf data not available");}		
+	}
+	echo "iamready = true;";
+}
+?>
+</script>
+</head>
+<body leftmargin='0' topmargin='10'  bgcolor='#ffffff' onload='register()'>
+</body>
+</html>

Modified: branches/print_dev/http/php/mod_wfsSpatialRequest_messages.php
===================================================================
--- branches/print_dev/http/php/mod_wfsSpatialRequest_messages.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_wfsSpatialRequest_messages.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,42 +1,42 @@
-<?php
-#$Id: mod_insertWmcIntoDb.php 507 2006-11-20 10:55:57Z christoph $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-
-$e = new mb_notice("locale: " . $_SESSION["mb_locale"] . "; lang: " . $_SESSION["mb_lang"]);
-setlocale(LC_ALL, $_SESSION["mb_locale"]);
-
-//
-// Messages
-//
-$msg_obj = array();
-$msg_obj["buttonLabelRectangle"] = _mb("select by rectangle");
-$msg_obj["buttonLabelPolygon"] = _mb("select by polygon");
-$msg_obj["buttonLabelPoint"] = _mb("select by point");
-$msg_obj["buttonLabelExtent"] = _mb("select by extent");
-$msg_obj["buttonLabelDialogue"] = _mb("open dialogue form");
-$msg_obj["errorMessageInvalidExtent"] = _mb("Invalid box!");
-
-$json = new Mapbender_JSON();
-$output = $json->encode($msg_obj);
-
-header("Content-type:application/x-json; charset=utf-8");
-echo $output;
+<?php
+#$Id: mod_insertWmcIntoDb.php 507 2006-11-20 10:55:57Z christoph $
+#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+$e = new mb_notice("locale: " . $_SESSION["mb_locale"] . "; lang: " . $_SESSION["mb_lang"]);
+setlocale(LC_ALL, $_SESSION["mb_locale"]);
+
+//
+// Messages
+//
+$msg_obj = array();
+$msg_obj["buttonLabelRectangle"] = _mb("select by rectangle");
+$msg_obj["buttonLabelPolygon"] = _mb("select by polygon");
+$msg_obj["buttonLabelPoint"] = _mb("select by point");
+$msg_obj["buttonLabelExtent"] = _mb("select by extent");
+$msg_obj["buttonLabelDialogue"] = _mb("open dialogue form");
+$msg_obj["errorMessageInvalidExtent"] = _mb("Invalid box!");
+
+$json = new Mapbender_JSON();
+$output = $json->encode($msg_obj);
+
+header("Content-type:application/x-json; charset=utf-8");
+echo $output;
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_wfs_gazetteer_server.php
===================================================================
--- branches/print_dev/http/php/mod_wfs_gazetteer_server.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_wfs_gazetteer_server.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,139 +1,139 @@
-<?php
-# $Id: mod_wfs_gazetteer_server.php 1190 2007-10-18 10:38:38Z baudson $
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
-require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
-require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
-require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
-
-$command = $_REQUEST["command"];
-
-/**
- * checks if a variable name is valid.
- * Currently a valid name would be sth. like $_SESSION["mb_user_id"]
- * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
- */
-function isValidVarName ($varname) {
-	if (preg_match("/[\$]{1}_[a-z]+\[\"[a-z_]+\"\]/i", $varname) != 0) {
-		return true;
-	}
-	return false;
-}
-
-/**
- * If access to the WFS conf is restricted, modify the filter.
- * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
- */
- function checkAccessConstraint($filter, $wfs_conf_id) {
-	/* wfs_conf_element */
-	$sql = "SELECT * FROM wfs_conf_element ";
-	$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
-	$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
-	$sql .= "ORDER BY wfs_conf_element.f_respos";
-			
-	$v = array($wfs_conf_id);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	while($row = db_fetch_array($res)){
-
-		if (!empty($row["f_auth_varname"])) {
-			$auth_varname = $row["f_auth_varname"];
-			$element_name = $row["element_name"];
-		}
-	}
-	if (!empty($auth_varname)) {
-
-		if (isValidVarName($auth_varname)) {
-			$user = eval("return " . $auth_varname . ";");
-			if ($user) {
-				$pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)";
-				$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; 
-				$filter = mb_eregi_replace($pattern, $replacement, $filter);
-			}
-			else {
-				$e = new mb_exception("mod_wfs_gazetteer_server: checkAccessConstraint: invalid value of variable containing user information!");
-			}
-		}
-		else {
-			$e = new mb_exception("mod_wfs_gazetteer_server: checkAccessConstraint: var name is not valid! (" . $auth_varname . ")");
-		}
-	}
-	return $filter;
-}
-
-
-if ($command == "getWfsConf") {
-	
-	$wfsConfIdString = $_GET["wfsConfIdString"];
-	
-	if ($wfsConfIdString != "") {
-		//array_keys(array_flip()) produces an array with unique entries
-		$wfsConfIdArray = array_keys(array_flip(mb_split(",", $wfsConfIdString)));
-	}
-	else {
-		echo "please specify wfs conf id.";
-		die();
-	}
-	
-	$obj = new WfsConf();
-	$obj->load($wfsConfIdArray);
-	$json = new Mapbender_JSON();
-	$output = $json->encode($obj->confArray);
-	echo $output;
-}
-else if ($command == "getSearchResults") {
-	$wfs_conf_id = $_REQUEST["wfs_conf_id"];
-	$backlink = $_REQUEST["backlink"];
-	$frame = $_REQUEST["frame"];
-	$filter = $_REQUEST["filter"];
-	$url = $_REQUEST["url"];
-	$typename = $_REQUEST["typename"];
-
-	$wfsConf = WfsConfiguration::createFromDb($wfs_conf_id);
-	if (is_null($wfsConf)) {
-		sendErrorMessage("Invalid WFS conf: " . $wfs_conf_id);
-	}
-	
-	$admin = new administration();
-	
-	$filter = $admin->char_decode(stripslashes($filter));
-
-	$wfsId = $wfsConf->wfsId;
-
-	$myWfsFactory = new UniversalWfsFactory();
-	$myWfs = $myWfsFactory->createFromDb($wfsId);
-	$data = $myWfs->getFeature($typename, $filter);
-	if ($data === null) die('{}');
-	
-//	$geomColumn = WfsConf::getGeomColumnNameByConfId($wfs_conf_id);
-
-	$gmlFactory = new UniversalGmlFactory();
-	$myGml = $gmlFactory->createFromXml($data, $wfsConf);
-	$geoJson = $myGml->toGeoJSON();
-	
-	header("Content-type:application/x-json; charset=utf-8");
-	echo $geoJson;
-}
-else {
-	echo "please enter a valid command.";
-}
+<?php
+# $Id: mod_wfs_gazetteer_server.php 1190 2007-10-18 10:38:38Z baudson $
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
+require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
+
+$command = $_REQUEST["command"];
+
+/**
+ * checks if a variable name is valid.
+ * Currently a valid name would be sth. like $_SESSION["mb_user_id"]
+ * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
+ */
+function isValidVarName ($varname) {
+	if (preg_match("/[\$]{1}_[a-z]+\[\"[a-z_]+\"\]/i", $varname) != 0) {
+		return true;
+	}
+	return false;
+}
+
+/**
+ * If access to the WFS conf is restricted, modify the filter.
+ * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
+ */
+ function checkAccessConstraint($filter, $wfs_conf_id) {
+	/* wfs_conf_element */
+	$sql = "SELECT * FROM wfs_conf_element ";
+	$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
+	$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
+	$sql .= "ORDER BY wfs_conf_element.f_respos";
+			
+	$v = array($wfs_conf_id);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	while($row = db_fetch_array($res)){
+
+		if (!empty($row["f_auth_varname"])) {
+			$auth_varname = $row["f_auth_varname"];
+			$element_name = $row["element_name"];
+		}
+	}
+	if (!empty($auth_varname)) {
+
+		if (isValidVarName($auth_varname)) {
+			$user = eval("return " . $auth_varname . ";");
+			if ($user) {
+				$pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)";
+				$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; 
+				$filter = mb_eregi_replace($pattern, $replacement, $filter);
+			}
+			else {
+				$e = new mb_exception("mod_wfs_gazetteer_server: checkAccessConstraint: invalid value of variable containing user information!");
+			}
+		}
+		else {
+			$e = new mb_exception("mod_wfs_gazetteer_server: checkAccessConstraint: var name is not valid! (" . $auth_varname . ")");
+		}
+	}
+	return $filter;
+}
+
+
+if ($command == "getWfsConf") {
+	
+	$wfsConfIdString = $_GET["wfsConfIdString"];
+	
+	if ($wfsConfIdString != "") {
+		//array_keys(array_flip()) produces an array with unique entries
+		$wfsConfIdArray = array_keys(array_flip(mb_split(",", $wfsConfIdString)));
+	}
+	else {
+		echo "please specify wfs conf id.";
+		die();
+	}
+	
+	$obj = new WfsConf();
+	$obj->load($wfsConfIdArray);
+	$json = new Mapbender_JSON();
+	$output = $json->encode($obj->confArray);
+	echo $output;
+}
+else if ($command == "getSearchResults") {
+	$wfs_conf_id = $_REQUEST["wfs_conf_id"];
+	$backlink = $_REQUEST["backlink"];
+	$frame = $_REQUEST["frame"];
+	$filter = $_REQUEST["filter"];
+	$url = $_REQUEST["url"];
+	$typename = $_REQUEST["typename"];
+
+	$wfsConf = WfsConfiguration::createFromDb($wfs_conf_id);
+	if (is_null($wfsConf)) {
+		sendErrorMessage("Invalid WFS conf: " . $wfs_conf_id);
+	}
+	
+	$admin = new administration();
+	
+	$filter = $admin->char_decode(stripslashes($filter));
+
+	$wfsId = $wfsConf->wfsId;
+
+	$myWfsFactory = new UniversalWfsFactory();
+	$myWfs = $myWfsFactory->createFromDb($wfsId);
+	$data = $myWfs->getFeature($typename, $filter);
+	if ($data === null) die('{}');
+	
+//	$geomColumn = WfsConf::getGeomColumnNameByConfId($wfs_conf_id);
+
+	$gmlFactory = new UniversalGmlFactory();
+	$myGml = $gmlFactory->createFromXml($data, $wfsConf);
+	$geoJson = $myGml->toGeoJSON();
+	
+	header("Content-type:application/x-json; charset=utf-8");
+	echo $geoJson;
+}
+else {
+	echo "please enter a valid command.";
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_wfs_result.php
===================================================================
--- branches/print_dev/http/php/mod_wfs_result.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_wfs_result.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,105 +1,105 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Administration
-# 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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../classes/class_stripRequest.php");
-require_once(dirname(__FILE__) . "/../classes/class_connector.php");
-require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
-require_once(dirname(__FILE__)."/../classes/class_wfs.php");
-require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
-require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
-
-$filter = stripslashes($_REQUEST["filter"]);
-$db_wfs_conf_id = $_REQUEST["db_wfs_conf_id"];
-$typename = $_REQUEST["typename"];
-
-/**
- * checks if a variable name is valid.
- * Currently a valid name would be sth. like $_SESSION["mb_user_id"]
- * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
- */
-function isValidVarName ($varname) {
-	if (preg_match("/[\$]{1}_[a-z]+\[\"[a-z_]+\"\]/i", $varname) != 0) {
-		return true;
-	}
-	return false;
-}
-/**
- * If access to the WFS conf is restricted, modify the filter.
- * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
- */
-function checkAccessConstraint($filter, $wfs_conf_id) {
-	/* wfs_conf_element */
-	$sql = "SELECT * FROM wfs_conf_element ";
-	$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
-	$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
-	$sql .= "ORDER BY wfs_conf_element.f_respos";
-			
-	$v = array($wfs_conf_id);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	while($row = db_fetch_array($res)){
-
-		if (!empty($row["f_auth_varname"])) {
-			$auth_varname = $row["f_auth_varname"];
-			$element_name = $row["element_name"];
-		}
-	}
-	$e = new mb_exception($auth_varname . " " . $element_name);
-	if (!empty($auth_varname)) {
-
-		if (isValidVarName($auth_varname)) {
-			$user = eval("return " . $auth_varname . ";");
-			$pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)";
-			$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; 
-			$filter = eregi_replace($pattern, $replacement, $filter);
-		}
-	}
-	return $filter;
-}
-
-$filter = checkAccessConstraint($filter, $db_wfs_conf_id);
-
-$sql = "SELECT fkey_wfs_id FROM wfs_conf WHERE wfs_conf_id = $1";
-$v = array($db_wfs_conf_id);
-$t = array('i');
-$res = db_prep_query($sql, $v, $t);
-$row = db_fetch_array($res);
-$wfsId = $row["fkey_wfs_id"];
-
-
-$myWfsFactory = new UniversalWfsFactory();
-$myWfs = $myWfsFactory->createFromDb($wfsId);
-$data = $myWfs->getFeature($typename, $filter);
-
-if ($data === null) die('{}');
-
-$myWfsConf = WfsConfiguration::createFromDb($db_wfs_conf_id);
-if (is_null($myWfsConf)) {
-	die("{}");
-}
-
-$gmlFactory = new UniversalGmlFactory();
-$myGml = $gmlFactory->createFromXml($data, $myWfsConf);
-
-$geoJson = $myGml->toGeoJSON();
-
-header('Content-type: text/html');
-echo $geoJson;
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Administration
+# 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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_stripRequest.php");
+require_once(dirname(__FILE__) . "/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs.php");
+require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
+
+$filter = stripslashes($_REQUEST["filter"]);
+$db_wfs_conf_id = $_REQUEST["db_wfs_conf_id"];
+$typename = $_REQUEST["typename"];
+
+/**
+ * checks if a variable name is valid.
+ * Currently a valid name would be sth. like $_SESSION["mb_user_id"]
+ * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
+ */
+function isValidVarName ($varname) {
+	if (preg_match("/[\$]{1}_[a-z]+\[\"[a-z_]+\"\]/i", $varname) != 0) {
+		return true;
+	}
+	return false;
+}
+/**
+ * If access to the WFS conf is restricted, modify the filter.
+ * TODO: this function is also in mod_wfs_result!! Maybe merge someday.
+ */
+function checkAccessConstraint($filter, $wfs_conf_id) {
+	/* wfs_conf_element */
+	$sql = "SELECT * FROM wfs_conf_element ";
+	$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
+	$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
+	$sql .= "ORDER BY wfs_conf_element.f_respos";
+			
+	$v = array($wfs_conf_id);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	while($row = db_fetch_array($res)){
+
+		if (!empty($row["f_auth_varname"])) {
+			$auth_varname = $row["f_auth_varname"];
+			$element_name = $row["element_name"];
+		}
+	}
+	$e = new mb_exception($auth_varname . " " . $element_name);
+	if (!empty($auth_varname)) {
+
+		if (isValidVarName($auth_varname)) {
+			$user = eval("return " . $auth_varname . ";");
+			$pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)";
+			$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; 
+			$filter = eregi_replace($pattern, $replacement, $filter);
+		}
+	}
+	return $filter;
+}
+
+$filter = checkAccessConstraint($filter, $db_wfs_conf_id);
+
+$sql = "SELECT fkey_wfs_id FROM wfs_conf WHERE wfs_conf_id = $1";
+$v = array($db_wfs_conf_id);
+$t = array('i');
+$res = db_prep_query($sql, $v, $t);
+$row = db_fetch_array($res);
+$wfsId = $row["fkey_wfs_id"];
+
+
+$myWfsFactory = new UniversalWfsFactory();
+$myWfs = $myWfsFactory->createFromDb($wfsId);
+$data = $myWfs->getFeature($typename, $filter);
+
+if ($data === null) die('{}');
+
+$myWfsConf = WfsConfiguration::createFromDb($db_wfs_conf_id);
+if (is_null($myWfsConf)) {
+	die("{}");
+}
+
+$gmlFactory = new UniversalGmlFactory();
+$myGml = $gmlFactory->createFromXml($data, $myWfsConf);
+
+$geoJson = $myGml->toGeoJSON();
+
+header('Content-type: text/html');
+echo $geoJson;
 ?> 
\ No newline at end of file

Modified: branches/print_dev/http/php/mod_wfs_server.php
===================================================================
--- branches/print_dev/http/php/mod_wfs_server.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/php/mod_wfs_server.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,324 +1,324 @@
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_wfs.php");
-require_once(dirname(__FILE__) . "/../classes/class_json.php");
-require_once(dirname(__FILE__) . "/../classes/class_universal_wfs_factory.php");
-
-$json = new Mapbender_JSON();
-$obj = $json->decode(stripslashes($_REQUEST['obj']));
-
-//workflow:
-switch($obj->action){
-	case 'getServices':
-		$obj->services = getServices($obj);
-		sendOutput($obj);
-	break;
-	case 'getWfsConfData':
-		$obj->wfsConf = getWfsConfData($obj->wfs);
-		sendOutput($obj);
-	break;
-	case 'getGuis':
-		$obj->id = getGuis($obj);
-		sendOutput($obj);
-	break;
-	case 'getAssignedConfs':
-		$obj->assignedConfs = getAssignedConfs($obj);
-		sendOutput($obj);
-	break;
-	case 'getUpdateUrl':
-		$obj->url = getUpdateUrl($obj);
-		sendOutput($obj);
-	break;
-		case 'add':
-		addConfsToGui($obj);
-		sendOutput($obj);
-	break;
-	case 'remove':
-		removeConfsFromGui($obj);
-		sendOutput($obj);
-	break;
-	case 'updateWfs':
-		updateWfs($obj);
-		sendOutput($obj);
-	break;
-	case 'deleteWfs':
-		deleteWfs($obj);
-		sendOutput($obj);
-	break;
-	case 'setOwsproxy':
-		$ows = array();
-		$ows['string'] = setOwsproxy($obj);
-		$ows['action'] = "owsproxy";
-		sendOutput($ows);
-	break;
-	case 'removeOwsproxy':
-		$ows = array();
-		$ows['string'] = removeOwsproxy($obj);
-		$ows['action'] = "owsproxy";
-		sendOutput($ows);
-	break;
-	case 'getOwsproxy':
-		$ows = array();
-		$ows['string'] = getOwsproxy($obj);
-		$ows['action'] = "owsproxy";
-		sendOutput($ows);
-	break;
-	default:
-		sendOutput("no action specified...");
-}
-
-
-/*
- * Get all services (ids and titles) where the current user is owner
- *
- * @return mixed[] services the ids and titles of the services
- */
-function getServices(){
-	global $con;
-	$services = array();
-	$services['id'] = array();
-	$services['title'] = array();
-	$adm = new administration();
-	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
-	if(count($serviceList) == 0){
-		return false;
-	}
-	$sql = "SELECT * FROM wfs WHERE wfs_id IN (";
-	$v = $serviceList;
-	$t = array();
-	for ($i = 1; $i <= count($serviceList); $i++) {
-		if ($i > 1) {
-			$sql .= ", ";
-		}
-		$sql .= "$" . $i;
-		array_push($t, "i");
-	}
-	$sql .= ") ORDER BY wfs_title";
-	$res = db_prep_query($sql, $v, $t);
-	while($row = db_fetch_array($res)){
-		array_push($services['id'], $row['wfs_id']);
-		array_push($services['title'], $row['wfs_title']);
-	}
-	return $services;
-}
-
-/*
- * Get all configurations of the selcted wfs if the current user is owner
- *
- * @return mixed[]
- */
-function getWfsConfData($wfsID){
-	global $con;
-	// re-check permission
-	$adm = new administration();
-	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
-	if(in_array($wfsID, $serviceList)){
-		$wfsConf = array();
-		$wfsConf['id'] = array();
-		$wfsConf['abstract'] = array();
-		$sql = "SELECT * FROM wfs_conf WHERE fkey_wfs_id = $1 ORDER BY wfs_conf_abstract";
-		$v = array($wfsID);
-		$t = array('i');
-		$res = db_prep_query($sql,$v,$t);
-		$cnt = 0;
-		while($row = db_fetch_array($res)){
-			array_push($wfsConf['id'], $row['wfs_conf_id']);
-			array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
-			$cnt++;
-		}
-		if($cnt == 0){
-			return false;
-		}
-		else{
-			return $wfsConf;
-		}
-	}
-	else if($wfsID==="gui_confs"){
-		$wfsConf = array();
-		$wfsConf['id'] = array();
-		$wfsConf['abstract'] = array();
-		$wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
-		$cnt = 0;
-		foreach($wfsConf['id'] as $wfscid){
-			$sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
-			$v = array($wfscid);
-			$t = array('i');
-			$res = db_prep_query($sql,$v,$t);
-			while($row = db_fetch_array($res)){
-				array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
-			}
-			$cnt++;
-		}
-		if($cnt == 0){
-			return false;
-		}
-		else{
-			return $wfsConf;
-		}
-	}
-}
-/*
- * Get all GUIs where the current user is owner. This are the GUIs where the user could publish his
- * wfs configurations
- *
- * @return mixed[]
- */
-function getGuis(){
-	$adm = new administration();
-	$guiList = $adm->getGuisByOwner($_SESSION['mb_user_id'],1);
-	if(count($guiList) > 0){
-		return $guiList;
-	}
-	return false;
-}
-
-
-/*
- * get all wfs_confs of the selected WFS which are assigned to the selected gui
- * @param
- * @return mixed[]
- */
-function getAssignedConfs($obj){
-	global $con;
-	$assignedConfs = array();
-	$confs = getWfsConfData($obj->selectedWfs);
-	if($confs === false){
-		return false;
-	}
-	$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id IN (".join(",",$confs['id']).")";
-	$v = array($obj->selectedGui);
-	$t = array('s');
-	$res = db_prep_query($sql,$v,$t);
-	if(!$res){
-		$e = new mb_exception("Error: SQL: " . $sql . " -> Gui: " .$obj->selectedGui);
-	}
-	while($row = db_fetch_array($res)){
-		array_push($assignedConfs, $row['fkey_wfs_conf_id']);
-	}
-	return $assignedConfs;
-}
-
-
-function addConfsToGui($obj){
-	global $con;
-	for($i=0; $i<count($obj->confs); $i++){
-		$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id = $2";
-		$v = array($obj->gui,$obj->confs->$i);
-		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);
-		if(!$row = db_fetch_array($res)){
-			$sql1 = "INSERT INTO gui_wfs_conf (fkey_gui_id,fkey_wfs_conf_id) VALUES ($1,$2)";
-			$v1 = array($obj->gui, $obj->confs->$i);
-			$t1 = array('s', 'i');
-			$res1 = db_prep_query($sql1,$v1,$t1);
-		}
-	}
-}
-
-function removeConfsFromGui($obj){
-	global $con;
-	for($i=0; $i<count($obj->confs); $i++){
-		$sql = "DELETE FROM gui_wfs_conf  WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id = $2";
-		$v = array($obj->gui, $obj->confs->$i);
-		$t = array('s', 'i');
-		$res = db_prep_query($sql,$v,$t);
-	}
-}
-/*
- * updates an WFS
- *
- * @param object the un-encoded object
- * @return boolean success
- */
-function updateWfs($obj){
-	$id = $obj->wfs;
-
-	$wfsFactory = new UniversalWfsFactory();
-	$myWfs = $wfsFactory->createFromDb($id);
-
-	if(is_null($myWfs) || !$myWfs->update()){
-		$obj->success = false;
-	}
-	else {
-		$obj->success = true;
-	}
-	return true;
-}
-/*
- * deletes an WFS
- *
- * @param object the un-encoded object
- * @return boolean success
- */
-function deleteWfs($obj){
-	$id = $obj->wfs;
-	
-	$wfsFactory = new UniversalWfsFactory();
-	$myWfs = $wfsFactory->createFromDb($id);
-	if (is_null($myWfs) || !$myWfs->delete()) {
-		$obj->success = false;
-	}
-	else {
-		$obj->success = true;
-	}
-	return true;
-}
-
-/*
- * gets the specified url column from db
- *
- * @param object the un-encoded object
- * @return string requested url
- */
-
-function getUpdateUrl($obj){
-	global $con;
-	$sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
-	$v = array($obj->wfs);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	while($row = db_fetch_array($res)){
-		$ContentOfColumn = $row[$obj->column];
-		if($obj->column == 'wfs_getcapabilities'){
-										$n = new administration();
-										$updateUrl = $n->checkURL($ContentOfColumn)."Version=".$row['wfs_version']."&Request=getCapabilities&SERVICE=WFS";
-		}else{
-					$updateUrl = $ContentOfColumn;
-		}
-			
-		return $updateUrl;
-	}
-	return "";
-}
-
-function getOwsproxy($obj){
-	$n = new administration();
-	if($obj->wfs=="gui_confs")
-		return false;
-	return $n->getWfsOwsproxyString($obj->wfs);
-}
-function setOwsproxy($obj){
-	$n = new administration();
-	if($obj->wfs=="gui_confs")
-		return false;
-	return $n->setWfsOwsproxyString($obj->wfs,true);
-}
-function removeOwsproxy($obj){
-	$n = new administration();
-	if($obj->wfs=="gui_confs")
-		return false;
-	return $n->setWfsOwsproxyString($obj->wfs,false);
-}
-/*
- * encodes and delivers the data
- *
- * @param object the un-encoded object
- */
-function sendOutput($out){
-	global $json;
-	$output = $json->encode($out);
-	header("Content-Type: text/x-json");
-	echo $output;
-}
-?>
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+require_once(dirname(__FILE__) . "/../classes/class_universal_wfs_factory.php");
+
+$json = new Mapbender_JSON();
+$obj = $json->decode(stripslashes($_REQUEST['obj']));
+
+//workflow:
+switch($obj->action){
+	case 'getServices':
+		$obj->services = getServices($obj);
+		sendOutput($obj);
+	break;
+	case 'getWfsConfData':
+		$obj->wfsConf = getWfsConfData($obj->wfs);
+		sendOutput($obj);
+	break;
+	case 'getGuis':
+		$obj->id = getGuis($obj);
+		sendOutput($obj);
+	break;
+	case 'getAssignedConfs':
+		$obj->assignedConfs = getAssignedConfs($obj);
+		sendOutput($obj);
+	break;
+	case 'getUpdateUrl':
+		$obj->url = getUpdateUrl($obj);
+		sendOutput($obj);
+	break;
+		case 'add':
+		addConfsToGui($obj);
+		sendOutput($obj);
+	break;
+	case 'remove':
+		removeConfsFromGui($obj);
+		sendOutput($obj);
+	break;
+	case 'updateWfs':
+		updateWfs($obj);
+		sendOutput($obj);
+	break;
+	case 'deleteWfs':
+		deleteWfs($obj);
+		sendOutput($obj);
+	break;
+	case 'setOwsproxy':
+		$ows = array();
+		$ows['string'] = setOwsproxy($obj);
+		$ows['action'] = "owsproxy";
+		sendOutput($ows);
+	break;
+	case 'removeOwsproxy':
+		$ows = array();
+		$ows['string'] = removeOwsproxy($obj);
+		$ows['action'] = "owsproxy";
+		sendOutput($ows);
+	break;
+	case 'getOwsproxy':
+		$ows = array();
+		$ows['string'] = getOwsproxy($obj);
+		$ows['action'] = "owsproxy";
+		sendOutput($ows);
+	break;
+	default:
+		sendOutput("no action specified...");
+}
+
+
+/*
+ * Get all services (ids and titles) where the current user is owner
+ *
+ * @return mixed[] services the ids and titles of the services
+ */
+function getServices(){
+	global $con;
+	$services = array();
+	$services['id'] = array();
+	$services['title'] = array();
+	$adm = new administration();
+	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
+	if(count($serviceList) == 0){
+		return false;
+	}
+	$sql = "SELECT * FROM wfs WHERE wfs_id IN (";
+	$v = $serviceList;
+	$t = array();
+	for ($i = 1; $i <= count($serviceList); $i++) {
+		if ($i > 1) {
+			$sql .= ", ";
+		}
+		$sql .= "$" . $i;
+		array_push($t, "i");
+	}
+	$sql .= ") ORDER BY wfs_title";
+	$res = db_prep_query($sql, $v, $t);
+	while($row = db_fetch_array($res)){
+		array_push($services['id'], $row['wfs_id']);
+		array_push($services['title'], $row['wfs_title']);
+	}
+	return $services;
+}
+
+/*
+ * Get all configurations of the selcted wfs if the current user is owner
+ *
+ * @return mixed[]
+ */
+function getWfsConfData($wfsID){
+	global $con;
+	// re-check permission
+	$adm = new administration();
+	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
+	if(in_array($wfsID, $serviceList)){
+		$wfsConf = array();
+		$wfsConf['id'] = array();
+		$wfsConf['abstract'] = array();
+		$sql = "SELECT * FROM wfs_conf WHERE fkey_wfs_id = $1 ORDER BY wfs_conf_abstract";
+		$v = array($wfsID);
+		$t = array('i');
+		$res = db_prep_query($sql,$v,$t);
+		$cnt = 0;
+		while($row = db_fetch_array($res)){
+			array_push($wfsConf['id'], $row['wfs_conf_id']);
+			array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
+			$cnt++;
+		}
+		if($cnt == 0){
+			return false;
+		}
+		else{
+			return $wfsConf;
+		}
+	}
+	else if($wfsID==="gui_confs"){
+		$wfsConf = array();
+		$wfsConf['id'] = array();
+		$wfsConf['abstract'] = array();
+		$wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
+		$cnt = 0;
+		foreach($wfsConf['id'] as $wfscid){
+			$sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
+			$v = array($wfscid);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			while($row = db_fetch_array($res)){
+				array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
+			}
+			$cnt++;
+		}
+		if($cnt == 0){
+			return false;
+		}
+		else{
+			return $wfsConf;
+		}
+	}
+}
+/*
+ * Get all GUIs where the current user is owner. This are the GUIs where the user could publish his
+ * wfs configurations
+ *
+ * @return mixed[]
+ */
+function getGuis(){
+	$adm = new administration();
+	$guiList = $adm->getGuisByOwner($_SESSION['mb_user_id'],1);
+	if(count($guiList) > 0){
+		return $guiList;
+	}
+	return false;
+}
+
+
+/*
+ * get all wfs_confs of the selected WFS which are assigned to the selected gui
+ * @param
+ * @return mixed[]
+ */
+function getAssignedConfs($obj){
+	global $con;
+	$assignedConfs = array();
+	$confs = getWfsConfData($obj->selectedWfs);
+	if($confs === false){
+		return false;
+	}
+	$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id IN (".join(",",$confs['id']).")";
+	$v = array($obj->selectedGui);
+	$t = array('s');
+	$res = db_prep_query($sql,$v,$t);
+	if(!$res){
+		$e = new mb_exception("Error: SQL: " . $sql . " -> Gui: " .$obj->selectedGui);
+	}
+	while($row = db_fetch_array($res)){
+		array_push($assignedConfs, $row['fkey_wfs_conf_id']);
+	}
+	return $assignedConfs;
+}
+
+
+function addConfsToGui($obj){
+	global $con;
+	for($i=0; $i<count($obj->confs); $i++){
+		$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id = $2";
+		$v = array($obj->gui,$obj->confs->$i);
+		$t = array('s','i');
+		$res = db_prep_query($sql,$v,$t);
+		if(!$row = db_fetch_array($res)){
+			$sql1 = "INSERT INTO gui_wfs_conf (fkey_gui_id,fkey_wfs_conf_id) VALUES ($1,$2)";
+			$v1 = array($obj->gui, $obj->confs->$i);
+			$t1 = array('s', 'i');
+			$res1 = db_prep_query($sql1,$v1,$t1);
+		}
+	}
+}
+
+function removeConfsFromGui($obj){
+	global $con;
+	for($i=0; $i<count($obj->confs); $i++){
+		$sql = "DELETE FROM gui_wfs_conf  WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id = $2";
+		$v = array($obj->gui, $obj->confs->$i);
+		$t = array('s', 'i');
+		$res = db_prep_query($sql,$v,$t);
+	}
+}
+/*
+ * updates an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function updateWfs($obj){
+	$id = $obj->wfs;
+
+	$wfsFactory = new UniversalWfsFactory();
+	$myWfs = $wfsFactory->createFromDb($id);
+
+	if(is_null($myWfs) || !$myWfs->update()){
+		$obj->success = false;
+	}
+	else {
+		$obj->success = true;
+	}
+	return true;
+}
+/*
+ * deletes an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function deleteWfs($obj){
+	$id = $obj->wfs;
+	
+	$wfsFactory = new UniversalWfsFactory();
+	$myWfs = $wfsFactory->createFromDb($id);
+	if (is_null($myWfs) || !$myWfs->delete()) {
+		$obj->success = false;
+	}
+	else {
+		$obj->success = true;
+	}
+	return true;
+}
+
+/*
+ * gets the specified url column from db
+ *
+ * @param object the un-encoded object
+ * @return string requested url
+ */
+
+function getUpdateUrl($obj){
+	global $con;
+	$sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
+	$v = array($obj->wfs);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	while($row = db_fetch_array($res)){
+		$ContentOfColumn = $row[$obj->column];
+		if($obj->column == 'wfs_getcapabilities'){
+										$n = new administration();
+										$updateUrl = $n->checkURL($ContentOfColumn)."Version=".$row['wfs_version']."&Request=getCapabilities&SERVICE=WFS";
+		}else{
+					$updateUrl = $ContentOfColumn;
+		}
+			
+		return $updateUrl;
+	}
+	return "";
+}
+
+function getOwsproxy($obj){
+	$n = new administration();
+	if($obj->wfs=="gui_confs")
+		return false;
+	return $n->getWfsOwsproxyString($obj->wfs);
+}
+function setOwsproxy($obj){
+	$n = new administration();
+	if($obj->wfs=="gui_confs")
+		return false;
+	return $n->setWfsOwsproxyString($obj->wfs,true);
+}
+function removeOwsproxy($obj){
+	$n = new administration();
+	if($obj->wfs=="gui_confs")
+		return false;
+	return $n->setWfsOwsproxyString($obj->wfs,false);
+}
+/*
+ * encodes and delivers the data
+ *
+ * @param object the un-encoded object
+ */
+function sendOutput($out){
+	global $json;
+	$output = $json->encode($out);
+	header("Content-Type: text/x-json");
+	echo $output;
+}
+?>

Modified: branches/print_dev/http/print/classes/factoryClasses.php
===================================================================
--- branches/print_dev/http/print/classes/factoryClasses.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/factoryClasses.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,76 +1,76 @@
-<?php
-
-require_once(dirname(__FILE__)."/../../../core/globalSettings.php");
-require_once(dirname(__FILE__) . "/../../classes/class_json.php");
-require_once(dirname(__FILE__) . "/../../classes/class_administration.php");
-
-
-abstract class mbPrintFactory {
-
-	protected function createOutput($jsonConf, $concreteFactory) {
-		return $concreteFactory->create($jsonConf);
-	}
-	
-	abstract public function create($jsonConf);
-
-}
-
-class mbPdfFactory extends mbPrintFactory {
-
-	private function readConfig($jsonConfFile) {
-		$admin = new administration();
-		$mbjson = new Mapbender_JSON(); 
-		$jsonStr = file_get_contents(dirname(__FILE__) . "/../".$jsonConfFile);
-		if ($jsonStr == false) {
-			$e = new mb_exception("mbPdfFactory: config file could not be read.");
-			die("config not found.");
-		}
-		$jsonConf = $mbjson->decode($admin->char_encode($jsonStr));
-		return $jsonConf;
-	}
-	
-	public function create($jsonConfFile) {
- 		$jsonConf = $this->readConfig($jsonConfFile);
-		try {
-			switch ($jsonConf->type) {
-				case "templatePDF":
-					$factory = new mbTemplatePdfFactory();
-            		break;
-				case "dynamicPDF":
-					$factory = new mbDynamicPdfFactory();
-            		break;
-				default:
-					$e = new mb_exception("mbPdfFactory: output type not supported.");
-			}
-			return $this->createOutput($jsonConf, $factory);
-		} catch (Exception $e){
-			$e = new mb_exception("mbPdfFactory: could not create PDF output.");
-		} 
-		
-		return;
-	}
-
-}
-
-class mbTemplatePdfFactory extends mbPrintFactory {
-
-	public function create($jsonConf) {
-		return new mbTemplatePdf($jsonConf);
-	}
-
-}
-
-class mbDynamicPdfFactory extends mbPrintFactory {
-
-	public function create($jsonConf) {
-		return new mbDynamicPdf($jsonConf);
-	}
-
-}
-
-function __autoload($class_name) {
-	if (file_exists(dirname(__FILE__). "/{$class_name}.php"))
-    	require_once $class_name . '.php';
-}
-
+<?php
+
+require_once(dirname(__FILE__)."/../../../core/globalSettings.php");
+require_once(dirname(__FILE__) . "/../../classes/class_json.php");
+require_once(dirname(__FILE__) . "/../../classes/class_administration.php");
+
+
+abstract class mbPrintFactory {
+
+	protected function createOutput($jsonConf, $concreteFactory) {
+		return $concreteFactory->create($jsonConf);
+	}
+	
+	abstract public function create($jsonConf);
+
+}
+
+class mbPdfFactory extends mbPrintFactory {
+
+	private function readConfig($jsonConfFile) {
+		$admin = new administration();
+		$mbjson = new Mapbender_JSON(); 
+		$jsonStr = file_get_contents(dirname(__FILE__) . "/../".$jsonConfFile);
+		if ($jsonStr == false) {
+			$e = new mb_exception("mbPdfFactory: config file could not be read.");
+			die("config not found.");
+		}
+		$jsonConf = $mbjson->decode($admin->char_encode($jsonStr));
+		return $jsonConf;
+	}
+	
+	public function create($jsonConfFile) {
+ 		$jsonConf = $this->readConfig($jsonConfFile);
+		try {
+			switch ($jsonConf->type) {
+				case "templatePDF":
+					$factory = new mbTemplatePdfFactory();
+            		break;
+				case "dynamicPDF":
+					$factory = new mbDynamicPdfFactory();
+            		break;
+				default:
+					$e = new mb_exception("mbPdfFactory: output type not supported.");
+			}
+			return $this->createOutput($jsonConf, $factory);
+		} catch (Exception $e){
+			$e = new mb_exception("mbPdfFactory: could not create PDF output.");
+		} 
+		
+		return;
+	}
+
+}
+
+class mbTemplatePdfFactory extends mbPrintFactory {
+
+	public function create($jsonConf) {
+		return new mbTemplatePdf($jsonConf);
+	}
+
+}
+
+class mbDynamicPdfFactory extends mbPrintFactory {
+
+	public function create($jsonConf) {
+		return new mbDynamicPdf($jsonConf);
+	}
+
+}
+
+function __autoload($class_name) {
+	if (file_exists(dirname(__FILE__). "/{$class_name}.php"))
+    	require_once $class_name . '.php';
+}
+
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/print/classes/mbImageDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbImageDecorator.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbImageDecorator.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,48 +1,48 @@
 <?php
-
+
 class mbImageDecorator extends mbTemplatePdfDecorator {
-
-	protected $pageElementType = "image";
-	protected $elementId;
-	protected $rotationAngle = 200;
-	protected $overrideMembersFromRequest = array("rotationAngle");
-	
-	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
-		parent::__construct($pdfObj, $mapConf, $controls);
-		$this->elementId = $elementId;
-		$this->override();		
-		$this->decorate();	
-	}
-	
-	public function override() {
-		/* returns an array of (request key, member id) arrays */ 
-		$idsFromRequest = $this->getPageElementLink($this->elementId);
-		foreach ($idsFromRequest as $requestKey => $memberId) {
-			$e = new mb_notice("mbImageDecorator: checking overrides: ".$requestKey.$memberId);
-		}
-		foreach ($_REQUEST as $k => $v) {
-			$e = new mb_notice("mbImageDecorator: checking Request: ".$k."=".$v);
-		}
-		
-		foreach ($this->overrideMembersFromRequest as $overrideMemberFromRequest) {
-			foreach ($idsFromRequest as $requestKey => $memberId) {
-				$e = new mb_notice("mbImageDecorator: before override: set ".$memberId." to ".$requestKey);
-				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
-					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
-					$e = new mb_notice("mbImageDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
-				}
-				else {
-					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
-					$e = new mb_notice("mbImageDecorator: using conf: ".$overrideMemberFromRequest." to ".$this->conf->{$memberId});
-				}	
-			}	
-		}
-	}
-	
-	public function decorate() {
-		#Image($file,$x,$y,$w=0,$h=0,$type='',$link='', $isMask=false, $maskImg=0, $angle=0)
-		$this->pdf->objPdf->Image($this->conf->filename, $this->conf->x_ul, $this->conf->y_ul, $this->conf->width, $this->conf->height,'','',false,0,5,$this->rotationAngle);
+
+	protected $pageElementType = "image";
+	protected $elementId;
+	protected $rotationAngle = 200;
+	protected $overrideMembersFromRequest = array("rotationAngle");
+	
+	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
+		parent::__construct($pdfObj, $mapConf, $controls);
+		$this->elementId = $elementId;
+		$this->override();		
+		$this->decorate();	
 	}
+	
+	public function override() {
+		/* returns an array of (request key, member id) arrays */ 
+		$idsFromRequest = $this->getPageElementLink($this->elementId);
+		foreach ($idsFromRequest as $requestKey => $memberId) {
+			$e = new mb_notice("mbImageDecorator: checking overrides: ".$requestKey.$memberId);
+		}
+		foreach ($_REQUEST as $k => $v) {
+			$e = new mb_notice("mbImageDecorator: checking Request: ".$k."=".$v);
+		}
+		
+		foreach ($this->overrideMembersFromRequest as $overrideMemberFromRequest) {
+			foreach ($idsFromRequest as $requestKey => $memberId) {
+				$e = new mb_notice("mbImageDecorator: before override: set ".$memberId." to ".$requestKey);
+				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
+					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
+					$e = new mb_notice("mbImageDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
+				}
+				else {
+					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
+					$e = new mb_notice("mbImageDecorator: using conf: ".$overrideMemberFromRequest." to ".$this->conf->{$memberId});
+				}	
+			}	
+		}
+	}
+	
+	public function decorate() {
+		#Image($file,$x,$y,$w=0,$h=0,$type='',$link='', $isMask=false, $maskImg=0, $angle=0)
+		$this->pdf->objPdf->Image($this->conf->filename, $this->conf->x_ul, $this->conf->y_ul, $this->conf->width, $this->conf->height,'','',false,0,5,$this->rotationAngle);
+	}
 }
 
 

Modified: branches/print_dev/http/print/classes/mbMapDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbMapDecorator.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbMapDecorator.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,93 +1,93 @@
-<?php
+<?php
 
-require_once(dirname(__FILE__)."/../../classes/class_stripRequest.php");
-require_once(dirname(__FILE__)."/../../classes/class_weldMaps2PNG.php");
-require_once(dirname(__FILE__)."/../../classes/class_map.php");
+require_once(dirname(__FILE__)."/../../classes/class_stripRequest.php");
+require_once(dirname(__FILE__)."/../../classes/class_weldMaps2PNG.php");
+require_once(dirname(__FILE__)."/../../classes/class_map.php");
 
 class mbMapDecorator extends mbTemplatePdfDecorator {
-
-	protected $pageElementType = "map";
-	protected $elementId;
-	protected $filename;
-	/* a decorator should declare which parameters could be overwritten through the request object */
-	protected $overrideMembersFromRequest = array("res_dpi");
-	protected $res_dpi;
+
+	protected $pageElementType = "map";
+	protected $elementId;
+	protected $filename;
+	/* a decorator should declare which parameters could be overwritten through the request object */
+	protected $overrideMembersFromRequest = array("res_dpi");
+	protected $res_dpi;
 	
-	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
-		parent::__construct($pdfObj, $mapConf, $controls);
-		$this->elementId = $elementId;
-		$this->filename = TMPDIR."/".parent::generateOutputFileName("map","png");
-		$this->override();		
-		$this->decorate();	
-	}
-	
-	public function override() {
-		/* returns an array of (request key, member id) arrays */ 
-		$idsFromRequest = $this->getPageElementLink($this->elementId);
-		foreach ($idsFromRequest as $requestKey => $memberId) {
-			$e = new mb_notice("mbMapDecorator: checking overrides: ".$requestKey.$memberId);
-		}
-		foreach ($_REQUEST as $k => $v) {
-			$e = new mb_notice("mbMapDecorator: checking Request: ".$k."=".$v);
-		}
-		
+	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
+		parent::__construct($pdfObj, $mapConf, $controls);
+		$this->elementId = $elementId;
+		$this->filename = TMPDIR."/".parent::generateOutputFileName("map","png");
+		$this->override();		
+		$this->decorate();	
+	}
+	
+	public function override() {
+		/* returns an array of (request key, member id) arrays */ 
+		$idsFromRequest = $this->getPageElementLink($this->elementId);
+		foreach ($idsFromRequest as $requestKey => $memberId) {
+			$e = new mb_notice("mbMapDecorator: checking overrides: ".$requestKey.$memberId);
+		}
+		foreach ($_REQUEST as $k => $v) {
+			$e = new mb_notice("mbMapDecorator: checking Request: ".$k."=".$v);
+		}
+		
 		foreach ($this->overrideMembersFromRequest as $overrideMemberFromRequest) {
-			$this->{$overrideMemberFromRequest} = $this->conf->{$overrideMemberFromRequest};
-			foreach ($idsFromRequest as $requestKey => $memberId) {
-				$e = new mb_notice("mbMapDecorator: before override: set ".$memberId." to ".$requestKey);
-				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
-					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
-					$e = new mb_notice("mbMapDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
-				}
-				else {
-					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
-					$e = new mb_notice("mbMapDecorator: override from conf: ".$overrideMemberFromRequest." to ".$this->conf->{$memberId});
-				}	
-			}	
-		}
-	}
-	
-	public function decorate() {
-		$urls = $_REQUEST["map_url"];
-		$array_urls = explode("___", $urls);
-		$width = $this->conf->width;
-		$height = $this->conf->height;
-		$res = $this->pdf->objPdf->k * ($this->res_dpi/72);
-		$myURL = new stripRequest($array_urls[0]);
-		$e = new mb_notice("mbMapDecorator: original bbox: ".$myURL->get('BBOX'));
-		$this->pdf->setMapInfo($this->conf->x_ul, $this->conf->y_ul, $width, $height, $this->pdf->adjustBbox($this->conf, explode(",",$myURL->get('BBOX')), $myURL->get('srs')));
-		$e = new mb_notice("mbMapDecorator: adjusted bbox: ".$this->pdf->getMapExtent());
-		for($i=0; $i<count($array_urls); $i++){
-			$m = new stripRequest($array_urls[$i]);
-			$m->set('width',(intval($width*$res)));
-			$m->set('height',(intval($height*$res)));
-			$m->set('bbox', $this->pdf->getMapExtent());
-			$array_urls[$i] = $m->url;
-		}
-		
-		$i = new weldMaps2PNG(implode("___",$array_urls), $this->filename);
-		$this->pdf->objPdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height,'png');
-		
-		/* show coordinates ... */
-		if ($this->conf->coords == 1) {
-			$coord = mb_split(",",$this->pdf->getMapExtent());
-
-			$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
-			$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
-			$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
-			$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
-
-			$this->pdf->objPdf->setTextColor(0, 0, 0);
-			$this->pdf->objPdf->setFont($this->conf->coords_font_family, "", $this->conf->coords_font_size);
-			#RotatedText($x, $y, $txt, $angle)
-			$this->pdf->objPdf->RotatedText($this->conf->x_ul - 2, $this->conf->y_ul + $height, $myMinx, 90); 
-			$this->pdf->objPdf->Text($this->conf->x_ul, $this->conf->y_ul + $height + 5, $myMiny);
-			$this->pdf->objPdf->RotatedText($this->conf->x_ul + $width + 2, $this->conf->y_ul, $myMaxy, 270);
-			$this->pdf->objPdf->Text($this->conf->x_ul + $width - ($this->pdf->objPdf->GetStringWidth($myMaxx)), $this->conf->y_ul - 2, $myMaxx);
-
-		}
-	}
+			$this->{$overrideMemberFromRequest} = $this->conf->{$overrideMemberFromRequest};
+			foreach ($idsFromRequest as $requestKey => $memberId) {
+				$e = new mb_notice("mbMapDecorator: before override: set ".$memberId." to ".$requestKey);
+				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
+					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
+					$e = new mb_notice("mbMapDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
+				}
+				else {
+					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
+					$e = new mb_notice("mbMapDecorator: override from conf: ".$overrideMemberFromRequest." to ".$this->conf->{$memberId});
+				}	
+			}	
+		}
+	}
 	
+	public function decorate() {
+		$urls = $_REQUEST["map_url"];
+		$array_urls = explode("___", $urls);
+		$width = $this->conf->width;
+		$height = $this->conf->height;
+		$res = $this->pdf->objPdf->k * ($this->res_dpi/72);
+		$myURL = new stripRequest($array_urls[0]);
+		$e = new mb_notice("mbMapDecorator: original bbox: ".$myURL->get('BBOX'));
+		$this->pdf->setMapInfo($this->conf->x_ul, $this->conf->y_ul, $width, $height, $this->pdf->adjustBbox($this->conf, explode(",",$myURL->get('BBOX')), $myURL->get('srs')));
+		$e = new mb_notice("mbMapDecorator: adjusted bbox: ".$this->pdf->getMapExtent());
+		for($i=0; $i<count($array_urls); $i++){
+			$m = new stripRequest($array_urls[$i]);
+			$m->set('width',(intval($width*$res)));
+			$m->set('height',(intval($height*$res)));
+			$m->set('bbox', $this->pdf->getMapExtent());
+			$array_urls[$i] = $m->url;
+		}
+		
+		$i = new weldMaps2PNG(implode("___",$array_urls), $this->filename);
+		$this->pdf->objPdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height,'png');
+		
+		/* show coordinates ... */
+		if ($this->conf->coords == 1) {
+			$coord = mb_split(",",$this->pdf->getMapExtent());
+
+			$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
+			$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
+			$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
+			$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
+
+			$this->pdf->objPdf->setTextColor(0, 0, 0);
+			$this->pdf->objPdf->setFont($this->conf->coords_font_family, "", $this->conf->coords_font_size);
+			#RotatedText($x, $y, $txt, $angle)
+			$this->pdf->objPdf->RotatedText($this->conf->x_ul - 2, $this->conf->y_ul + $height, $myMinx, 90); 
+			$this->pdf->objPdf->Text($this->conf->x_ul, $this->conf->y_ul + $height + 5, $myMiny);
+			$this->pdf->objPdf->RotatedText($this->conf->x_ul + $width + 2, $this->conf->y_ul, $myMaxy, 270);
+			$this->pdf->objPdf->Text($this->conf->x_ul + $width - ($this->pdf->objPdf->GetStringWidth($myMaxx)), $this->conf->y_ul - 2, $myMaxx);
+
+		}
+	}
+	
 }
 
 ?>

Modified: branches/print_dev/http/print/classes/mbMeasureDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbMeasureDecorator.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbMeasureDecorator.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,81 +1,81 @@
-<?php
+<?php
 class mbMeasureDecorator extends mbTemplatePdfDecorator {
-
-	protected $pageElementType = "measure";
-	protected $elementId;
+
+	protected $pageElementType = "measure";
+	protected $elementId;
 	
-	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
-		parent::__construct($pdfObj, $mapConf, $controls);
-		$this->elementId = $elementId;
-		$this->override();		
-		$this->decorate();
-	}
-	
-	public function override() {}
-	
-	public function decorate() {
-		include (dirname(__FILE__)."/../print_functions.php");
-		
-		global $mapOffset_left, $mapOffset_bottom, $map_height, $map_width, $coord;
-		global $yAxisOrientation;
-		$yAxisOrientation = 1;
-		
-		if (isset($_REQUEST["measured_x_values"]) && $_REQUEST["measured_x_values"] != "") {
-			$x_value_str = $_REQUEST["measured_x_values"];
-			$y_value_str = $_REQUEST["measured_y_values"];
-			$e = new mb_notice("mbMeasureDecorator: x values: ".$x_value_str);
-			$e = new mb_notice("mbMeasureDecorator: y values: ".$y_value_str);
-		}
-		else {
-			return "No measurements found.";
-		}
-		
-		$coord = mb_split(",",$this->pdf->getMapExtent());
-		$mapInfo = $this->pdf->getMapInfo();
-		foreach ($mapInfo as $k => $v) {
-			$e = new mb_notice("mbMeasureDecorator: mapInfo: ".$k."=".$v);
-		}
-		$mapOffset_left = $mapInfo["x_ul"];
-		$mapOffset_bottom = $mapInfo["y_ul"];
-		$map_height = $mapInfo["height"];
-		$map_width = $mapInfo["width"];
-		
-		// get the arrays, be aware of the different y-axis values
-		$theFullArr = makeCoordPairs($x_value_str, $y_value_str);
-		foreach ($theFullArr as $oneFullArr) {
-			$e = new mb_notice("mbMeasureDecorator: coordinates: ".implode(" ",array_values($oneFullArr)));
-		}
-    	$thePolyArr = makePolyFromCoord($theFullArr);
-    	$e = new mb_notice("mbMeasureDecorator: coordinates: ".implode(" ",$thePolyArr));
-	
-		if (isClosedPolygon($theFullArr)) {
-			$isClosed = TRUE;
-		} 
-		else {
-			$isClosed = FALSE;
-		}
-		$nr_of_points = count($theFullArr);
-		$e = new mb_notice("mbMeasureDecorator: closed polygon: ".$isClosed);
-
-		$this->pdf->objPdf->ClippingRect($mapOffset_left, $mapOffset_bottom, $map_width, $map_height, false);
-		if ($isClosed) {
-			$this->pdf->objPdf->Polygon($thePolyArr);
-		}
-		else {
-			$theStrokePointPairs = makeStrokePointPairs($theFullArr);
-			for($i = 0; $i < count($theStrokePointPairs); $i++) {
-				$line = $theStrokePointPairs[$i];
-				$e = new mb_notice("mbMeasureDecorator: line coordinates: ".implode(" ",$line));
-				if ($i != count($theStrokePointPairs) - 1) {
-			    	$this->pdf->objPdf->Line($line[0], $line[1], $line[2], $line[3]);
-				}
-			}
-		}
-		$this->pdf->objPdf->UnsetClipping();
-
-	}
-	
+	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
+		parent::__construct($pdfObj, $mapConf, $controls);
+		$this->elementId = $elementId;
+		$this->override();		
+		$this->decorate();
+	}
+	
+	public function override() {}
+	
+	public function decorate() {
+		include (dirname(__FILE__)."/../print_functions.php");
+		
+		global $mapOffset_left, $mapOffset_bottom, $map_height, $map_width, $coord;
+		global $yAxisOrientation;
+		$yAxisOrientation = 1;
+		
+		if (isset($_REQUEST["measured_x_values"]) && $_REQUEST["measured_x_values"] != "") {
+			$x_value_str = $_REQUEST["measured_x_values"];
+			$y_value_str = $_REQUEST["measured_y_values"];
+			$e = new mb_notice("mbMeasureDecorator: x values: ".$x_value_str);
+			$e = new mb_notice("mbMeasureDecorator: y values: ".$y_value_str);
+		}
+		else {
+			return "No measurements found.";
+		}
+		
+		$coord = mb_split(",",$this->pdf->getMapExtent());
+		$mapInfo = $this->pdf->getMapInfo();
+		foreach ($mapInfo as $k => $v) {
+			$e = new mb_notice("mbMeasureDecorator: mapInfo: ".$k."=".$v);
+		}
+		$mapOffset_left = $mapInfo["x_ul"];
+		$mapOffset_bottom = $mapInfo["y_ul"];
+		$map_height = $mapInfo["height"];
+		$map_width = $mapInfo["width"];
+		
+		// get the arrays, be aware of the different y-axis values
+		$theFullArr = makeCoordPairs($x_value_str, $y_value_str);
+		foreach ($theFullArr as $oneFullArr) {
+			$e = new mb_notice("mbMeasureDecorator: coordinates: ".implode(" ",array_values($oneFullArr)));
+		}
+    	$thePolyArr = makePolyFromCoord($theFullArr);
+    	$e = new mb_notice("mbMeasureDecorator: coordinates: ".implode(" ",$thePolyArr));
+	
+		if (isClosedPolygon($theFullArr)) {
+			$isClosed = TRUE;
+		} 
+		else {
+			$isClosed = FALSE;
+		}
+		$nr_of_points = count($theFullArr);
+		$e = new mb_notice("mbMeasureDecorator: closed polygon: ".$isClosed);
 
+		$this->pdf->objPdf->ClippingRect($mapOffset_left, $mapOffset_bottom, $map_width, $map_height, false);
+		if ($isClosed) {
+			$this->pdf->objPdf->Polygon($thePolyArr);
+		}
+		else {
+			$theStrokePointPairs = makeStrokePointPairs($theFullArr);
+			for($i = 0; $i < count($theStrokePointPairs); $i++) {
+				$line = $theStrokePointPairs[$i];
+				$e = new mb_notice("mbMeasureDecorator: line coordinates: ".implode(" ",$line));
+				if ($i != count($theStrokePointPairs) - 1) {
+			    	$this->pdf->objPdf->Line($line[0], $line[1], $line[2], $line[3]);
+				}
+			}
+		}
+		$this->pdf->objPdf->UnsetClipping();
+
+	}
+	
+
 }
 
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/print/classes/mbOverviewDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbOverviewDecorator.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbOverviewDecorator.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,43 +1,43 @@
 <?php
-
-require_once(dirname(__FILE__)."/../../classes/class_stripRequest.php");
-require_once(dirname(__FILE__)."/../../classes/class_weldOverview2PNG.php");
 
+require_once(dirname(__FILE__)."/../../classes/class_stripRequest.php");
+require_once(dirname(__FILE__)."/../../classes/class_weldOverview2PNG.php");
+
 class mbOverviewDecorator extends mbTemplatePdfDecorator {
-
-	protected $pageElementType = "overview";
+
+	protected $pageElementType = "overview";
 	protected $elementId;
-	protected $filename;
-	
-	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
-		parent::__construct($pdfObj, $mapConf, $controls);
-		$this->elementId = $elementId;
-		$this->filename = TMPDIR."/".parent::generateOutputFileName("map","png");		
-		$this->override();		
-		$this->decorate();	
-	}
-	
-	public function override() {}
-	
-	public function decorate() {
-		$overview_url = $_REQUEST["overview_url"];
-		$o_url = new stripRequest($overview_url);
-		$width = $this->conf->width;
-		$height = $this->conf->height;
-		$res = $this->pdf->objPdf->k*($this->conf->res_dpi/72);		
-		$o_url->set('width',intval($width*$res));
-		$o_url->set('height',intval($height*$res));
-		$o_url->set('bbox', $this->pdf->adjustBbox($this->conf, explode(",",$o_url->get('BBOX')), $o_url->get('srs')));
-		$overview_url = $o_url->url;	
-
-		$urls = $_REQUEST["map_url"];
-		$array_urls = explode("___", $urls);
-		$myURL = new stripRequest($array_urls[0]);
-		$myURL->set('bbox', $this->pdf->getMapExtent());
-
-		$i = new weldOverview2PNG($overview_url, $myURL->url, $this->filename);
-		$this->pdf->objPdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height, 'png');
+	protected $filename;
+	
+	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
+		parent::__construct($pdfObj, $mapConf, $controls);
+		$this->elementId = $elementId;
+		$this->filename = TMPDIR."/".parent::generateOutputFileName("map","png");		
+		$this->override();		
+		$this->decorate();	
 	}
+	
+	public function override() {}
+	
+	public function decorate() {
+		$overview_url = $_REQUEST["overview_url"];
+		$o_url = new stripRequest($overview_url);
+		$width = $this->conf->width;
+		$height = $this->conf->height;
+		$res = $this->pdf->objPdf->k*($this->conf->res_dpi/72);		
+		$o_url->set('width',intval($width*$res));
+		$o_url->set('height',intval($height*$res));
+		$o_url->set('bbox', $this->pdf->adjustBbox($this->conf, explode(",",$o_url->get('BBOX')), $o_url->get('srs')));
+		$overview_url = $o_url->url;	
+
+		$urls = $_REQUEST["map_url"];
+		$array_urls = explode("___", $urls);
+		$myURL = new stripRequest($array_urls[0]);
+		$myURL->set('bbox', $this->pdf->getMapExtent());
+
+		$i = new weldOverview2PNG($overview_url, $myURL->url, $this->filename);
+		$this->pdf->objPdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height, 'png');
+	}
 }
 
 

Modified: branches/print_dev/http/print/classes/mbParagraphDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbParagraphDecorator.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbParagraphDecorator.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,55 +1,55 @@
-<?php
+<?php
 
 class mbParagraphDecorator extends mbTemplatePdfDecorator {
-
-	protected $pageElementType = "para";
-	protected $elementId;
-	/* a decorator should declare which parameters could be overwritten through the request object */
-	protected $overrideMembersFromRequest = array("value");
-	/* the actual text that should be printed */
-	protected $value = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...";
+
+	protected $pageElementType = "para";
+	protected $elementId;
+	/* a decorator should declare which parameters could be overwritten through the request object */
+	protected $overrideMembersFromRequest = array("value");
+	/* the actual text that should be printed */
+	protected $value = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...";
 	
-	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
-		parent::__construct($pdfObj, $mapConf, $controls);
-		$this->elementId = $elementId;
-		$this->override();		
-		$this->decorate();	
-	}
-	
-	public function override() {
-		/* returns an array of (request key, member id) arrays */ 
-		$idsFromRequest = $this->getPageElementLink($this->elementId);
-		foreach ($idsFromRequest as $requestKey => $memberId) {
-			$e = new mb_notice("mbParagraphDecorator: checking overrides: ".$requestKey.$memberId);
-		}
-		foreach ($_REQUEST as $k => $v) {
-			$e = new mb_notice("mbParagraphDecorator: checking Request: ".$k."=".$v);
-		}
-		
-		foreach ($this->overrideMembersFromRequest as $overrideMemberFromRequest) {
-			foreach ($idsFromRequest as $requestKey => $memberId) {
-				$e = new mb_notice("mbParagraphDecorator: before override: set ".$memberId." to ".$requestKey);
-				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
-					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
-					$e = new mb_notice("mbParagraphDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
-				}
-				else {
-					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
-				}	
-			}	
-		}
-	}
-	
-	public function decorate() {
-		$this->pdf->objPdf->setTextColor(0, 0, 0);
-		$this->pdf->objPdf->setFillColor(255, 255, 255);
-		$this->pdf->objPdf->setDrawColor(0, 0, 0);
-		$this->pdf->objPdf->SetLineWidth($this->conf->border_width);
-		$this->pdf->objPdf->SetXY($this->conf->x_ul, $this->conf->y_ul);
-		$this->pdf->objPdf->setFont($this->conf->font_family, "", $this->conf->font_size);
-		$this->pdf->objPdf->Cell($this->conf->width, $this->conf->height, $this->value, $this->conf->border, 0, $this->conf->align, $this->conf->fill);
-	}
-	
+	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
+		parent::__construct($pdfObj, $mapConf, $controls);
+		$this->elementId = $elementId;
+		$this->override();		
+		$this->decorate();	
+	}
+	
+	public function override() {
+		/* returns an array of (request key, member id) arrays */ 
+		$idsFromRequest = $this->getPageElementLink($this->elementId);
+		foreach ($idsFromRequest as $requestKey => $memberId) {
+			$e = new mb_notice("mbParagraphDecorator: checking overrides: ".$requestKey.$memberId);
+		}
+		foreach ($_REQUEST as $k => $v) {
+			$e = new mb_notice("mbParagraphDecorator: checking Request: ".$k."=".$v);
+		}
+		
+		foreach ($this->overrideMembersFromRequest as $overrideMemberFromRequest) {
+			foreach ($idsFromRequest as $requestKey => $memberId) {
+				$e = new mb_notice("mbParagraphDecorator: before override: set ".$memberId." to ".$requestKey);
+				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
+					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
+					$e = new mb_notice("mbParagraphDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
+				}
+				else {
+					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
+				}	
+			}	
+		}
+	}
+	
+	public function decorate() {
+		$this->pdf->objPdf->setTextColor(0, 0, 0);
+		$this->pdf->objPdf->setFillColor(255, 255, 255);
+		$this->pdf->objPdf->setDrawColor(0, 0, 0);
+		$this->pdf->objPdf->SetLineWidth($this->conf->border_width);
+		$this->pdf->objPdf->SetXY($this->conf->x_ul, $this->conf->y_ul);
+		$this->pdf->objPdf->setFont($this->conf->font_family, "", $this->conf->font_size);
+		$this->pdf->objPdf->Cell($this->conf->width, $this->conf->height, $this->value, $this->conf->border, 0, $this->conf->align, $this->conf->fill);
+	}
+	
 
 }
 

Modified: branches/print_dev/http/print/classes/mbPdf.php
===================================================================
--- branches/print_dev/http/print/classes/mbPdf.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbPdf.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,60 +1,60 @@
 <?php
-
-require_once(dirname(__FILE__)."/../../../core/globalSettings.php");
-require_once(dirname(__FILE__) . "/../../classes/class_json.php");
 
+require_once(dirname(__FILE__)."/../../../core/globalSettings.php");
+require_once(dirname(__FILE__) . "/../../classes/class_json.php");
+
 abstract class mbPdf {
 
-	/* the actual pdf */
-	public $objPdf; 
-	public $confPdf;
-	public $outputFileName;
-
-	public $isRendered = false;
-	public $isSaved = false;
-
-	abstract public function render();
-	abstract public function save();
-	
-	public function generateOutputFileName($prefix, $suffix) {
-		return $prefix."_".substr(md5(uniqid(rand())),0,7).".".$suffix;
-	}
-
-	public function returnPDF() {
-		if ($this->isSaved) {
-		    header('Content-Type: application/octet-stream');
-		    header('Content-Disposition: attachment; filename="'.$this->outputFileName.'"');
-		    header('Pragma: public');
-		    ob_end_flush();
-			$this->objPdf->Output($this->outputFileName,'S');
-		}
-		else
-			die("PDF output not rendered yet.");
-	}	
-
-	public function returnAbsoluteUrl() {
-		$mbjson = new Mapbender_JSON();
-		if ($this->isSaved) {
-			if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")
-				$prot = "https://";
-			else
-				$prot = "http://";
-			$absoluteUrlToPdf = $prot.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/printPDF_download.php?f=".$this->outputFileName."&".SID;
-			return $mbjson->encode(array("outputFileName"=>$absoluteUrlToPdf));
-		}
-		else
-		    return $mbjson->encode(array("error"=>"Possibly no map urls delivered."));
-	}	
-	
-	public function returnUrl() {
-		$mbjson = new Mapbender_JSON();
-		if ($this->isSaved) {
-			return $mbjson->encode(array("outputFileName"=>TMPDIR."/".$this->outputFileName));
-		}
-		else
-		    return $mbjson->encode(array("error"=>"Possibly no map urls delivered."));
-	}	
+	/* the actual pdf */
+	public $objPdf; 
+	public $confPdf;
+	public $outputFileName;
 
+	public $isRendered = false;
+	public $isSaved = false;
+
+	abstract public function render();
+	abstract public function save();
+	
+	public function generateOutputFileName($prefix, $suffix) {
+		return $prefix."_".substr(md5(uniqid(rand())),0,7).".".$suffix;
+	}
+
+	public function returnPDF() {
+		if ($this->isSaved) {
+		    header('Content-Type: application/octet-stream');
+		    header('Content-Disposition: attachment; filename="'.$this->outputFileName.'"');
+		    header('Pragma: public');
+		    ob_end_flush();
+			$this->objPdf->Output($this->outputFileName,'S');
+		}
+		else
+			die("PDF output not rendered yet.");
+	}	
+
+	public function returnAbsoluteUrl() {
+		$mbjson = new Mapbender_JSON();
+		if ($this->isSaved) {
+			if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")
+				$prot = "https://";
+			else
+				$prot = "http://";
+			$absoluteUrlToPdf = $prot.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/printPDF_download.php?f=".$this->outputFileName."&".SID;
+			return $mbjson->encode(array("outputFileName"=>$absoluteUrlToPdf));
+		}
+		else
+		    return $mbjson->encode(array("error"=>"Possibly no map urls delivered."));
+	}	
+	
+	public function returnUrl() {
+		$mbjson = new Mapbender_JSON();
+		if ($this->isSaved) {
+			return $mbjson->encode(array("outputFileName"=>TMPDIR."/".$this->outputFileName));
+		}
+		else
+		    return $mbjson->encode(array("error"=>"Possibly no map urls delivered."));
+	}	
+
 }
 
 

Modified: branches/print_dev/http/print/classes/mbTemplatePdf.php
===================================================================
--- branches/print_dev/http/print/classes/mbTemplatePdf.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbTemplatePdf.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,99 +1,99 @@
-<?php
+<?php
 
 require_once(dirname(__FILE__)."/../../extensions/fpdf/mb_fpdi.php");
-
+
 class mbTemplatePdf extends mbPdf {
-
-	/* it seems several decorators are going to need this information */
-	public $mapInfo = array();	
-
-	public function __construct($jsonConf) {
-		$this->confPdf = $jsonConf;
-		if (!$this->confPdf->orientation ||	!$this->confPdf->units || !$this->confPdf->format) {
-			die("no valid config");
-		}	
-		$this->objPdf = new mb_fpdi($this->confPdf->orientation,
-									$this->confPdf->units,
-									$this->confPdf->format);
-		$this->outputFileName = $this->generateOutputFileName("map","pdf");
+
+	/* it seems several decorators are going to need this information */
+	public $mapInfo = array();	
+
+	public function __construct($jsonConf) {
+		$this->confPdf = $jsonConf;
+		if (!$this->confPdf->orientation ||	!$this->confPdf->units || !$this->confPdf->format) {
+			die("no valid config");
+		}	
+		$this->objPdf = new mb_fpdi($this->confPdf->orientation,
+									$this->confPdf->units,
+									$this->confPdf->format);
+		$this->outputFileName = $this->generateOutputFileName("map","pdf");
 	}
-
-	public function setMapInfo($x_ul, $y_ul, $width, $height, $aBboxString) {
-		$this->mapinfo["x_ul"] = $x_ul;
-		$this->mapinfo["y_ul"] = $y_ul;
-		$this->mapinfo["width"] = $width;
-		$this->mapinfo["height"] = $height;
-		$this->mapinfo["extent"] = $aBboxString;
-		$e = new mb_notice("mbTemplatePdf: setting mapInfo ...");
-	}
-
-	public function getMapInfo() {
-		$e = new mb_notice("mbTemplatePdf: getting mapInfo ..");
-		return $this->mapinfo;
-	}
-	
-	public function setMapExtent($aBboxString) {
-		$this->mapinfo["extent"] = $aBboxString;
-		$e = new mb_notice("mbTemplatePdf: setting mapExtent to ".$this->mapinfo["extent"]);
-	}
-		
-	public function getMapExtent() {
-		$e = new mb_notice("mbTemplatePdf: getting mapExtent as ".$this->mapinfo["extent"]);
-		return $this->mapinfo["extent"];
-	}	
-
-	public function adjustBbox($elementConf, $aBboxArray, $aSrsString) {
-		$aMbBbox = new Mapbender_bbox($aBboxArray[0],$aBboxArray[1],$aBboxArray[2],$aBboxArray[3],$aSrsString);
-		$aMap = new Map();
-		$aMap->setWidth($elementConf->width);
-		$aMap->setHeight($elementConf->height);
-		$aMap->calculateExtent($aMbBbox);
-		$adjustedMapExt = $aMap->getExtentInfo();
-		return implode(",",$adjustedMapExt);
-	}	
-	
-	public function render() {
-		foreach ($this->confPdf->pages as $pageConf) {
-			/* apply the template to the pdf page */
-			$this->objPdf->addPage();
-            $pagecount = $this->objPdf->setSourceFile(dirname(__FILE__)."/../".$pageConf->tpl);
-            $tplidx = $this->objPdf->importPage($pageConf->useTplPage);
-            $controls = $this->confPdf->controls;
-            $this->objPdf->useTemplate($tplidx);
-            
-            foreach ($pageConf->elements as $pageElementId => $pageElementConf) {
-				switch ($pageElementConf->type) {
-					case "map":
-						$err = new mbMapDecorator($this, $pageElementId, $pageElementConf, $controls);
-						break;
-					case "overview":
-						$err = new mbOverviewDecorator($this, $pageElementId, $pageElementConf, $controls);
-						break;
-					case "text":
-						$err = new mbTextDecorator($this, $pageElementId, $pageElementConf, $controls);
-						break;		
-					case "para":
-						$err = new mbParagraphDecorator($this, $pageElementId, $pageElementConf, $controls);
-						break;	
-					case "measure":
-						$err = new mbMeasureDecorator($this, $pageElementId, $pageElementConf, $controls);
-						break;		
-					case "image":
-						$err = new mbImageDecorator($this, $pageElementId, $pageElementConf, $controls);
-						break;																									
-				}
-            }
-            
-            $this->isRendered = true;
-		}
-	}
-	
-	public function save() {
-		if ($this->isRendered) {
-			$this->objPdf->Output(TMPDIR."/".$this->outputFileName, "F");
-			$this->isSaved = true;
-		}
+
+	public function setMapInfo($x_ul, $y_ul, $width, $height, $aBboxString) {
+		$this->mapinfo["x_ul"] = $x_ul;
+		$this->mapinfo["y_ul"] = $y_ul;
+		$this->mapinfo["width"] = $width;
+		$this->mapinfo["height"] = $height;
+		$this->mapinfo["extent"] = $aBboxString;
+		$e = new mb_notice("mbTemplatePdf: setting mapInfo ...");
 	}
+
+	public function getMapInfo() {
+		$e = new mb_notice("mbTemplatePdf: getting mapInfo ..");
+		return $this->mapinfo;
+	}
+	
+	public function setMapExtent($aBboxString) {
+		$this->mapinfo["extent"] = $aBboxString;
+		$e = new mb_notice("mbTemplatePdf: setting mapExtent to ".$this->mapinfo["extent"]);
+	}
+		
+	public function getMapExtent() {
+		$e = new mb_notice("mbTemplatePdf: getting mapExtent as ".$this->mapinfo["extent"]);
+		return $this->mapinfo["extent"];
+	}	
+
+	public function adjustBbox($elementConf, $aBboxArray, $aSrsString) {
+		$aMbBbox = new Mapbender_bbox($aBboxArray[0],$aBboxArray[1],$aBboxArray[2],$aBboxArray[3],$aSrsString);
+		$aMap = new Map();
+		$aMap->setWidth($elementConf->width);
+		$aMap->setHeight($elementConf->height);
+		$aMap->calculateExtent($aMbBbox);
+		$adjustedMapExt = $aMap->getExtentInfo();
+		return implode(",",$adjustedMapExt);
+	}	
+	
+	public function render() {
+		foreach ($this->confPdf->pages as $pageConf) {
+			/* apply the template to the pdf page */
+			$this->objPdf->addPage();
+            $pagecount = $this->objPdf->setSourceFile(dirname(__FILE__)."/../".$pageConf->tpl);
+            $tplidx = $this->objPdf->importPage($pageConf->useTplPage);
+            $controls = $this->confPdf->controls;
+            $this->objPdf->useTemplate($tplidx);
+            
+            foreach ($pageConf->elements as $pageElementId => $pageElementConf) {
+				switch ($pageElementConf->type) {
+					case "map":
+						$err = new mbMapDecorator($this, $pageElementId, $pageElementConf, $controls);
+						break;
+					case "overview":
+						$err = new mbOverviewDecorator($this, $pageElementId, $pageElementConf, $controls);
+						break;
+					case "text":
+						$err = new mbTextDecorator($this, $pageElementId, $pageElementConf, $controls);
+						break;		
+					case "para":
+						$err = new mbParagraphDecorator($this, $pageElementId, $pageElementConf, $controls);
+						break;	
+					case "measure":
+						$err = new mbMeasureDecorator($this, $pageElementId, $pageElementConf, $controls);
+						break;		
+					case "image":
+						$err = new mbImageDecorator($this, $pageElementId, $pageElementConf, $controls);
+						break;																									
+				}
+            }
+            
+            $this->isRendered = true;
+		}
+	}
+	
+	public function save() {
+		if ($this->isRendered) {
+			$this->objPdf->Output(TMPDIR."/".$this->outputFileName, "F");
+			$this->isSaved = true;
+		}
+	}
 }
 
 

Modified: branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,40 +1,40 @@
 <?php
 
 abstract class mbTemplatePdfDecorator extends mbTemplatePdf {
-
-	/* the template pdf object to decorate */
-	public $pdf;
-	/* the conf object for the desired decoration */
-	public $conf;
-	/* the controls object of the configuration */
-	public $controls;
-	/* possibly a zIndex will be needed */
-	public $zIndex;	
-	
-	public function __construct($pdfObj, $mapConf, $controls) {
-		$this->pdf = $pdfObj;
-		$this->conf = $mapConf;
-		$this->controls = $controls;
-	}
-	
-	public function getPageElementLink($pageElementId) {
-		$pageElementLinkArray = array();
-		$e = new mb_notice("mbTemplatePdfDecorator: pageElementId: ".$pageElementId);
-		foreach ($this->controls as $control) {
-			foreach ($control->pageElementsLink as $pageElementLinkId => $pageElementLinkValue) {
-				$e = new mb_notice("mbTemplatePdfDecorator: pageElementsLink: ".$control->id);
-				if ($pageElementLinkId == $pageElementId) 
-					#array_push($pageElementLinkArray, array($control->id => $pageElementLinkValue));
-					$pageElementLinkArray[$control->id]=$pageElementLinkValue;
-			}
-		}
-		return $pageElementLinkArray;
-	} 
-	
-	abstract public function override();
-	
-	abstract public function decorate();
 
+	/* the template pdf object to decorate */
+	public $pdf;
+	/* the conf object for the desired decoration */
+	public $conf;
+	/* the controls object of the configuration */
+	public $controls;
+	/* possibly a zIndex will be needed */
+	public $zIndex;	
+	
+	public function __construct($pdfObj, $mapConf, $controls) {
+		$this->pdf = $pdfObj;
+		$this->conf = $mapConf;
+		$this->controls = $controls;
+	}
+	
+	public function getPageElementLink($pageElementId) {
+		$pageElementLinkArray = array();
+		$e = new mb_notice("mbTemplatePdfDecorator: pageElementId: ".$pageElementId);
+		foreach ($this->controls as $control) {
+			foreach ($control->pageElementsLink as $pageElementLinkId => $pageElementLinkValue) {
+				$e = new mb_notice("mbTemplatePdfDecorator: pageElementsLink: ".$control->id);
+				if ($pageElementLinkId == $pageElementId) 
+					#array_push($pageElementLinkArray, array($control->id => $pageElementLinkValue));
+					$pageElementLinkArray[$control->id]=$pageElementLinkValue;
+			}
+		}
+		return $pageElementLinkArray;
+	} 
+	
+	abstract public function override();
+	
+	abstract public function decorate();
+
 }
 
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/print/classes/mbTextDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbTextDecorator.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/classes/mbTextDecorator.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,32 +1,32 @@
-<?php
+<?php
 
 class mbTextDecorator extends mbTemplatePdfDecorator {
-
-	protected $pageElementType = "text";
-	protected $elementId;
-	/* a decorator should declare which parameters could be overwritten through the request object */
-	protected $overrideMembersFromRequest = array("value");
-	/* the actual text that should be printed */
-	protected $value = "Lorem ipsum";
+
+	protected $pageElementType = "text";
+	protected $elementId;
+	/* a decorator should declare which parameters could be overwritten through the request object */
+	protected $overrideMembersFromRequest = array("value");
+	/* the actual text that should be printed */
+	protected $value = "Lorem ipsum";
 	
-	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
-		parent::__construct($pdfObj, $mapConf, $controls);
-		$this->elementId = $elementId;
-		$this->override();		
-		$this->decorate();	
-	}
-	
-	public function override() {
-		/* returns an array of (request key, member id) arrays */ 
-		$idsFromRequest = $this->getPageElementLink($this->elementId);
-		foreach ($idsFromRequest as $requestKey => $memberId) {
-			$e = new mb_notice("mbTextDecorator: checking overrides: ".$requestKey.$memberId);
-		}
-		foreach ($_REQUEST as $k => $v) {
-			$e = new mb_notice("mbTextDecorator: checking Request: ".$k."=".$v);
-		}
-		
-		foreach ($this->overrideMembersFromRequest as $overrideMemberFromRequest) {
+	public function __construct($pdfObj, $elementId, $mapConf, $controls) {
+		parent::__construct($pdfObj, $mapConf, $controls);
+		$this->elementId = $elementId;
+		$this->override();		
+		$this->decorate();	
+	}
+	
+	public function override() {
+		/* returns an array of (request key, member id) arrays */ 
+		$idsFromRequest = $this->getPageElementLink($this->elementId);
+		foreach ($idsFromRequest as $requestKey => $memberId) {
+			$e = new mb_notice("mbTextDecorator: checking overrides: ".$requestKey.$memberId);
+		}
+		foreach ($_REQUEST as $k => $v) {
+			$e = new mb_notice("mbTextDecorator: checking Request: ".$k."=".$v);
+		}
+		
+		foreach ($this->overrideMembersFromRequest as $overrideMemberFromRequest) {
 			switch ($this->conf->{$overrideMemberFromRequest})  {
 				case "date": 
 					$this->{$overrideMemberFromRequest} = date("d.m.y");
@@ -38,25 +38,25 @@
 					$this->{$overrideMemberFromRequest} = $this->conf->{$overrideMemberFromRequest};
 					break;
 			}
-			foreach ($idsFromRequest as $requestKey => $memberId) {
-				$e = new mb_notice("mbTextDecorator: before override: set ".$memberId." to ".$requestKey);
-				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
-					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
-					$e = new mb_notice("mbTextDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
-				}
-				else {
-					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
-				}	
-			}	
-		}
-	}
-	
-	public function decorate() {
-		$this->pdf->objPdf->setTextColor(0, 0, 0);
-		$this->pdf->objPdf->setFont($this->conf->font_family, "", $this->conf->font_size);
-		$this->pdf->objPdf->Text($this->conf->x_ul, $this->conf->y_ul, $this->value);
-	}
-	
+			foreach ($idsFromRequest as $requestKey => $memberId) {
+				$e = new mb_notice("mbTextDecorator: before override: set ".$memberId." to ".$requestKey);
+				if ($overrideMemberFromRequest==$memberId && isset($_REQUEST[$requestKey]) && $_REQUEST[$requestKey] != "") { 
+					$this->{$overrideMemberFromRequest} = $_REQUEST[$requestKey];
+					$e = new mb_notice("mbTextDecorator: override from Request: ".$overrideMemberFromRequest." to ".$this->{$overrideMemberFromRequest});
+				}
+				else {
+					$this->{$overrideMemberFromRequest} = $this->conf->{$memberId};
+				}	
+			}	
+		}
+	}
+	
+	public function decorate() {
+		$this->pdf->objPdf->setTextColor(0, 0, 0);
+		$this->pdf->objPdf->setFont($this->conf->font_family, "", $this->conf->font_size);
+		$this->pdf->objPdf->Text($this->conf->x_ul, $this->conf->y_ul, $this->value);
+	}
+	
 
 }
 

Modified: branches/print_dev/http/print/mod_printPDF_div.php
===================================================================
--- branches/print_dev/http/print/mod_printPDF_div.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/mod_printPDF_div.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -17,221 +17,221 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-include(dirname(__FILE__)."/../include/dyn_js.php");
-
-echo "var myTarget = '".$e_target[0]."';";
-echo "var myId = '".$e_id."';";
-?>
-
-/* the array of json print config files */
-try{
-	if (mbPrintConfigFilenames){}
-}
-catch(e){
-	mbPrintConfigFilenames = new Array("testConfigTemplate.json");
-}
-
-/* the array of json print config titles */
-try{
-	if (mbPrintConfigTitles){}
-}
-catch(e){
-	mbPrintConfigTitles = new Array("Default");
-}
-
-/* the path where the json print config files reside*/
-try{
-	if (mbPrintConfigPath){}
-}
-catch(e){
-	mbPrintConfigPath = "../print/";
-}
-
-eventInit.register(function () {
-	mod_printPDF_init();
-});
-
-function mod_printPDF_init() {
-	/* first we'd need to build the configuration selection */
-	buildConfigSelector();	
-	/* second we'd need to read the json configuration */
-	loadConfig(mbPrintConfigFilenames[0]);
-}
-
-function loadConfig(configFilename) {
-	$.get(mbPrintConfigPath + configFilename, function(json, status){
-	    var obj = eval('(' + json + ')');
-	    buildForm(obj); 
-	    hookForm();
-	});
-}
-
-function hookForm() {
-	var options = { 
-   		url:			'../print/printFactory.php', 
-   		type:			'post',
-   		dataType:		'json',
-   		beforeSubmit: 	validate,
-   		success:    	showResult
-	};
-	$("#"+myId+"_form").ajaxForm(options);	
-}
-
-/**
- * Change status of the working elements. These should begin with "$myId_working" 
- *
- * @param {String} newStatus either "hide or "show"
- */
-function showHideWorking(newStatus) {
-	if (newStatus=="hide")
-    	$("[id^='"+myId+"_working']").hide();
-    else
-    	$("[id^='"+myId+"_working']").show();	
-}
-
-/**
- * update form values helper function
- *
- */
-function updateFormField(formData, key, value) {
-	for(var j=0; j < formData.length; j++){
-		if (formData[j].name == key) {
-			formData[j].value = value;
-			break;
-		}
-	}	
-}
-
-
-/**
- * Validates and updates form data values.
- * Adds the elements before the submit button.
- *
- * @see jquery.forms#beforeSubmitHandler
- */
-function validate(formData, jqForm, options) {
-	showHideWorking("show");
-	var ind = getMapObjIndexByName(myTarget);
-	var f = jqForm[0];
-	f.map_url.value = '';
-	f.overview_url.value = '';
-	for(var i=0; i < mb_mapObj[ind].wms.length; i++){
-		if(mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-			if(mb_mapObj[ind].wms[i].mapURL != false && mb_mapObj[ind].wms[i].mapURL != 'false' && mb_mapObj[ind].wms[i].mapURL != ''){   
-				if(f.map_url.value != ""){
-					f.map_url.value += '___';
-				}      
-				f.map_url.value += mb_mapObj[ind].wms[i].mapURL;
-			}
-		}
-	}
-	updateFormField(formData, "map_url", f.map_url.value);
-	
-	//overview_url
-	var ind_overview = getMapObjIndexByName('overview');
-	if(mb_mapObj[ind_overview].mapURL != false ){
-		updateFormField(formData, "overview_url", mb_mapObj[ind_overview].mapURL);
-	}
-	
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+include(dirname(__FILE__)."/../include/dyn_js.php");
+
+echo "var myTarget = '".$e_target[0]."';";
+echo "var myId = '".$e_id."';";
+?>
+
+/* the array of json print config files */
+try{
+	if (mbPrintConfigFilenames){}
+}
+catch(e){
+	mbPrintConfigFilenames = new Array("testConfigTemplate.json");
+}
+
+/* the array of json print config titles */
+try{
+	if (mbPrintConfigTitles){}
+}
+catch(e){
+	mbPrintConfigTitles = new Array("Default");
+}
+
+/* the path where the json print config files reside*/
+try{
+	if (mbPrintConfigPath){}
+}
+catch(e){
+	mbPrintConfigPath = "../print/";
+}
+
+eventInit.register(function () {
+	mod_printPDF_init();
+});
+
+function mod_printPDF_init() {
+	/* first we'd need to build the configuration selection */
+	buildConfigSelector();	
+	/* second we'd need to read the json configuration */
+	loadConfig(mbPrintConfigFilenames[0]);
+}
+
+function loadConfig(configFilename) {
+	$.get(mbPrintConfigPath + configFilename, function(json, status){
+	    var obj = eval('(' + json + ')');
+	    buildForm(obj); 
+	    hookForm();
+	});
+}
+
+function hookForm() {
+	var options = { 
+   		url:			'../print/printFactory.php', 
+   		type:			'post',
+   		dataType:		'json',
+   		beforeSubmit: 	validate,
+   		success:    	showResult
+	};
+	$("#"+myId+"_form").ajaxForm(options);	
+}
+
+/**
+ * Change status of the working elements. These should begin with "$myId_working" 
+ *
+ * @param {String} newStatus either "hide or "show"
+ */
+function showHideWorking(newStatus) {
+	if (newStatus=="hide")
+    	$("[id^='"+myId+"_working']").hide();
+    else
+    	$("[id^='"+myId+"_working']").show();	
+}
+
+/**
+ * update form values helper function
+ *
+ */
+function updateFormField(formData, key, value) {
+	for(var j=0; j < formData.length; j++){
+		if (formData[j].name == key) {
+			formData[j].value = value;
+			break;
+		}
+	}	
+}
+
+
+/**
+ * Validates and updates form data values.
+ * Adds the elements before the submit button.
+ *
+ * @see jquery.forms#beforeSubmitHandler
+ */
+function validate(formData, jqForm, options) {
+	showHideWorking("show");
+	var ind = getMapObjIndexByName(myTarget);
+	var f = jqForm[0];
+	f.map_url.value = '';
+	f.overview_url.value = '';
+	for(var i=0; i < mb_mapObj[ind].wms.length; i++){
+		if(mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+			if(mb_mapObj[ind].wms[i].mapURL != false && mb_mapObj[ind].wms[i].mapURL != 'false' && mb_mapObj[ind].wms[i].mapURL != ''){   
+				if(f.map_url.value != ""){
+					f.map_url.value += '___';
+				}      
+				f.map_url.value += mb_mapObj[ind].wms[i].mapURL;
+			}
+		}
+	}
+	updateFormField(formData, "map_url", f.map_url.value);
+	
+	//overview_url
+	var ind_overview = getMapObjIndexByName('overview');
+	if(mb_mapObj[ind_overview].mapURL != false ){
+		updateFormField(formData, "overview_url", mb_mapObj[ind_overview].mapURL);
+	}
+	
 	updateFormField(formData, "map_scale", mb_getScale(myTarget));
-	// write the measured coordinates
-	if (mod_measure_RX != undefined && mod_measure_RY != undefined) {
-		var tmp_x = '';
-		var tmp_y = '';
-		for(i = 0; i < mod_measure_RX.length; i++) {
-			if(tmp_x != '') {
-				tmp_x += ','
-			}
-			tmp_x += mod_measure_RX[i];
-		}
-		for(i = 0; i < mod_measure_RY.length; i++) {
-			if(tmp_y != '') {
-				tmp_y += ','
-			}
-			tmp_y += mod_measure_RY[i];
-		}
-		updateFormField(formData, "measured_x_values", tmp_x);
-		updateFormField(formData, "measured_y_values", tmp_y);
-	}	
-	
-	
-	if (f.map_url.value!="") {
-		return true;
-	} else {
-	    showHideWorking("hide");
-		return false;
-	}
-		
-}
-
-function showResult(res, text) {
-	if (text == 'success') {
-		window.location = stripslashes(res.outputFileName);
-		showHideWorking("hide");	
-	}
-	else {
-		/* something went wrong */
-		$("#"+myId+"_result").html(text);
-	}
-}
-
-/**
- * Generates form elements as specified in the config controls object.
- * Adds the elements before the submit button.
- * 
- * @param {Object} json the config object in json
- */
-function buildForm(json) {
-	$(".print_option_dyn").remove();
-	var str = "";
-	for (var item in json.controls) {
-		var element = json.controls[item];
-		var element_id = myId + "_" + element.id;
-		if (element.type != "hidden") {
-			str += '<div class="print_option_dyn">\n';	
-			str += '<label class="print_label" for="'+element.id+'">'+element.label+'</label>\n';
-		}
-		switch (element.type) {
-			case "text":
-				str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'" size="'+element.size+'"><br>\n';
-				break;
-			case "hidden":
-				str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'"><br>\n';
-				break;				
-			case "textarea":
-				str += '<textarea id="'+element.id+'" name="'+element.id+'" size="'+element.size+'"></textarea><br>\n';
-				break;				
-			case "select":
-				str += '<select id="'+element.id+'" name="'+element.id+'" size="1">\n';
-				for (var option_index in element.options) {
-					option = element.options[option_index];
-					str += '<option value="'+option.value+'">'+option.label+'</option>\n';
-				}
-				str += '</select><br>\n';
-				break;
-		}
-		if (element.type != "hidden") str += '</div>\n';
-	}
-	if (str) $("#"+myId+"_formsubmit").before(str);
-}
-
-/**
- * Generates the configuration select element from the gui element vars
- * mbPrintConfigFilenames and mbPrintConfigTitles
- */
-function buildConfigSelector() {
-	var str = "";
-	str += '<label class="print_label" for="printPDF_template">Vorlage</label>\n';
-	str += '<select id="printPDF_template" name="printPDF_template" size="1" onchange="loadConfig(mbPrintConfigFilenames[this.selectedIndex]);">\n';
-	for (var i = 0; i < mbPrintConfigFilenames.length; i++) {
-		str += '<option value="'+mbPrintConfigFilenames[i]+'">'+mbPrintConfigTitles[i]+'</option>\n';
-	}
-	str += '</select><br />\n';
-	if (str) $("#printPDF_selector").append(str);
-}
-
-function stripslashes( str ) {
-    return (str+'').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1');
+	// write the measured coordinates
+	if (mod_measure_RX != undefined && mod_measure_RY != undefined) {
+		var tmp_x = '';
+		var tmp_y = '';
+		for(i = 0; i < mod_measure_RX.length; i++) {
+			if(tmp_x != '') {
+				tmp_x += ','
+			}
+			tmp_x += mod_measure_RX[i];
+		}
+		for(i = 0; i < mod_measure_RY.length; i++) {
+			if(tmp_y != '') {
+				tmp_y += ','
+			}
+			tmp_y += mod_measure_RY[i];
+		}
+		updateFormField(formData, "measured_x_values", tmp_x);
+		updateFormField(formData, "measured_y_values", tmp_y);
+	}	
+	
+	
+	if (f.map_url.value!="") {
+		return true;
+	} else {
+	    showHideWorking("hide");
+		return false;
+	}
+		
 }
+
+function showResult(res, text) {
+	if (text == 'success') {
+		window.location = stripslashes(res.outputFileName);
+		showHideWorking("hide");	
+	}
+	else {
+		/* something went wrong */
+		$("#"+myId+"_result").html(text);
+	}
+}
+
+/**
+ * Generates form elements as specified in the config controls object.
+ * Adds the elements before the submit button.
+ * 
+ * @param {Object} json the config object in json
+ */
+function buildForm(json) {
+	$(".print_option_dyn").remove();
+	var str = "";
+	for (var item in json.controls) {
+		var element = json.controls[item];
+		var element_id = myId + "_" + element.id;
+		if (element.type != "hidden") {
+			str += '<div class="print_option_dyn">\n';	
+			str += '<label class="print_label" for="'+element.id+'">'+element.label+'</label>\n';
+		}
+		switch (element.type) {
+			case "text":
+				str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'" size="'+element.size+'"><br>\n';
+				break;
+			case "hidden":
+				str += '<input type="'+element.type+'" name="'+element.id+'" id="'+element.id+'"><br>\n';
+				break;				
+			case "textarea":
+				str += '<textarea id="'+element.id+'" name="'+element.id+'" size="'+element.size+'"></textarea><br>\n';
+				break;				
+			case "select":
+				str += '<select id="'+element.id+'" name="'+element.id+'" size="1">\n';
+				for (var option_index in element.options) {
+					option = element.options[option_index];
+					str += '<option value="'+option.value+'">'+option.label+'</option>\n';
+				}
+				str += '</select><br>\n';
+				break;
+		}
+		if (element.type != "hidden") str += '</div>\n';
+	}
+	if (str) $("#"+myId+"_formsubmit").before(str);
+}
+
+/**
+ * Generates the configuration select element from the gui element vars
+ * mbPrintConfigFilenames and mbPrintConfigTitles
+ */
+function buildConfigSelector() {
+	var str = "";
+	str += '<label class="print_label" for="printPDF_template">Vorlage</label>\n';
+	str += '<select id="printPDF_template" name="printPDF_template" size="1" onchange="loadConfig(mbPrintConfigFilenames[this.selectedIndex]);">\n';
+	for (var i = 0; i < mbPrintConfigFilenames.length; i++) {
+		str += '<option value="'+mbPrintConfigFilenames[i]+'">'+mbPrintConfigTitles[i]+'</option>\n';
+	}
+	str += '</select><br />\n';
+	if (str) $("#printPDF_selector").append(str);
+}
+
+function stripslashes( str ) {
+    return (str+'').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1');
+}

Modified: branches/print_dev/http/print/printFactory.php
===================================================================
--- branches/print_dev/http/print/printFactory.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/printFactory.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,12 +1,12 @@
 <?php
-
-require_once(dirname(__FILE__)."/classes/factoryClasses.php");
-
-$pf = new mbPdfFactory();
-$pdf = $pf->create($_REQUEST["printPDF_template"]);
-
-$pdf->render();
-$pdf->save();
-
+
+require_once(dirname(__FILE__)."/classes/factoryClasses.php");
+
+$pf = new mbPdfFactory();
+$pdf = $pf->create($_REQUEST["printPDF_template"]);
+
+$pdf->render();
+$pdf->save();
+
 print $pdf->returnAbsoluteUrl();
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/print/printPDF_download.php
===================================================================
--- branches/print_dev/http/print/printPDF_download.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/printPDF_download.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,17 +1,17 @@
-<?php
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-if (isset($_REQUEST["f"]) && $_REQUEST["f"]!="" && file_exists(TMPDIR."/".$_REQUEST["f"])) {
-	$filename = TMPDIR."/".$_REQUEST["f"];
-    header('Content-Type: application/octet-stream');
-    header('Content-Disposition: attachment; filename="'.basename($filename).'"');
-    header('Pragma: public');
-    ob_clean();
-    flush();
-    readfile($filename);
-    exit;
-}
-else {
-	echo "not found";
+<?php
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+if (isset($_REQUEST["f"]) && $_REQUEST["f"]!="" && file_exists(TMPDIR."/".$_REQUEST["f"])) {
+	$filename = TMPDIR."/".$_REQUEST["f"];
+    header('Content-Type: application/octet-stream');
+    header('Content-Disposition: attachment; filename="'.basename($filename).'"');
+    header('Pragma: public');
+    ob_clean();
+    flush();
+    readfile($filename);
+    exit;
 }
+else {
+	echo "not found";
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/print/print_functions.php
===================================================================
--- branches/print_dev/http/print/print_functions.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/print/print_functions.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,381 +1,381 @@
-<?php
-/**
- * $Id$
- * 
- * converts the coordinates created via the JavaScript
- * functions in 'mod_measure.php' into an array which 
- * then holds both X- ans Y-values for each point in
- * the formats 'realworld coordinate' and 'pdf_coordinate' 
- * 
- * @param string commaseperated X-values of the points (realworld coordinate)
- * @param string commaseperated Y-values of the points (realworld coordinate)
- * 
- * @return array Array looking like 0 => array(
- *                                         'real_x' => 1234567,
- *                                         'real_y' => 7654321,
- *                                         'pdf_x'  => 451.12,
- *                                         'pdf_y'  => 254.7          
- *                                       )
- * 
- * @see transformForPDF
- *
- * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
- */
-function makeCoordPairs($x_values, $y_values) {
-  $arr_x = explode(",", $x_values);
-	$arr_y = explode(",", $y_values);
-	$x_elems = count($arr_x);
-	$y_elems = count($arr_y);
-	
-	$the_return_arr = array();
-	
-	if ($x_elems == $y_elems) {
-	  for ($i = 0; $i < $x_elems; $i ++) {
-		  $the_return_arr[$i] = array(
-			                        "real_x" => $arr_x[$i],
-															"real_y" => $arr_y[$i],
-															"pdf_x"  => transformForPDF($arr_x[$i], "x"),
-															"pdf_y"  => transformForPDF($arr_y[$i], "y")
-															);
-		}
-	}
-	
-	return $the_return_arr;
-} // end of function makeCoordPairs
-
-
-
-/**
- * Transforms given realworld-coordinate according to its type (X or Y) 
- * into a pdf-coordinate. Needs the variables $mapOffset_left, $mapOffset_bottom,
- * $map_height, $map_width, $coord to be defined in a global scope.
- *
- * @param float the realworld coordinate
- * @param string type of coordinate either 'X' or 'Y'
- *   
- * @see makeCoordPairs [needs this function]
- *
- * @return float the pdf-coordinate
- *
- * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
- */
-function transformForPDF ($theRealCoord, $theType) {
-  global $mapOffset_left, $mapOffset_bottom, $map_height, $map_width, $coord;
-  global $yAxisOrientation;
-	
-	$thePDFvalue = "";
-	
-	switch (mb_strtolower($theType)) {
-	  case 'x':
-		  // calculate pdf x-pos:
-			$real_shown_width = $coord[2] - $coord[0];
-			$ratio_to_display = $map_width / $real_shown_width;
-			$target_width     = $theRealCoord - $coord[0];
-			$thePDFvalue      = $mapOffset_left + ($target_width * $ratio_to_display);
-			break;
-		case 'y':
-		  // calculate pdf y-pos:
-			$real_shown_height = $coord[3] - $coord[1];
-			$ratio_to_display  = $map_height / $real_shown_height;
-			$target_height     = $theRealCoord - $coord[1];
-			if (isset($yAxisOrientation) && $yAxisOrientation==1)
-				$thePDFvalue   = $map_height + $mapOffset_bottom - ($target_height * $ratio_to_display);
-			else	
-				$thePDFvalue   = $mapOffset_bottom + ($target_height * $ratio_to_display);
-		  break;
-		default:
-		  // a non valid parameter was given
-		  $thePDFvalue = $theRealCoord;
-      break;
-	}
-	return $thePDFvalue;
-} // end of function transformForPDF
-
-
-
-
-/**
- * extracts PDF-relevant information from a full coordinates array 
- * and returns a transformed array
- * 
- * @param array the Array containing all infos about single coordinates
- *              created via makeCoordPairs()
- * 
- * @return array the array containing PDF-Values for a polygon
- *
- * @see makeCoordPairs
- *
- * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
- */
-function makePolyFromCoord($theFullCoordinatesArray) {
-  $theRetArr = array();
-	foreach($theFullCoordinatesArray as $singlePoint) {
-	  $theRetArr[] = $singlePoint['pdf_x'];
-		$theRetArr[] = $singlePoint['pdf_y'];
-	}
-	return $theRetArr;
-} // end of function makePolyFromCoord
-
-
-
-
-/**
- * converts an array of coordinates (created e.g. by makeCoordPairs()) into
- * an array thats needed to draw lines via line(x0, y0, x1, y1)
- *
- * @param array the Array containing all infos about single coordinates
- *              created via makeCoordPairs()
- * 
- * @return array the array containing PDF-Values for single lines
- *
- * @see makeCoordPairs
- *
- * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
- */
-function makeStrokePointPairs($thePointArray) {
-  $cnt = count($thePointArray);
-	$theRetArray = array();
-  for($i = 0; $i < $cnt; $i++) {
-	  if($i != $cnt - 1) {
-		  $theRetArray[] = array(
-		    $thePointArray[$i]['pdf_x'],
-				$thePointArray[$i]['pdf_y'],
-				$thePointArray[$i+1]['pdf_x'],
-				$thePointArray[$i+1]['pdf_y'],
-				);
-		} else {
-		  $theRetArray[] = array(
-		    $thePointArray[$i]['pdf_x'],
-				$thePointArray[$i]['pdf_y'],
-				$thePointArray[0]['pdf_x'],
-				$thePointArray[0]['pdf_y'],
-				);
-		}
-	}
-	return $theRetArray;
-} // end of function makeStrokePointPairs
-
-
-
-
-/**
- * test whether the coordinates in an array form a closed polygon
- * meaning that first an last point of polygon are equal
- *
- * @param array the Array containing all infos about single coordinates
- *              created via makeCoordPairs()
- * 
- * @return bool is it closed (TRUE || FALSE)
- *
- * @see makeCoordPairs
- *
- * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
- */
-function isClosedPolygon($coord_arr) {
-  $nr_of = count($coord_arr);
-	if ($coord_arr[0]['pdf_x'] == $coord_arr[$nr_of-1]['pdf_x']
-	    && $coord_arr[0]['pdf_y'] == $coord_arr[$nr_of-1]['pdf_y']
-			&& $nr_of != 1) {
-	  return TRUE; 
-	} else {
-	  return FALSE;
-	}
-}  // end of function isClosedPolygon
-
-
-
-
-/**
- * Adds the measured item to the PDF output.
- * 
- * @param object reference (!) to the current ezPDF-Object
- * @param string commaseperated X-Values of polygon / line
- * @param string commaseperated Y-Values of polygon / line
- * @param array configuration settings.
- *
- * @return void nothing
- *
- * @see makeCoordPairs
- * @see isClosedPolygon
- * @see makeStrokePointPairs
- * @see makePolyFromCoord
- * @see transformForPDF
- * @see makeCoordPairs
- *
- * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
- */
-function addMeasuredItem($thePDF, $x_value_str, $y_value_str, $theConfArray = array()) {
-  // get global variable:
-  global $legendFilenameUserPolygon;
-	// create legend image:
-	$legend_width = 17;
-	$leg_img = imagecreate($legend_width, $legend_width);
-	// save previous state:
-	$thePDF->saveState();
-	
-	// save colors for legend:
-	if(!defined("MAP_HAS_USER_POLYGON")) {
-	  define("MAP_HAS_USER_POLYGON", "test");
-	}
-
-	// get the arrays
-	$theFullArr = makeCoordPairs($x_value_str, $y_value_str);
-    $thePolyArr = makePolyFromCoord($theFullArr);
-	
-	if (isClosedPolygon($theFullArr)) {
-		$isClosed = TRUE;
-	} 
-	else {
-		$isClosed = FALSE;
-	}
-	$nr_of_points = count($theFullArr);
-	
-	// is fill option set?
-	// wenn der erste und letzte punkt nicht �bereinstimmen,
-	// so muss in jedem Falle dofill auf 0 gesetzt werden
-	if($theConfArray['do_fill'] != '' && $isClosed) {
-	  $doFill = 1;
-	  // which color to use for filling?
-	  if (is_array($theConfArray['fill_color']) 
-	      && $theConfArray['fill_color']['r'] != ''
-			  && $theConfArray['fill_color']['g'] != ''
-			  && $theConfArray['fill_color']['b'] != '') {
-	    $thePDF->setColor($theConfArray['fill_color']['r'], $theConfArray['fill_color']['g'], $theConfArray['fill_color']['b']);
-			$legend_image_fill = $theConfArray['fill_color']['r'] . "," . $theConfArray['fill_color']['g'] . "," . $theConfArray['fill_color']['b'];
-			// color to legend file
-			$bg_color = imagecolorallocate($leg_img, round($theConfArray['fill_color']['r'] * 255), round($theConfArray['fill_color']['g'] * 255), round($theConfArray['fill_color']['b'] * 255));
-	  } else {
-	    $thePDF->setColor(0, 0, 0);
-			// color to legend file
-			$bg_color = imagecolorallocate($leg_img, 0, 0, 0);
-	  }
-	} else {
-	  $doFill = 0;
-		// color to legend file
-	  $bg_color = imagecolorallocate($leg_img, -1, -1, -1);
-	}
-	
-	// Do we need to stroke (outline)?
-	if($theConfArray['do_stroke'] != '') {
-	  // which color to use for filling?
-	  if (is_array($theConfArray['stroke_color']) 
-	      && $theConfArray['stroke_color']['r'] != ''
-			  && $theConfArray['stroke_color']['g'] != ''
-			  && $theConfArray['stroke_color']['b'] != '') {
-	    $thePDF->setStrokeColor($theConfArray['stroke_color']['r'], $theConfArray['stroke_color']['g'], $theConfArray['stroke_color']['b']);
-			$thePDF->setLineStyle($theConfArray['line_style']['width'], $theConfArray['line_style']['cap'], $theConfArray['line_style']['join'], $theConfArray['line_style']['dash']);
-			$theStrokePointPairs = makeStrokePointPairs($theFullArr);
-			for($i = 0; $i < count($theStrokePointPairs); $i++) {
-			  $line = $theStrokePointPairs[$i];
-				if ($i != count($theStrokePointPairs) - 1
-				    || $isClosed) {
-			    $thePDF->line($line[0], $line[1], $line[2], $line[3]);
-					
-					$stroke_color_legend_image = imagecolorallocate($leg_img, round($theConfArray['stroke_color']['r'] * 255), round($theConfArray['stroke_color']['g'] * 255), round($theConfArray['stroke_color']['b'] * 255));
-					if (is_array($theConfArray['line_style']['dash'])
-					    && $theConfArray['line_style']['dash'][1] != ""
-							&& $theConfArray['line_style']['dash'][1] != 0) {
-						imagedashedline($leg_img, 0, 0, $legend_width-1, 0, $stroke_color_legend_image);
-						imagedashedline($leg_img, $legend_width-1, 1, $legend_width-1, $legend_width-1, $stroke_color_legend_image);
-						imagedashedline($leg_img, 0, 0, 0, $legend_width-1, $stroke_color_legend_image);
-						imagedashedline($leg_img, 0, $legend_width-1, $legend_width-1,$legend_width-1, $stroke_color_legend_image);
-					} else {
-					  imageline($leg_img, 0, 0, $legend_width-1, 0, $stroke_color_legend_image);
-						imageline($leg_img, $legend_width-1, 0, $legend_width-1, $legend_width-1, $stroke_color_legend_image);
-						imageline($leg_img, $legend_width-1, $legend_width-1, 0, $legend_width-1, $stroke_color_legend_image);
-						imageline($leg_img, 0, $legend_width-1, 0, 0, $stroke_color_legend_image);
-					}		
-				} 
-			}
-	  } 
-	}
-	
-  $thePDF->polygon($thePolyArr, $nr_of_points, $doFill);
-  // eventually create the file:
-	imagepng($leg_img, $legendFilenameUserPolygon);
-	
-	$thePDF->restoreState();
-} // end of function addMeasuredItem
-
-/**
- * Konvertiert einen Text in ein array aus einzelnen Zeilen. Parameter wie Zeichen pro
- * zeile etc. k�nnen in der Funktion ge�ndert werden.
- */
-function convert2lines($the_text) {
-    $words = explode(' ', $the_text);
-	$maxlines                 = 6;
-	$available_chars_per_line = 35;
-	$total_number_of_lines    = 0;
-	$chars_current_line       = 0;
-	$the_return_array         = array();
-
-    foreach($words as $word) {
-    	// trimme wort auf maximal erlaubte zeichenzahl
-        $word_fit = mb_substr($word, 0, $available_chars_per_line);
-	    $chars = preg_split('//', $word_fit, -1, PREG_SPLIT_NO_EMPTY);
-	    
-	    if(count($chars) + $chars_current_line + 1 < $available_chars_per_line && $total_number_of_lines < $maxlines) {
-		    $chars_current_line += count($chars) + 1;
-			$the_return_array[$total_number_of_lines]  .= " " . $word_fit;
-		} elseif($total_number_of_lines < $maxlines) {
-	      $chars_current_line = count($chars) + 1;
-		  $the_return_array[$total_number_of_lines + 1] = " " . $word_fit;
-		  $total_number_of_lines++;
-		}
-	}
-  return $the_return_array;
-} // end of function convert2lines
-
-/**
- * Adds two white polygons to hide any user elements outside the mapframe:
- * First all A-Areas are filled, then all B-Areas. This is a rather grumpy
- * way out of having user edited stuff flying outside the mapframe.
- * 
- * @example <pre>
- * BBBBBBBBBBBBBBBBBBBBBBBBBBBBAAA
- * BBBBBBBBBBBBBBBBBBBBBBBBBBBBAAA
- * BBB                                                  AAA
- * BBB                                                  AAA
- * BBB       Mapframe                              AAA
- * BBB                                                  AAA
- * BBB                                                  AAA
- * BBB                                                  AAA
- * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- * </pre>
- * 
- * @param reference (!, pass over with '&') to the pdf-file
- * @author M. Jansen <jansen at terrestris.de>
- */
-function hideElementsOutsideMapframe($pdf) {
-  // get globals
-  global $mapOffset_left, $map_width, $mapOffset_bottom, $map_height;
-  $pdf->saveState();
-  $pdf->setColor(1, 1, 1);
-	// The AAA-Part
-  $allOutside = array(
-    0                              , 0,                       // 1st coord-pair
-    $pdf->ez['pageWidth']          , 0,                       // 2nd coord-pair
-    $pdf->ez['pageWidth']          , $pdf->ez['pageHeight'],  // ...
-    $mapOffset_left + $map_width   , $pdf->ez['pageHeight'],
-    $mapOffset_left + $map_width   , $mapOffset_bottom,
-    0                              , $mapOffset_bottom,
-    0                              , 0
-  );
-	// draw polygon
-  $pdf->polygon($allOutside, 7, 1);    
-  // The BBB-part
-  $allOutside = array(
-    0                              , $mapOffset_bottom,       // 1st coord-pair
-    $mapOffset_left                , $mapOffset_bottom,       // 2nd coord-pair
-    $mapOffset_left                , $mapOffset_bottom + $map_height, // ...
-    $mapOffset_left + $map_width   , $mapOffset_bottom + $map_height,
-    $mapOffset_left + $map_width   , $pdf->ez['pageHeight'],
-    0                              , $pdf->ez['pageHeight'],
-    0                              , $mapOffset_bottom,  
-  );
-	// draw polygon
-  $pdf->polygon($allOutside, 7, 1);
-  $pdf->restoreState();
-}
+<?php
+/**
+ * $Id$
+ * 
+ * converts the coordinates created via the JavaScript
+ * functions in 'mod_measure.php' into an array which 
+ * then holds both X- ans Y-values for each point in
+ * the formats 'realworld coordinate' and 'pdf_coordinate' 
+ * 
+ * @param string commaseperated X-values of the points (realworld coordinate)
+ * @param string commaseperated Y-values of the points (realworld coordinate)
+ * 
+ * @return array Array looking like 0 => array(
+ *                                         'real_x' => 1234567,
+ *                                         'real_y' => 7654321,
+ *                                         'pdf_x'  => 451.12,
+ *                                         'pdf_y'  => 254.7          
+ *                                       )
+ * 
+ * @see transformForPDF
+ *
+ * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
+ */
+function makeCoordPairs($x_values, $y_values) {
+  $arr_x = explode(",", $x_values);
+	$arr_y = explode(",", $y_values);
+	$x_elems = count($arr_x);
+	$y_elems = count($arr_y);
+	
+	$the_return_arr = array();
+	
+	if ($x_elems == $y_elems) {
+	  for ($i = 0; $i < $x_elems; $i ++) {
+		  $the_return_arr[$i] = array(
+			                        "real_x" => $arr_x[$i],
+															"real_y" => $arr_y[$i],
+															"pdf_x"  => transformForPDF($arr_x[$i], "x"),
+															"pdf_y"  => transformForPDF($arr_y[$i], "y")
+															);
+		}
+	}
+	
+	return $the_return_arr;
+} // end of function makeCoordPairs
+
+
+
+/**
+ * Transforms given realworld-coordinate according to its type (X or Y) 
+ * into a pdf-coordinate. Needs the variables $mapOffset_left, $mapOffset_bottom,
+ * $map_height, $map_width, $coord to be defined in a global scope.
+ *
+ * @param float the realworld coordinate
+ * @param string type of coordinate either 'X' or 'Y'
+ *   
+ * @see makeCoordPairs [needs this function]
+ *
+ * @return float the pdf-coordinate
+ *
+ * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
+ */
+function transformForPDF ($theRealCoord, $theType) {
+  global $mapOffset_left, $mapOffset_bottom, $map_height, $map_width, $coord;
+  global $yAxisOrientation;
+	
+	$thePDFvalue = "";
+	
+	switch (mb_strtolower($theType)) {
+	  case 'x':
+		  // calculate pdf x-pos:
+			$real_shown_width = $coord[2] - $coord[0];
+			$ratio_to_display = $map_width / $real_shown_width;
+			$target_width     = $theRealCoord - $coord[0];
+			$thePDFvalue      = $mapOffset_left + ($target_width * $ratio_to_display);
+			break;
+		case 'y':
+		  // calculate pdf y-pos:
+			$real_shown_height = $coord[3] - $coord[1];
+			$ratio_to_display  = $map_height / $real_shown_height;
+			$target_height     = $theRealCoord - $coord[1];
+			if (isset($yAxisOrientation) && $yAxisOrientation==1)
+				$thePDFvalue   = $map_height + $mapOffset_bottom - ($target_height * $ratio_to_display);
+			else	
+				$thePDFvalue   = $mapOffset_bottom + ($target_height * $ratio_to_display);
+		  break;
+		default:
+		  // a non valid parameter was given
+		  $thePDFvalue = $theRealCoord;
+      break;
+	}
+	return $thePDFvalue;
+} // end of function transformForPDF
+
+
+
+
+/**
+ * extracts PDF-relevant information from a full coordinates array 
+ * and returns a transformed array
+ * 
+ * @param array the Array containing all infos about single coordinates
+ *              created via makeCoordPairs()
+ * 
+ * @return array the array containing PDF-Values for a polygon
+ *
+ * @see makeCoordPairs
+ *
+ * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
+ */
+function makePolyFromCoord($theFullCoordinatesArray) {
+  $theRetArr = array();
+	foreach($theFullCoordinatesArray as $singlePoint) {
+	  $theRetArr[] = $singlePoint['pdf_x'];
+		$theRetArr[] = $singlePoint['pdf_y'];
+	}
+	return $theRetArr;
+} // end of function makePolyFromCoord
+
+
+
+
+/**
+ * converts an array of coordinates (created e.g. by makeCoordPairs()) into
+ * an array thats needed to draw lines via line(x0, y0, x1, y1)
+ *
+ * @param array the Array containing all infos about single coordinates
+ *              created via makeCoordPairs()
+ * 
+ * @return array the array containing PDF-Values for single lines
+ *
+ * @see makeCoordPairs
+ *
+ * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
+ */
+function makeStrokePointPairs($thePointArray) {
+  $cnt = count($thePointArray);
+	$theRetArray = array();
+  for($i = 0; $i < $cnt; $i++) {
+	  if($i != $cnt - 1) {
+		  $theRetArray[] = array(
+		    $thePointArray[$i]['pdf_x'],
+				$thePointArray[$i]['pdf_y'],
+				$thePointArray[$i+1]['pdf_x'],
+				$thePointArray[$i+1]['pdf_y'],
+				);
+		} else {
+		  $theRetArray[] = array(
+		    $thePointArray[$i]['pdf_x'],
+				$thePointArray[$i]['pdf_y'],
+				$thePointArray[0]['pdf_x'],
+				$thePointArray[0]['pdf_y'],
+				);
+		}
+	}
+	return $theRetArray;
+} // end of function makeStrokePointPairs
+
+
+
+
+/**
+ * test whether the coordinates in an array form a closed polygon
+ * meaning that first an last point of polygon are equal
+ *
+ * @param array the Array containing all infos about single coordinates
+ *              created via makeCoordPairs()
+ * 
+ * @return bool is it closed (TRUE || FALSE)
+ *
+ * @see makeCoordPairs
+ *
+ * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
+ */
+function isClosedPolygon($coord_arr) {
+  $nr_of = count($coord_arr);
+	if ($coord_arr[0]['pdf_x'] == $coord_arr[$nr_of-1]['pdf_x']
+	    && $coord_arr[0]['pdf_y'] == $coord_arr[$nr_of-1]['pdf_y']
+			&& $nr_of != 1) {
+	  return TRUE; 
+	} else {
+	  return FALSE;
+	}
+}  // end of function isClosedPolygon
+
+
+
+
+/**
+ * Adds the measured item to the PDF output.
+ * 
+ * @param object reference (!) to the current ezPDF-Object
+ * @param string commaseperated X-Values of polygon / line
+ * @param string commaseperated Y-Values of polygon / line
+ * @param array configuration settings.
+ *
+ * @return void nothing
+ *
+ * @see makeCoordPairs
+ * @see isClosedPolygon
+ * @see makeStrokePointPairs
+ * @see makePolyFromCoord
+ * @see transformForPDF
+ * @see makeCoordPairs
+ *
+ * @author M. Jansen <jansen at terrestris.de>, 2006-05-26
+ */
+function addMeasuredItem($thePDF, $x_value_str, $y_value_str, $theConfArray = array()) {
+  // get global variable:
+  global $legendFilenameUserPolygon;
+	// create legend image:
+	$legend_width = 17;
+	$leg_img = imagecreate($legend_width, $legend_width);
+	// save previous state:
+	$thePDF->saveState();
+	
+	// save colors for legend:
+	if(!defined("MAP_HAS_USER_POLYGON")) {
+	  define("MAP_HAS_USER_POLYGON", "test");
+	}
+
+	// get the arrays
+	$theFullArr = makeCoordPairs($x_value_str, $y_value_str);
+    $thePolyArr = makePolyFromCoord($theFullArr);
+	
+	if (isClosedPolygon($theFullArr)) {
+		$isClosed = TRUE;
+	} 
+	else {
+		$isClosed = FALSE;
+	}
+	$nr_of_points = count($theFullArr);
+	
+	// is fill option set?
+	// wenn der erste und letzte punkt nicht �bereinstimmen,
+	// so muss in jedem Falle dofill auf 0 gesetzt werden
+	if($theConfArray['do_fill'] != '' && $isClosed) {
+	  $doFill = 1;
+	  // which color to use for filling?
+	  if (is_array($theConfArray['fill_color']) 
+	      && $theConfArray['fill_color']['r'] != ''
+			  && $theConfArray['fill_color']['g'] != ''
+			  && $theConfArray['fill_color']['b'] != '') {
+	    $thePDF->setColor($theConfArray['fill_color']['r'], $theConfArray['fill_color']['g'], $theConfArray['fill_color']['b']);
+			$legend_image_fill = $theConfArray['fill_color']['r'] . "," . $theConfArray['fill_color']['g'] . "," . $theConfArray['fill_color']['b'];
+			// color to legend file
+			$bg_color = imagecolorallocate($leg_img, round($theConfArray['fill_color']['r'] * 255), round($theConfArray['fill_color']['g'] * 255), round($theConfArray['fill_color']['b'] * 255));
+	  } else {
+	    $thePDF->setColor(0, 0, 0);
+			// color to legend file
+			$bg_color = imagecolorallocate($leg_img, 0, 0, 0);
+	  }
+	} else {
+	  $doFill = 0;
+		// color to legend file
+	  $bg_color = imagecolorallocate($leg_img, -1, -1, -1);
+	}
+	
+	// Do we need to stroke (outline)?
+	if($theConfArray['do_stroke'] != '') {
+	  // which color to use for filling?
+	  if (is_array($theConfArray['stroke_color']) 
+	      && $theConfArray['stroke_color']['r'] != ''
+			  && $theConfArray['stroke_color']['g'] != ''
+			  && $theConfArray['stroke_color']['b'] != '') {
+	    $thePDF->setStrokeColor($theConfArray['stroke_color']['r'], $theConfArray['stroke_color']['g'], $theConfArray['stroke_color']['b']);
+			$thePDF->setLineStyle($theConfArray['line_style']['width'], $theConfArray['line_style']['cap'], $theConfArray['line_style']['join'], $theConfArray['line_style']['dash']);
+			$theStrokePointPairs = makeStrokePointPairs($theFullArr);
+			for($i = 0; $i < count($theStrokePointPairs); $i++) {
+			  $line = $theStrokePointPairs[$i];
+				if ($i != count($theStrokePointPairs) - 1
+				    || $isClosed) {
+			    $thePDF->line($line[0], $line[1], $line[2], $line[3]);
+					
+					$stroke_color_legend_image = imagecolorallocate($leg_img, round($theConfArray['stroke_color']['r'] * 255), round($theConfArray['stroke_color']['g'] * 255), round($theConfArray['stroke_color']['b'] * 255));
+					if (is_array($theConfArray['line_style']['dash'])
+					    && $theConfArray['line_style']['dash'][1] != ""
+							&& $theConfArray['line_style']['dash'][1] != 0) {
+						imagedashedline($leg_img, 0, 0, $legend_width-1, 0, $stroke_color_legend_image);
+						imagedashedline($leg_img, $legend_width-1, 1, $legend_width-1, $legend_width-1, $stroke_color_legend_image);
+						imagedashedline($leg_img, 0, 0, 0, $legend_width-1, $stroke_color_legend_image);
+						imagedashedline($leg_img, 0, $legend_width-1, $legend_width-1,$legend_width-1, $stroke_color_legend_image);
+					} else {
+					  imageline($leg_img, 0, 0, $legend_width-1, 0, $stroke_color_legend_image);
+						imageline($leg_img, $legend_width-1, 0, $legend_width-1, $legend_width-1, $stroke_color_legend_image);
+						imageline($leg_img, $legend_width-1, $legend_width-1, 0, $legend_width-1, $stroke_color_legend_image);
+						imageline($leg_img, 0, $legend_width-1, 0, 0, $stroke_color_legend_image);
+					}		
+				} 
+			}
+	  } 
+	}
+	
+  $thePDF->polygon($thePolyArr, $nr_of_points, $doFill);
+  // eventually create the file:
+	imagepng($leg_img, $legendFilenameUserPolygon);
+	
+	$thePDF->restoreState();
+} // end of function addMeasuredItem
+
+/**
+ * Konvertiert einen Text in ein array aus einzelnen Zeilen. Parameter wie Zeichen pro
+ * zeile etc. k�nnen in der Funktion ge�ndert werden.
+ */
+function convert2lines($the_text) {
+    $words = explode(' ', $the_text);
+	$maxlines                 = 6;
+	$available_chars_per_line = 35;
+	$total_number_of_lines    = 0;
+	$chars_current_line       = 0;
+	$the_return_array         = array();
+
+    foreach($words as $word) {
+    	// trimme wort auf maximal erlaubte zeichenzahl
+        $word_fit = mb_substr($word, 0, $available_chars_per_line);
+	    $chars = preg_split('//', $word_fit, -1, PREG_SPLIT_NO_EMPTY);
+	    
+	    if(count($chars) + $chars_current_line + 1 < $available_chars_per_line && $total_number_of_lines < $maxlines) {
+		    $chars_current_line += count($chars) + 1;
+			$the_return_array[$total_number_of_lines]  .= " " . $word_fit;
+		} elseif($total_number_of_lines < $maxlines) {
+	      $chars_current_line = count($chars) + 1;
+		  $the_return_array[$total_number_of_lines + 1] = " " . $word_fit;
+		  $total_number_of_lines++;
+		}
+	}
+  return $the_return_array;
+} // end of function convert2lines
+
+/**
+ * Adds two white polygons to hide any user elements outside the mapframe:
+ * First all A-Areas are filled, then all B-Areas. This is a rather grumpy
+ * way out of having user edited stuff flying outside the mapframe.
+ * 
+ * @example <pre>
+ * BBBBBBBBBBBBBBBBBBBBBBBBBBBBAAA
+ * BBBBBBBBBBBBBBBBBBBBBBBBBBBBAAA
+ * BBB                                                  AAA
+ * BBB                                                  AAA
+ * BBB       Mapframe                              AAA
+ * BBB                                                  AAA
+ * BBB                                                  AAA
+ * BBB                                                  AAA
+ * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ * </pre>
+ * 
+ * @param reference (!, pass over with '&') to the pdf-file
+ * @author M. Jansen <jansen at terrestris.de>
+ */
+function hideElementsOutsideMapframe($pdf) {
+  // get globals
+  global $mapOffset_left, $map_width, $mapOffset_bottom, $map_height;
+  $pdf->saveState();
+  $pdf->setColor(1, 1, 1);
+	// The AAA-Part
+  $allOutside = array(
+    0                              , 0,                       // 1st coord-pair
+    $pdf->ez['pageWidth']          , 0,                       // 2nd coord-pair
+    $pdf->ez['pageWidth']          , $pdf->ez['pageHeight'],  // ...
+    $mapOffset_left + $map_width   , $pdf->ez['pageHeight'],
+    $mapOffset_left + $map_width   , $mapOffset_bottom,
+    0                              , $mapOffset_bottom,
+    0                              , 0
+  );
+	// draw polygon
+  $pdf->polygon($allOutside, 7, 1);    
+  // The BBB-part
+  $allOutside = array(
+    0                              , $mapOffset_bottom,       // 1st coord-pair
+    $mapOffset_left                , $mapOffset_bottom,       // 2nd coord-pair
+    $mapOffset_left                , $mapOffset_bottom + $map_height, // ...
+    $mapOffset_left + $map_width   , $mapOffset_bottom + $map_height,
+    $mapOffset_left + $map_width   , $pdf->ez['pageHeight'],
+    0                              , $pdf->ez['pageHeight'],
+    0                              , $mapOffset_bottom,  
+  );
+	// draw polygon
+  $pdf->polygon($allOutside, 7, 1);
+  $pdf->restoreState();
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/AddOperationModule.php
===================================================================
--- branches/print_dev/http/sld/classes/AddOperationModule.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/AddOperationModule.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,80 +1,80 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Template class that only creates the source code for the function of adding an operation
- * is used whereever an operation can be added. Simpyl change this class and the change
- * will affect all the appearences of the add operation function.
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class AddOperationModule
-{
-	/**
-	 * stores the id of the referring object (the id member field of the object!)
-	 */
-	var $objId = "";
-	/**
-	 * stores the prefix of the referring object's html-form-fields
-	 */
-	var $htmlId = "";
-	
-	/**
-	 * constructor that sets the necessary values ov the member fields
-	 */
-	function AddOperationModule($objId, $htmlId)
-	{
-		$this->objId = $objId;
-		$this->htmlId = $htmlId;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<select name=\"".$this->htmlId."_newoperation\">\n";
-		$temp .= $offset." <option value=\"and\">AND - logisches UND</option>\n";
-		$temp .= $offset." <option value=\"or\">OR - logisches ODER</option>\n";
-		$temp .= $offset." <option value=\"not\">NOT - logisches NICHT</option>\n";
-		$temp .= $offset." <option value=\"propertyisequalto\">Eigenschaft = x</option>\n";
-		$temp .= $offset." <option value=\"propertyisnotequalto\">Eigenschaft != x</option>\n";
-		$temp .= $offset." <option value=\"propertyisgreaterthan\">Eigenschaft &gt; x</option>\n";
-		$temp .= $offset." <option value=\"propertyisgreaterthanorequalto\">Eigenschaft &gt;= x</option>\n";
-		$temp .= $offset." <option value=\"propertyislessthan\">Eigenschaft &lt; x</option>\n";
-		$temp .= $offset." <option value=\"propertyislessthanorequalto\">Eigenschaft &lt;= x</option>\n";
-		$temp .= $offset." <option value=\"propertyislike\">Eigenschaft �hnlich x</option>\n";
-		$temp .= $offset." <option value=\"propertyisnull\">Eigenschaft nicht definiert</option>\n";
-		$temp .= $offset." <option value=\"propertyisbetween\">x &lt;= Eigenschaft &lt;= y</option>\n";
-		$temp .= $offset."</select>\n";
-		$temp .= $offset."<span class=\"edit hand\"";
-		$temp .= " onClick=\"url='?function=addoperation&id=".$this->objId."&operation=';";
-		$temp .= " url += document.editFilter.".$this->htmlId."_newoperation.value;";
-		$temp .= " location.href = url;\"";
-		$temp .= ">";
-		$temp .= "<img src='./img/plus.gif' border='0'>&nbsp;hinzuf&uuml;gen\n</span>";
-		return $temp;
-	}
+/**
+ * Template class that only creates the source code for the function of adding an operation
+ * is used whereever an operation can be added. Simpyl change this class and the change
+ * will affect all the appearences of the add operation function.
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class AddOperationModule
+{
+	/**
+	 * stores the id of the referring object (the id member field of the object!)
+	 */
+	var $objId = "";
+	/**
+	 * stores the prefix of the referring object's html-form-fields
+	 */
+	var $htmlId = "";
+	
+	/**
+	 * constructor that sets the necessary values ov the member fields
+	 */
+	function AddOperationModule($objId, $htmlId)
+	{
+		$this->objId = $objId;
+		$this->htmlId = $htmlId;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<select name=\"".$this->htmlId."_newoperation\">\n";
+		$temp .= $offset." <option value=\"and\">AND - logisches UND</option>\n";
+		$temp .= $offset." <option value=\"or\">OR - logisches ODER</option>\n";
+		$temp .= $offset." <option value=\"not\">NOT - logisches NICHT</option>\n";
+		$temp .= $offset." <option value=\"propertyisequalto\">Eigenschaft = x</option>\n";
+		$temp .= $offset." <option value=\"propertyisnotequalto\">Eigenschaft != x</option>\n";
+		$temp .= $offset." <option value=\"propertyisgreaterthan\">Eigenschaft &gt; x</option>\n";
+		$temp .= $offset." <option value=\"propertyisgreaterthanorequalto\">Eigenschaft &gt;= x</option>\n";
+		$temp .= $offset." <option value=\"propertyislessthan\">Eigenschaft &lt; x</option>\n";
+		$temp .= $offset." <option value=\"propertyislessthanorequalto\">Eigenschaft &lt;= x</option>\n";
+		$temp .= $offset." <option value=\"propertyislike\">Eigenschaft �hnlich x</option>\n";
+		$temp .= $offset." <option value=\"propertyisnull\">Eigenschaft nicht definiert</option>\n";
+		$temp .= $offset." <option value=\"propertyisbetween\">x &lt;= Eigenschaft &lt;= y</option>\n";
+		$temp .= $offset."</select>\n";
+		$temp .= $offset."<span class=\"edit hand\"";
+		$temp .= " onClick=\"url='?function=addoperation&id=".$this->objId."&operation=';";
+		$temp .= " url += document.editFilter.".$this->htmlId."_newoperation.value;";
+		$temp .= " location.href = url;\"";
+		$temp .= ">";
+		$temp .= "<img src='./img/plus.gif' border='0'>&nbsp;hinzuf&uuml;gen\n</span>";
+		return $temp;
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/AnchorPoint.php
===================================================================
--- branches/print_dev/http/sld/classes/AnchorPoint.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/AnchorPoint.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,151 +1,151 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the AnchorPoint-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class AnchorPoint
-{
-	/**
-	 * The anchorpointx attribute from the xml-scheme.
-	 * Allowed values are between 0 and 1.
-	 * @var float
-	 */
-	var $anchorpointx = "";
-	
-	/**
-	 * The anchorpointy attribute from the xml-scheme.
-	 * Allowed values are between 0 and 1.
-	 * @var float
-	 */
-	var $anchorpointy = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<AnchorPoint>\n";
-		$temp .= $offset." <AnchorPointX>".htmlspecialchars($this->anchorpointx)."</AnchorPointX>\n";
-		$temp .= $offset." <AnchorPointY>".htmlspecialchars($this->anchorpointy)."</AnchorPointY>\n";
-		$temp .= $offset."</AnchorPoint>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"anchorpoint\">\n";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  AnchorPointX:\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		
-		//TODO - check possible values and their meaning
-		$temp .= $offset."  <select name=\"".$id."_anchorpointx\">\n";
-		$temp .= $offset."   <option value=\"0.0\"";
-		if ( $this->anchorpointx == "0.0") $temp .= " selected";
-		$temp .= ">0.0 - Ankerpunkt rechts</option>\n";
-		$temp .= $offset."   <option value=\"0.5\"";
-		if ( $this->anchorpointx == "0.5") $temp .= " selected";
-		$temp .= ">0.5 - Ankerpunkt mitte</option>\n";
-		$temp .= $offset."   <option value=\"1.0\"";
-		if ( $this->anchorpointx == "1.0") $temp .= " selected";
-		$temp .= ">1.0 - Ankerpunkt links</option>\n";
-		$temp .= $offset."  </select>\n";
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  AnchorPointY:\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		
-		//TODO - check possible values and their meaning
-		$temp .= $offset."  <select name=\"".$id."_anchorpointy\">\n";
-		$temp .= $offset."   <option value=\"0.0\"";
-		if ( $this->anchorpointy == "0.0") $temp .= " selected";
-		$temp .= ">0.0 - Ankerpunkt oben</option>\n";
-		$temp .= $offset."   <option value=\"0.5\"";
-		if ( $this->anchorpointy == "0.5") $temp .= " selected";
-		$temp .= ">0.5 - Ankerpunkt mitte</option>\n";
-		$temp .= $offset."   <option value=\"1.0\"";
-		if ( $this->anchorpointy == "1.0") $temp .= " selected";
-		$temp .= ">1.0 - Ankerpunkt unten</option>\n";
-		$temp .= $offset."  </select>\n";
-		
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_anchorpointx"]))
-		{
-			$this->anchorpointx = $_REQUEST[$id."_anchorpointx"];
-		}
-		if (isset($_REQUEST[$id."_anchorpointy"]))
-		{
-			$this->anchorpointy = $_REQUEST[$id."_anchorpointy"];
-		}
-	}
+/**
+ * Implementation of the AnchorPoint-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class AnchorPoint
+{
+	/**
+	 * The anchorpointx attribute from the xml-scheme.
+	 * Allowed values are between 0 and 1.
+	 * @var float
+	 */
+	var $anchorpointx = "";
+	
+	/**
+	 * The anchorpointy attribute from the xml-scheme.
+	 * Allowed values are between 0 and 1.
+	 * @var float
+	 */
+	var $anchorpointy = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<AnchorPoint>\n";
+		$temp .= $offset." <AnchorPointX>".htmlspecialchars($this->anchorpointx)."</AnchorPointX>\n";
+		$temp .= $offset." <AnchorPointY>".htmlspecialchars($this->anchorpointy)."</AnchorPointY>\n";
+		$temp .= $offset."</AnchorPoint>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"anchorpoint\">\n";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  AnchorPointX:\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		
+		//TODO - check possible values and their meaning
+		$temp .= $offset."  <select name=\"".$id."_anchorpointx\">\n";
+		$temp .= $offset."   <option value=\"0.0\"";
+		if ( $this->anchorpointx == "0.0") $temp .= " selected";
+		$temp .= ">0.0 - Ankerpunkt rechts</option>\n";
+		$temp .= $offset."   <option value=\"0.5\"";
+		if ( $this->anchorpointx == "0.5") $temp .= " selected";
+		$temp .= ">0.5 - Ankerpunkt mitte</option>\n";
+		$temp .= $offset."   <option value=\"1.0\"";
+		if ( $this->anchorpointx == "1.0") $temp .= " selected";
+		$temp .= ">1.0 - Ankerpunkt links</option>\n";
+		$temp .= $offset."  </select>\n";
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  AnchorPointY:\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		
+		//TODO - check possible values and their meaning
+		$temp .= $offset."  <select name=\"".$id."_anchorpointy\">\n";
+		$temp .= $offset."   <option value=\"0.0\"";
+		if ( $this->anchorpointy == "0.0") $temp .= " selected";
+		$temp .= ">0.0 - Ankerpunkt oben</option>\n";
+		$temp .= $offset."   <option value=\"0.5\"";
+		if ( $this->anchorpointy == "0.5") $temp .= " selected";
+		$temp .= ">0.5 - Ankerpunkt mitte</option>\n";
+		$temp .= $offset."   <option value=\"1.0\"";
+		if ( $this->anchorpointy == "1.0") $temp .= " selected";
+		$temp .= ">1.0 - Ankerpunkt unten</option>\n";
+		$temp .= $offset."  </select>\n";
+		
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_anchorpointx"]))
+		{
+			$this->anchorpointx = $_REQUEST[$id."_anchorpointx"];
+		}
+		if (isset($_REQUEST[$id."_anchorpointy"]))
+		{
+			$this->anchorpointy = $_REQUEST[$id."_anchorpointy"];
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/BinaryComparisonOp.php
===================================================================
--- branches/print_dev/http/sld/classes/BinaryComparisonOp.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/BinaryComparisonOp.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,158 +1,158 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the BinaryComparisonOp-element
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class BinaryComparisonOp
-{
-	/**
-	 * Defines the type of comparison operation.
-	 * @var string
-	 */
-	var $name = "";
-	
-	/**
-	 * Name of the property that is addressed in this comparison.
-	 * @var string
-	 */
-	var $ogcPropertyName = "";
-	
-	/**
-	 * String that is compared to the property-value.
-	 * Regular Expression?
-	 * @var string
-	 */
-	var $ogcLiteral = "";
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * constructor that directly fills the $name variable.
-	 * @param string $name the type of the comparison operation
-	 */
-	function BinaryComparisonOp($name)
-	{
-		$this->name = $name;
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ogc:".$this->name.">\n";
-		$temp .= $offset. " <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
-		$temp .= $offset. " <ogc:Literal>".$this->ogcLiteral."</ogc:Literal>\n";
-		$temp .= $offset."</ogc:".$this->name.">\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id = "", $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"binaryComparisonOp\">\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."_name\" value=\"".$this->name."\">\n";
-		if (count($_SESSION["sld_objects"][3]->attrs)>0) {
-			$temp .= $offset."  <input type=\"hidden\" id=\"".$id."_ogcpropertyname\" name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
-			$temp_elements = $_SESSION["sld_objects"][3]->generateElementsHtml($id."_ogcpropertyname",$this->ogcPropertyName);
-			$temp .= $offset.$temp_elements;
-		} else {
-			$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
-		}
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td style=\"width:50px; text-align: center; font-size: large; \">";
-				
-		switch($this->name)
-		{
-			case "PropertyIsEqualTo": $temp .= "="; break;
-			case "PropertyIsNotEqualTo": $temp .= "!="; break;
-			case "PropertyIsGreaterThan": $temp .= "&gt;"; break;
-			case "PropertyIsGreaterThanOrEqualTo": $temp .= "&gt;="; break;
-			case "PropertyIsLessThan": $temp .= "&lt;"; break;
-			case "PropertyIsLessThanOrEqualTo": $temp .= "&lt;="; break;
-			default: $temp .= $this->name;
-		}
-		$temp .= "\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		
-		$temp .= $offset."  <input name=\"".$id."_ogcliteral\" value=\"".$this->ogcLiteral."\">\n";
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
-		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->name = $_REQUEST[$id."_name"];
-		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
-		$this->ogcLiteral = $_REQUEST[$id."_ogcliteral"];
-	}
+/**
+ * Implementation of the BinaryComparisonOp-element
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class BinaryComparisonOp
+{
+	/**
+	 * Defines the type of comparison operation.
+	 * @var string
+	 */
+	var $name = "";
+	
+	/**
+	 * Name of the property that is addressed in this comparison.
+	 * @var string
+	 */
+	var $ogcPropertyName = "";
+	
+	/**
+	 * String that is compared to the property-value.
+	 * Regular Expression?
+	 * @var string
+	 */
+	var $ogcLiteral = "";
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * constructor that directly fills the $name variable.
+	 * @param string $name the type of the comparison operation
+	 */
+	function BinaryComparisonOp($name)
+	{
+		$this->name = $name;
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ogc:".$this->name.">\n";
+		$temp .= $offset. " <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
+		$temp .= $offset. " <ogc:Literal>".$this->ogcLiteral."</ogc:Literal>\n";
+		$temp .= $offset."</ogc:".$this->name.">\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id = "", $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"binaryComparisonOp\">\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."_name\" value=\"".$this->name."\">\n";
+		if (count($_SESSION["sld_objects"][3]->attrs)>0) {
+			$temp .= $offset."  <input type=\"hidden\" id=\"".$id."_ogcpropertyname\" name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
+			$temp_elements = $_SESSION["sld_objects"][3]->generateElementsHtml($id."_ogcpropertyname",$this->ogcPropertyName);
+			$temp .= $offset.$temp_elements;
+		} else {
+			$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
+		}
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td style=\"width:50px; text-align: center; font-size: large; \">";
+				
+		switch($this->name)
+		{
+			case "PropertyIsEqualTo": $temp .= "="; break;
+			case "PropertyIsNotEqualTo": $temp .= "!="; break;
+			case "PropertyIsGreaterThan": $temp .= "&gt;"; break;
+			case "PropertyIsGreaterThanOrEqualTo": $temp .= "&gt;="; break;
+			case "PropertyIsLessThan": $temp .= "&lt;"; break;
+			case "PropertyIsLessThanOrEqualTo": $temp .= "&lt;="; break;
+			default: $temp .= $this->name;
+		}
+		$temp .= "\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		
+		$temp .= $offset."  <input name=\"".$id."_ogcliteral\" value=\"".$this->ogcLiteral."\">\n";
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
+		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->name = $_REQUEST[$id."_name"];
+		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
+		$this->ogcLiteral = $_REQUEST[$id."_ogcliteral"];
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/BinaryLogicOp.php
===================================================================
--- branches/print_dev/http/sld/classes/BinaryLogicOp.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/BinaryLogicOp.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,208 +1,208 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the BinaryLogicOp-element
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class BinaryLogicOp
-{
-	/**
-	 * Defines the type of logical operation.
-	 * Possible values: and + or
-	 * @var string
-	 */
-	var $name = "";
-	
-	/**
-	 * Array containing the operations of this filter
-	 * @see UnaryLogicOp
-	 * @see BinaryLogicOp
-	 * @see BinaryComparisonOp
-	 * @see PropertyIsLike
-	 * @see PropertyIsNull
-	 * @see PropertyIsBetween
-	 * @var array
-	 */
-	var $operations = array();
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * Constructor that directly fills the $name variable.
-	 * @param string $name the type of this logical operation.
-	 */
-	function BinaryLogicOp($name)
-	{
-		$this->name = $name;
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ogc:".$this->name.">\n";
-		foreach($this->operations as $operation)
-		{
-			$temp .= $operation->generateXml($offset." ");
-		}
-		$temp .= $offset."</ogc:".$this->name.">\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id = "", $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"binaryLogicOp\">\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."_name\" value=\"".$this->name."\">\n";
-		
-		$temp .= $offset."  ".$this->name."<br>\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."   <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
-		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-		
-		
-		
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td colspan=\"3\">\n";
-		
-		$temp .= $offset."  <table>\n";
-		
-		$displayOperationModule = new DisplayOperationModule();
-		$temp .= $displayOperationModule->generateHtmlForm($offset."   ", $this->operations, $id);
-		
-		if(count($this->operations) == 1)
-		{
-			$temp .= $offset."<tr>\n";
-			$temp .= $offset." <td colspan=\"4\">\n";
-			$temp .= $offset."  <hr style=\"color: black\">\n";
-			$temp .= $offset." </td>\n";
-			$temp .= $offset."</tr>\n";
-		}
-		
-		
-		//Only 2 Operations
-		//if (count($this->operations) < 2)
-		// why should there be only 2 operations? Nothing in the specs ...
-
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td colspan=\"4\">\n";
-		
-		$addOperationModule = new AddOperationModule($this->id, $id);
-		$temp .= $addOperationModule->generateHtmlForm($offset."   ");
-			
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		
-		$temp .= $offset."   </table>\n";
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->name = $_REQUEST[$id."_name"];
-		$countOperations = 0;
-		while (isset($_REQUEST[$id."_operation_".$countOperations]))
-		{
-			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryComparisonOp")
-			{
-				$operation = new BinaryComparisonOp();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryLogicOp")
-			{
-				$operation = new BinaryLogicOp();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "unaryLogicOp")
-			{
-				$operation = new UnaryLogicOp();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsLike")
-			{
-				$operation = new PropertyIsLike();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsNull")
-			{
-				$operation = new PropertyIsNull();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsBetween")
-			{
-				$operation = new PropertyIsBetween();
-			}
-			
-			$operation->generateObjectFromPost($id."_operation_".$countOperations);
-			$this->operations[] = $operation;
-			$countOperations++;
-		}
-	}
-	
-	/**
-	 * deletes the rule with the given index from the $operations array
-	 * @param int $index index of the operation that has to be deleted
-	 */
-	function deleteOperation($index)
-	{
-		array_splice($this->operations, $index, 1);
-	}
+/**
+ * Implementation of the BinaryLogicOp-element
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class BinaryLogicOp
+{
+	/**
+	 * Defines the type of logical operation.
+	 * Possible values: and + or
+	 * @var string
+	 */
+	var $name = "";
+	
+	/**
+	 * Array containing the operations of this filter
+	 * @see UnaryLogicOp
+	 * @see BinaryLogicOp
+	 * @see BinaryComparisonOp
+	 * @see PropertyIsLike
+	 * @see PropertyIsNull
+	 * @see PropertyIsBetween
+	 * @var array
+	 */
+	var $operations = array();
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * Constructor that directly fills the $name variable.
+	 * @param string $name the type of this logical operation.
+	 */
+	function BinaryLogicOp($name)
+	{
+		$this->name = $name;
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ogc:".$this->name.">\n";
+		foreach($this->operations as $operation)
+		{
+			$temp .= $operation->generateXml($offset." ");
+		}
+		$temp .= $offset."</ogc:".$this->name.">\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id = "", $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"binaryLogicOp\">\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."_name\" value=\"".$this->name."\">\n";
+		
+		$temp .= $offset."  ".$this->name."<br>\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."   <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
+		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+		
+		
+		
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td colspan=\"3\">\n";
+		
+		$temp .= $offset."  <table>\n";
+		
+		$displayOperationModule = new DisplayOperationModule();
+		$temp .= $displayOperationModule->generateHtmlForm($offset."   ", $this->operations, $id);
+		
+		if(count($this->operations) == 1)
+		{
+			$temp .= $offset."<tr>\n";
+			$temp .= $offset." <td colspan=\"4\">\n";
+			$temp .= $offset."  <hr style=\"color: black\">\n";
+			$temp .= $offset." </td>\n";
+			$temp .= $offset."</tr>\n";
+		}
+		
+		
+		//Only 2 Operations
+		//if (count($this->operations) < 2)
+		// why should there be only 2 operations? Nothing in the specs ...
+
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td colspan=\"4\">\n";
+		
+		$addOperationModule = new AddOperationModule($this->id, $id);
+		$temp .= $addOperationModule->generateHtmlForm($offset."   ");
+			
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		
+		$temp .= $offset."   </table>\n";
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->name = $_REQUEST[$id."_name"];
+		$countOperations = 0;
+		while (isset($_REQUEST[$id."_operation_".$countOperations]))
+		{
+			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryComparisonOp")
+			{
+				$operation = new BinaryComparisonOp();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryLogicOp")
+			{
+				$operation = new BinaryLogicOp();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "unaryLogicOp")
+			{
+				$operation = new UnaryLogicOp();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsLike")
+			{
+				$operation = new PropertyIsLike();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsNull")
+			{
+				$operation = new PropertyIsNull();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsBetween")
+			{
+				$operation = new PropertyIsBetween();
+			}
+			
+			$operation->generateObjectFromPost($id."_operation_".$countOperations);
+			$this->operations[] = $operation;
+			$countOperations++;
+		}
+	}
+	
+	/**
+	 * deletes the rule with the given index from the $operations array
+	 * @param int $index index of the operation that has to be deleted
+	 */
+	function deleteOperation($index)
+	{
+		array_splice($this->operations, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/ColorMap.php
===================================================================
--- branches/print_dev/http/sld/classes/ColorMap.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/ColorMap.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,135 +1,135 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the ColorMap-element
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class ColorMap
-{
-	/**
-	 * Array containing the ColorMapEntry objects from the sld.
-	 *
-	 * @see ColorMapEntry
-	 * @var object
-	 */
-	var $colormapentries = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ColorMap>\n";
-		foreach ($this->colormapentries as $colormapentry)
-		{
-			$temp .= $colormapentry->generateXml($offset." ");
-		}
-		$temp .= $offset."</ColorMap>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<tr valign=\"top\">\n";
-		$temp .= $offset." <td style=\"width: 100px;\">\n";
-		$temp .= $offset."  ColorMap<br>\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"colormap\">\n";
-		$temp .= $offset."  <a class='edit' href=\"sld_function_handler.php?function=deletecolormap&id=".$this->parent."\">l&ouml;schen</a>\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$colormapentry_id = 0;
-		foreach ($this->colormapentries as $colormapentry)
-		{
-			$temp .= $colormapentry->generateHtmlForm($id."_colormapentry_".$colormapentry_id, $offset."  ");
-			$colormapentry_id++;
-		}
-		$temp .= $offset."  <a class='edit' href=\"sld_function_handler.php?function=addcolormapentry&id=".$this->id."\">ColorMapEntry hinzuf&uuml;gen</a>\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$countColorMapEntries = 0;
-		while (isset($_REQUEST[$id."_colormapentry_".$countColorMapEntries]))
-		{
-			$colormapentry = new ColorMapEntry();
-			$colormapentry->generateObjectFromPost($id."_colormapentry_".$countColorMapEntries);
-			$this->colormapentries[] = $colormapentry;
-			$countColorMapEntries++;
-		}
-	}
-	
-	/**
-	 * Adds a ColorMapEntry object to the array.
-	 */
-	function addColorMapEntry()
-	{
-		$this->colormapentries[] = new ColorMapEntry();
-	}
-	
-	/**
-	 * Deletes the ColorMapEntry object at the given index.
-	 * @param int $index index of the ColorMapEntry that has to be deleted
-	 */
-	function deleteColorMapEntry($index)
-	{
-		array_splice($this->colormapentries, $index, 1);
-	}
+/**
+ * Implementation of the ColorMap-element
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class ColorMap
+{
+	/**
+	 * Array containing the ColorMapEntry objects from the sld.
+	 *
+	 * @see ColorMapEntry
+	 * @var object
+	 */
+	var $colormapentries = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ColorMap>\n";
+		foreach ($this->colormapentries as $colormapentry)
+		{
+			$temp .= $colormapentry->generateXml($offset." ");
+		}
+		$temp .= $offset."</ColorMap>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<tr valign=\"top\">\n";
+		$temp .= $offset." <td style=\"width: 100px;\">\n";
+		$temp .= $offset."  ColorMap<br>\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"colormap\">\n";
+		$temp .= $offset."  <a class='edit' href=\"sld_function_handler.php?function=deletecolormap&id=".$this->parent."\">l&ouml;schen</a>\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$colormapentry_id = 0;
+		foreach ($this->colormapentries as $colormapentry)
+		{
+			$temp .= $colormapentry->generateHtmlForm($id."_colormapentry_".$colormapentry_id, $offset."  ");
+			$colormapentry_id++;
+		}
+		$temp .= $offset."  <a class='edit' href=\"sld_function_handler.php?function=addcolormapentry&id=".$this->id."\">ColorMapEntry hinzuf&uuml;gen</a>\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$countColorMapEntries = 0;
+		while (isset($_REQUEST[$id."_colormapentry_".$countColorMapEntries]))
+		{
+			$colormapentry = new ColorMapEntry();
+			$colormapentry->generateObjectFromPost($id."_colormapentry_".$countColorMapEntries);
+			$this->colormapentries[] = $colormapentry;
+			$countColorMapEntries++;
+		}
+	}
+	
+	/**
+	 * Adds a ColorMapEntry object to the array.
+	 */
+	function addColorMapEntry()
+	{
+		$this->colormapentries[] = new ColorMapEntry();
+	}
+	
+	/**
+	 * Deletes the ColorMapEntry object at the given index.
+	 * @param int $index index of the ColorMapEntry that has to be deleted
+	 */
+	function deleteColorMapEntry($index)
+	{
+		array_splice($this->colormapentries, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/ColorMapEntry.php
===================================================================
--- branches/print_dev/http/sld/classes/ColorMapEntry.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/ColorMapEntry.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,183 +1,183 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the ColorMapEntry-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class ColorMapEntry
-{
-	/**
-	 * The color attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $color = "";
-	
-	/**
-	 * The opacity attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $opacity = "";
-	
-	/**
-	 * The quantity attribute from the xml-scheme.
-	 * @var int
-	 */
-	var $quantity = "";
-	
-	/**
-	 * The label attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $label = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ColorMapEntry";
-		if ($this->color != "") $temp.= " color=\"".htmlspecialchars($this->color)."\"";
-		if ($this->opacity != "") $temp.= " opacity=\"".htmlspecialchars($this->opacity)."\"";
-		if ($this->quantity != "") $temp.= " quantity=\"".htmlspecialchars($this->quantity)."\"";
-		if ($this->label != "") $temp.= " label=\"".htmlspecialchars($this->label)."\"";
-		$temp .= " />\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   ColormapEntry<br>\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletecolormapentry&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"colormapentry\">\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." <td>\n";
-		
-		
-		$temp .= $offset."   <table>\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td style=\"width: 100px\">\n";
-		$temp .= $offset."      Color:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td";
-		$temp .= " id=\"".$id."_color_preview\" style=\"border: 1px solid black; width: 100px; cursor: hand; background-color:".htmlspecialchars($this->color).";\" ";
-		$temp .= "onClick=\"window.open('sld_pick_color.php?id=".$id."_color','Farbauswahl','width=299, height=194, resizable=no');\">\n";
-		$temp .= $offset."      <input type=\"hidden\" name=\"".$id."_color\" value=\"".htmlspecialchars($this->color)."\">\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      Opacity:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      <input name=\"".$id."_opacity\" value=\"".htmlspecialchars($this->opacity)."\">\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      Quantity:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      <input name=\"".$id."_quantity\" value=\"".htmlspecialchars($this->quantity)."\">\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      Label:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      <input name=\"".$id."_label\" value=\"".htmlspecialchars($this->label)."\">\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."   </table>\n";
-		
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_color"]))
-		{
-			$this->color = $_REQUEST[$id."_color"];
-		}
-		if (isset($_REQUEST[$id."_opacity"]))
-		{
-			$this->opacity = $_REQUEST[$id."_opacity"];
-		}
-		if (isset($_REQUEST[$id."_quantity"]))
-		{
-			$this->quantity = $_REQUEST[$id."_quantity"];
-		}
-		if (isset($_REQUEST[$id."_label"]))
-		{
-			$this->label = $_REQUEST[$id."_label"];
-		}
-	}
+/**
+ * Implementation of the ColorMapEntry-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class ColorMapEntry
+{
+	/**
+	 * The color attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $color = "";
+	
+	/**
+	 * The opacity attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $opacity = "";
+	
+	/**
+	 * The quantity attribute from the xml-scheme.
+	 * @var int
+	 */
+	var $quantity = "";
+	
+	/**
+	 * The label attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $label = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ColorMapEntry";
+		if ($this->color != "") $temp.= " color=\"".htmlspecialchars($this->color)."\"";
+		if ($this->opacity != "") $temp.= " opacity=\"".htmlspecialchars($this->opacity)."\"";
+		if ($this->quantity != "") $temp.= " quantity=\"".htmlspecialchars($this->quantity)."\"";
+		if ($this->label != "") $temp.= " label=\"".htmlspecialchars($this->label)."\"";
+		$temp .= " />\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   ColormapEntry<br>\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletecolormapentry&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"colormapentry\">\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." <td>\n";
+		
+		
+		$temp .= $offset."   <table>\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td style=\"width: 100px\">\n";
+		$temp .= $offset."      Color:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td";
+		$temp .= " id=\"".$id."_color_preview\" style=\"border: 1px solid black; width: 100px; cursor: hand; background-color:".htmlspecialchars($this->color).";\" ";
+		$temp .= "onClick=\"window.open('sld_pick_color.php?id=".$id."_color','Farbauswahl','width=299, height=194, resizable=no');\">\n";
+		$temp .= $offset."      <input type=\"hidden\" name=\"".$id."_color\" value=\"".htmlspecialchars($this->color)."\">\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      Opacity:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      <input name=\"".$id."_opacity\" value=\"".htmlspecialchars($this->opacity)."\">\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      Quantity:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      <input name=\"".$id."_quantity\" value=\"".htmlspecialchars($this->quantity)."\">\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      Label:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      <input name=\"".$id."_label\" value=\"".htmlspecialchars($this->label)."\">\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."   </table>\n";
+		
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_color"]))
+		{
+			$this->color = $_REQUEST[$id."_color"];
+		}
+		if (isset($_REQUEST[$id."_opacity"]))
+		{
+			$this->opacity = $_REQUEST[$id."_opacity"];
+		}
+		if (isset($_REQUEST[$id."_quantity"]))
+		{
+			$this->quantity = $_REQUEST[$id."_quantity"];
+		}
+		if (isset($_REQUEST[$id."_label"]))
+		{
+			$this->label = $_REQUEST[$id."_label"];
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/CssParameter.php
===================================================================
--- branches/print_dev/http/sld/classes/CssParameter.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/CssParameter.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,173 +1,173 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the CssParameter-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class CssParameter
-{
-	/**
-	 * The name attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $name = "";
-	
-	/**
-	 * The value attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $value = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<CssParameter ";
-		$temp .= "name=\"".htmlspecialchars($this->name)."\">";
-		$temp .= htmlspecialchars($this->value);
-		$temp .= "</CssParameter>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   CssParameter<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"cssparameter\">\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletecssparameter&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		
-		$temp .= $offset."   <table>\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td style=\"width: 100px;\">\n";
-		$temp .= $offset."      ".htmlspecialchars($this->name)."\n";
-		$temp .= $offset."      <input type=\"hidden\" name=\"".$id."_name\" value=\"".htmlspecialchars($this->name)."\">\n";
-		$temp .= $offset."     </td>\n";
-		
-		//Farbauswahl
-		if ($this->name == "fill" || $this->name == "stroke")
-		{
-			$temp .= $offset."     <td";
-			$temp .= " id=\"".$id."_value_preview\" style=\"border: 1px solid black; width: 100px; cursor: hand; background-color:".htmlspecialchars($this->value).";\" ";
-			$temp .= "onClick=\"window.open('sld_pick_color.php?id=".$id."_value','Farbauswahl','width=299, height=194, resizable=no');\">\n";
-			$temp .= $offset."      <input type=\"hidden\" name=\"".$id."_value\" id=\"".$id."_value\" value=\"".htmlspecialchars($this->value)."\">\n";
-			$temp .= $offset."     </td>\n";
-		}
-		else if ($this->name == "stroke-width" || $this->name == "font-size")
-		{
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."      <select name=\"".$id."_value\" onchange=\"document.getElementById('sld_editor_form').submit();\">\n";
-			for ($i=0; $i < 17; $i++)
-			{
-				$temp .= $offset."      <option value=\"".$i."\"";
-				if ( $this->value == $i ) $temp .= " selected";
-				$temp .= ">".$i." px</option>\n";
-			}
-			$temp .= $offset."      </select>\n";
-			$temp .= $offset."     </td>\n";
-		}
-		else if ($this->name == "font-family")
-		{
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."      <select name=\"".$id."_value\" onchange=\"document.getElementById('sld_editor_form').submit();\">\n";
-			$temp .= $offset."       <option value=\"verdana\"";
-			if ($this->value == "verdana") $temp .= " selected";
-			$temp .= ">Verdana</option>\n";
-			$temp .= $offset."       <option value=\"arial\"";
-			if ($this->value == "arial") $temp .= " selected";
-			$temp .= ">Arial</option>\n";
-			$temp .= $offset."      </select>\n";
-			$temp .= $offset."     </td>\n";
-		}
-		else
-		{
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."      <input name=\"".$id."_value\" value=\"".htmlspecialchars($this->value)."\">\n";
-			$temp .= $offset."     </td>\n";
-		}
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."   </table>\n";
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_name"]))
-		{
-			$this->name = $_REQUEST[$id."_name"];
-		}
-		if (isset($_REQUEST[$id."_value"]))
-		{
-			$this->value = $_REQUEST[$id."_value"];
-		}
-	}
+/**
+ * Implementation of the CssParameter-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class CssParameter
+{
+	/**
+	 * The name attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $name = "";
+	
+	/**
+	 * The value attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $value = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<CssParameter ";
+		$temp .= "name=\"".htmlspecialchars($this->name)."\">";
+		$temp .= htmlspecialchars($this->value);
+		$temp .= "</CssParameter>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   CssParameter<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"cssparameter\">\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletecssparameter&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		
+		$temp .= $offset."   <table>\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td style=\"width: 100px;\">\n";
+		$temp .= $offset."      ".htmlspecialchars($this->name)."\n";
+		$temp .= $offset."      <input type=\"hidden\" name=\"".$id."_name\" value=\"".htmlspecialchars($this->name)."\">\n";
+		$temp .= $offset."     </td>\n";
+		
+		//Farbauswahl
+		if ($this->name == "fill" || $this->name == "stroke")
+		{
+			$temp .= $offset."     <td";
+			$temp .= " id=\"".$id."_value_preview\" style=\"border: 1px solid black; width: 100px; cursor: hand; background-color:".htmlspecialchars($this->value).";\" ";
+			$temp .= "onClick=\"window.open('sld_pick_color.php?id=".$id."_value','Farbauswahl','width=299, height=194, resizable=no');\">\n";
+			$temp .= $offset."      <input type=\"hidden\" name=\"".$id."_value\" id=\"".$id."_value\" value=\"".htmlspecialchars($this->value)."\">\n";
+			$temp .= $offset."     </td>\n";
+		}
+		else if ($this->name == "stroke-width" || $this->name == "font-size")
+		{
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."      <select name=\"".$id."_value\" onchange=\"document.getElementById('sld_editor_form').submit();\">\n";
+			for ($i=0; $i < 17; $i++)
+			{
+				$temp .= $offset."      <option value=\"".$i."\"";
+				if ( $this->value == $i ) $temp .= " selected";
+				$temp .= ">".$i." px</option>\n";
+			}
+			$temp .= $offset."      </select>\n";
+			$temp .= $offset."     </td>\n";
+		}
+		else if ($this->name == "font-family")
+		{
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."      <select name=\"".$id."_value\" onchange=\"document.getElementById('sld_editor_form').submit();\">\n";
+			$temp .= $offset."       <option value=\"verdana\"";
+			if ($this->value == "verdana") $temp .= " selected";
+			$temp .= ">Verdana</option>\n";
+			$temp .= $offset."       <option value=\"arial\"";
+			if ($this->value == "arial") $temp .= " selected";
+			$temp .= ">Arial</option>\n";
+			$temp .= $offset."      </select>\n";
+			$temp .= $offset."     </td>\n";
+		}
+		else
+		{
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."      <input name=\"".$id."_value\" value=\"".htmlspecialchars($this->value)."\">\n";
+			$temp .= $offset."     </td>\n";
+		}
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."   </table>\n";
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_name"]))
+		{
+			$this->name = $_REQUEST[$id."_name"];
+		}
+		if (isset($_REQUEST[$id."_value"]))
+		{
+			$this->value = $_REQUEST[$id."_value"];
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/DbUtils.php
===================================================================
--- branches/print_dev/http/sld/classes/DbUtils.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/DbUtils.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,134 +1,134 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-require_once(dirname(__FILE__)."/../../../conf/mapbender.conf");
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
-
-/**
- * This class wraps db functions of the sld implementation.
- *
- * @package sld_classes
- * @author Michael Schulz
- */
-class DbUtils 
-{
-    /**
-     * Read the layer_id from the DB.
-     * 
-     * @param <int> the wms_id
-     * @param <string> the layer_name
-     * @return <int> the layer_id
-     */
-	function getLayerIdFromLayerName($wms_id, $layer_name) {
-		$sql = "SELECT * FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
-		$v = array($wms_id, $layer_name);
-		$t = array('i', 's');
-		$res = db_prep_query($sql,$v,$t);
-		if ( db_fetch_row($res, 0) ) {
-			return db_result($res, 0, "layer_id");
-		} else {
-			return false;
-		}
-	}
-	
-	/**
-     * Check for a layer wfs-Conf.
-     * 
-     * @param <int> the layer_id
-     * @param <string> the gui_id
-     * @return <int> wfs_conf_id
-     */
-	function getLayerWfsConfId($gui_id, $layer_id) {
-		$sql = "SELECT gui_layer_wfs_featuretype FROM gui_layer WHERE fkey_gui_id = $1 AND fkey_layer_id = $2";
-		$v = array($gui_id, $layer_id);
-		$t = array('s', 'i');
-		$res = db_prep_query($sql,$v,$t);
-		if ( db_fetch_row($res, 0) ) {
-			return db_result($res, 0, "gui_layer_wfs_featuretype");
-		} else {
-			return false;
-		}
-	}
-
-	/**
-     * return layer wfs-FeatureType-id.
-     * 
-     * @param <int> the wfs_conf_id
-     * @return <int> fkey_featuretype_id
-     */
-	function getWfsConfFeatureTypeId($wfs_conf_id) {
-		$sql = "SELECT fkey_featuretype_id FROM wfs_conf WHERE wfs_conf_id = $1";
-		$v = array($wfs_conf_id);
-		$t = array('i');
-		$res = db_prep_query($sql,$v,$t);
-		if ( db_fetch_row($res, 0) ) {
-			return db_result($res, 0, "fkey_featuretype_id");
-		} else {
-			return false;
-		}
-	}	
-	
-	/**
-	 * create a getmap request for the map images
-	 * 
-	 * @param <string> gui_id
-	 * @param <int> layer_id
-	 * @param <int> wms_id
-	 *
-	 * @return <string> getmap URL
-	 */
-	function getPreviewMapUrl($gui_id, $layer_id, $wms_id) {
-		$previewMapSrs = "";
-		$sql = "select w.gui_wms_epsg as srs, e.minx, e.miny, e.maxx, e.maxy ";
-		$sql .= "from gui_wms w, layer l, layer_epsg e ";
-		$sql .= "where l.fkey_wms_id=w.fkey_wms_id and e.fkey_layer_id=l.layer_id and e.epsg=w.gui_wms_epsg and ";
-		$sql .= "l.layer_parent = '' and w.fkey_gui_id = $1 and w.gui_wms_position=0";
-		$v = array($gui_id);
-		$t = array('s');
-		$res = db_prep_query($sql,$v,$t);
-		if ( $res ) {
-			$row = db_fetch_array($res, 0); 
-			$previewMapSrs .= "&SRS=".$row["srs"]."&BBOX=".$row["minx"].",".$row["miny"].",".$row["maxx"].",".$row["maxy"];
-		} else {
-			return false;
-		}
-		
-		$sql = "select wms.wms_getmap as mapurl, layer.layer_name, wms.wms_version as version, w.gui_wms_mapformat as format ";
-		$sql .= "from gui_wms w, gui_layer l, wms, layer ";
-		$sql .= "where w.fkey_gui_id=l.fkey_gui_id and wms.wms_id = w.fkey_wms_id and l.fkey_layer_id = layer.layer_id and ";
-		$sql .= "w.fkey_gui_id=$1 and l.fkey_layer_id=$2 and wms.wms_id = $3";
-		$v = array($gui_id, $layer_id, $wms_id);
-		$t = array('s', 'i', 'i');
-		$res = db_prep_query($sql,$v,$t);
-		$previewMapUrl = "";
-		if ( $res ) {
-			$row = db_fetch_array($res, 0); 
-			$previewMapUrl .= $row["mapurl"]."SERVICE=WMS&REQUEST=GetMap&VERSION=".$row["version"];
-			$previewMapUrl .= "&LAYERS=".$row["layer_name"]."&STYLES=";
-			$previewMapUrl .= $previewMapSrs;
-			$previewMapUrl .= "&FORMAT=".$row["format"];
-			return $previewMapUrl;
-		} else {
-			return false;
-		}
-	}
-}
-
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
+
+require_once(dirname(__FILE__)."/../../../conf/mapbender.conf");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+/**
+ * This class wraps db functions of the sld implementation.
+ *
+ * @package sld_classes
+ * @author Michael Schulz
+ */
+class DbUtils 
+{
+    /**
+     * Read the layer_id from the DB.
+     * 
+     * @param <int> the wms_id
+     * @param <string> the layer_name
+     * @return <int> the layer_id
+     */
+	function getLayerIdFromLayerName($wms_id, $layer_name) {
+		$sql = "SELECT * FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
+		$v = array($wms_id, $layer_name);
+		$t = array('i', 's');
+		$res = db_prep_query($sql,$v,$t);
+		if ( db_fetch_row($res, 0) ) {
+			return db_result($res, 0, "layer_id");
+		} else {
+			return false;
+		}
+	}
+	
+	/**
+     * Check for a layer wfs-Conf.
+     * 
+     * @param <int> the layer_id
+     * @param <string> the gui_id
+     * @return <int> wfs_conf_id
+     */
+	function getLayerWfsConfId($gui_id, $layer_id) {
+		$sql = "SELECT gui_layer_wfs_featuretype FROM gui_layer WHERE fkey_gui_id = $1 AND fkey_layer_id = $2";
+		$v = array($gui_id, $layer_id);
+		$t = array('s', 'i');
+		$res = db_prep_query($sql,$v,$t);
+		if ( db_fetch_row($res, 0) ) {
+			return db_result($res, 0, "gui_layer_wfs_featuretype");
+		} else {
+			return false;
+		}
+	}
+
+	/**
+     * return layer wfs-FeatureType-id.
+     * 
+     * @param <int> the wfs_conf_id
+     * @return <int> fkey_featuretype_id
+     */
+	function getWfsConfFeatureTypeId($wfs_conf_id) {
+		$sql = "SELECT fkey_featuretype_id FROM wfs_conf WHERE wfs_conf_id = $1";
+		$v = array($wfs_conf_id);
+		$t = array('i');
+		$res = db_prep_query($sql,$v,$t);
+		if ( db_fetch_row($res, 0) ) {
+			return db_result($res, 0, "fkey_featuretype_id");
+		} else {
+			return false;
+		}
+	}	
+	
+	/**
+	 * create a getmap request for the map images
+	 * 
+	 * @param <string> gui_id
+	 * @param <int> layer_id
+	 * @param <int> wms_id
+	 *
+	 * @return <string> getmap URL
+	 */
+	function getPreviewMapUrl($gui_id, $layer_id, $wms_id) {
+		$previewMapSrs = "";
+		$sql = "select w.gui_wms_epsg as srs, e.minx, e.miny, e.maxx, e.maxy ";
+		$sql .= "from gui_wms w, layer l, layer_epsg e ";
+		$sql .= "where l.fkey_wms_id=w.fkey_wms_id and e.fkey_layer_id=l.layer_id and e.epsg=w.gui_wms_epsg and ";
+		$sql .= "l.layer_parent = '' and w.fkey_gui_id = $1 and w.gui_wms_position=0";
+		$v = array($gui_id);
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		if ( $res ) {
+			$row = db_fetch_array($res, 0); 
+			$previewMapSrs .= "&SRS=".$row["srs"]."&BBOX=".$row["minx"].",".$row["miny"].",".$row["maxx"].",".$row["maxy"];
+		} else {
+			return false;
+		}
+		
+		$sql = "select wms.wms_getmap as mapurl, layer.layer_name, wms.wms_version as version, w.gui_wms_mapformat as format ";
+		$sql .= "from gui_wms w, gui_layer l, wms, layer ";
+		$sql .= "where w.fkey_gui_id=l.fkey_gui_id and wms.wms_id = w.fkey_wms_id and l.fkey_layer_id = layer.layer_id and ";
+		$sql .= "w.fkey_gui_id=$1 and l.fkey_layer_id=$2 and wms.wms_id = $3";
+		$v = array($gui_id, $layer_id, $wms_id);
+		$t = array('s', 'i', 'i');
+		$res = db_prep_query($sql,$v,$t);
+		$previewMapUrl = "";
+		if ( $res ) {
+			$row = db_fetch_array($res, 0); 
+			$previewMapUrl .= $row["mapurl"]."SERVICE=WMS&REQUEST=GetMap&VERSION=".$row["version"];
+			$previewMapUrl .= "&LAYERS=".$row["layer_name"]."&STYLES=";
+			$previewMapUrl .= $previewMapSrs;
+			$previewMapUrl .= "&FORMAT=".$row["format"];
+			return $previewMapUrl;
+		} else {
+			return false;
+		}
+	}
+}
+
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Displacement.php
===================================================================
--- branches/print_dev/http/sld/classes/Displacement.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Displacement.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,122 +1,122 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Displacement-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Displacement
-{
-	/**
-	 * The displacementx attribute from the xml-scheme.
-	 * @var int
-	 */
-	var $displacementx = "";
-	
-	/**
-	 * The displacementy attribute from the xml-scheme.
-	 * @var int
-	 */
-	var $displacementy = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Displacement>\n";
-		$temp .= $offset." <DisplacementX>".htmlspecialchars($this->displacementx)."</DisplacementX>\n";
-		$temp .= $offset." <DisplacementY>".htmlspecialchars($this->displacementy)."</DisplacementY>\n";
-		$temp .= $offset."</Displacement>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"displacement\">\n";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  DisplacementX:\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_displacementx\" value=\"".htmlspecialchars($this->displacementx)."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  DisplacementY:\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_displacementy\" value=\"".htmlspecialchars($this->displacementy)."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_displacementx"]))
-		{
-			$this->displacementx = $_REQUEST[$id."_displacementx"];
-		}
-		if (isset($_REQUEST[$id."_displacementy"]))
-		{
-			$this->displacementy = $_REQUEST[$id."_displacementy"];
-		}
-	}
+/**
+ * Implementation of the Displacement-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Displacement
+{
+	/**
+	 * The displacementx attribute from the xml-scheme.
+	 * @var int
+	 */
+	var $displacementx = "";
+	
+	/**
+	 * The displacementy attribute from the xml-scheme.
+	 * @var int
+	 */
+	var $displacementy = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Displacement>\n";
+		$temp .= $offset." <DisplacementX>".htmlspecialchars($this->displacementx)."</DisplacementX>\n";
+		$temp .= $offset." <DisplacementY>".htmlspecialchars($this->displacementy)."</DisplacementY>\n";
+		$temp .= $offset."</Displacement>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"displacement\">\n";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  DisplacementX:\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_displacementx\" value=\"".htmlspecialchars($this->displacementx)."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  DisplacementY:\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_displacementy\" value=\"".htmlspecialchars($this->displacementy)."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_displacementx"]))
+		{
+			$this->displacementx = $_REQUEST[$id."_displacementx"];
+		}
+		if (isset($_REQUEST[$id."_displacementy"]))
+		{
+			$this->displacementy = $_REQUEST[$id."_displacementy"];
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/DisplayOperationModule.php
===================================================================
--- branches/print_dev/http/sld/classes/DisplayOperationModule.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/DisplayOperationModule.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,66 +1,66 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Template Class that is used to display the operations
- * creates the hmtl source code for the operations
- * similar to the AddOperationModule
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class DisplayOperationModule
-{
-	/**
-	 * function that creates the html-form-fragment sourcecode
-	 * 
-	 * @param $offset string whitespaces that should be added in every row of sourcecode for formatting
-	 * @param $operations array containing the operations for which the source should be created
-	 * @return string the created code
-	 */
-	function generateHtmlForm($offset = "", $operations, $id)
-	{
-		$temp = "";
-		$operation_id = 0;
-		$max = count($operations);
-		foreach ($operations as $operation)
-		{
-			if ($id == "")
-			{
-				$temp .= $operation->generateHtmlForm($id."operation_".$operation_id, $offset);
-			}
-			else
-			{
-				$temp .= $operation->generateHtmlForm($id."_operation_".$operation_id, $offset);
-			}
-			//Display emtpy row or line to separate the operations
-			if ($operation_id+1 < $max)
-			{
-				$temp .= $offset."<tr>\n";
-				$temp .= $offset." <td colspan=\"4\">\n";
-				$temp .= $offset."  <hr style=\"color: black\">\n";
-				$temp .= $offset." </td>\n";
-				$temp .= $offset."</tr>\n";	
-			}
-			$operation_id++;
-		}
-		return $temp;
-	}
+/**
+ * Template Class that is used to display the operations
+ * creates the hmtl source code for the operations
+ * similar to the AddOperationModule
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class DisplayOperationModule
+{
+	/**
+	 * function that creates the html-form-fragment sourcecode
+	 * 
+	 * @param $offset string whitespaces that should be added in every row of sourcecode for formatting
+	 * @param $operations array containing the operations for which the source should be created
+	 * @return string the created code
+	 */
+	function generateHtmlForm($offset = "", $operations, $id)
+	{
+		$temp = "";
+		$operation_id = 0;
+		$max = count($operations);
+		foreach ($operations as $operation)
+		{
+			if ($id == "")
+			{
+				$temp .= $operation->generateHtmlForm($id."operation_".$operation_id, $offset);
+			}
+			else
+			{
+				$temp .= $operation->generateHtmlForm($id."_operation_".$operation_id, $offset);
+			}
+			//Display emtpy row or line to separate the operations
+			if ($operation_id+1 < $max)
+			{
+				$temp .= $offset."<tr>\n";
+				$temp .= $offset." <td colspan=\"4\">\n";
+				$temp .= $offset."  <hr style=\"color: black\">\n";
+				$temp .= $offset." </td>\n";
+				$temp .= $offset."</tr>\n";	
+			}
+			$operation_id++;
+		}
+		return $temp;
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/ElseFilter.php
===================================================================
--- branches/print_dev/http/sld/classes/ElseFilter.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/ElseFilter.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,72 +1,72 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the ElseFilter-element.
- * An ElseFilter can be used instead of a Filter.
- * An ElseFilter is always true an should be used to group those
- * entities that do not have a specific rule for themselves.
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class ElseFilter extends Rule
-{
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<ElseFilter />\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<input type=\"hidden\" name=\"elsefilter\">\n";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr>\n";
-		$temp .= $offset."  <td>\n";
-		$temp .= $offset."   ElseFilter:<br>\n";
-		$temp .= $offset."   <a class=\"edit\" href=\"sld_edit_filter.php?function=deletefilter\">";
-		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	
+/**
+ * Implementation of the ElseFilter-element.
+ * An ElseFilter can be used instead of a Filter.
+ * An ElseFilter is always true an should be used to group those
+ * entities that do not have a specific rule for themselves.
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class ElseFilter extends Rule
+{
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<ElseFilter />\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<input type=\"hidden\" name=\"elsefilter\">\n";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr>\n";
+		$temp .= $offset."  <td>\n";
+		$temp .= $offset."   ElseFilter:<br>\n";
+		$temp .= $offset."   <a class=\"edit\" href=\"sld_edit_filter.php?function=deletefilter\">";
+		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/ExternalGraphic.php
===================================================================
--- branches/print_dev/http/sld/classes/ExternalGraphic.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/ExternalGraphic.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,143 +1,143 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the ExternalGraphic-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class ExternalGraphic
-{
-	/**
-	 * The onlineresource element from the xml-scheme.
-	 * @var string
-	 */
-	var $onlineresource = "";
-	
-	/**
-	 * The format element from the xml-scheme.
-	 * @var string
-	 */
-	var $format = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ExternalGraphic>\n";
-		$temp .= $offset." <OnlineResource xlink:href=\"".htmlspecialchars($this->onlineresource)."\" />\n";
-		$temp .= $offset." <Format>".htmlspecialchars($this->format)."</Format>\n";
-		$temp .= $offset."</ExternalGraphic>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table style=\"border: 1px solid black;\" >\n";
-		$temp .= $offset." <tr valign='top'>\n";
-		$temp .= $offset."  <td>\n";
-		$temp .= $offset."   ExternalGraphic<br>\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deleteexternalgraphicormark&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"externalgraphic\">\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		
-		$temp .= $offset."   <table border=\"0\">\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      OnlineResource:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      <input name=\"".$id."_onlineresource\" value=\"".htmlspecialchars($this->onlineresource)."\">\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      Format:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      <input name=\"".$id."_format\" value=\"".htmlspecialchars($this->format)."\">\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."   </table>\n";
-		
-		//TODO: Selectbox f�r Format
-
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		$temp .= $offset."  <br>\n";		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_onlineresource"]))
-		{
-			$this->onlineresource = $_REQUEST[$id."_onlineresource"];
-		}
-		if (isset($_REQUEST[$id."_format"]))
-		{
-			$this->format = $_REQUEST[$id."_format"];
-		}
-	}
+/**
+ * Implementation of the ExternalGraphic-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class ExternalGraphic
+{
+	/**
+	 * The onlineresource element from the xml-scheme.
+	 * @var string
+	 */
+	var $onlineresource = "";
+	
+	/**
+	 * The format element from the xml-scheme.
+	 * @var string
+	 */
+	var $format = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ExternalGraphic>\n";
+		$temp .= $offset." <OnlineResource xlink:href=\"".htmlspecialchars($this->onlineresource)."\" />\n";
+		$temp .= $offset." <Format>".htmlspecialchars($this->format)."</Format>\n";
+		$temp .= $offset."</ExternalGraphic>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table style=\"border: 1px solid black;\" >\n";
+		$temp .= $offset." <tr valign='top'>\n";
+		$temp .= $offset."  <td>\n";
+		$temp .= $offset."   ExternalGraphic<br>\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deleteexternalgraphicormark&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"externalgraphic\">\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		
+		$temp .= $offset."   <table border=\"0\">\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      OnlineResource:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      <input name=\"".$id."_onlineresource\" value=\"".htmlspecialchars($this->onlineresource)."\">\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      Format:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      <input name=\"".$id."_format\" value=\"".htmlspecialchars($this->format)."\">\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."   </table>\n";
+		
+		//TODO: Selectbox f�r Format
+
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		$temp .= $offset."  <br>\n";		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_onlineresource"]))
+		{
+			$this->onlineresource = $_REQUEST[$id."_onlineresource"];
+		}
+		if (isset($_REQUEST[$id."_format"]))
+		{
+			$this->format = $_REQUEST[$id."_format"];
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/FeatureTypeStyle.php
===================================================================
--- branches/print_dev/http/sld/classes/FeatureTypeStyle.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/FeatureTypeStyle.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,197 +1,197 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-/**
- * Implementation of the FeatureTypeStyle-element
- * 
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class FeatureTypeStyle extends UserStyle
-{
-	/**
-	 * Array containing the Rule-objects
-	 *
-	 * @see Rule
-	 * @var array
-	 */
-	var $rules = array();
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * Array containing the FeatureTypes attribute names (aka elements), acquired either by a 
-	 * - Mapbender WFS-configuration
-	 * - or via a DescribeFeatureType request (niy)
-	 * @see PropertyIsEqualTo, TextSymbolizer 
-	 * @var array
-	 */
-	var $attrs = array();
-	
-	final function setElementArray($name,$array) {
-		$this->attrs[$name] = $array;
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<FeatureTypeStyle>\n";
-		foreach($this->rules as $rule)
-		{
-			$temp .= $rule->generateXml($offset." ");
-		}
-		$temp .= $offset."</FeatureTypeStyle>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{	
-		###### -----------> Fensterrahmen Rule
-		$temp = "";
-		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"featuretypestyle\">\n";
-		$temp .= $offset."<table border=\"0\" cellspacing=\"2\" cellspacing=\"1\">\n";
-		
-		$rule_id = 0;
-		foreach ($this->rules as $rule)
-		{
-			$temp .= $offset." <tr>\n";
-			$temp .= $rule->generateHtmlForm($id."_rule_".$rule_id, $offset."  ");
-			$rule_id++;
-			$temp .= $offset." </tr>\n";
-			
-			$temp .= $offset."<tr>\n";
-			$temp .= $offset."<td colspan=\"3\"' height='5'>\n";
-			$temp .= $offset."<hr size='1' noshade color='#86A6C5'>\n";
-			$temp .= $offset."</td>\n";				
-			$temp .= $offset."</tr>\n";
-		}
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset."<td colspan=\"3\">\n";
-			$temp .= $offset."<table width='100%' border='0' cellspacing=\"2\" cellspacing=\"1\">\n";
-			$temp .= $offset."<tr>\n";
-			$temp .= $offset."<td>\n";		
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addrule&id=".$this->id."\">\n";
-			$temp .= $offset."<img src='./img/plus.gif' border='0' alt='Rule hinzuf�gen'>&nbsp;hinzuf&uuml;gen\n";		
-			$temp .= $offset."</a>\n";
-			$temp .= $offset."</td>\n";		
-			$temp .= $offset."</tr>\n";
-			$temp .= $offset."</table>\n";				
-			$temp .= $offset."</td>\n";
-			$temp .= $offset."</tr>\n";
-			$temp .= $offset."</table>\n";
-
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$countRules = 0;
-		while (isset($_REQUEST[$id."_rule_".$countRules]))
-		{
-			$rule = new Rule();
-			$rule->generateObjectFromPost($id."_rule_".$countRules);
-			$this->rules[] = $rule;
-			$countRules++;
-		}
-	}
-	/**
-	 * adds a new Rule object to the $rules array
-	 *
-	 * this function is called from sld_function_handler.php
-	 */
-	function addRule()
-	{
-		$this->rules[] = new Rule();
-	}
-	/**
-	 * deletes the rule with the given index from the $rules array
-	 *
-	 * this function is called from sld_function_handler.php
-	 *
-	 * @param int $index index of the rule that has to be deleted
-	 */
-	function deleteRule($index)
-	{
-		array_splice($this->rules, $index, 1);
-	}
-	/**
-	 * generates html with the fts elements to choose from, useful for Label, Filter, etc.
-	 * 
-	 * @param string $field string that holds the id of the form field where to return the selected value
-	 *
-	 * @param string $value string that holds the name of an already used element name
-	 * 
-	 * @return string html-fragment that lists the elements, each can be clicked and the name is 
-	 * returned to the form field 
-	 */
-	final function generateElementsHtml($field,$value)
-	{
-		$html = "";
-		if ($this->attrs) {
-			$html .= "<select name='elementname' onchange=\"if (this.selectedIndex!=0) document.getElementById('".$field."').value=this.options[this.selectedIndex].value;\">\n";
-			$html .= "<option>Choose ...</option>";
-			foreach ($this->attrs["element_name"] as $ename) {
-				$html .= "<option value='".$ename."' ";
-				if ($value == $ename)
-					$html .= "selected";
-				$html .= ">".$ename."<otion>\n";
-			}
-			$html .= "</select>\n";
-		}
-		return $html;
-	}
-	
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
+/**
+ * Implementation of the FeatureTypeStyle-element
+ * 
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class FeatureTypeStyle extends UserStyle
+{
+	/**
+	 * Array containing the Rule-objects
+	 *
+	 * @see Rule
+	 * @var array
+	 */
+	var $rules = array();
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * Array containing the FeatureTypes attribute names (aka elements), acquired either by a 
+	 * - Mapbender WFS-configuration
+	 * - or via a DescribeFeatureType request (niy)
+	 * @see PropertyIsEqualTo, TextSymbolizer 
+	 * @var array
+	 */
+	var $attrs = array();
+	
+	final function setElementArray($name,$array) {
+		$this->attrs[$name] = $array;
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<FeatureTypeStyle>\n";
+		foreach($this->rules as $rule)
+		{
+			$temp .= $rule->generateXml($offset." ");
+		}
+		$temp .= $offset."</FeatureTypeStyle>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{	
+		###### -----------> Fensterrahmen Rule
+		$temp = "";
+		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"featuretypestyle\">\n";
+		$temp .= $offset."<table border=\"0\" cellspacing=\"2\" cellspacing=\"1\">\n";
+		
+		$rule_id = 0;
+		foreach ($this->rules as $rule)
+		{
+			$temp .= $offset." <tr>\n";
+			$temp .= $rule->generateHtmlForm($id."_rule_".$rule_id, $offset."  ");
+			$rule_id++;
+			$temp .= $offset." </tr>\n";
+			
+			$temp .= $offset."<tr>\n";
+			$temp .= $offset."<td colspan=\"3\"' height='5'>\n";
+			$temp .= $offset."<hr size='1' noshade color='#86A6C5'>\n";
+			$temp .= $offset."</td>\n";				
+			$temp .= $offset."</tr>\n";
+		}
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset."<td colspan=\"3\">\n";
+			$temp .= $offset."<table width='100%' border='0' cellspacing=\"2\" cellspacing=\"1\">\n";
+			$temp .= $offset."<tr>\n";
+			$temp .= $offset."<td>\n";		
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addrule&id=".$this->id."\">\n";
+			$temp .= $offset."<img src='./img/plus.gif' border='0' alt='Rule hinzuf�gen'>&nbsp;hinzuf&uuml;gen\n";		
+			$temp .= $offset."</a>\n";
+			$temp .= $offset."</td>\n";		
+			$temp .= $offset."</tr>\n";
+			$temp .= $offset."</table>\n";				
+			$temp .= $offset."</td>\n";
+			$temp .= $offset."</tr>\n";
+			$temp .= $offset."</table>\n";
+
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$countRules = 0;
+		while (isset($_REQUEST[$id."_rule_".$countRules]))
+		{
+			$rule = new Rule();
+			$rule->generateObjectFromPost($id."_rule_".$countRules);
+			$this->rules[] = $rule;
+			$countRules++;
+		}
+	}
+	/**
+	 * adds a new Rule object to the $rules array
+	 *
+	 * this function is called from sld_function_handler.php
+	 */
+	function addRule()
+	{
+		$this->rules[] = new Rule();
+	}
+	/**
+	 * deletes the rule with the given index from the $rules array
+	 *
+	 * this function is called from sld_function_handler.php
+	 *
+	 * @param int $index index of the rule that has to be deleted
+	 */
+	function deleteRule($index)
+	{
+		array_splice($this->rules, $index, 1);
+	}
+	/**
+	 * generates html with the fts elements to choose from, useful for Label, Filter, etc.
+	 * 
+	 * @param string $field string that holds the id of the form field where to return the selected value
+	 *
+	 * @param string $value string that holds the name of an already used element name
+	 * 
+	 * @return string html-fragment that lists the elements, each can be clicked and the name is 
+	 * returned to the form field 
+	 */
+	final function generateElementsHtml($field,$value)
+	{
+		$html = "";
+		if ($this->attrs) {
+			$html .= "<select name='elementname' onchange=\"if (this.selectedIndex!=0) document.getElementById('".$field."').value=this.options[this.selectedIndex].value;\">\n";
+			$html .= "<option>Choose ...</option>";
+			foreach ($this->attrs["element_name"] as $ename) {
+				$html .= "<option value='".$ename."' ";
+				if ($value == $ename)
+					$html .= "selected";
+				$html .= ">".$ename."<otion>\n";
+			}
+			$html .= "</select>\n";
+		}
+		return $html;
+	}
+	
+}
+
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Fill.php
===================================================================
--- branches/print_dev/http/sld/classes/Fill.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Fill.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,172 +1,172 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Fill-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Fill
-{
-	/**
-	 * The GraphicFill object from the xml-scheme.
-	 *
-	 * @see GraphicFill
-	 * @var string
-	 */
-	var $graphicfill = "";
-	
-	/**
-	 * Array containing the CssParameter objects from the xml-scheme.
-	 *
-	 * @see CssParameter
-	 * @var array
-	 */
-	var $cssparameters = array();
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Fill>\n";
-		if ($this->graphicfill != "") $temp .= $this->graphicfill->generateXml($offset." ");
-		foreach ($this->cssparameters as $cssparameter)
-		{
-			$temp .= $cssparameter->generateXml($offset." ");
-		}
-		$temp .= $offset."</Fill>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "<hr class=\"sep\">\n";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   Fill<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"fill\">\n";
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletefill&id=".$this->parent."\">l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td valign=\"top\">\n";
-		if ($this->graphicfill != "")
-		{
-			$temp .= $this->graphicfill->generateHtmlForm($id."_graphicfill", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addgraphicfill&id=".$this->id."\">GraphicFill hinzuf&uuml;gen</a><br>\n";
-		}
-		$cssparameter_id = 0;
-		foreach ($this->cssparameters as $cssparameter)
-		{
-			$temp .= $cssparameter->generateHtmlForm($id."_cssparameter_".$cssparameter_id, $offset."   ");
-			$cssparameter_id++;
-		}
-		$temp .= $offset."   <select name=\"".$id."_newcssparameter\">\n";
-		$temp .= $offset."    <option value=\"fill\">fill</option>\n";
-		$temp .= $offset."    <option value=\"fill-opacity\">fill-opacity</option>\n";
-		$temp .= $offset."   </select>\n";
-		$temp .= $offset."   <input type=\"button\" value=\"hinzuf&uuml;gen\"";
-		//Javascript to make a http request
-		$temp .= " onClick=\"url='sld_function_handler.php?function=addcssparameter&id=".$this->id."&cssparameter=';";
-		$temp .= " url += ".$id."_newcssparameter.value;";
-		$temp .= " location.href = url;\"";
-		$temp .= ">\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_graphicfill"]))
-		{
-			$this->graphicfill = new GraphicFill();
-			$this->graphicfill->generateObjectFromPost($id."_graphicfill");
-		}
-		$countCssParameters = 0;
-		while (isset($_REQUEST[$id."_cssparameter_".$countCssParameters]))
-		{
-			$cssParameter = new CssParameter();
-			$cssParameter->generateObjectFromPost($id."_cssparameter_".$countCssParameters);
-			$this->cssparameters[] = $cssParameter;
-			$countCssParameters++;
-		}
-	}
-	
-	/**
-	 * Function that adds a new CssParameter to the array.
-	 * @param string $cssparameter the name of the new CssParameter object
-	 */
-	function addCssParameter($cssParameter)
-	{
-		$newCssParameter = new CssParameter();
-		$newCssParameter->name = $cssParameter;
-		$this->cssparameters[] = $newCssParameter;
-	}
-	
-	/**
-	 * Deletes the CssParameter at the given index.
-	 * @param int $index index of the CssParamater in the array that has to be deleted
-	 */
-	function deleteCssParameter($index)
-	{
-		array_splice($this->cssparameters, $index, 1);
-	}
+/**
+ * Implementation of the Fill-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Fill
+{
+	/**
+	 * The GraphicFill object from the xml-scheme.
+	 *
+	 * @see GraphicFill
+	 * @var string
+	 */
+	var $graphicfill = "";
+	
+	/**
+	 * Array containing the CssParameter objects from the xml-scheme.
+	 *
+	 * @see CssParameter
+	 * @var array
+	 */
+	var $cssparameters = array();
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Fill>\n";
+		if ($this->graphicfill != "") $temp .= $this->graphicfill->generateXml($offset." ");
+		foreach ($this->cssparameters as $cssparameter)
+		{
+			$temp .= $cssparameter->generateXml($offset." ");
+		}
+		$temp .= $offset."</Fill>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "<hr class=\"sep\">\n";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   Fill<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"fill\">\n";
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletefill&id=".$this->parent."\">l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td valign=\"top\">\n";
+		if ($this->graphicfill != "")
+		{
+			$temp .= $this->graphicfill->generateHtmlForm($id."_graphicfill", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addgraphicfill&id=".$this->id."\">GraphicFill hinzuf&uuml;gen</a><br>\n";
+		}
+		$cssparameter_id = 0;
+		foreach ($this->cssparameters as $cssparameter)
+		{
+			$temp .= $cssparameter->generateHtmlForm($id."_cssparameter_".$cssparameter_id, $offset."   ");
+			$cssparameter_id++;
+		}
+		$temp .= $offset."   <select name=\"".$id."_newcssparameter\">\n";
+		$temp .= $offset."    <option value=\"fill\">fill</option>\n";
+		$temp .= $offset."    <option value=\"fill-opacity\">fill-opacity</option>\n";
+		$temp .= $offset."   </select>\n";
+		$temp .= $offset."   <input type=\"button\" value=\"hinzuf&uuml;gen\"";
+		//Javascript to make a http request
+		$temp .= " onClick=\"url='sld_function_handler.php?function=addcssparameter&id=".$this->id."&cssparameter=';";
+		$temp .= " url += ".$id."_newcssparameter.value;";
+		$temp .= " location.href = url;\"";
+		$temp .= ">\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_graphicfill"]))
+		{
+			$this->graphicfill = new GraphicFill();
+			$this->graphicfill->generateObjectFromPost($id."_graphicfill");
+		}
+		$countCssParameters = 0;
+		while (isset($_REQUEST[$id."_cssparameter_".$countCssParameters]))
+		{
+			$cssParameter = new CssParameter();
+			$cssParameter->generateObjectFromPost($id."_cssparameter_".$countCssParameters);
+			$this->cssparameters[] = $cssParameter;
+			$countCssParameters++;
+		}
+	}
+	
+	/**
+	 * Function that adds a new CssParameter to the array.
+	 * @param string $cssparameter the name of the new CssParameter object
+	 */
+	function addCssParameter($cssParameter)
+	{
+		$newCssParameter = new CssParameter();
+		$newCssParameter->name = $cssParameter;
+		$this->cssparameters[] = $newCssParameter;
+	}
+	
+	/**
+	 * Deletes the CssParameter at the given index.
+	 * @param int $index index of the CssParamater in the array that has to be deleted
+	 */
+	function deleteCssParameter($index)
+	{
+		array_splice($this->cssparameters, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Filter.php
===================================================================
--- branches/print_dev/http/sld/classes/Filter.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Filter.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,180 +1,180 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * This file contains the classes used for editing filter expressions.
- * Filter expressions are currently limited to logical and comparison operations.
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-
-
-
-/**
- * This class is the implementation of the filter-element from ogc:filter.
- *
- * This element builds up the root of filter-expressions.
- * This class is directly referred to in the sld_edit_filter.php.
- * 
- * @package filter_classes
- */
-class Filter extends Rule
-{
-	/**
-	 * Array containing the operations of this filter
-	 * @see UnaryLogicOp
-	 * @see BinaryLogicOp
-	 * @see BinaryComparisonOp
-	 * @see PropertyIsLike
-	 * @see PropertyIsNull
-	 * @see PropertyIsBetween
-	 * @var array
-	 */
-	var $operations = array();
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ogc:Filter>\n";
-		foreach($this->operations as $operation)
-		{
-			$temp .= $operation->generateXml($offset." ");
-		}
-		$temp .= $offset."</ogc:Filter>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id = "", $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<input type=\"hidden\" name=\"filter\">\n";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr>\n";
-		$temp .= $offset."  <td>\n";
-		$temp .= $offset."   Filter:<br>\n";
-		$temp .= $offset."   <a class=\"edit\" href=\"sld_edit_filter.php?function=deletefilter\">";
-		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td colspan=\"3\">\n";
-		$temp .= $offset."  &nbsp;\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		
-		$displayOperationModule = new DisplayOperationModule();
-		$temp .= $displayOperationModule->generateHtmlForm($offset." ", $this->operations, $id);
-		
-		if (count($this->operations) == 0)
-		{
-			$temp .= $offset." <tr>\n";
-			$temp .= $offset."  <td colspan=\"4\">\n";
-			
-			$addOperationModule = new AddOperationModule($this->id, $id);
-			$temp .= $addOperationModule->generateHtmlForm($offset."    ");
-			
-			$temp .= $offset."  </td>\n";
-			$temp .= $offset." </tr>\n";
-		}
-		$temp .= $offset."</table>\n";
-		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$countOperations = 0;
-		while (isset($_REQUEST[$id."operation_".$countOperations]))
-		{
-			if ($_REQUEST[$id."operation_".$countOperations] == "binaryComparisonOp")
-			{
-				$operation = new BinaryComparisonOp();
-			}
-			if ($_REQUEST[$id."operation_".$countOperations] == "binaryLogicOp")
-			{
-				$operation = new BinaryLogicOp();
-			}
-			if ($_REQUEST[$id."operation_".$countOperations] == "unaryLogicOp")
-			{
-				$operation = new UnaryLogicOp();
-			}
-			if ($_REQUEST[$id."operation_".$countOperations] == "propertyIsLike")
-			{
-				$operation = new PropertyIsLike();
-			}
-			if ($_REQUEST[$id."operation_".$countOperations] == "propertyIsNull")
-			{
-				$operation = new PropertyIsNull();
-			}
-			if ($_REQUEST[$id."operation_".$countOperations] == "propertyIsBetween")
-			{
-				$operation = new PropertyIsBetween();
-			}
-			$operation->generateObjectFromPost($id."operation_".$countOperations);
-			$this->operations[] = $operation;
-			$countOperations++;
-		}
-	}
-	
-	/**
-	 * deletes the rule with the given index from the $operations array
-	 * @param int $index index of the operation that has to be deleted
-	 */
-	function deleteOperation($index)
-	{
-		array_splice($this->operations, $index, 1);
-	}
+/**
+ * This file contains the classes used for editing filter expressions.
+ * Filter expressions are currently limited to logical and comparison operations.
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+
+
+
+/**
+ * This class is the implementation of the filter-element from ogc:filter.
+ *
+ * This element builds up the root of filter-expressions.
+ * This class is directly referred to in the sld_edit_filter.php.
+ * 
+ * @package filter_classes
+ */
+class Filter extends Rule
+{
+	/**
+	 * Array containing the operations of this filter
+	 * @see UnaryLogicOp
+	 * @see BinaryLogicOp
+	 * @see BinaryComparisonOp
+	 * @see PropertyIsLike
+	 * @see PropertyIsNull
+	 * @see PropertyIsBetween
+	 * @var array
+	 */
+	var $operations = array();
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ogc:Filter>\n";
+		foreach($this->operations as $operation)
+		{
+			$temp .= $operation->generateXml($offset." ");
+		}
+		$temp .= $offset."</ogc:Filter>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id = "", $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<input type=\"hidden\" name=\"filter\">\n";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr>\n";
+		$temp .= $offset."  <td>\n";
+		$temp .= $offset."   Filter:<br>\n";
+		$temp .= $offset."   <a class=\"edit\" href=\"sld_edit_filter.php?function=deletefilter\">";
+		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td colspan=\"3\">\n";
+		$temp .= $offset."  &nbsp;\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		
+		$displayOperationModule = new DisplayOperationModule();
+		$temp .= $displayOperationModule->generateHtmlForm($offset." ", $this->operations, $id);
+		
+		if (count($this->operations) == 0)
+		{
+			$temp .= $offset." <tr>\n";
+			$temp .= $offset."  <td colspan=\"4\">\n";
+			
+			$addOperationModule = new AddOperationModule($this->id, $id);
+			$temp .= $addOperationModule->generateHtmlForm($offset."    ");
+			
+			$temp .= $offset."  </td>\n";
+			$temp .= $offset." </tr>\n";
+		}
+		$temp .= $offset."</table>\n";
+		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$countOperations = 0;
+		while (isset($_REQUEST[$id."operation_".$countOperations]))
+		{
+			if ($_REQUEST[$id."operation_".$countOperations] == "binaryComparisonOp")
+			{
+				$operation = new BinaryComparisonOp();
+			}
+			if ($_REQUEST[$id."operation_".$countOperations] == "binaryLogicOp")
+			{
+				$operation = new BinaryLogicOp();
+			}
+			if ($_REQUEST[$id."operation_".$countOperations] == "unaryLogicOp")
+			{
+				$operation = new UnaryLogicOp();
+			}
+			if ($_REQUEST[$id."operation_".$countOperations] == "propertyIsLike")
+			{
+				$operation = new PropertyIsLike();
+			}
+			if ($_REQUEST[$id."operation_".$countOperations] == "propertyIsNull")
+			{
+				$operation = new PropertyIsNull();
+			}
+			if ($_REQUEST[$id."operation_".$countOperations] == "propertyIsBetween")
+			{
+				$operation = new PropertyIsBetween();
+			}
+			$operation->generateObjectFromPost($id."operation_".$countOperations);
+			$this->operations[] = $operation;
+			$countOperations++;
+		}
+	}
+	
+	/**
+	 * deletes the rule with the given index from the $operations array
+	 * @param int $index index of the operation that has to be deleted
+	 */
+	function deleteOperation($index)
+	{
+		array_splice($this->operations, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Font.php
===================================================================
--- branches/print_dev/http/sld/classes/Font.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Font.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,156 +1,156 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Font-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Font
-{
-	/**
-	 * Array containing the CssParameter objects from the sld.
-	 *
-	 * @see CssParameter
-	 * @var array
-	 */
-	var $cssparameters = array();
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Font>\n";
-		foreach ($this->cssparameters as $cssparameter)
-		{
-			$temp .= $cssparameter->generateXml($offset." ");
-		}
-		$temp .= $offset."</Font>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "<hr class=\"sep\">\n";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   Font<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"font\">\n";
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletefont&id=".$this->parent."\">l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		$cssparameter_id = 0;
-		foreach ($this->cssparameters as $cssparameter)
-		{
-			$temp .= $cssparameter->generateHtmlForm($id."_cssparameter_".$cssparameter_id, $offset."   ");
-			$cssparameter_id++;
-		}
-		$temp .= $offset."   <select name=\"".$id."_newcssparameter\">\n";
-		$temp .= $offset."    <option value=\"font-family\">font-family</option>\n";
-		$temp .= $offset."    <option value=\"font-size\">font-size</option>\n";
-		
-		//Probably not supported by Mapserver
-		//$temp .= $offset."<option value=\"font-style\">font-style</option>\n";
-		//$temp .= $offset."<option value=\"font-weight\">font-weight</option>\n";
-		
-		$temp .= $offset."   </select>\n";
-		$temp .= $offset."   <input type=\"button\" value=\"hinzuf&uuml;gen\"";
-		//Javascript to make a http request
-		$temp .= " onClick=\"url='sld_function_handler.php?function=addcssparameter&id=".$this->id."&cssparameter=';";
-		$temp .= " url += ".$id."_newcssparameter.value;";
-		$temp .= " location.href = url;\"";
-		$temp .= ">\n";
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$countCssParameters = 0;
-		while (isset($_REQUEST[$id."_cssparameter_".$countCssParameters]))
-		{
-			$cssParameter = new CssParameter();
-			$cssParameter->generateObjectFromPost($id."_cssparameter_".$countCssParameters);
-			$this->cssparameters[] = $cssParameter;
-			$countCssParameters++;
-		}
-	}
-	
-	/**
-	 * Adds a new CssParameter object to the array.
-	 * @param string $cssParameter name of the new CssParameter object
-	 */
-	function addCssParameter($cssParameter)
-	{
-		$newCssParameter = new CssParameter();
-		$newCssParameter->name = $cssParameter;
-		$this->cssparameters[] = $newCssParameter;
-	}
-	
-	/**
-	 * Deletes the CssParameter object at the given index.
-	 * @param int $index index of the CssParameter object that should be deleted
-	 */
-	function deleteCssParameter($index)
-	{
-		array_splice($this->cssparameters, $index, 1);
-	}
+/**
+ * Implementation of the Font-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Font
+{
+	/**
+	 * Array containing the CssParameter objects from the sld.
+	 *
+	 * @see CssParameter
+	 * @var array
+	 */
+	var $cssparameters = array();
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Font>\n";
+		foreach ($this->cssparameters as $cssparameter)
+		{
+			$temp .= $cssparameter->generateXml($offset." ");
+		}
+		$temp .= $offset."</Font>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "<hr class=\"sep\">\n";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   Font<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"font\">\n";
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletefont&id=".$this->parent."\">l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		$cssparameter_id = 0;
+		foreach ($this->cssparameters as $cssparameter)
+		{
+			$temp .= $cssparameter->generateHtmlForm($id."_cssparameter_".$cssparameter_id, $offset."   ");
+			$cssparameter_id++;
+		}
+		$temp .= $offset."   <select name=\"".$id."_newcssparameter\">\n";
+		$temp .= $offset."    <option value=\"font-family\">font-family</option>\n";
+		$temp .= $offset."    <option value=\"font-size\">font-size</option>\n";
+		
+		//Probably not supported by Mapserver
+		//$temp .= $offset."<option value=\"font-style\">font-style</option>\n";
+		//$temp .= $offset."<option value=\"font-weight\">font-weight</option>\n";
+		
+		$temp .= $offset."   </select>\n";
+		$temp .= $offset."   <input type=\"button\" value=\"hinzuf&uuml;gen\"";
+		//Javascript to make a http request
+		$temp .= " onClick=\"url='sld_function_handler.php?function=addcssparameter&id=".$this->id."&cssparameter=';";
+		$temp .= " url += ".$id."_newcssparameter.value;";
+		$temp .= " location.href = url;\"";
+		$temp .= ">\n";
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$countCssParameters = 0;
+		while (isset($_REQUEST[$id."_cssparameter_".$countCssParameters]))
+		{
+			$cssParameter = new CssParameter();
+			$cssParameter->generateObjectFromPost($id."_cssparameter_".$countCssParameters);
+			$this->cssparameters[] = $cssParameter;
+			$countCssParameters++;
+		}
+	}
+	
+	/**
+	 * Adds a new CssParameter object to the array.
+	 * @param string $cssParameter name of the new CssParameter object
+	 */
+	function addCssParameter($cssParameter)
+	{
+		$newCssParameter = new CssParameter();
+		$newCssParameter->name = $cssParameter;
+		$this->cssparameters[] = $newCssParameter;
+	}
+	
+	/**
+	 * Deletes the CssParameter object at the given index.
+	 * @param int $index index of the CssParameter object that should be deleted
+	 */
+	function deleteCssParameter($index)
+	{
+		array_splice($this->cssparameters, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Graphic.php
===================================================================
--- branches/print_dev/http/sld/classes/Graphic.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Graphic.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,243 +1,243 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Graphic-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Graphic
-{
-	/**
-	 * Array containing ExternalGraphic or Mark objects.
-	 *
-	 * @see ExternalGraphic
-	 * @see Mark
-	 * @var array
-	 */
-	var $externalgraphicsormarks = array();
-	
-	/**
-	 * The opacity element from the xml-scheme.
-	 *
-	 * Not sure if this feature is supported by UMN-MapServer!
-	 *
-	 * @var string
-	 */
-	var $opacity = "";
-	
-	/**
-	 * The size element from the xml-scheme.
-	 * @var string
-	 */
-	var $size = "";
-	
-	/**
-	 * The rotation element from the xml-scheme.
-	 *
-	 * Not sure if this feature is supported by UMN-MapServer!
-	 *
-	 * @var int
-	 */
-	var $rotation = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Graphic>\n";
-		foreach ($this->externalgraphicsormarks as $externalgraphicormark)
-		{
-			$temp .= $externalgraphicormark->generateXml($offset." ");
-		}
-		if ($this->opacity != "") $temp .= $offset." <Opacity>".htmlspecialchars($this->opacity)."</Opacity>\n";
-		if ($this->size != "") $temp .= $offset." <Size>".htmlspecialchars($this->size)."</Size>\n";
-		if ($this->rotation != "") $temp .= $offset." <Rotation>".htmlspecialchars($this->rotation)."</Rotation>\n";
-		$temp .= $offset."</Graphic>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table border='0' cellpadding='2' cellspacing='0'>\n";
-		$temp .= $offset."<tr valign='top'>\n";
-		$temp .= $offset."<td>\n";
-		$temp .= $offset."<span>\n";
-		$temp .= $offset."Graphic:\n";
-		$temp .= $offset."</span>\n";		
-		$temp .= $offset."<br>\n";
-		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"graphic\">\n";
-		$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=deletegraphic&id=".$this->parent."\">";
-		$temp .= $offset."<img src='./img/minus.gif' border='0' alt='Rule l&ouml;schen'>&nbsp;l&ouml;schen";
-		$temp .= $offset."</a>\n";
-		$temp .= $offset."</td>\n";
-		$temp .= $offset."<td valign='top'>\n";
-		
-			$temp .= $offset."   <table border='1' cellpadding='2' cellspacing='1'>\n";
-			$temp .= $offset."    <tr>\n";
-			$temp .= $offset."     <td class='edit_label_bg edit_label_text' style=\"width: 100px;\">\n";
-			$temp .= $offset."      Opacity:\n";
-			$temp .= $offset."     </td>\n";
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."      <input class='inputfield edit_label_text' name=\"".$id."_opacity\" value=\"".htmlspecialchars($this->opacity)."\">\n";
-			$temp .= $offset."     </td>\n";
-			$temp .= $offset."    </tr>\n";
-			$temp .= $offset."    <tr>\n";
-			$temp .= $offset."     <td class='edit_label_bg edit_label_text'>\n";
-			$temp .= $offset."      Size:\n";
-			$temp .= $offset."     </td>\n";
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."      <input class='inputfield edit_label_text' name=\"".$id."_size\" value=\"".htmlspecialchars($this->size)."\">\n";
-			$temp .= $offset."     </td>\n";
-			$temp .= $offset."    </tr>\n";
-			$temp .= $offset."    <tr>\n";
-			$temp .= $offset."     <td class='edit_label_bg edit_label_text'>\n";
-			$temp .= $offset."      Rotation:\n";
-			$temp .= $offset."     </td>\n";
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."      <input class='inputfield edit_label_text' name=\"".$id."_rotation\" value=\"".htmlspecialchars($this->rotation)."\">\n";
-			$temp .= $offset."     </td>\n";
-			$temp .= $offset."    </tr>\n";
-			$temp .= $offset."    <tr>\n";
-			$temp .= $offset."     <td valign='top'>\n";
-			$temp .= $offset."      <select class=\"edit_label_text\" name=\"".$id."_newexternalgraphicormark\">\n";
-			$temp .= $offset."       <option value=\"mark\">Mark</option>\n";
-			$temp .= $offset."       <option value=\"externalgraphic\">ExternalGraphic</option>\n";
-			$temp .= $offset."      </select>\n";
-			$temp .= $offset."     </td>\n";			
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."    &nbsp;\n";											
-			$temp .= $offset."     </td>\n";						
-			$temp .= $offset."    </tr>\n";
-			$temp .= $offset."    <tr>\n";
-			$temp .= $offset."     <td colspan='2'>\n";
-			$externalgraphicormark_id = 0;
-			foreach ($this->externalgraphicsormarks as $externalgraphicormark)
-			{
-				$temp .= $externalgraphicormark->generateHtmlForm($id."_externalgraphicormark_".$externalgraphicormark_id, $offset."");
-				$externalgraphicormark_id++;
-			}									
-			$temp .= $offset."     </td>\n";									
-			$temp .= $offset."    </tr>\n";
-			$temp .= $offset."    <tr>\n";
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."<input class='edit' type=\"button\" value=\"hinzuf&uuml;gen\"";
-			$temp .= " onClick=\"url='sld_function_handler.php?function=addexternalgraphicormark&id=".$this->id."&externalgraphicormark=';";
-			$temp .= " url += ".$id."_newexternalgraphicormark.value;";
-			$temp .= " location.href = url;\"";
-			$temp .= ">\n";			
-			$temp .= $offset."     </td>\n";						
-			$temp .= $offset."     <td>\n";
-			$temp .= $offset."    &nbsp;\n";
-			$temp .= $offset."     </td>\n";			
-			$temp .= $offset."    </tr>\n";
-			$temp .= $offset."   </table>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";		
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$countExternalGraphicsOrMarks = 0;
-		while (isset($_REQUEST[$id."_externalgraphicormark_".$countExternalGraphicsOrMarks]))
-		{
-			$externalgraphicormark = "";
-			if ($_REQUEST[$id."_externalgraphicormark_".$countExternalGraphicsOrMarks] == "mark")
-			{
-				$externalgraphicormark = new Mark();
-			}
-			else if ($_REQUEST[$id."_externalgraphicormark_".$countExternalGraphicsOrMarks] == "externalgraphic")
-			{
-				$externalgraphicormark = new ExternalGraphic();
-			}
-			$externalgraphicormark->generateObjectFromPost($id."_externalgraphicormark_".$countExternalGraphicsOrMarks);
-			$this->externalgraphicsormarks[] = $externalgraphicormark;
-			$countExternalGraphicsOrMarks++;
-		}
-		if (isset($_REQUEST[$id."_opacity"]))
-		{
-			$this->opacity = $_REQUEST[$id."_opacity"];
-		}
-		if (isset($_REQUEST[$id."_size"]))
-		{
-			$this->size = $_REQUEST[$id."_size"];
-		}
-		if (isset($_REQUEST[$id."_rotation"]))
-		{
-			$this->rotation = $_REQUEST[$id."_rotation"];
-		}
-	}
-	function addExternalGraphicOrMark($externalgraphicormark)
-	{
-		if ($externalgraphicormark == "externalgraphic")
-		{
-			$this->externalgraphicsormarks[] = new ExternalGraphic();
-		}
-		else if ($externalgraphicormark == "mark")
-		{
-			$test = new Mark();
-			$this->externalgraphicsormarks[] = $test;
-		}
-	}
-	function deleteExternalGraphicOrMark($index)
-	{
-		array_splice($this->externalgraphicsormarks, $index, 1);
-	}
+/**
+ * Implementation of the Graphic-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Graphic
+{
+	/**
+	 * Array containing ExternalGraphic or Mark objects.
+	 *
+	 * @see ExternalGraphic
+	 * @see Mark
+	 * @var array
+	 */
+	var $externalgraphicsormarks = array();
+	
+	/**
+	 * The opacity element from the xml-scheme.
+	 *
+	 * Not sure if this feature is supported by UMN-MapServer!
+	 *
+	 * @var string
+	 */
+	var $opacity = "";
+	
+	/**
+	 * The size element from the xml-scheme.
+	 * @var string
+	 */
+	var $size = "";
+	
+	/**
+	 * The rotation element from the xml-scheme.
+	 *
+	 * Not sure if this feature is supported by UMN-MapServer!
+	 *
+	 * @var int
+	 */
+	var $rotation = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Graphic>\n";
+		foreach ($this->externalgraphicsormarks as $externalgraphicormark)
+		{
+			$temp .= $externalgraphicormark->generateXml($offset." ");
+		}
+		if ($this->opacity != "") $temp .= $offset." <Opacity>".htmlspecialchars($this->opacity)."</Opacity>\n";
+		if ($this->size != "") $temp .= $offset." <Size>".htmlspecialchars($this->size)."</Size>\n";
+		if ($this->rotation != "") $temp .= $offset." <Rotation>".htmlspecialchars($this->rotation)."</Rotation>\n";
+		$temp .= $offset."</Graphic>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table border='0' cellpadding='2' cellspacing='0'>\n";
+		$temp .= $offset."<tr valign='top'>\n";
+		$temp .= $offset."<td>\n";
+		$temp .= $offset."<span>\n";
+		$temp .= $offset."Graphic:\n";
+		$temp .= $offset."</span>\n";		
+		$temp .= $offset."<br>\n";
+		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"graphic\">\n";
+		$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=deletegraphic&id=".$this->parent."\">";
+		$temp .= $offset."<img src='./img/minus.gif' border='0' alt='Rule l&ouml;schen'>&nbsp;l&ouml;schen";
+		$temp .= $offset."</a>\n";
+		$temp .= $offset."</td>\n";
+		$temp .= $offset."<td valign='top'>\n";
+		
+			$temp .= $offset."   <table border='1' cellpadding='2' cellspacing='1'>\n";
+			$temp .= $offset."    <tr>\n";
+			$temp .= $offset."     <td class='edit_label_bg edit_label_text' style=\"width: 100px;\">\n";
+			$temp .= $offset."      Opacity:\n";
+			$temp .= $offset."     </td>\n";
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."      <input class='inputfield edit_label_text' name=\"".$id."_opacity\" value=\"".htmlspecialchars($this->opacity)."\">\n";
+			$temp .= $offset."     </td>\n";
+			$temp .= $offset."    </tr>\n";
+			$temp .= $offset."    <tr>\n";
+			$temp .= $offset."     <td class='edit_label_bg edit_label_text'>\n";
+			$temp .= $offset."      Size:\n";
+			$temp .= $offset."     </td>\n";
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."      <input class='inputfield edit_label_text' name=\"".$id."_size\" value=\"".htmlspecialchars($this->size)."\">\n";
+			$temp .= $offset."     </td>\n";
+			$temp .= $offset."    </tr>\n";
+			$temp .= $offset."    <tr>\n";
+			$temp .= $offset."     <td class='edit_label_bg edit_label_text'>\n";
+			$temp .= $offset."      Rotation:\n";
+			$temp .= $offset."     </td>\n";
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."      <input class='inputfield edit_label_text' name=\"".$id."_rotation\" value=\"".htmlspecialchars($this->rotation)."\">\n";
+			$temp .= $offset."     </td>\n";
+			$temp .= $offset."    </tr>\n";
+			$temp .= $offset."    <tr>\n";
+			$temp .= $offset."     <td valign='top'>\n";
+			$temp .= $offset."      <select class=\"edit_label_text\" name=\"".$id."_newexternalgraphicormark\">\n";
+			$temp .= $offset."       <option value=\"mark\">Mark</option>\n";
+			$temp .= $offset."       <option value=\"externalgraphic\">ExternalGraphic</option>\n";
+			$temp .= $offset."      </select>\n";
+			$temp .= $offset."     </td>\n";			
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."    &nbsp;\n";											
+			$temp .= $offset."     </td>\n";						
+			$temp .= $offset."    </tr>\n";
+			$temp .= $offset."    <tr>\n";
+			$temp .= $offset."     <td colspan='2'>\n";
+			$externalgraphicormark_id = 0;
+			foreach ($this->externalgraphicsormarks as $externalgraphicormark)
+			{
+				$temp .= $externalgraphicormark->generateHtmlForm($id."_externalgraphicormark_".$externalgraphicormark_id, $offset."");
+				$externalgraphicormark_id++;
+			}									
+			$temp .= $offset."     </td>\n";									
+			$temp .= $offset."    </tr>\n";
+			$temp .= $offset."    <tr>\n";
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."<input class='edit' type=\"button\" value=\"hinzuf&uuml;gen\"";
+			$temp .= " onClick=\"url='sld_function_handler.php?function=addexternalgraphicormark&id=".$this->id."&externalgraphicormark=';";
+			$temp .= " url += ".$id."_newexternalgraphicormark.value;";
+			$temp .= " location.href = url;\"";
+			$temp .= ">\n";			
+			$temp .= $offset."     </td>\n";						
+			$temp .= $offset."     <td>\n";
+			$temp .= $offset."    &nbsp;\n";
+			$temp .= $offset."     </td>\n";			
+			$temp .= $offset."    </tr>\n";
+			$temp .= $offset."   </table>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";		
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$countExternalGraphicsOrMarks = 0;
+		while (isset($_REQUEST[$id."_externalgraphicormark_".$countExternalGraphicsOrMarks]))
+		{
+			$externalgraphicormark = "";
+			if ($_REQUEST[$id."_externalgraphicormark_".$countExternalGraphicsOrMarks] == "mark")
+			{
+				$externalgraphicormark = new Mark();
+			}
+			else if ($_REQUEST[$id."_externalgraphicormark_".$countExternalGraphicsOrMarks] == "externalgraphic")
+			{
+				$externalgraphicormark = new ExternalGraphic();
+			}
+			$externalgraphicormark->generateObjectFromPost($id."_externalgraphicormark_".$countExternalGraphicsOrMarks);
+			$this->externalgraphicsormarks[] = $externalgraphicormark;
+			$countExternalGraphicsOrMarks++;
+		}
+		if (isset($_REQUEST[$id."_opacity"]))
+		{
+			$this->opacity = $_REQUEST[$id."_opacity"];
+		}
+		if (isset($_REQUEST[$id."_size"]))
+		{
+			$this->size = $_REQUEST[$id."_size"];
+		}
+		if (isset($_REQUEST[$id."_rotation"]))
+		{
+			$this->rotation = $_REQUEST[$id."_rotation"];
+		}
+	}
+	function addExternalGraphicOrMark($externalgraphicormark)
+	{
+		if ($externalgraphicormark == "externalgraphic")
+		{
+			$this->externalgraphicsormarks[] = new ExternalGraphic();
+		}
+		else if ($externalgraphicormark == "mark")
+		{
+			$test = new Mark();
+			$this->externalgraphicsormarks[] = $test;
+		}
+	}
+	function deleteExternalGraphicOrMark($index)
+	{
+		array_splice($this->externalgraphicsormarks, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/GraphicFill.php
===================================================================
--- branches/print_dev/http/sld/classes/GraphicFill.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/GraphicFill.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,116 +1,116 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the GraphicFill-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class GraphicFill
-{
-	/**
-	 * The Graphic object from the xml-scheme.
-	 *
-	 * @see Graphic
-	 * @var object
-	 */
-	var $graphic = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<GraphicFill>\n";
-		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
-		$temp .= $offset."</GraphicFill>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table style=\"border: 1px solid black;\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   GraphicFill<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"graphicfill\">\n";
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletegraphicfill&id=".$this->parent."\">l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		if ($this->graphic != "")
-		{
-			$temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."Graphic hinzuf&uuml;gen<a class='edit' href=\"sld_function_handler.php?function=addgraphic&id=".$this->id."\">Graphic hinzuf&uuml;gen</a><br>\n";
-		}
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_graphic"]))
-		{
-			$this->graphic = new Graphic();
-			$this->graphic->generateObjectFromPost($id."_graphic");
-		}
-	}
+/**
+ * Implementation of the GraphicFill-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class GraphicFill
+{
+	/**
+	 * The Graphic object from the xml-scheme.
+	 *
+	 * @see Graphic
+	 * @var object
+	 */
+	var $graphic = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<GraphicFill>\n";
+		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
+		$temp .= $offset."</GraphicFill>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table style=\"border: 1px solid black;\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   GraphicFill<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"graphicfill\">\n";
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletegraphicfill&id=".$this->parent."\">l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		if ($this->graphic != "")
+		{
+			$temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."Graphic hinzuf&uuml;gen<a class='edit' href=\"sld_function_handler.php?function=addgraphic&id=".$this->id."\">Graphic hinzuf&uuml;gen</a><br>\n";
+		}
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_graphic"]))
+		{
+			$this->graphic = new Graphic();
+			$this->graphic->generateObjectFromPost($id."_graphic");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/GraphicStroke.php
===================================================================
--- branches/print_dev/http/sld/classes/GraphicStroke.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/GraphicStroke.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,118 +1,118 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the GraphicStroke-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class GraphicStroke
-{
-	/**
-	 * The Graphic object from the xml-scheme.
-	 *
-	 * @see Graphic
-	 * @var object
-	 */
-	var $graphic = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * Default constructor that automatically creates a Graphic object.
-	 */
-	function GraphicStroke()
-	{
-		$this->graphic = new Graphic();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<GraphicStroke>\n";
-		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
-		$temp .= $offset."</GraphicStroke>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table style=\"border: 1px solid black;\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td>\n";
-		$temp .= $offset."   GraphicStroke\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"graphicstroke\">\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		
-		if ($this->graphic != "") $temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_graphic"]))
-		{
-			$this->graphic = new Graphic();
-			$this->graphic->generateObjectFromPost($id."_graphic");
-		}
-	}
+/**
+ * Implementation of the GraphicStroke-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class GraphicStroke
+{
+	/**
+	 * The Graphic object from the xml-scheme.
+	 *
+	 * @see Graphic
+	 * @var object
+	 */
+	var $graphic = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * Default constructor that automatically creates a Graphic object.
+	 */
+	function GraphicStroke()
+	{
+		$this->graphic = new Graphic();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<GraphicStroke>\n";
+		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
+		$temp .= $offset."</GraphicStroke>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table style=\"border: 1px solid black;\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td>\n";
+		$temp .= $offset."   GraphicStroke\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"graphicstroke\">\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		
+		if ($this->graphic != "") $temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_graphic"]))
+		{
+			$this->graphic = new Graphic();
+			$this->graphic->generateObjectFromPost($id."_graphic");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Halo.php
===================================================================
--- branches/print_dev/http/sld/classes/Halo.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Halo.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,125 +1,125 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Halo-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Halo
-{
-	/**
-	 * The radius attribute from the xml-scheme.
-	 * @var int
-	 */
-	var $radius = "";
-	
-	/**
-	 * The Fill object from the xml-scheme.
-	 *
-	 * @see Fill
-	 * @var string
-	 */
-	var $fill = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Halo>\n";
-		if ($this->radius != "") $temp .= $offset." <Radius>".htmlspecialchars($this->radius)."</Radius>\n";
-		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
-		$temp .= $offset."</Halo>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "<hr class=\"sep\">\n";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   Halo\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"halo\">\n<br />";
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletehalo&id=".$this->parent."\">l&ouml;schen</a>\n";		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		$temp .= $offset."   Radius: <input name=\"".$id."_radius\" value=\"".htmlspecialchars($this->radius)."\"><br>\n";
-		if ($this->fill != "") { 
-			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   "); }
-		else {
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
-		}
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_radius"]))
-		{
-			$this->radius = $_REQUEST[$id."_radius"];
-		}
-		if (isset($_REQUEST[$id."_fill"]))
-		{
-			$this->fill = new Fill();
-			$this->fill->generateObjectFromPost($id."_fill");
-		}
-	}
+/**
+ * Implementation of the Halo-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Halo
+{
+	/**
+	 * The radius attribute from the xml-scheme.
+	 * @var int
+	 */
+	var $radius = "";
+	
+	/**
+	 * The Fill object from the xml-scheme.
+	 *
+	 * @see Fill
+	 * @var string
+	 */
+	var $fill = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Halo>\n";
+		if ($this->radius != "") $temp .= $offset." <Radius>".htmlspecialchars($this->radius)."</Radius>\n";
+		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
+		$temp .= $offset."</Halo>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "<hr class=\"sep\">\n";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   Halo\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"halo\">\n<br />";
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletehalo&id=".$this->parent."\">l&ouml;schen</a>\n";		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		$temp .= $offset."   Radius: <input name=\"".$id."_radius\" value=\"".htmlspecialchars($this->radius)."\"><br>\n";
+		if ($this->fill != "") { 
+			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   "); }
+		else {
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
+		}
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_radius"]))
+		{
+			$this->radius = $_REQUEST[$id."_radius"];
+		}
+		if (isset($_REQUEST[$id."_fill"]))
+		{
+			$this->fill = new Fill();
+			$this->fill->generateObjectFromPost($id."_fill");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/LabelPlacement.php
===================================================================
--- branches/print_dev/http/sld/classes/LabelPlacement.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/LabelPlacement.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,125 +1,125 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the LabelPlacement-element
- *
- * This implementation only supports PointPlacement for Labels, because UMN-Mapservers's implementation is limited to PointPlacement, too.
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class LabelPlacement
-{
-	/**
-	 * The Placement object from the xml-scheme.
-	 * Only PointPlacement is supported in UMN-MapServer.
-	 *
-	 * @see Pointplacement
-	 * @var object
-	 */
-	var $placement = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * Default constructor that automatically creates a PointPlacement object.
-	 */
-	function LabelPlacement()
-	{
-		//Only PointPlacement is supported by MapServer
-		$this->placement = new PointPlacement();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<LabelPlacement>\n";
-		$temp .= $this->placement->generateXml($offset." ");
-		$temp .= $offset."</LabelPlacement>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "<hr class=\"sep\">\n";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   LabelPlacement<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"labelplacement\">\n";
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletelabelplacement&id=".$this->parent."\">l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		
-		$temp .= $this->placement->generateHtmlForm($id."_placement", $offset."   ");
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		//Todo - Unterscheidung von PointPlacement und anderen Placements (wenn vorhanden)
-		//not supported by Mapserver
-		if (isset($_REQUEST[$id."_placement"]))
-		{
-			$this->placement = new PointPlacement();
-			$this->placement->generateObjectFromPost($id."_placement");
-		}
-	}
+/**
+ * Implementation of the LabelPlacement-element
+ *
+ * This implementation only supports PointPlacement for Labels, because UMN-Mapservers's implementation is limited to PointPlacement, too.
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class LabelPlacement
+{
+	/**
+	 * The Placement object from the xml-scheme.
+	 * Only PointPlacement is supported in UMN-MapServer.
+	 *
+	 * @see Pointplacement
+	 * @var object
+	 */
+	var $placement = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * Default constructor that automatically creates a PointPlacement object.
+	 */
+	function LabelPlacement()
+	{
+		//Only PointPlacement is supported by MapServer
+		$this->placement = new PointPlacement();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<LabelPlacement>\n";
+		$temp .= $this->placement->generateXml($offset." ");
+		$temp .= $offset."</LabelPlacement>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "<hr class=\"sep\">\n";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   LabelPlacement<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"labelplacement\">\n";
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletelabelplacement&id=".$this->parent."\">l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		
+		$temp .= $this->placement->generateHtmlForm($id."_placement", $offset."   ");
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		//Todo - Unterscheidung von PointPlacement und anderen Placements (wenn vorhanden)
+		//not supported by Mapserver
+		if (isset($_REQUEST[$id."_placement"]))
+		{
+			$this->placement = new PointPlacement();
+			$this->placement->generateObjectFromPost($id."_placement");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/LegendGraphic.php
===================================================================
--- branches/print_dev/http/sld/classes/LegendGraphic.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/LegendGraphic.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,154 +1,154 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the LegendGraphic-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class LegendGraphic extends Rule
-{
-	/**
-	 * The Graphic object from the xml-scheme.
-	 *
-	 * @see Graphic
-	 * @var object
-	 */
-	var $graphic = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<LegendGraphic>\n";
-		//Graphic must occur once
-		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
-		$temp .= $offset."</LegendGraphic>\n";
-		return $temp;
-	}
-		
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";				
-		$temp .= $offset."<table width='100%' border='0' cellpadding='1' cellspacing='0'>\n";
-		$temp .= $offset." <tr>\n";
-		$temp .= $offset."  <td class='edit_label_bg edit_label_text' valign='top' width='136'>\n";
-		$temp .= $offset."   LegendGraphic:\n";
-		$temp .= $offset."  </td>\n";
-
-		if ($this->graphic != "")
-		{	
-			$temp .= $offset."<td rowspan='2'>\n";
-			$temp .= $offset."<td>\n";
-			$temp .= $offset."<td rowspan='2' style='border:1px solid black; background-color:#FFFFFF'>\n";		
-			$temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
-			$temp .= $offset."<td>\n";
-			$temp .= $offset."</tr>\n";
-			$temp .= $offset."<tr>\n";
-			$temp .= $offset."<td>\n";
-			$temp .= $offset."&nbsp;\n";
-			$temp .= $offset."</td>\n";
-			$temp .= $offset." </tr>\n";									
-		}
-		else
-		{	
-			$temp .= $offset."<td>\n";
-			$temp .= $offset."&nbsp;\n";
-			$temp .= $offset."</td>\n";
-			$temp .= $offset."<td class='text' style='border:1px solid black; border-bottom:none; background-color:#FFFFFF'>\n";
-			$temp .= $offset."&nbsp;Graphic:\n";
-			$temp .= $offset."</td>\n";
-			$temp .= $offset."</tr>\n";			
-			//--------------------------
-			$temp .= $offset."  <tr>\n";
-			$temp .= $offset."  <td valign='bottom'>\n";
-			$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"legendgraphic\">\n";
-			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletelegendgraphic&id=".$this->parent."\">\n";
-			$temp .= $offset."    <img src='./img/minus.gif' border='0' alt='LegendGraphic l&ouml;schen'>&nbsp;l&ouml;schen\n";
-			$temp .= $offset."   </a>\n";
-			$temp .= $offset."  </td>\n";
-			$temp .= $offset."<td>\n";
-			$temp .= $offset."&nbsp;\n";
-			$temp .= $offset."</td>\n";							
-			$temp .= $offset."<td style='border:1px solid black; border-top:none; background-color:#FFFFFF'>\n";
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addgraphic&id=".$this->id."\">\n";
-			$temp .= $offset."   <img src='./img/plus.gif' border='0' alt='Graphic hinzuf&uuml;gen'>&nbsp;hinzuf&uuml;gen</a><br>\n";
-			$temp .= $offset."</td>\n";
-			$temp .= $offset." </tr>\n";				
-		}
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_graphic"]))
-		{
-			$this->graphic = new Graphic();
-			$this->graphic->generateObjectFromPost($id."_graphic");
-		}
-	}
-	
-	/**
-	 * Function that adds a graphic object.
-	 * Not sure if this function is neccessary / in use!
-	 */
-	function addGraphic()
-	{
-		$this->graphic = new Graphic();
-	}
+/**
+ * Implementation of the LegendGraphic-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class LegendGraphic extends Rule
+{
+	/**
+	 * The Graphic object from the xml-scheme.
+	 *
+	 * @see Graphic
+	 * @var object
+	 */
+	var $graphic = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<LegendGraphic>\n";
+		//Graphic must occur once
+		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
+		$temp .= $offset."</LegendGraphic>\n";
+		return $temp;
+	}
+		
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";				
+		$temp .= $offset."<table width='100%' border='0' cellpadding='1' cellspacing='0'>\n";
+		$temp .= $offset." <tr>\n";
+		$temp .= $offset."  <td class='edit_label_bg edit_label_text' valign='top' width='136'>\n";
+		$temp .= $offset."   LegendGraphic:\n";
+		$temp .= $offset."  </td>\n";
+
+		if ($this->graphic != "")
+		{	
+			$temp .= $offset."<td rowspan='2'>\n";
+			$temp .= $offset."<td>\n";
+			$temp .= $offset."<td rowspan='2' style='border:1px solid black; background-color:#FFFFFF'>\n";		
+			$temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
+			$temp .= $offset."<td>\n";
+			$temp .= $offset."</tr>\n";
+			$temp .= $offset."<tr>\n";
+			$temp .= $offset."<td>\n";
+			$temp .= $offset."&nbsp;\n";
+			$temp .= $offset."</td>\n";
+			$temp .= $offset." </tr>\n";									
+		}
+		else
+		{	
+			$temp .= $offset."<td>\n";
+			$temp .= $offset."&nbsp;\n";
+			$temp .= $offset."</td>\n";
+			$temp .= $offset."<td class='text' style='border:1px solid black; border-bottom:none; background-color:#FFFFFF'>\n";
+			$temp .= $offset."&nbsp;Graphic:\n";
+			$temp .= $offset."</td>\n";
+			$temp .= $offset."</tr>\n";			
+			//--------------------------
+			$temp .= $offset."  <tr>\n";
+			$temp .= $offset."  <td valign='bottom'>\n";
+			$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"legendgraphic\">\n";
+			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletelegendgraphic&id=".$this->parent."\">\n";
+			$temp .= $offset."    <img src='./img/minus.gif' border='0' alt='LegendGraphic l&ouml;schen'>&nbsp;l&ouml;schen\n";
+			$temp .= $offset."   </a>\n";
+			$temp .= $offset."  </td>\n";
+			$temp .= $offset."<td>\n";
+			$temp .= $offset."&nbsp;\n";
+			$temp .= $offset."</td>\n";							
+			$temp .= $offset."<td style='border:1px solid black; border-top:none; background-color:#FFFFFF'>\n";
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addgraphic&id=".$this->id."\">\n";
+			$temp .= $offset."   <img src='./img/plus.gif' border='0' alt='Graphic hinzuf&uuml;gen'>&nbsp;hinzuf&uuml;gen</a><br>\n";
+			$temp .= $offset."</td>\n";
+			$temp .= $offset." </tr>\n";				
+		}
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_graphic"]))
+		{
+			$this->graphic = new Graphic();
+			$this->graphic->generateObjectFromPost($id."_graphic");
+		}
+	}
+	
+	/**
+	 * Function that adds a graphic object.
+	 * Not sure if this function is neccessary / in use!
+	 */
+	function addGraphic()
+	{
+		$this->graphic = new Graphic();
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/LineSymbolizer.php
===================================================================
--- branches/print_dev/http/sld/classes/LineSymbolizer.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/LineSymbolizer.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,129 +1,129 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the LineSymbolizer-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class LineSymbolizer extends Rule
-{
-	/**
-	 * The Stroke object from the xml-scheme.
-	 *
-	 * @see Stroke
-	 * @var object
-	 */
-	var $stroke = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	
-	function LineSymbolizer()
-	{
-		//$this->stroke = new Stroke();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<LineSymbolizer>\n";
-		if ($this->stroke != "") $temp .= $this->stroke->generateXml($offset." ");
-		$temp .= $offset."</LineSymbolizer>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black; width:100%;\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td class='text' style=\"width: 130px;\">\n";
-		
-		$temp .= $offset."   LineSymbolizer<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"linesymbolizer\">\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		
-		if ($this->stroke != "")
-		{
-			$temp .= $this->stroke->generateHtmlForm($id."_stroke", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addstroke&id=".$this->id."\">Stroke hinzuf&uuml;gen</a>\n";
-		}
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		$temp .= $offset."<br>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_stroke"]))
-		{
-			$this->stroke = new Stroke();
-			$this->stroke->generateObjectFromPost($id."_stroke");
-		}
-	}
+/**
+ * Implementation of the LineSymbolizer-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class LineSymbolizer extends Rule
+{
+	/**
+	 * The Stroke object from the xml-scheme.
+	 *
+	 * @see Stroke
+	 * @var object
+	 */
+	var $stroke = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	
+	function LineSymbolizer()
+	{
+		//$this->stroke = new Stroke();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<LineSymbolizer>\n";
+		if ($this->stroke != "") $temp .= $this->stroke->generateXml($offset." ");
+		$temp .= $offset."</LineSymbolizer>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black; width:100%;\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td class='text' style=\"width: 130px;\">\n";
+		
+		$temp .= $offset."   LineSymbolizer<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"linesymbolizer\">\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		
+		if ($this->stroke != "")
+		{
+			$temp .= $this->stroke->generateHtmlForm($id."_stroke", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addstroke&id=".$this->id."\">Stroke hinzuf&uuml;gen</a>\n";
+		}
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		$temp .= $offset."<br>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_stroke"]))
+		{
+			$this->stroke = new Stroke();
+			$this->stroke->generateObjectFromPost($id."_stroke");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Mark.php
===================================================================
--- branches/print_dev/http/sld/classes/Mark.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Mark.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,179 +1,179 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Mark-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Mark
-{
-	/**
-	 * The wellknownname element from the xml-scheme.
-	 * @var string
-	 */
-	var $wellknownname = "";
-	
-	/**
-	 * The Fill object from the xml-scheme.
-	 *
-	 * @see Fill
-	 * @var object
-	 */
-	var $fill = "";
-	
-	/**
-	 * The Stroke object from the xml-scheme.
-	 *
-	 * @see Stroke
-	 * @var object
-	 */
-	var $stroke = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Mark>\n";
-		if ($this->wellknownname != "") $temp .= $offset." <WellKnownName>".htmlspecialchars($this->wellknownname)."</WellKnownName>\n";
-		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
-		if ($this->stroke != "") $temp .= $this->stroke->generateXml($offset." ");
-		$temp .= $offset."</Mark>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table style=\"border: 1px solid black;\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px\">\n";
-		$temp .= $offset."   Mark<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"mark\">\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deleteexternalgraphicormark&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		$temp .= $offset."   WellKnownName:\n";
-		$temp .= $offset."   <select name=\"".$id."_wellknownname\" onchange=\"document.getElementById('sld_editor_form').submit();\">\n";
-		$temp .= $offset."    <option value=\"square\"";
-		if ($this->wellknownname == "square") $temp .= " selected";
-		$temp .= ">square</option>\n";
-		$temp .= $offset."    <option value=\"circle\"";
-		if ($this->wellknownname == "circle") $temp .= " selected";
-		$temp .= ">circle</option>\n";
-		$temp .= $offset."    <option value=\"triangle\"";
-		if ($this->wellknownname == "triangle") $temp .= " selected";
-		$temp .= ">triangle</option>\n";
-		$temp .= $offset."    <option value=\"star\"";
-		if ($this->wellknownname == "star") $temp .= " selected";
-		$temp .= ">star</option>\n";
-		$temp .= $offset."    <option value=\"cross\"";
-		if ($this->wellknownname == "cross") $temp .= " selected";
-		$temp .= ">cross</option>\n";
-		$temp .= $offset."<option value=\"x\"";
-		if ($this->wellknownname == "x") $temp .= " selected";
-		$temp .= ">x</option>\n";
-		$temp .= $offset."   </select>\n";
-		$temp .= $offset."   <br>\n";
-		//TODO - Zeilenumbruch
-		if ($this->fill != "")
-		{
-			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
-		}
-		if ($this->stroke != "")
-		{
-			$temp .= $this->stroke->generateHtmlForm($id."_stroke", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addstroke&id=".$this->id."\">Stroke hinzuf&uuml;gen</a><br>\n";
-		}
-
-		$temp .= $offset."</td>\n";
-		$temp .= $offset."</tr>\n";
-		$temp .= $offset."</table>\n";
-		$temp .= $offset."<br>\n";		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_wellknownname"]))
-		{
-			$this->wellknownname = $_REQUEST[$id."_wellknownname"];
-		}
-		if (isset($_REQUEST[$id."_fill"]))
-		{
-			$this->fill = new Fill();
-			$this->fill->generateObjectFromPost($id."_fill");
-		}
-		if (isset($_REQUEST[$id."_stroke"]))
-		{
-			$this->stroke = new Stroke();
-			$this->stroke->generateObjectFromPost($id."_stroke");
-		}
-	}
+/**
+ * Implementation of the Mark-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Mark
+{
+	/**
+	 * The wellknownname element from the xml-scheme.
+	 * @var string
+	 */
+	var $wellknownname = "";
+	
+	/**
+	 * The Fill object from the xml-scheme.
+	 *
+	 * @see Fill
+	 * @var object
+	 */
+	var $fill = "";
+	
+	/**
+	 * The Stroke object from the xml-scheme.
+	 *
+	 * @see Stroke
+	 * @var object
+	 */
+	var $stroke = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Mark>\n";
+		if ($this->wellknownname != "") $temp .= $offset." <WellKnownName>".htmlspecialchars($this->wellknownname)."</WellKnownName>\n";
+		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
+		if ($this->stroke != "") $temp .= $this->stroke->generateXml($offset." ");
+		$temp .= $offset."</Mark>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table style=\"border: 1px solid black;\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px\">\n";
+		$temp .= $offset."   Mark<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"mark\">\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deleteexternalgraphicormark&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		$temp .= $offset."   WellKnownName:\n";
+		$temp .= $offset."   <select name=\"".$id."_wellknownname\" onchange=\"document.getElementById('sld_editor_form').submit();\">\n";
+		$temp .= $offset."    <option value=\"square\"";
+		if ($this->wellknownname == "square") $temp .= " selected";
+		$temp .= ">square</option>\n";
+		$temp .= $offset."    <option value=\"circle\"";
+		if ($this->wellknownname == "circle") $temp .= " selected";
+		$temp .= ">circle</option>\n";
+		$temp .= $offset."    <option value=\"triangle\"";
+		if ($this->wellknownname == "triangle") $temp .= " selected";
+		$temp .= ">triangle</option>\n";
+		$temp .= $offset."    <option value=\"star\"";
+		if ($this->wellknownname == "star") $temp .= " selected";
+		$temp .= ">star</option>\n";
+		$temp .= $offset."    <option value=\"cross\"";
+		if ($this->wellknownname == "cross") $temp .= " selected";
+		$temp .= ">cross</option>\n";
+		$temp .= $offset."<option value=\"x\"";
+		if ($this->wellknownname == "x") $temp .= " selected";
+		$temp .= ">x</option>\n";
+		$temp .= $offset."   </select>\n";
+		$temp .= $offset."   <br>\n";
+		//TODO - Zeilenumbruch
+		if ($this->fill != "")
+		{
+			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
+		}
+		if ($this->stroke != "")
+		{
+			$temp .= $this->stroke->generateHtmlForm($id."_stroke", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addstroke&id=".$this->id."\">Stroke hinzuf&uuml;gen</a><br>\n";
+		}
+
+		$temp .= $offset."</td>\n";
+		$temp .= $offset."</tr>\n";
+		$temp .= $offset."</table>\n";
+		$temp .= $offset."<br>\n";		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_wellknownname"]))
+		{
+			$this->wellknownname = $_REQUEST[$id."_wellknownname"];
+		}
+		if (isset($_REQUEST[$id."_fill"]))
+		{
+			$this->fill = new Fill();
+			$this->fill->generateObjectFromPost($id."_fill");
+		}
+		if (isset($_REQUEST[$id."_stroke"]))
+		{
+			$this->stroke = new Stroke();
+			$this->stroke->generateObjectFromPost($id."_stroke");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/NamedLayer.php
===================================================================
--- branches/print_dev/http/sld/classes/NamedLayer.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/NamedLayer.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,138 +1,138 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the NamedLayer-element
- *
- * @package sld_classes
- * @see StyledLayerDescriptor::$layers
- * @author Markus Krzyzanowski
- */
-class NamedLayer extends StyledLayerDescriptor
-{
-	/**
-	 * The name attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $name = "";
-	//Probably not supported by Mapserver - TODO
-	//var $layerfeatureconstraints = "";
-	/**
-	 * Array containing the style-objects of the layer.
-	 *
-	 * @see UserStyle
-	 * @var array
-	 */
-	var $styles = array();
-	// $id and $parent for the $objects session array
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<NamedLayer>\n";
-		$temp .= $offset." <Name>".htmlspecialchars($this->name)."</Name>\n";
-		foreach($this->styles as $style)
-		{
-			$temp .= $style->generateXml($offset." ");
-		}
-		$temp .= $offset."</NamedLayer>\n";
-		return $temp;
-	}
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr>\n";
-		$temp .= $offset."  <td class='edit_label_bg edit_label_text_head'>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"namedlayer\">\n";
-		$temp .= $offset."   <em>&nbsp;&nbsp;Layer: ".htmlspecialchars($this->name)."</em>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."_name\" value=\"".htmlspecialchars($this->name)."\">\n";			
-		$style_id = 0;
-		foreach ($this->styles as $style)
-		{
-			$temp .= $style->generateHtmlForm($id."_style_".$style_id, $offset."    ");
-			$style_id++;
-		}			
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->name = $_REQUEST[$id."_name"];
-		$countStyles = 0;
-		while (isset($_REQUEST[$id."_style_".$countStyles]))
-		{
-			$style = "";
-			if ($_REQUEST[$id."_style_".$countStyles] == "userstyle")
-			{
-				$style = new UserStyle();
-			}
-			else
-			{
-				//Todo evtl: namedstyle erstellen
-				//NamedStyle is currently not supported by UMN-MapServer!
-				//$style = new NamedStyle();
-			}
-			$style->generateObjectFromPost($id."_style_".$countStyles);
-			$this->styles[] = $style;
-			$countStyles++;
-		}
-	}
-}
+/**
+ * Implementation of the NamedLayer-element
+ *
+ * @package sld_classes
+ * @see StyledLayerDescriptor::$layers
+ * @author Markus Krzyzanowski
+ */
+class NamedLayer extends StyledLayerDescriptor
+{
+	/**
+	 * The name attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $name = "";
+	//Probably not supported by Mapserver - TODO
+	//var $layerfeatureconstraints = "";
+	/**
+	 * Array containing the style-objects of the layer.
+	 *
+	 * @see UserStyle
+	 * @var array
+	 */
+	var $styles = array();
+	// $id and $parent for the $objects session array
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<NamedLayer>\n";
+		$temp .= $offset." <Name>".htmlspecialchars($this->name)."</Name>\n";
+		foreach($this->styles as $style)
+		{
+			$temp .= $style->generateXml($offset." ");
+		}
+		$temp .= $offset."</NamedLayer>\n";
+		return $temp;
+	}
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr>\n";
+		$temp .= $offset."  <td class='edit_label_bg edit_label_text_head'>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"namedlayer\">\n";
+		$temp .= $offset."   <em>&nbsp;&nbsp;Layer: ".htmlspecialchars($this->name)."</em>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."_name\" value=\"".htmlspecialchars($this->name)."\">\n";			
+		$style_id = 0;
+		foreach ($this->styles as $style)
+		{
+			$temp .= $style->generateHtmlForm($id."_style_".$style_id, $offset."    ");
+			$style_id++;
+		}			
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->name = $_REQUEST[$id."_name"];
+		$countStyles = 0;
+		while (isset($_REQUEST[$id."_style_".$countStyles]))
+		{
+			$style = "";
+			if ($_REQUEST[$id."_style_".$countStyles] == "userstyle")
+			{
+				$style = new UserStyle();
+			}
+			else
+			{
+				//Todo evtl: namedstyle erstellen
+				//NamedStyle is currently not supported by UMN-MapServer!
+				//$style = new NamedStyle();
+			}
+			$style->generateObjectFromPost($id."_style_".$countStyles);
+			$this->styles[] = $style;
+			$countStyles++;
+		}
+	}
+}
 
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/ParameterValue.php
===================================================================
--- branches/print_dev/http/sld/classes/ParameterValue.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/ParameterValue.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,75 +1,75 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-/**
- * Implementation of the ParameterValueType type of elements
- *
- * @package sld_classes
- * @author Michael Schulz
- */
-class ParameterValue
-{
-	/**
-	 * The value attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $value = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml()
-	{
-		$temp = "<PropertyName>".$this->value."</PropertyName>";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = $this->value;
-		return $temp;
-	}
-	
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
+
+/**
+ * Implementation of the ParameterValueType type of elements
+ *
+ * @package sld_classes
+ * @author Michael Schulz
+ */
+class ParameterValue
+{
+	/**
+	 * The value attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $value = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml()
+	{
+		$temp = "<PropertyName>".$this->value."</PropertyName>";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = $this->value;
+		return $temp;
+	}
+	
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/PointPlacement.php
===================================================================
--- branches/print_dev/http/sld/classes/PointPlacement.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/PointPlacement.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,151 +1,151 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the PointPlacement-element
- *
- * Creating an instance of this class will also create the anchorpoint and displacement objects for this instance.
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class PointPlacement
-{
-	/**
-	 * The anchorpoint object from the xml-scheme.
-	 *
-	 * @see AnchorPoint
-	 * @var object
-	 */
-	var $anchorpoint = "";
-	
-	/**
-	 * The displacement object from the xml-scheme.
-	 *
-	 * @see Displacement
-	 * @var object
-	 */
-	var $displacement = "";
-	
-	/**
-	 * The rotation attribute from the xml-scheme.
-	 *
-	 * Not sure if this feature is supported in UMN-MapServer.
-	 *
-	 * @var int
-	 */
-	var $rotation = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * Default constructor that automatically creates an AnchorPoint and a Displacement object.
-	 */
-	function PointPlacement()
-	{
-		$this->anchorpoint = new AnchorPoint();
-		$this->displacement = new Displacement();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<PointPlacement>\n";
-		$temp .= $this->anchorpoint->generateXml($offset." ");
-		$temp .= $this->displacement->generateXml($offset." ");
-		if ($this->rotation != "") $temp .= $offset." <Rotation>".htmlspecialchars($this->rotation)."</Rotation>\n";
-		$temp .= $offset."</PointPlacement>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"pointplacement\">\n";
-		$temp .= $offset."<table>\n";
-
-		$temp .= $this->anchorpoint->generateHtmlForm($id."_anchorpoint", $offset." ");
-		$temp .= $this->displacement->generateHtmlForm($id."_displacement", $offset." ");
-		
-		$temp .= $offset." <tr>\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   Rotation:\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		$temp .= $offset."   <input name=\"".$id."_rotation\" value=\"".htmlspecialchars($this->rotation)."\"><br>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_anchorpoint"]))
-		{
-			$this->anchorpoint = new AnchorPoint();
-			$this->anchorpoint->generateObjectFromPost($id."_anchorpoint");
-		}
-		if (isset($_REQUEST[$id."_displacement"]))
-		{
-			$this->displacement = new Displacement();
-			$this->displacement->generateObjectFromPost($id."_displacement");
-		}
-		if (isset($_REQUEST[$id."_rotation"]))
-		{
-			$this->rotation = $_REQUEST[$id."_rotation"];
-		}
-	}
+/**
+ * Implementation of the PointPlacement-element
+ *
+ * Creating an instance of this class will also create the anchorpoint and displacement objects for this instance.
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class PointPlacement
+{
+	/**
+	 * The anchorpoint object from the xml-scheme.
+	 *
+	 * @see AnchorPoint
+	 * @var object
+	 */
+	var $anchorpoint = "";
+	
+	/**
+	 * The displacement object from the xml-scheme.
+	 *
+	 * @see Displacement
+	 * @var object
+	 */
+	var $displacement = "";
+	
+	/**
+	 * The rotation attribute from the xml-scheme.
+	 *
+	 * Not sure if this feature is supported in UMN-MapServer.
+	 *
+	 * @var int
+	 */
+	var $rotation = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * Default constructor that automatically creates an AnchorPoint and a Displacement object.
+	 */
+	function PointPlacement()
+	{
+		$this->anchorpoint = new AnchorPoint();
+		$this->displacement = new Displacement();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<PointPlacement>\n";
+		$temp .= $this->anchorpoint->generateXml($offset." ");
+		$temp .= $this->displacement->generateXml($offset." ");
+		if ($this->rotation != "") $temp .= $offset." <Rotation>".htmlspecialchars($this->rotation)."</Rotation>\n";
+		$temp .= $offset."</PointPlacement>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"pointplacement\">\n";
+		$temp .= $offset."<table>\n";
+
+		$temp .= $this->anchorpoint->generateHtmlForm($id."_anchorpoint", $offset." ");
+		$temp .= $this->displacement->generateHtmlForm($id."_displacement", $offset." ");
+		
+		$temp .= $offset." <tr>\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   Rotation:\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		$temp .= $offset."   <input name=\"".$id."_rotation\" value=\"".htmlspecialchars($this->rotation)."\"><br>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_anchorpoint"]))
+		{
+			$this->anchorpoint = new AnchorPoint();
+			$this->anchorpoint->generateObjectFromPost($id."_anchorpoint");
+		}
+		if (isset($_REQUEST[$id."_displacement"]))
+		{
+			$this->displacement = new Displacement();
+			$this->displacement->generateObjectFromPost($id."_displacement");
+		}
+		if (isset($_REQUEST[$id."_rotation"]))
+		{
+			$this->rotation = $_REQUEST[$id."_rotation"];
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/PointSymbolizer.php
===================================================================
--- branches/print_dev/http/sld/classes/PointSymbolizer.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/PointSymbolizer.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,137 +1,137 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the PointSymbolizer-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class PointSymbolizer extends Rule
-{
-	/**
-	 * The Graphic object from the xml-scheme.
-	 *
-	 * @see Graphic
-	 * @var object
-	 */
-	var $graphic = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	
-	function PointSymbolizer()
-	{
-		//$this->graphic = new Graphic();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<PointSymbolizer>\n";
-		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
-		$temp .= $offset."</PointSymbolizer>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black; width:100%;\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 130px;\">\n";
-		$temp .= $offset."   PointSymbolizer<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"pointsymbolizer\">\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		if ($this->graphic != "")
-		{
-			$temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."Graphic:&nbsp;<a class='edit' href=\"sld_function_handler.php?function=addgraphic&id=".$this->id."\">Graphic hinzuf&uuml;gen</a>\n";
-		}
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		$temp .= $offset."<br>\n";		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_graphic"]))
-		{
-			$this->graphic = new Graphic();
-			$this->graphic->generateObjectFromPost($id."_graphic");
-		}
-	}
-	
-	/**
-	 * Function that creates a new Graphic object.
-	 * 
-	 * Not sure if this function is neccessary / in use!
-	 */
-	function addGraphic()
-	{
-		$this->graphic = new Graphic();
-	}
+/**
+ * Implementation of the PointSymbolizer-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class PointSymbolizer extends Rule
+{
+	/**
+	 * The Graphic object from the xml-scheme.
+	 *
+	 * @see Graphic
+	 * @var object
+	 */
+	var $graphic = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	
+	function PointSymbolizer()
+	{
+		//$this->graphic = new Graphic();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<PointSymbolizer>\n";
+		if ($this->graphic != "") $temp .= $this->graphic->generateXml($offset." ");
+		$temp .= $offset."</PointSymbolizer>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black; width:100%;\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 130px;\">\n";
+		$temp .= $offset."   PointSymbolizer<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"pointsymbolizer\">\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		if ($this->graphic != "")
+		{
+			$temp .= $this->graphic->generateHtmlForm($id."_graphic", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."Graphic:&nbsp;<a class='edit' href=\"sld_function_handler.php?function=addgraphic&id=".$this->id."\">Graphic hinzuf&uuml;gen</a>\n";
+		}
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		$temp .= $offset."<br>\n";		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_graphic"]))
+		{
+			$this->graphic = new Graphic();
+			$this->graphic->generateObjectFromPost($id."_graphic");
+		}
+	}
+	
+	/**
+	 * Function that creates a new Graphic object.
+	 * 
+	 * Not sure if this function is neccessary / in use!
+	 */
+	function addGraphic()
+	{
+		$this->graphic = new Graphic();
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/PolygonSymbolizer.php
===================================================================
--- branches/print_dev/http/sld/classes/PolygonSymbolizer.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/PolygonSymbolizer.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,151 +1,151 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the PolygonSymbolizer-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class PolygonSymbolizer extends Rule
-{
-	/**
-	 * The Fill object from the xml-scheme.
-	 *
-	 * @see Fill
-	 * @var object
-	 */
-	var $fill = "";
-	
-	/**
-	 * The Stroke object from the xml-scheme.
-	 *
-	 * @see Stroke
-	 * @var object
-	 */
-	var $stroke = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	
-	function PolygonSymbolizer()
-	{
-		//$this->fill = new Fill();
-		//$this->stroke = new Stroke();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<PolygonSymbolizer>\n";
-		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
-		if ($this->stroke != "") $temp .= $this->stroke->generateXml($offset." ");
-		$temp .= $offset."</PolygonSymbolizer>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black; width:100%;\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 130px;\">\n";
-		$temp .= $offset."   PolygonSymbolizer<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"polygonsymbolizer\">\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		if ($this->fill != "")
-		{
-			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
-		}
-		if ($this->stroke != "")
-		{
-			$temp .= $this->stroke->generateHtmlForm($id."_stroke", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addstroke&id=".$this->id."\">Stroke hinzuf&uuml;gen</a>\n";
-		}
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		$temp .= $offset."<br>\n";		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_fill"]))
-		{
-			$this->fill = new Fill();
-			$this->fill->generateObjectFromPost($id."_fill");
-		}
-		if (isset($_REQUEST[$id."_stroke"]))
-		{
-			$this->stroke = new Stroke();
-			$this->stroke->generateObjectFromPost($id."_stroke");
-		}
-	}
+/**
+ * Implementation of the PolygonSymbolizer-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class PolygonSymbolizer extends Rule
+{
+	/**
+	 * The Fill object from the xml-scheme.
+	 *
+	 * @see Fill
+	 * @var object
+	 */
+	var $fill = "";
+	
+	/**
+	 * The Stroke object from the xml-scheme.
+	 *
+	 * @see Stroke
+	 * @var object
+	 */
+	var $stroke = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	
+	function PolygonSymbolizer()
+	{
+		//$this->fill = new Fill();
+		//$this->stroke = new Stroke();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<PolygonSymbolizer>\n";
+		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
+		if ($this->stroke != "") $temp .= $this->stroke->generateXml($offset." ");
+		$temp .= $offset."</PolygonSymbolizer>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black; width:100%;\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 130px;\">\n";
+		$temp .= $offset."   PolygonSymbolizer<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"polygonsymbolizer\">\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		if ($this->fill != "")
+		{
+			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
+		}
+		if ($this->stroke != "")
+		{
+			$temp .= $this->stroke->generateHtmlForm($id."_stroke", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addstroke&id=".$this->id."\">Stroke hinzuf&uuml;gen</a>\n";
+		}
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		$temp .= $offset."<br>\n";		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_fill"]))
+		{
+			$this->fill = new Fill();
+			$this->fill->generateObjectFromPost($id."_fill");
+		}
+		if (isset($_REQUEST[$id."_stroke"]))
+		{
+			$this->stroke = new Stroke();
+			$this->stroke->generateObjectFromPost($id."_stroke");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/PropertyIsBetween.php
===================================================================
--- branches/print_dev/http/sld/classes/PropertyIsBetween.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/PropertyIsBetween.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,152 +1,152 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the PropertyIsBetween-element
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class PropertyIsBetween
-{
-	/**
-	 * The property name
-	 * @var string
-	 */
-	var $ogcPropertyName = "";
-	
-	/**
-	 * The lower boundary for this property
-	 * @var float
-	 */
-	var $upperBoundary = "";
-	
-	/**
-	 * The upper boundary for this property
-	 * @var float
-	 */
-	var $lowerBoundary = "";
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ogc:PropertyIsBetween>\n";
-		$temp .= $offset." <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
-		$temp .= $offset." <ogc:LowerBoundary><ogc:Literal>".$this->lowerBoundary."</ogc:Literal></ogc:LowerBoundary>\n";
-		$temp .= $offset." <ogc:UpperBoundary><ogc:Literal>".$this->upperBoundary."</ogc:Literal></ogc:UpperBoundary>\n";
-		$temp .= $offset."</ogc:PropertyIsBetween>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id = "", $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"propertyIsBetween\">\n";
-		$temp .= $offset."  PropertyName\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td style=\"width: 50px; text-align: center; font-size: large;\">=</td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  &nbsp;\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  LowerBoundary\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td style=\"width: 50px; text-align: center; font-size: large;\">=</td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_lowerboundary\" value=\"".$this->lowerBoundary."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  &nbsp;\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  UpperBoundary\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td style=\"width: 50px; text-align: center; font-size: large;\">=</td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_upperboundary\" value=\"".$this->upperBoundary."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
-		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
-		$this->lowerBoundary = $_REQUEST[$id."_lowerboundary"];
-		$this->upperBoundary = $_REQUEST[$id."_upperboundary"];
-	}
+/**
+ * Implementation of the PropertyIsBetween-element
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class PropertyIsBetween
+{
+	/**
+	 * The property name
+	 * @var string
+	 */
+	var $ogcPropertyName = "";
+	
+	/**
+	 * The lower boundary for this property
+	 * @var float
+	 */
+	var $upperBoundary = "";
+	
+	/**
+	 * The upper boundary for this property
+	 * @var float
+	 */
+	var $lowerBoundary = "";
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ogc:PropertyIsBetween>\n";
+		$temp .= $offset." <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
+		$temp .= $offset." <ogc:LowerBoundary><ogc:Literal>".$this->lowerBoundary."</ogc:Literal></ogc:LowerBoundary>\n";
+		$temp .= $offset." <ogc:UpperBoundary><ogc:Literal>".$this->upperBoundary."</ogc:Literal></ogc:UpperBoundary>\n";
+		$temp .= $offset."</ogc:PropertyIsBetween>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id = "", $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"propertyIsBetween\">\n";
+		$temp .= $offset."  PropertyName\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td style=\"width: 50px; text-align: center; font-size: large;\">=</td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  &nbsp;\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  LowerBoundary\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td style=\"width: 50px; text-align: center; font-size: large;\">=</td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_lowerboundary\" value=\"".$this->lowerBoundary."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  &nbsp;\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  UpperBoundary\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td style=\"width: 50px; text-align: center; font-size: large;\">=</td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_upperboundary\" value=\"".$this->upperBoundary."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
+		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
+		$this->lowerBoundary = $_REQUEST[$id."_lowerboundary"];
+		$this->upperBoundary = $_REQUEST[$id."_upperboundary"];
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/PropertyIsLike.php
===================================================================
--- branches/print_dev/http/sld/classes/PropertyIsLike.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/PropertyIsLike.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,173 +1,173 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the PropertyIsLike-element
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class PropertyIsLike
-{
-	/**
-	 * wildcard attribute
-	 * @var string
-	 */
-	var $wildCard = "*";
-	
-	/**
-	 * singleChar attribute
-	 * @var string
-	 */
-	var $singleChar = "#";
-	
-	/**
-	 * escape character attribute
-	 * @var string
-	 */
-	var $escape = "!";
-	
-	/**
-	 * Name of the Property
-	 * @var string
-	 */
-	var $ogcPropertyName = "";
-	
-	/**
-	 * Regular Expression using the above variables as escape + ... chars.
-	 * @var string
-	 */
-	var $ogcLiteral = "";
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ogc:PropertyIsLike";
-		$temp .= " wildCard=\"".$this->wildCard."\"";
-		$temp .= " singleChar=\"".$this->singleChar."\"";
-		$temp .= " escape=\"".$this->escape."\"";
-		$temp .= ">\n";
-		$temp .= $offset. " <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
-		$temp .= $offset. " <ogc:Literal>".$this->ogcLiteral."</ogc:Literal>\n";
-		$temp .= $offset."</ogc:PropertyIsLike>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id = "", $offset = "")
-	{
-		$temp = "";
-		
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td colspan=\"2\">\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"propertyIsLike\">\n";
-		$temp .= $offset."  WildCard\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_wildcard\" value=\"".$this->wildCard."\">";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>&nbsp;</td>\n";
-		$temp .= $offset."</tr>\n";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td colspan=\"2\">\n";
-		$temp .= $offset."  singleChar\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_singlechar\" value=\"".$this->singleChar."\">";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>&nbsp;</td>\n";
-		$temp .= $offset."</tr>\n";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td colspan=\"2\">\n";
-		$temp .= $offset."  Escape\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_escape\" value=\"".$this->escape."\">";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>&nbsp;</td>\n";
-		$temp .= $offset."</tr>\n";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td style=\"width:50px; text-align: center;\">\n";
-		$temp .= $offset."  LIKE";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_ogcliteral\" value=\"".$this->ogcLiteral."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">\n";
-		$temp .= $offset."  <img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->wildCard = $_REQUEST[$id."_wildcard"];
-		$this->singleChar = $_REQUEST[$id."_singlechar"];
-		$this->escape = $_REQUEST[$id."_escape"];
-		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
-		$this->ogcLiteral = $_REQUEST[$id."_ogcliteral"];
-	}
+/**
+ * Implementation of the PropertyIsLike-element
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class PropertyIsLike
+{
+	/**
+	 * wildcard attribute
+	 * @var string
+	 */
+	var $wildCard = "*";
+	
+	/**
+	 * singleChar attribute
+	 * @var string
+	 */
+	var $singleChar = "#";
+	
+	/**
+	 * escape character attribute
+	 * @var string
+	 */
+	var $escape = "!";
+	
+	/**
+	 * Name of the Property
+	 * @var string
+	 */
+	var $ogcPropertyName = "";
+	
+	/**
+	 * Regular Expression using the above variables as escape + ... chars.
+	 * @var string
+	 */
+	var $ogcLiteral = "";
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ogc:PropertyIsLike";
+		$temp .= " wildCard=\"".$this->wildCard."\"";
+		$temp .= " singleChar=\"".$this->singleChar."\"";
+		$temp .= " escape=\"".$this->escape."\"";
+		$temp .= ">\n";
+		$temp .= $offset. " <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
+		$temp .= $offset. " <ogc:Literal>".$this->ogcLiteral."</ogc:Literal>\n";
+		$temp .= $offset."</ogc:PropertyIsLike>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id = "", $offset = "")
+	{
+		$temp = "";
+		
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td colspan=\"2\">\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"propertyIsLike\">\n";
+		$temp .= $offset."  WildCard\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_wildcard\" value=\"".$this->wildCard."\">";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>&nbsp;</td>\n";
+		$temp .= $offset."</tr>\n";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td colspan=\"2\">\n";
+		$temp .= $offset."  singleChar\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_singlechar\" value=\"".$this->singleChar."\">";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>&nbsp;</td>\n";
+		$temp .= $offset."</tr>\n";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td colspan=\"2\">\n";
+		$temp .= $offset."  Escape\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_escape\" value=\"".$this->escape."\">";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>&nbsp;</td>\n";
+		$temp .= $offset."</tr>\n";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td style=\"width:50px; text-align: center;\">\n";
+		$temp .= $offset."  LIKE";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_ogcliteral\" value=\"".$this->ogcLiteral."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">\n";
+		$temp .= $offset."  <img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->wildCard = $_REQUEST[$id."_wildcard"];
+		$this->singleChar = $_REQUEST[$id."_singlechar"];
+		$this->escape = $_REQUEST[$id."_escape"];
+		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
+		$this->ogcLiteral = $_REQUEST[$id."_ogcliteral"];
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/PropertyIsNull.php
===================================================================
--- branches/print_dev/http/sld/classes/PropertyIsNull.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/PropertyIsNull.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,119 +1,119 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the PropertyIsNull-element
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class PropertyIsNull
-{
-	/**
-	 * Name of the Property
-	 * @var string
-	 */
-	var $ogcPropertyName = "";
-	
-	/**
-	 * String. Not sure was this is used for in ogc:filter.
-	 * An "isNull" comparison usually does not require a literal string.
-	 * @var string
-	 */
-	var $ogcLiteral = "";
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<ogc:PropertyIsNull>\n";
-		$temp .= $offset. " <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
-		$temp .= $offset. " <ogc:Literal>".$this->ogcLiteral."</ogc:Literal>\n";
-		$temp .= $offset."</ogc:PropertyIsNull>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id = "", $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"propertyIsNull\">\n";
-		$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td style=\"width:50px; text-align: center;\">\n";
-		$temp .= $offset."  NULL";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input name=\"".$id."_ogcliteral\" value=\"".$this->ogcLiteral."\">\n";
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td>\n";
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
-		$temp .= $offset."  <img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
-		$this->ogcLiteral = $_REQUEST[$id."_ogcliteral"];
-	}
+/**
+ * Implementation of the PropertyIsNull-element
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class PropertyIsNull
+{
+	/**
+	 * Name of the Property
+	 * @var string
+	 */
+	var $ogcPropertyName = "";
+	
+	/**
+	 * String. Not sure was this is used for in ogc:filter.
+	 * An "isNull" comparison usually does not require a literal string.
+	 * @var string
+	 */
+	var $ogcLiteral = "";
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<ogc:PropertyIsNull>\n";
+		$temp .= $offset. " <ogc:PropertyName>".$this->ogcPropertyName."</ogc:PropertyName>\n";
+		$temp .= $offset. " <ogc:Literal>".$this->ogcLiteral."</ogc:Literal>\n";
+		$temp .= $offset."</ogc:PropertyIsNull>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id = "", $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"propertyIsNull\">\n";
+		$temp .= $offset."  <input name=\"".$id."_ogcpropertyname\" value=\"".$this->ogcPropertyName."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td style=\"width:50px; text-align: center;\">\n";
+		$temp .= $offset."  NULL";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input name=\"".$id."_ogcliteral\" value=\"".$this->ogcLiteral."\">\n";
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td>\n";
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."  <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
+		$temp .= $offset."  <img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->ogcPropertyName = $_REQUEST[$id."_ogcpropertyname"];
+		$this->ogcLiteral = $_REQUEST[$id."_ogcliteral"];
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/RasterSymbolizer.php
===================================================================
--- branches/print_dev/http/sld/classes/RasterSymbolizer.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/RasterSymbolizer.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,160 +1,160 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the RasterSymbolizer-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class RasterSymbolizer extends Rule
-{
-	/**
-	 * The Opacity element from the xml-scheme.
-	 * This element is not implemented as an object.
-	 *
-	 * @var string
-	 */
-	var $opacity = "";
-	
-	/**
-	 * The ColorMap object from the xml-scheme.
-	 *
-	 * @see ColorMap
-	 * @var object
-	 */
-	var $colormap = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	
-	function RasterSymbolizer()
-	{
-		//$this->colormap = new ColorMap();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<RasterSymbolizer>\n";
-		if ($this->opacity != "") $temp .= $offset." <Opacity>".htmlspecialchars($this->opacity)."</Opacity>\n";
-		if ($this->colormap != "") $temp .= $this->colormap->generateXml($offset." ");
-		$temp .= $offset."</RasterSymbolizer>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black;width:100%\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 130px;\">\n";
-		
-		$temp .= $offset."   RasterSymbolizer<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"rastersymbolizer\">\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		
-		$temp .= $offset."  </td>\n";
-		
-		$temp .= $offset."  <td>\n";
-		
-		$temp .= $offset."   <table>\n";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td style=\"width: 100px;\">\n";
-		$temp .= $offset."      Opacity:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      <input name=\"".$id."_opacity\" value=\"".htmlspecialchars($this->opacity)."\">\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		if ($this->colormap != "")
-		{
-			$temp .= $this->colormap->generateHtmlForm($id."_colormap", $offset."    ");
-		}
-		else
-		{
-			$temp .= $offset."    <tr>\n";
-			$temp .= $offset."     <td colspan=\"2\">\n";
-			$temp .= $offset."      <a class='edit' href=\"sld_function_handler.php?function=addcolormap&id=".$this->id."\">ColorMap hinzuf&uuml;gen</a>\n";
-			$temp .= $offset."     </td>\n";
-			$temp .= $offset."    </tr>\n";
-		}
-		$temp .= $offset."   </table>\n";
-		
-		
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		$temp .= $offset."<br>\n";		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_opacity"]))
-		{
-			$this->opacity = $_REQUEST[$id."_opacity"];
-		}
-		if (isset($_REQUEST[$id."_colormap"]))
-		{
-			$this->colormap = new ColorMap();
-			$this->colormap->generateObjectFromPost($id."_colormap");
-		}
-	}
+/**
+ * Implementation of the RasterSymbolizer-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class RasterSymbolizer extends Rule
+{
+	/**
+	 * The Opacity element from the xml-scheme.
+	 * This element is not implemented as an object.
+	 *
+	 * @var string
+	 */
+	var $opacity = "";
+	
+	/**
+	 * The ColorMap object from the xml-scheme.
+	 *
+	 * @see ColorMap
+	 * @var object
+	 */
+	var $colormap = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	
+	function RasterSymbolizer()
+	{
+		//$this->colormap = new ColorMap();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<RasterSymbolizer>\n";
+		if ($this->opacity != "") $temp .= $offset." <Opacity>".htmlspecialchars($this->opacity)."</Opacity>\n";
+		if ($this->colormap != "") $temp .= $this->colormap->generateXml($offset." ");
+		$temp .= $offset."</RasterSymbolizer>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<table bgcolor=\"#FFFFFF\" style=\"border: 1px solid black;width:100%\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 130px;\">\n";
+		
+		$temp .= $offset."   RasterSymbolizer<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"rastersymbolizer\">\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		
+		$temp .= $offset."  </td>\n";
+		
+		$temp .= $offset."  <td>\n";
+		
+		$temp .= $offset."   <table>\n";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td style=\"width: 100px;\">\n";
+		$temp .= $offset."      Opacity:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      <input name=\"".$id."_opacity\" value=\"".htmlspecialchars($this->opacity)."\">\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		if ($this->colormap != "")
+		{
+			$temp .= $this->colormap->generateHtmlForm($id."_colormap", $offset."    ");
+		}
+		else
+		{
+			$temp .= $offset."    <tr>\n";
+			$temp .= $offset."     <td colspan=\"2\">\n";
+			$temp .= $offset."      <a class='edit' href=\"sld_function_handler.php?function=addcolormap&id=".$this->id."\">ColorMap hinzuf&uuml;gen</a>\n";
+			$temp .= $offset."     </td>\n";
+			$temp .= $offset."    </tr>\n";
+		}
+		$temp .= $offset."   </table>\n";
+		
+		
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		$temp .= $offset."<br>\n";		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_opacity"]))
+		{
+			$this->opacity = $_REQUEST[$id."_opacity"];
+		}
+		if (isset($_REQUEST[$id."_colormap"]))
+		{
+			$this->colormap = new ColorMap();
+			$this->colormap->generateObjectFromPost($id."_colormap");
+		}
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Rule.php
===================================================================
--- branches/print_dev/http/sld/classes/Rule.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Rule.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,378 +1,378 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Rule-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Rule extends FeatureTypeStyle
-{
-	/**
-	 * The name attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $name = "";
-	
-	/**
-	 * The title attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $title = "";
-	
-	/**
-	 * The LegendGraphic element from the xml-scheme.
-	 * @see LegendGraphic
-	 * @var object
-	 */
-	var $legendgraphic = "";
-	
-	/**
-	 * The complete filter expression.
-	 *
-	 * The parsing an editing of the filter expressions is not done in the main sld editor.
-	 * This field contains the complete filter expression without any parsing.
-	 * The parsing is done in sld_filter_parse.php using the classes in sld_filter_classes.php.
-	 * Editing is possible in sld_edit_filter.php. This page is opened in a popup-window.
-	 *
-	 * @see sld_filter_classes.php
-	 * @var string
-	 */
-	var $filter = "";
-	
-	/**
-	 * The miscaledenominator attribute from the xml-scheme.
-	 * @var int
-	 */
-	var $minscaledenominator = "";
-	
-	/**
-	 * The maxscaledenominator attribute from the xml-scheme.
-	 * @var int
-	 */
-	var $maxscaledenominator = "";
-	
-	/**
-	 * Array containing the different symbolizers for this rule.
-	 * @var array
-	 */
-	var $symbolizers = array();
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Rule>\n";
-		if ($this->name != "") $temp .= $offset." <Name>".htmlspecialchars($this->name)."</Name>\n";
-		if ($this->title != "") $temp .= $offset." <Title>".htmlspecialchars($this->title)."</Title>\n";
-		if ($this->legendgraphic != "") $temp .= $this->legendgraphic->generateXml($offset." ");
-		
-		if ($this->filter != "") $temp .= $offset." ".$this->filter."\n";
-		if ($this->minscaledenominator != "") $temp .= $offset." <MinScaleDenominator>".htmlspecialchars($this->minscaledenominator)."</MinScaleDenominator>\n";
-		if ($this->maxscaledenominator != "") $temp .= $offset." <MaxScaleDenominator>".htmlspecialchars($this->maxscaledenominator)."</MaxScaleDenominator>\n";
-		foreach($this->symbolizers as $symbolizer)
-		{
-			$temp .= $symbolizer->generateXml($offset." ");
-		}
-		$temp .= $offset."</Rule>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<td rowspan=\"2\" valign='top'>\n";
-		
-			//Table in the first cell for the attributes of this rule
-			###### -----------> Fenster Rule Eigenschaften
-			$temp .= $offset." <table class='edit_label_bg2' border=\"0\" cellspacing=\"2\" cellpadding=\"1\">\n";
-			$temp .= $offset."  <tr>\n";
-			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>\n";
-			$temp .= $offset."    Rule:\n";
-			$temp .= $offset."    <input type=\"hidden\" name=\"".$id."\" value=\"rule\">\n";
-			$temp .= $offset."   </td>\n";
-			
-			$number = split("_", $id);
-			$number = $number[count($number)-1];
-			
-			$temp .= $offset."   <td>\n";
-			$temp .= $offset."    &nbsp;\n";
-			$temp .= $offset."   </td>\n";
-			$temp .= $offset."  </tr>\n";
-			$temp .= $offset."  <tr>\n";
-			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Name:</td>\n";
-			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_name\" value=\"".htmlspecialchars($this->name)."\"></td>\n";
-			$temp .= $offset."  </tr>\n";
-			$temp .= $offset."  <tr>\n";
-			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Title:</td>\n";
-			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_title\" value=\"".htmlspecialchars($this->title)."\"></td>\n";
-			$temp .= $offset."  </tr>\n";
-			
-			$temp .= $offset."  <tr>\n";
-			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>";
-			$temp .= $offset."	 Filter:";
-			$temp .= $offset."	</td>\n";
-			$temp .= $offset."   <td>\n";
-			$temp .= $offset."    <input type=\"hidden\" name=\"".$id."_filter\" value=\"".htmlspecialchars($this->filter)."\">\n";
-			$temp .= $offset."    	<img src='./img/lightning.png' class='hand' border='0' alt='Filter bearbeiten'";
-			$temp .= "onClick=\"window.open('sld_edit_filter.php?".$urlParameters."&sld_form_element_id=".$id."_filter&sld_objects_rule_id=".$this->id."','editFilter',";
-			$temp .= " 'width=1000, height=800, resizable=yes');\">\n";
-			$temp .= $offset."   </td>\n";
-			$temp .= $offset."  </tr>\n";
-			
-			$temp .= $offset."  <tr>\n";
-			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Minscale:</td>\n";
-			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_minscale\" value=\"".$this->minscaledenominator."\"></td>\n";
-			$temp .= $offset."  </tr>\n";
-			$temp .= $offset."  <tr>\n";
-			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Maxscale:</td>\n";
-			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_maxscale\" value=\"".$this->maxscaledenominator."\"></td>\n";
-			$temp .= $offset."  </tr>\n";
-			$temp .= $offset."  <tr>\n";				
-			$temp .= $offset."   <td>\n";
-			$temp .= $offset."	  <a class='edit' href=\"sld_function_handler.php?function=deleterule&id=".$this->parent."&number=".$number."\">\n";
-			$temp .= $offset."    <img src='./img/minus.gif' border='0' alt='Rule l&ouml;schen'>&nbsp;l&ouml;schen\n";
-			$temp .= $offset."    </a>\n";
-			$temp .= $offset."   </td>\n";
-			$temp .= $offset."   <td>\n";
-			$temp .= $offset."   	&nbsp;";
-			$temp .= $offset."   </td>\n";
-			$temp .= $offset."  </tr>\n";
-			$temp .= $offset." </table>\n";
-			//End Table in first cell
-		
-		$temp .= $offset."</td>\n";
-		$temp .= $offset."<td>\n";
-		$temp .= $offset."-\n";
-		$temp .= $offset."</td>\n";
-
-		
-		$temp .= $offset."<td>\n";
-			//Second cell for the symbolizers and the legendgraphic			
-			// Table1 in second cell
-			$temp .= $offset."<table class='edit_label_bg2' border=\"0\" cellspacing=\"2\" cellpadding=\"1\">\n";
-			$temp .= $offset."<tr>\n";
-			########### -----------> LEGENDGRAPHIC		
-			if ($this->legendgraphic != "")
-			{
-				$temp .= $offset."<td>\n";
-				$temp .= $this->legendgraphic->generateHtmlForm($id."_legendgraphic", $offset." ");
-				$temp .= $offset."</td>\n";
-				$temp .= $offset."</tr>\n";							
-			}
-			else
-			{	
-			$temp .= $offset."<td class='edit_label_bg edit_label_text' width='136'>\n";			
-			$temp .= $offset."LegendGraphic:\n";
-			$temp .= $offset."</td>\n";			
-			$temp .= $offset."<td>\n";						
-			$temp .= $offset."&nbsp;\n";			
-			$temp .= $offset."</td>\n";						
-			$temp .= $offset."</tr>\n";
-			$temp .= $offset."<tr>\n";
-			$temp .= $offset."<td>\n";
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addlegendgraphic&id=".$this->id."\">\n";
-			$temp .= $offset."<img src='./img/plus.gif' border='0' alt='LegendGraphic hinzuf&uuml;gen'>&nbsp;hinzuf&uuml;gen</a>\n";
-			$temp .= $offset."</td>\n";	
-			$temp .= $offset."<td>\n";
-			$temp .= $offset."&nbsp;\n";									
-			$temp .= $offset."</td>\n";														
-			$temp .= $offset."</tr>\n";
-			}
-			$temp .= $offset."</table>\n";
-			//End Table1 in second cell
-			
-		$temp .= $offset."</td>\n";
-		$temp .= $offset."</tr>\n";
-
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset."<td>\n";
-		$temp .= $offset."-\n";
-		$temp .= $offset."</td>\n";
-
-		$temp .= $offset."<td>\n";
-
-			// Table in second cell
-			$temp .= $offset."<table class='edit_label_bg2' border=\"0\" cellspacing=\"2\" cellpadding=\"1\">\n";
-			########### -----------> SYMBOLIZER
-			$temp .= $offset."<tr>\n";
-			$temp .= $offset."<td class='edit_label_bg edit_label_text' valign='top'>\n";
-			$temp .= $offset." <select class=\"edit_label_text\" name=\"".$id."_newsymbolizer\">\n";
-			$temp .= $offset."  <option value=\"textsymbolizer\">Textsymbolizer</option>\n";
-			$temp .= $offset."  <option value=\"polygonsymbolizer\">Polygonsymbolizer</option>\n";
-			$temp .= $offset."  <option value=\"pointsymbolizer\">Pointsymbolizer</option>\n";
-			$temp .= $offset."  <option value=\"rastersymbolizer\">Rastersymbolizer</option>\n";
-			$temp .= $offset."  <option value=\"linesymbolizer\">Linesymbolizer</option>\n";
-			$temp .= $offset." </select>\n";					
-			$temp .= $offset."</td>\n";
-			$temp .= $offset."</tr>\n";
-			$temp .= $offset."<tr>\n";			
-			$temp .= $offset."<td>\n";	
-			$symbolizer_id = 0;
-			foreach ($this->symbolizers as $symbolizer)
-			{
-				$temp .= $symbolizer->generateHtmlForm($id."_symbolizer_".$symbolizer_id, $offset."  ");
-				$symbolizer_id++;
-			}
-			$temp .= $offset."</td>\n";							
-			$temp .= $offset."</tr>\n";
-			$temp .= $offset."<tr>\n";
-			$temp .= $offset."<td valign='bottom'>\n";		
-			$temp .= $offset."<input class=\"edit\" type=\"button\" value=\"hinzuf&uuml;gen\"";
-			//Javascript to make a http request
-			$temp .= " onClick=\"url='sld_function_handler.php?function=addsymbolizer&id=".$this->id."&symbolizer=';";
-			$temp .= " url += ".$id."_newsymbolizer.value;";
-			$temp .= " location.href = url;\"";
-			$temp .= ">\n";
-			$temp .= $offset."</td>\n";
-			$temp .= $offset."</tr>\n";
-			$temp .= $offset."</table>\n";
-			//End Table in second cell
-			
-		$temp .= $offset."</td>\n";													
-		$temp .= $offset."</tr>\n";		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->name = $_REQUEST[$id."_name"];
-		$this->title = $_REQUEST[$id."_title"];
-		
-		$this->filter = $_REQUEST[$id."_filter"];
-		
-		$this->minscaledenominator = $_REQUEST[$id."_minscale"];
-		$this->maxscaledenominator = $_REQUEST[$id."_maxscale"];
-		if (isset($_REQUEST[$id."_legendgraphic"]))
-		{
-			$this->legendgraphic = new LegendGraphic();
-			$this->legendgraphic->generateObjectFromPost($id."_legendgraphic");
-		}
-		$countSymbolizers = 0;
-		while (isset($_REQUEST[$id."_symbolizer_".$countSymbolizers]))
-		{
-			$symbolizer = "";
-			if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "linesymbolizer")
-			{
-				$symbolizer = new LineSymbolizer();
-			}
-			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "polygonsymbolizer")
-			{
-				$symbolizer = new PolygonSymbolizer();
-			}
-			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "pointsymbolizer")
-			{
-				$symbolizer = new PointSymbolizer();
-			}
-			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "textsymbolizer")
-			{
-				$symbolizer = new TextSymbolizer();
-			}
-			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "rastersymbolizer")
-			{
-				$symbolizer = new RasterSymbolizer();
-			}
-			
-			$symbolizer->generateObjectFromPost($id."_symbolizer_".$countSymbolizers);
-			$this->symbolizers[] = $symbolizer;
-			$countSymbolizers++;
-		}
-	}
-	
-	/**
-	 * Function that adds a symbolizer to the symbolizers array.
-	 *
-	 * This function is called from sld_function_handler.php
-	 *
-	 * @param string $symbolizer string containing the type of the symbolizer that has to be added
-	 */
-	function addSymbolizer($symbolizer)
-	{
-		if ($symbolizer == "linesymbolizer")
-		{
-			$this->symbolizers[] = new LineSymbolizer();
-		}
-		else if ($symbolizer == "textsymbolizer")
-		{
-			$this->symbolizers[] = new TextSymbolizer();
-		}
-		else if ($symbolizer == "polygonsymbolizer")
-		{
-			$this->symbolizers[] = new PolygonSymbolizer();
-		}
-		else if ($symbolizer == "rastersymbolizer")
-		{
-			$this->symbolizers[] = new RasterSymbolizer();
-		}
-		else if ($symbolizer == "pointsymbolizer")
-		{
-			$this->symbolizers[] = new PointSymbolizer();
-		}
-	}
-	
-	/**
-	 * Deletes the symbolizer at the given index from the symbolizers array.
-	 *
-	 * This function is called from sld_function_handler.php
-	 *
-	 * @param int $index index of the symbolizer that should be deleted.
-	 */
-	function deleteSymbolizer($index)
-	{
-		array_splice($this->symbolizers, $index, 1);
-	}
+/**
+ * Implementation of the Rule-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Rule extends FeatureTypeStyle
+{
+	/**
+	 * The name attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $name = "";
+	
+	/**
+	 * The title attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $title = "";
+	
+	/**
+	 * The LegendGraphic element from the xml-scheme.
+	 * @see LegendGraphic
+	 * @var object
+	 */
+	var $legendgraphic = "";
+	
+	/**
+	 * The complete filter expression.
+	 *
+	 * The parsing an editing of the filter expressions is not done in the main sld editor.
+	 * This field contains the complete filter expression without any parsing.
+	 * The parsing is done in sld_filter_parse.php using the classes in sld_filter_classes.php.
+	 * Editing is possible in sld_edit_filter.php. This page is opened in a popup-window.
+	 *
+	 * @see sld_filter_classes.php
+	 * @var string
+	 */
+	var $filter = "";
+	
+	/**
+	 * The miscaledenominator attribute from the xml-scheme.
+	 * @var int
+	 */
+	var $minscaledenominator = "";
+	
+	/**
+	 * The maxscaledenominator attribute from the xml-scheme.
+	 * @var int
+	 */
+	var $maxscaledenominator = "";
+	
+	/**
+	 * Array containing the different symbolizers for this rule.
+	 * @var array
+	 */
+	var $symbolizers = array();
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Rule>\n";
+		if ($this->name != "") $temp .= $offset." <Name>".htmlspecialchars($this->name)."</Name>\n";
+		if ($this->title != "") $temp .= $offset." <Title>".htmlspecialchars($this->title)."</Title>\n";
+		if ($this->legendgraphic != "") $temp .= $this->legendgraphic->generateXml($offset." ");
+		
+		if ($this->filter != "") $temp .= $offset." ".$this->filter."\n";
+		if ($this->minscaledenominator != "") $temp .= $offset." <MinScaleDenominator>".htmlspecialchars($this->minscaledenominator)."</MinScaleDenominator>\n";
+		if ($this->maxscaledenominator != "") $temp .= $offset." <MaxScaleDenominator>".htmlspecialchars($this->maxscaledenominator)."</MaxScaleDenominator>\n";
+		foreach($this->symbolizers as $symbolizer)
+		{
+			$temp .= $symbolizer->generateXml($offset." ");
+		}
+		$temp .= $offset."</Rule>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<td rowspan=\"2\" valign='top'>\n";
+		
+			//Table in the first cell for the attributes of this rule
+			###### -----------> Fenster Rule Eigenschaften
+			$temp .= $offset." <table class='edit_label_bg2' border=\"0\" cellspacing=\"2\" cellpadding=\"1\">\n";
+			$temp .= $offset."  <tr>\n";
+			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>\n";
+			$temp .= $offset."    Rule:\n";
+			$temp .= $offset."    <input type=\"hidden\" name=\"".$id."\" value=\"rule\">\n";
+			$temp .= $offset."   </td>\n";
+			
+			$number = split("_", $id);
+			$number = $number[count($number)-1];
+			
+			$temp .= $offset."   <td>\n";
+			$temp .= $offset."    &nbsp;\n";
+			$temp .= $offset."   </td>\n";
+			$temp .= $offset."  </tr>\n";
+			$temp .= $offset."  <tr>\n";
+			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Name:</td>\n";
+			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_name\" value=\"".htmlspecialchars($this->name)."\"></td>\n";
+			$temp .= $offset."  </tr>\n";
+			$temp .= $offset."  <tr>\n";
+			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Title:</td>\n";
+			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_title\" value=\"".htmlspecialchars($this->title)."\"></td>\n";
+			$temp .= $offset."  </tr>\n";
+			
+			$temp .= $offset."  <tr>\n";
+			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>";
+			$temp .= $offset."	 Filter:";
+			$temp .= $offset."	</td>\n";
+			$temp .= $offset."   <td>\n";
+			$temp .= $offset."    <input type=\"hidden\" name=\"".$id."_filter\" value=\"".htmlspecialchars($this->filter)."\">\n";
+			$temp .= $offset."    	<img src='./img/lightning.png' class='hand' border='0' alt='Filter bearbeiten'";
+			$temp .= "onClick=\"window.open('sld_edit_filter.php?".$urlParameters."&sld_form_element_id=".$id."_filter&sld_objects_rule_id=".$this->id."','editFilter',";
+			$temp .= " 'width=1000, height=800, resizable=yes');\">\n";
+			$temp .= $offset."   </td>\n";
+			$temp .= $offset."  </tr>\n";
+			
+			$temp .= $offset."  <tr>\n";
+			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Minscale:</td>\n";
+			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_minscale\" value=\"".$this->minscaledenominator."\"></td>\n";
+			$temp .= $offset."  </tr>\n";
+			$temp .= $offset."  <tr>\n";
+			$temp .= $offset."   <td class='edit_label_bg edit_label_text'>Maxscale:</td>\n";
+			$temp .= $offset."   <td><input class='inputfield edit_label_text' name=\"".$id."_maxscale\" value=\"".$this->maxscaledenominator."\"></td>\n";
+			$temp .= $offset."  </tr>\n";
+			$temp .= $offset."  <tr>\n";				
+			$temp .= $offset."   <td>\n";
+			$temp .= $offset."	  <a class='edit' href=\"sld_function_handler.php?function=deleterule&id=".$this->parent."&number=".$number."\">\n";
+			$temp .= $offset."    <img src='./img/minus.gif' border='0' alt='Rule l&ouml;schen'>&nbsp;l&ouml;schen\n";
+			$temp .= $offset."    </a>\n";
+			$temp .= $offset."   </td>\n";
+			$temp .= $offset."   <td>\n";
+			$temp .= $offset."   	&nbsp;";
+			$temp .= $offset."   </td>\n";
+			$temp .= $offset."  </tr>\n";
+			$temp .= $offset." </table>\n";
+			//End Table in first cell
+		
+		$temp .= $offset."</td>\n";
+		$temp .= $offset."<td>\n";
+		$temp .= $offset."-\n";
+		$temp .= $offset."</td>\n";
+
+		
+		$temp .= $offset."<td>\n";
+			//Second cell for the symbolizers and the legendgraphic			
+			// Table1 in second cell
+			$temp .= $offset."<table class='edit_label_bg2' border=\"0\" cellspacing=\"2\" cellpadding=\"1\">\n";
+			$temp .= $offset."<tr>\n";
+			########### -----------> LEGENDGRAPHIC		
+			if ($this->legendgraphic != "")
+			{
+				$temp .= $offset."<td>\n";
+				$temp .= $this->legendgraphic->generateHtmlForm($id."_legendgraphic", $offset." ");
+				$temp .= $offset."</td>\n";
+				$temp .= $offset."</tr>\n";							
+			}
+			else
+			{	
+			$temp .= $offset."<td class='edit_label_bg edit_label_text' width='136'>\n";			
+			$temp .= $offset."LegendGraphic:\n";
+			$temp .= $offset."</td>\n";			
+			$temp .= $offset."<td>\n";						
+			$temp .= $offset."&nbsp;\n";			
+			$temp .= $offset."</td>\n";						
+			$temp .= $offset."</tr>\n";
+			$temp .= $offset."<tr>\n";
+			$temp .= $offset."<td>\n";
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addlegendgraphic&id=".$this->id."\">\n";
+			$temp .= $offset."<img src='./img/plus.gif' border='0' alt='LegendGraphic hinzuf&uuml;gen'>&nbsp;hinzuf&uuml;gen</a>\n";
+			$temp .= $offset."</td>\n";	
+			$temp .= $offset."<td>\n";
+			$temp .= $offset."&nbsp;\n";									
+			$temp .= $offset."</td>\n";														
+			$temp .= $offset."</tr>\n";
+			}
+			$temp .= $offset."</table>\n";
+			//End Table1 in second cell
+			
+		$temp .= $offset."</td>\n";
+		$temp .= $offset."</tr>\n";
+
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset."<td>\n";
+		$temp .= $offset."-\n";
+		$temp .= $offset."</td>\n";
+
+		$temp .= $offset."<td>\n";
+
+			// Table in second cell
+			$temp .= $offset."<table class='edit_label_bg2' border=\"0\" cellspacing=\"2\" cellpadding=\"1\">\n";
+			########### -----------> SYMBOLIZER
+			$temp .= $offset."<tr>\n";
+			$temp .= $offset."<td class='edit_label_bg edit_label_text' valign='top'>\n";
+			$temp .= $offset." <select class=\"edit_label_text\" name=\"".$id."_newsymbolizer\">\n";
+			$temp .= $offset."  <option value=\"textsymbolizer\">Textsymbolizer</option>\n";
+			$temp .= $offset."  <option value=\"polygonsymbolizer\">Polygonsymbolizer</option>\n";
+			$temp .= $offset."  <option value=\"pointsymbolizer\">Pointsymbolizer</option>\n";
+			$temp .= $offset."  <option value=\"rastersymbolizer\">Rastersymbolizer</option>\n";
+			$temp .= $offset."  <option value=\"linesymbolizer\">Linesymbolizer</option>\n";
+			$temp .= $offset." </select>\n";					
+			$temp .= $offset."</td>\n";
+			$temp .= $offset."</tr>\n";
+			$temp .= $offset."<tr>\n";			
+			$temp .= $offset."<td>\n";	
+			$symbolizer_id = 0;
+			foreach ($this->symbolizers as $symbolizer)
+			{
+				$temp .= $symbolizer->generateHtmlForm($id."_symbolizer_".$symbolizer_id, $offset."  ");
+				$symbolizer_id++;
+			}
+			$temp .= $offset."</td>\n";							
+			$temp .= $offset."</tr>\n";
+			$temp .= $offset."<tr>\n";
+			$temp .= $offset."<td valign='bottom'>\n";		
+			$temp .= $offset."<input class=\"edit\" type=\"button\" value=\"hinzuf&uuml;gen\"";
+			//Javascript to make a http request
+			$temp .= " onClick=\"url='sld_function_handler.php?function=addsymbolizer&id=".$this->id."&symbolizer=';";
+			$temp .= " url += ".$id."_newsymbolizer.value;";
+			$temp .= " location.href = url;\"";
+			$temp .= ">\n";
+			$temp .= $offset."</td>\n";
+			$temp .= $offset."</tr>\n";
+			$temp .= $offset."</table>\n";
+			//End Table in second cell
+			
+		$temp .= $offset."</td>\n";													
+		$temp .= $offset."</tr>\n";		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->name = $_REQUEST[$id."_name"];
+		$this->title = $_REQUEST[$id."_title"];
+		
+		$this->filter = $_REQUEST[$id."_filter"];
+		
+		$this->minscaledenominator = $_REQUEST[$id."_minscale"];
+		$this->maxscaledenominator = $_REQUEST[$id."_maxscale"];
+		if (isset($_REQUEST[$id."_legendgraphic"]))
+		{
+			$this->legendgraphic = new LegendGraphic();
+			$this->legendgraphic->generateObjectFromPost($id."_legendgraphic");
+		}
+		$countSymbolizers = 0;
+		while (isset($_REQUEST[$id."_symbolizer_".$countSymbolizers]))
+		{
+			$symbolizer = "";
+			if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "linesymbolizer")
+			{
+				$symbolizer = new LineSymbolizer();
+			}
+			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "polygonsymbolizer")
+			{
+				$symbolizer = new PolygonSymbolizer();
+			}
+			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "pointsymbolizer")
+			{
+				$symbolizer = new PointSymbolizer();
+			}
+			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "textsymbolizer")
+			{
+				$symbolizer = new TextSymbolizer();
+			}
+			else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "rastersymbolizer")
+			{
+				$symbolizer = new RasterSymbolizer();
+			}
+			
+			$symbolizer->generateObjectFromPost($id."_symbolizer_".$countSymbolizers);
+			$this->symbolizers[] = $symbolizer;
+			$countSymbolizers++;
+		}
+	}
+	
+	/**
+	 * Function that adds a symbolizer to the symbolizers array.
+	 *
+	 * This function is called from sld_function_handler.php
+	 *
+	 * @param string $symbolizer string containing the type of the symbolizer that has to be added
+	 */
+	function addSymbolizer($symbolizer)
+	{
+		if ($symbolizer == "linesymbolizer")
+		{
+			$this->symbolizers[] = new LineSymbolizer();
+		}
+		else if ($symbolizer == "textsymbolizer")
+		{
+			$this->symbolizers[] = new TextSymbolizer();
+		}
+		else if ($symbolizer == "polygonsymbolizer")
+		{
+			$this->symbolizers[] = new PolygonSymbolizer();
+		}
+		else if ($symbolizer == "rastersymbolizer")
+		{
+			$this->symbolizers[] = new RasterSymbolizer();
+		}
+		else if ($symbolizer == "pointsymbolizer")
+		{
+			$this->symbolizers[] = new PointSymbolizer();
+		}
+	}
+	
+	/**
+	 * Deletes the symbolizer at the given index from the symbolizers array.
+	 *
+	 * This function is called from sld_function_handler.php
+	 *
+	 * @param int $index index of the symbolizer that should be deleted.
+	 */
+	function deleteSymbolizer($index)
+	{
+		array_splice($this->symbolizers, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/Stroke.php
===================================================================
--- branches/print_dev/http/sld/classes/Stroke.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/Stroke.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,202 +1,202 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the Stroke-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class Stroke
-{
-	//choice
-	//GraphicFill and GraphicStroke are not supported by Mapserver
-	//var $graphicfill = "";
-	//var $graphicstroke = "";
-	//end choice
-	
-	/**
-	 * Array containing the CssParameter objects from the xml-scheme.
-	 *
-	 * @see CssParameter
-	 * @var array
-	 */
-	var $cssparameters = array();
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<Stroke>\n";
-		//if ($this->graphicfill != "") $temp .= $this->graphicfill->generateXml($offset." ");
-		//if ($this->graphicstroke != "") $temp .= $this->graphicstroke->generateXml($offset." ");
-		foreach ($this->cssparameters as $cssparameter)
-		{
-			$temp .= $cssparameter->generateXml($offset." ");
-		}
-		$temp .= $offset."</Stroke>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = $offset."<hr class=\"sep\">\n";
-		$temp .= $offset."<table>\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."  <td style=\"width: 100px;\">\n";
-		$temp .= $offset."   Stroke<br>\n";
-		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"stroke\">\n";
-		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletestroke&id=".$this->parent."\">l&ouml;schen</a>\n";
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td valign=\"top\">\n";
-
-//		if ($this->graphicfill == "" && $this->graphicstroke == "")
-//		{
-//			//Add new Graphicfill or Graphicstroke TODO!!!
-//			$temp .= $offset."<select name=\"".$id."_newgraphicfillorgraphicstroke\">\n";
-//			$temp .= $offset."<option value=\"graphicfill\">GraphicFill</option>\n";
-//			$temp .= $offset."<option value=\"graphicstroke\">GraphicStroke</option>\n";
-//			$temp .= $offset."</select>\n";
-//			$temp .= $offset."<input type=\"button\" value=\"GraphicFill oder GraphicStroke hinzuf&uuml;gen\"";
-//			$temp .= $offset." onClick=\"url='sld_function_handler.php?function=addgraphicfillorgraphicstroke&id=".$id."&graphicfillorgraphicstroke=';";
-//			$temp .= $offset." url += ".$id."_newgraphicfillorgraphicstroke.value;";
-//			$temp .= $offset." location.href = url;\"";
-//			$temp .= $offset."><br>\n";
-//		}
-//		else if ($this->graphicfill != "")
-//		{
-//			$this->graphicfill->generateHtmlForm($id."_graphicfill");
-//		}
-//		else if ($this->graphicstroke != "")
-//		{
-//			$this->graphicstroke->generateHtmlForm($id."_graphicstroke");
-//		}
-		
-
-		$cssparameter_id = 0;
-		foreach ($this->cssparameters as $cssparameter)
-		{
-			$temp .= $cssparameter->generateHtmlForm($id."_cssparameter_".$cssparameter_id, $offset."      ");
-			$cssparameter_id++;
-		}
-
-		
-		$temp .= $offset."      <select name=\"".$id."_newcssparameter\">\n";
-		//Some of the options are not supported by Mapserver
-		$temp .= $offset."       <option value=\"stroke\">stroke</option>\n";
-		$temp .= $offset."       <option value=\"stroke-width\">stroke-width</option>\n";
-		$temp .= $offset."       <option value=\"stroke-dasharray\">stroke-dasharray</option>\n";
-		$temp .= $offset."      </select>\n";
-
-		
-		$temp .= $offset."      <input type=\"button\" value=\"hinzuf&uuml;gen\"";
-		//Javascript to make a http request
-		$temp .= " onClick=\"url='sld_function_handler.php?function=addcssparameter&id=".$this->id."&cssparameter=';";
-		$temp .= " url += ".$id."_newcssparameter.value;";
-		$temp .= " location.href = url;\"";
-		$temp .= ">\n";
-
-
-
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-//		if (isset($_REQUEST[$id."_graphicfill"]))
-//		{
-//			$this->graphicfill = new GraphicFill();
-//			$this->graphicfill->generateObjectFromPost($id."_graphicfill");
-//		}
-//		if (isset($_REQUEST[$id."_graphicstroke"]))
-//		{
-//			$this->graphicstroke = new GraphicStroke();
-//			$this->graphicstroke->generateObjectFromPost($id."_graphicstroke");
-//		}
-		$countCssParameters = 0;
-		while (isset($_REQUEST[$id."_cssparameter_".$countCssParameters]))
-		{
-			$cssParameter = new CssParameter();
-			$cssParameter->generateObjectFromPost($id."_cssparameter_".$countCssParameters);
-			$this->cssparameters[] = $cssParameter;
-			$countCssParameters++;
-		}
-	}
-	
-	/**
-	 * Adds a new CssParameter to the array.
-	 * @param string $cssParameter name attribute of the CssParameter that has to be created.
-	 */
-	function addCssParameter($cssParameter)
-	{
-		$newCssParameter = new CssParameter();
-		$newCssParameter->name = $cssParameter;
-		$this->cssparameters[] = $newCssParameter;
-	}
-	
-	/**
-	 * Deletes a CssParameter from the array at the given index.
-	 * @param int $index index of the CssParameter that has to be deleted.
-	 */
-	function deleteCssParameter($index)
-	{
-		array_splice($this->cssparameters, $index, 1);
-	}
+/**
+ * Implementation of the Stroke-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class Stroke
+{
+	//choice
+	//GraphicFill and GraphicStroke are not supported by Mapserver
+	//var $graphicfill = "";
+	//var $graphicstroke = "";
+	//end choice
+	
+	/**
+	 * Array containing the CssParameter objects from the xml-scheme.
+	 *
+	 * @see CssParameter
+	 * @var array
+	 */
+	var $cssparameters = array();
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<Stroke>\n";
+		//if ($this->graphicfill != "") $temp .= $this->graphicfill->generateXml($offset." ");
+		//if ($this->graphicstroke != "") $temp .= $this->graphicstroke->generateXml($offset." ");
+		foreach ($this->cssparameters as $cssparameter)
+		{
+			$temp .= $cssparameter->generateXml($offset." ");
+		}
+		$temp .= $offset."</Stroke>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = $offset."<hr class=\"sep\">\n";
+		$temp .= $offset."<table>\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."  <td style=\"width: 100px;\">\n";
+		$temp .= $offset."   Stroke<br>\n";
+		$temp .= $offset."   <input type=\"hidden\" name=\"".$id."\" value=\"stroke\">\n";
+		$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=deletestroke&id=".$this->parent."\">l&ouml;schen</a>\n";
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td valign=\"top\">\n";
+
+//		if ($this->graphicfill == "" && $this->graphicstroke == "")
+//		{
+//			//Add new Graphicfill or Graphicstroke TODO!!!
+//			$temp .= $offset."<select name=\"".$id."_newgraphicfillorgraphicstroke\">\n";
+//			$temp .= $offset."<option value=\"graphicfill\">GraphicFill</option>\n";
+//			$temp .= $offset."<option value=\"graphicstroke\">GraphicStroke</option>\n";
+//			$temp .= $offset."</select>\n";
+//			$temp .= $offset."<input type=\"button\" value=\"GraphicFill oder GraphicStroke hinzuf&uuml;gen\"";
+//			$temp .= $offset." onClick=\"url='sld_function_handler.php?function=addgraphicfillorgraphicstroke&id=".$id."&graphicfillorgraphicstroke=';";
+//			$temp .= $offset." url += ".$id."_newgraphicfillorgraphicstroke.value;";
+//			$temp .= $offset." location.href = url;\"";
+//			$temp .= $offset."><br>\n";
+//		}
+//		else if ($this->graphicfill != "")
+//		{
+//			$this->graphicfill->generateHtmlForm($id."_graphicfill");
+//		}
+//		else if ($this->graphicstroke != "")
+//		{
+//			$this->graphicstroke->generateHtmlForm($id."_graphicstroke");
+//		}
+		
+
+		$cssparameter_id = 0;
+		foreach ($this->cssparameters as $cssparameter)
+		{
+			$temp .= $cssparameter->generateHtmlForm($id."_cssparameter_".$cssparameter_id, $offset."      ");
+			$cssparameter_id++;
+		}
+
+		
+		$temp .= $offset."      <select name=\"".$id."_newcssparameter\">\n";
+		//Some of the options are not supported by Mapserver
+		$temp .= $offset."       <option value=\"stroke\">stroke</option>\n";
+		$temp .= $offset."       <option value=\"stroke-width\">stroke-width</option>\n";
+		$temp .= $offset."       <option value=\"stroke-dasharray\">stroke-dasharray</option>\n";
+		$temp .= $offset."      </select>\n";
+
+		
+		$temp .= $offset."      <input type=\"button\" value=\"hinzuf&uuml;gen\"";
+		//Javascript to make a http request
+		$temp .= " onClick=\"url='sld_function_handler.php?function=addcssparameter&id=".$this->id."&cssparameter=';";
+		$temp .= " url += ".$id."_newcssparameter.value;";
+		$temp .= " location.href = url;\"";
+		$temp .= ">\n";
+
+
+
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+//		if (isset($_REQUEST[$id."_graphicfill"]))
+//		{
+//			$this->graphicfill = new GraphicFill();
+//			$this->graphicfill->generateObjectFromPost($id."_graphicfill");
+//		}
+//		if (isset($_REQUEST[$id."_graphicstroke"]))
+//		{
+//			$this->graphicstroke = new GraphicStroke();
+//			$this->graphicstroke->generateObjectFromPost($id."_graphicstroke");
+//		}
+		$countCssParameters = 0;
+		while (isset($_REQUEST[$id."_cssparameter_".$countCssParameters]))
+		{
+			$cssParameter = new CssParameter();
+			$cssParameter->generateObjectFromPost($id."_cssparameter_".$countCssParameters);
+			$this->cssparameters[] = $cssParameter;
+			$countCssParameters++;
+		}
+	}
+	
+	/**
+	 * Adds a new CssParameter to the array.
+	 * @param string $cssParameter name attribute of the CssParameter that has to be created.
+	 */
+	function addCssParameter($cssParameter)
+	{
+		$newCssParameter = new CssParameter();
+		$newCssParameter->name = $cssParameter;
+		$this->cssparameters[] = $newCssParameter;
+	}
+	
+	/**
+	 * Deletes a CssParameter from the array at the given index.
+	 * @param int $index index of the CssParameter that has to be deleted.
+	 */
+	function deleteCssParameter($index)
+	{
+		array_splice($this->cssparameters, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/StyledLayerDescriptor.php
===================================================================
--- branches/print_dev/http/sld/classes/StyledLayerDescriptor.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/StyledLayerDescriptor.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,212 +1,212 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-/**
- * This file contains the class definitions for the sld-editor.
- *
- * This class is the implementation of the StyledLayerDescriptor-element of the sld-xml-scheme.
- * This element builds up the root of every sld-document.
- * This class is directly referred to in the sld_main.php.
- *
- * @package sld_classes
- * @author Markus Krzyzanowski, Design for all HTML-output by Bao Ngan
- */
-class StyledLayerDescriptor
-{
-	/**
-	 * The name attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $name = "";
-	/**
-	 * The title attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $title = "";
-	/**
-	 * The abstract attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $abstract = "";
-	/**
-	 * Array containing the layers of the sld.
-	 * @see NamedLayer
-	 * @var array
-	 */
-	var $layers = array();
-	/**
-	 * The version attribute from the xml-scheme.
-	 * @var string
-	 */
-	var $version = "";
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * Generates the sld-document as an xml-string and returns it.
-	 *
-	 * Calls the generateXml-function of its child objects.
-	 * This object only has layers as childs, all other child-elements of
-	 * StyledLayerDescriptor are modelled as primitive datatypes
-	 * 
-	 * @param string $offset string that should be added at the beginning
-	 * of every line of xml that is being created. Should only contain
-	 * a number of whitespaces to format the output and provide a
-	 * good readability.
-	 *
-	 * @return string the created sld-document
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<StyledLayerDescriptor";
-		if ($this->version != "") $temp .= " version=\"".htmlspecialchars($this->version)."\"";
-		$temp .= " xsi:schemaLocation=\"http://www.opengis.net/sld StyledLayerDescriptor.xsd\"";
-		$temp .= " xmlns=\"http://www.opengis.net/sld\"";
-		$temp .= " xmlns:ogc=\"http://www.opengis.net/ogc\""; 
-		$temp .= " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
-		$temp .= " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
-		$temp .= ">\n";
-		if ($this->name != "") $temp .= $offset." <Name>".htmlspecialchars($this->name)."</Name>\n";
-		if ($this->title != "") $temp .= $offset." <Title>".htmlspecialchars($this->title)."</Title>\n";
-		if ($this->abstract != "") $temp .= $offset." <Abstract>".htmlspecialchars($this->abstract)."</Abstract>\n";
-
-		
-		foreach($this->layers as $layer)
-		{
-			$temp .= $layer->generateXml($offset." ");
-		}
-		$temp .= $offset."</StyledLayerDescriptor>\n";
-		return $temp;
-	}
-	
-	
-	/**
-	 * Generates a html-form-fragment
-	 * that contains form-elements (e.g. input) for every member of this class.
-	 * Some of these are hidden fields and so they are not editable by the user.
-	 * The reason for this is that some values should not be changed (such as the layer name)
-	 * or they are to complicated for end-users that are not familiar to the sld-xml-scheme.
-	 * 
-	 * Calls the generateHtmlForm-function of its child objects.
-	 *
-	 * @param string $id string identifying the form-elements belonging to this object
-	 * @param string $offset string for formatting the output
-	 * @return string the created html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		//Commented out, because these options should not be changed by the end user
-		//$temp .= $offset."<table style=\"border: 1px solid black\">\n";
-		//$temp .= $offset."<tr>\n";
-		//$temp .= $offset."<td>Name:</td>\n";
-		//$temp .= $offset."<td><input name=\"name\" value=\"".$this->name."\"></td>\n";
-		//$temp .= $offset."</tr>\n";
-		//$temp .= $offset."<tr>\n";
-		//$temp .= $offset."<td>Title:</td>\n";
-		//$temp .= $offset."<td><input name=\"title\" value=\"".$this->title."\"></td>\n";
-		//$temp .= $offset."</tr>\n";
-		//$temp .= $offset."<tr>\n";
-		//$temp .= $offset."<td>Abstract:</td>\n";
-		//$temp .= $offset."<td><input name=\"abstract\" value=\"".$this->abstract."\"></td>\n";
-		//$temp .= $offset."</tr>\n";
-		//$temp .= $offset."<tr>\n";
-		//$temp .= $offset."<td>Version:</td>\n";
-		//$temp .= $offset."<td><input name=\"version\" value=\"".$this->version."\"></td>\n";
-		//$temp .= $offset."</tr>\n";
-		//$temp .= $offset."</table>\n";
-		//$temp .= $offset."<br>\n";
-		
-		//Hidden fields to hold the values
-		$temp .= $offset."<input type=\"hidden\" name=\"name\" value=\"".htmlspecialchars($this->name)."\">\n";
-		$temp .= $offset."<input type=\"hidden\" name=\"title\" value=\"".htmlspecialchars($this->title)."\">\n";
-		$temp .= $offset."<input type=\"hidden\" name=\"abstract\" value=\"".htmlspecialchars($this->abstract)."\">\n";
-		$temp .= $offset."<input type=\"hidden\" name=\"version\" value=\"".htmlspecialchars($this->version)."\">\n";
-		
-		$layer_id = 0;
-		foreach ($this->layers as $layer)
-		{
-			$temp .= $layer->generateHtmlForm("layer_".$layer_id, $offset." ");
-			$layer_id++;
-		}
-		return $temp;
-	}
-	
-	/**
-	 * Populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 * this parameter has no use for this object, because it is only called without a value
-	 * in other classes this parameter should have the same value, that was used in
-	 * generateHtmlForm(...) for the $id to create the html-form
-	 *
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->version = $_REQUEST[$id."version"];
-		$this->name = $_REQUEST[$id."name"];
-		$this->title = $_REQUEST[$id."title"];
-		$this->abstract = $_REQUEST[$id."abstract"];
-		$countLayers = 0;
-		while (isset($_REQUEST[$id."layer_".$countLayers]))
-		{
-			if ($_REQUEST[$id."layer_".$countLayers] == "namedlayer")
-			{
-				$layer = new NamedLayer();
-			}
-			else
-			{
-				//Todo evtl: userlayer erstellen
-				$layer = new NamedLayer();
-			}
-			$layer->generateObjectFromPost($id."layer_".$countLayers);
-			$this->layers[] = $layer;
-			$countLayers++;
-		}
-	}
-}
-
-/**
- * Loads classes by name
- * 
- * If the php interpreter finds a class that is needed in a module or class 
- * and it is not yet included via include, then it tries to load this class 
- * with the given name in the current context. No need for includes ... 
- * 
- * @param string $class_name
- */
-function __autoload($class_name) {
-	if (file_exists(dirname(__FILE__). "/{$class_name}.php"))
-    	require_once $class_name . '.php';
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
+
+/**
+ * This file contains the class definitions for the sld-editor.
+ *
+ * This class is the implementation of the StyledLayerDescriptor-element of the sld-xml-scheme.
+ * This element builds up the root of every sld-document.
+ * This class is directly referred to in the sld_main.php.
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski, Design for all HTML-output by Bao Ngan
+ */
+class StyledLayerDescriptor
+{
+	/**
+	 * The name attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $name = "";
+	/**
+	 * The title attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $title = "";
+	/**
+	 * The abstract attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $abstract = "";
+	/**
+	 * Array containing the layers of the sld.
+	 * @see NamedLayer
+	 * @var array
+	 */
+	var $layers = array();
+	/**
+	 * The version attribute from the xml-scheme.
+	 * @var string
+	 */
+	var $version = "";
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * Generates the sld-document as an xml-string and returns it.
+	 *
+	 * Calls the generateXml-function of its child objects.
+	 * This object only has layers as childs, all other child-elements of
+	 * StyledLayerDescriptor are modelled as primitive datatypes
+	 * 
+	 * @param string $offset string that should be added at the beginning
+	 * of every line of xml that is being created. Should only contain
+	 * a number of whitespaces to format the output and provide a
+	 * good readability.
+	 *
+	 * @return string the created sld-document
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<StyledLayerDescriptor";
+		if ($this->version != "") $temp .= " version=\"".htmlspecialchars($this->version)."\"";
+		$temp .= " xsi:schemaLocation=\"http://www.opengis.net/sld StyledLayerDescriptor.xsd\"";
+		$temp .= " xmlns=\"http://www.opengis.net/sld\"";
+		$temp .= " xmlns:ogc=\"http://www.opengis.net/ogc\""; 
+		$temp .= " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
+		$temp .= " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
+		$temp .= ">\n";
+		if ($this->name != "") $temp .= $offset." <Name>".htmlspecialchars($this->name)."</Name>\n";
+		if ($this->title != "") $temp .= $offset." <Title>".htmlspecialchars($this->title)."</Title>\n";
+		if ($this->abstract != "") $temp .= $offset." <Abstract>".htmlspecialchars($this->abstract)."</Abstract>\n";
+
+		
+		foreach($this->layers as $layer)
+		{
+			$temp .= $layer->generateXml($offset." ");
+		}
+		$temp .= $offset."</StyledLayerDescriptor>\n";
+		return $temp;
+	}
+	
+	
+	/**
+	 * Generates a html-form-fragment
+	 * that contains form-elements (e.g. input) for every member of this class.
+	 * Some of these are hidden fields and so they are not editable by the user.
+	 * The reason for this is that some values should not be changed (such as the layer name)
+	 * or they are to complicated for end-users that are not familiar to the sld-xml-scheme.
+	 * 
+	 * Calls the generateHtmlForm-function of its child objects.
+	 *
+	 * @param string $id string identifying the form-elements belonging to this object
+	 * @param string $offset string for formatting the output
+	 * @return string the created html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		//Commented out, because these options should not be changed by the end user
+		//$temp .= $offset."<table style=\"border: 1px solid black\">\n";
+		//$temp .= $offset."<tr>\n";
+		//$temp .= $offset."<td>Name:</td>\n";
+		//$temp .= $offset."<td><input name=\"name\" value=\"".$this->name."\"></td>\n";
+		//$temp .= $offset."</tr>\n";
+		//$temp .= $offset."<tr>\n";
+		//$temp .= $offset."<td>Title:</td>\n";
+		//$temp .= $offset."<td><input name=\"title\" value=\"".$this->title."\"></td>\n";
+		//$temp .= $offset."</tr>\n";
+		//$temp .= $offset."<tr>\n";
+		//$temp .= $offset."<td>Abstract:</td>\n";
+		//$temp .= $offset."<td><input name=\"abstract\" value=\"".$this->abstract."\"></td>\n";
+		//$temp .= $offset."</tr>\n";
+		//$temp .= $offset."<tr>\n";
+		//$temp .= $offset."<td>Version:</td>\n";
+		//$temp .= $offset."<td><input name=\"version\" value=\"".$this->version."\"></td>\n";
+		//$temp .= $offset."</tr>\n";
+		//$temp .= $offset."</table>\n";
+		//$temp .= $offset."<br>\n";
+		
+		//Hidden fields to hold the values
+		$temp .= $offset."<input type=\"hidden\" name=\"name\" value=\"".htmlspecialchars($this->name)."\">\n";
+		$temp .= $offset."<input type=\"hidden\" name=\"title\" value=\"".htmlspecialchars($this->title)."\">\n";
+		$temp .= $offset."<input type=\"hidden\" name=\"abstract\" value=\"".htmlspecialchars($this->abstract)."\">\n";
+		$temp .= $offset."<input type=\"hidden\" name=\"version\" value=\"".htmlspecialchars($this->version)."\">\n";
+		
+		$layer_id = 0;
+		foreach ($this->layers as $layer)
+		{
+			$temp .= $layer->generateHtmlForm("layer_".$layer_id, $offset." ");
+			$layer_id++;
+		}
+		return $temp;
+	}
+	
+	/**
+	 * Populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 * this parameter has no use for this object, because it is only called without a value
+	 * in other classes this parameter should have the same value, that was used in
+	 * generateHtmlForm(...) for the $id to create the html-form
+	 *
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->version = $_REQUEST[$id."version"];
+		$this->name = $_REQUEST[$id."name"];
+		$this->title = $_REQUEST[$id."title"];
+		$this->abstract = $_REQUEST[$id."abstract"];
+		$countLayers = 0;
+		while (isset($_REQUEST[$id."layer_".$countLayers]))
+		{
+			if ($_REQUEST[$id."layer_".$countLayers] == "namedlayer")
+			{
+				$layer = new NamedLayer();
+			}
+			else
+			{
+				//Todo evtl: userlayer erstellen
+				$layer = new NamedLayer();
+			}
+			$layer->generateObjectFromPost($id."layer_".$countLayers);
+			$this->layers[] = $layer;
+			$countLayers++;
+		}
+	}
+}
+
+/**
+ * Loads classes by name
+ * 
+ * If the php interpreter finds a class that is needed in a module or class 
+ * and it is not yet included via include, then it tries to load this class 
+ * with the given name in the current context. No need for includes ... 
+ * 
+ * @param string $class_name
+ */
+function __autoload($class_name) {
+	if (file_exists(dirname(__FILE__). "/{$class_name}.php"))
+    	require_once $class_name . '.php';
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/TextSymbolizer.php
===================================================================
--- branches/print_dev/http/sld/classes/TextSymbolizer.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/TextSymbolizer.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,224 +1,224 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the TextSymbolizer-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class TextSymbolizer extends Rule
-{
-	/**
-	 * The Label element from the xml-scheme.
-	 * This element is not implemented as an object.
-	 * Although it is an object, we'll use a workaround ...
-	 * <Label>Townname: <ogc:PropertyValue>NAME</ogc:PropertyValue></Label> should be possible
-	 *
-	 * @var object
-	 */
-	var $label = "";
-	
-	/**
-	 * The Font object from the xml-scheme.
-	 *
-	 * @see Font
-	 * @var object
-	 */
-	var $font = "";
-	
-	/**
-	 * The Labelplacement object from the xml-scheme.
-	 *
-	 * @see LabelPlacement
-	 * @var object
-	 */
-	var $labelplacement = "";
-	
-	//Halo is not supported by Mapserver
-	var $halo = "";
-	
-	//Fill is not supported by Mapserver - only solid color
-	var $fill = "";
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	
-	function TextSymbolizer()
-	{
-		//$this->label = new ParameterValue();
-		//$this->labelplacement = new LabelPlacement();
-		//$this->fill = new Fill();
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<TextSymbolizer>\n";
-		#if ($this->label != "") $temp .= $offset." <Label>".htmlspecialchars($this->label)."</Label>\n";
-		if ($this->label != "") $temp .= $offset." <Label>".$this->label->generateXml()."</Label>\n";
-		if ($this->font != "") $temp .= $this->font->generateXml($offset." ");
-		if ($this->labelplacement != "") $temp .= $this->labelplacement->generateXml($offset." ");
-		if ($this->halo != "") $temp .= $this->halo->generateXml($offset." ");
-		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
-		$temp .= $offset."</TextSymbolizer>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset= "")
-	{
-		$temp = "";
-		$label_value = "";
-		$temp .= $offset."<table bgcolor=\"#FFFFFF\" cellspacing='2' cellpadding='0' style=\"border: 1px solid black; width:100%;\">\n";
-		$temp .= $offset." <tr valign=\"top\">\n";
-		$temp .= $offset."   <td class='text' style=\"width: 130px;\">\n";
-		$temp .= $offset."    TextSymbolizer<br>\n";
-		$temp .= $offset."    <input type=\"hidden\" name=\"".$id."\" value=\"textsymbolizer\">\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		
-		$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
-		
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset."  <td>\n";
-		
-		$temp .= $offset."   <table>";
-		$temp .= $offset."    <tr>\n";
-		$temp .= $offset."     <td style=\"width: 100px\">\n";
-		$temp .= $offset."      Label:\n";
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."     <td>\n";
-		$temp .= $offset."      <input name=\"".$id."_label\" id=\"".$id."_label\" value=\"";
-		if ($this->label != "")
-			$label_value = $this->label->generateHtmlForm($id."_label","");
-			$temp .= $label_value;
-		$temp .= "\">\n";
-		//experimental
-		$temp_elements = $_SESSION["sld_objects"][3]->generateElementsHtml($id."_label",$label_value);
-		$temp .= $offset.$temp_elements;
-		$temp .= $offset."     </td>\n";
-		$temp .= $offset."    </tr>\n";
-		$temp .= $offset."   </table>\n";
-
-		if ($this->font != "")
-		{
-			$temp .= $this->font->generateHtmlForm($id."_font", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addfont&id=".$this->id."\">Font hinzuf&uuml;gen</a><br>\n";
-		}
-		if ($this->labelplacement != "")
-		{
-			$temp .= $this->labelplacement->generateHtmlForm($id."_labelplacement", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addlabelplacement&id=".$this->id."\">Labelplacement hinzuf&uuml;gen</a><br>\n";
-		}
-		//Halo is not supported - removed from source
-		if ($this->halo != "")
-		{
-			$temp .= $this->halo->generateHtmlForm($id."_halo", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addhalo&id=".$this->id."\">Halo hinzuf&uuml;gen</a><br>\n";
-		}
-		
-		if ($this->fill != "")
-		{
-			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
-		}
-		$temp .= $offset."  </td>\n";
-		$temp .= $offset." </tr>\n";
-		$temp .= $offset."</table>\n";
-		$temp .= $offset."<br>\n";		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		if (isset($_REQUEST[$id."_label"]))
-		{
-			$this->label = new ParameterValue();
-			$this->label->value = $_REQUEST[$id."_label"];
-		}
-		if (isset($_REQUEST[$id."_font"]))
-		{
-			$this->font = new Font();
-			$this->font->generateObjectFromPost($id."_font");
-		}
-		if (isset($_REQUEST[$id."_labelplacement"]))
-		{
-			$this->labelplacement = new LabelPlacement();
-			$this->labelplacement->generateObjectFromPost($id."_labelplacement");
-		}
-		if (isset($_REQUEST[$id."_halo"]))
-		{
-			$this->halo = new Halo();
-			$this->halo->generateObjectFromPost($id."_halo");
-		}
-		if (isset($_REQUEST[$id."_fill"]))
-		{
-			$this->fill = new Fill();
-			$this->fill->generateObjectFromPost($id."_fill");
-		}
-	}
+/**
+ * Implementation of the TextSymbolizer-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class TextSymbolizer extends Rule
+{
+	/**
+	 * The Label element from the xml-scheme.
+	 * This element is not implemented as an object.
+	 * Although it is an object, we'll use a workaround ...
+	 * <Label>Townname: <ogc:PropertyValue>NAME</ogc:PropertyValue></Label> should be possible
+	 *
+	 * @var object
+	 */
+	var $label = "";
+	
+	/**
+	 * The Font object from the xml-scheme.
+	 *
+	 * @see Font
+	 * @var object
+	 */
+	var $font = "";
+	
+	/**
+	 * The Labelplacement object from the xml-scheme.
+	 *
+	 * @see LabelPlacement
+	 * @var object
+	 */
+	var $labelplacement = "";
+	
+	//Halo is not supported by Mapserver
+	var $halo = "";
+	
+	//Fill is not supported by Mapserver - only solid color
+	var $fill = "";
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	
+	function TextSymbolizer()
+	{
+		//$this->label = new ParameterValue();
+		//$this->labelplacement = new LabelPlacement();
+		//$this->fill = new Fill();
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<TextSymbolizer>\n";
+		#if ($this->label != "") $temp .= $offset." <Label>".htmlspecialchars($this->label)."</Label>\n";
+		if ($this->label != "") $temp .= $offset." <Label>".$this->label->generateXml()."</Label>\n";
+		if ($this->font != "") $temp .= $this->font->generateXml($offset." ");
+		if ($this->labelplacement != "") $temp .= $this->labelplacement->generateXml($offset." ");
+		if ($this->halo != "") $temp .= $this->halo->generateXml($offset." ");
+		if ($this->fill != "") $temp .= $this->fill->generateXml($offset." ");
+		$temp .= $offset."</TextSymbolizer>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset= "")
+	{
+		$temp = "";
+		$label_value = "";
+		$temp .= $offset."<table bgcolor=\"#FFFFFF\" cellspacing='2' cellpadding='0' style=\"border: 1px solid black; width:100%;\">\n";
+		$temp .= $offset." <tr valign=\"top\">\n";
+		$temp .= $offset."   <td class='text' style=\"width: 130px;\">\n";
+		$temp .= $offset."    TextSymbolizer<br>\n";
+		$temp .= $offset."    <input type=\"hidden\" name=\"".$id."\" value=\"textsymbolizer\">\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		
+		$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=deletesymbolizer&id=".$this->parent."&number=".$number."\">l&ouml;schen</a>\n";
+		
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset."  <td>\n";
+		
+		$temp .= $offset."   <table>";
+		$temp .= $offset."    <tr>\n";
+		$temp .= $offset."     <td style=\"width: 100px\">\n";
+		$temp .= $offset."      Label:\n";
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."     <td>\n";
+		$temp .= $offset."      <input name=\"".$id."_label\" id=\"".$id."_label\" value=\"";
+		if ($this->label != "")
+			$label_value = $this->label->generateHtmlForm($id."_label","");
+			$temp .= $label_value;
+		$temp .= "\">\n";
+		//experimental
+		$temp_elements = $_SESSION["sld_objects"][3]->generateElementsHtml($id."_label",$label_value);
+		$temp .= $offset.$temp_elements;
+		$temp .= $offset."     </td>\n";
+		$temp .= $offset."    </tr>\n";
+		$temp .= $offset."   </table>\n";
+
+		if ($this->font != "")
+		{
+			$temp .= $this->font->generateHtmlForm($id."_font", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addfont&id=".$this->id."\">Font hinzuf&uuml;gen</a><br>\n";
+		}
+		if ($this->labelplacement != "")
+		{
+			$temp .= $this->labelplacement->generateHtmlForm($id."_labelplacement", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."<a class='edit' href=\"sld_function_handler.php?function=addlabelplacement&id=".$this->id."\">Labelplacement hinzuf&uuml;gen</a><br>\n";
+		}
+		//Halo is not supported - removed from source
+		if ($this->halo != "")
+		{
+			$temp .= $this->halo->generateHtmlForm($id."_halo", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addhalo&id=".$this->id."\">Halo hinzuf&uuml;gen</a><br>\n";
+		}
+		
+		if ($this->fill != "")
+		{
+			$temp .= $this->fill->generateHtmlForm($id."_fill", $offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."   <a class='edit' href=\"sld_function_handler.php?function=addfill&id=".$this->id."\">Fill hinzuf&uuml;gen</a><br>\n";
+		}
+		$temp .= $offset."  </td>\n";
+		$temp .= $offset." </tr>\n";
+		$temp .= $offset."</table>\n";
+		$temp .= $offset."<br>\n";		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		if (isset($_REQUEST[$id."_label"]))
+		{
+			$this->label = new ParameterValue();
+			$this->label->value = $_REQUEST[$id."_label"];
+		}
+		if (isset($_REQUEST[$id."_font"]))
+		{
+			$this->font = new Font();
+			$this->font->generateObjectFromPost($id."_font");
+		}
+		if (isset($_REQUEST[$id."_labelplacement"]))
+		{
+			$this->labelplacement = new LabelPlacement();
+			$this->labelplacement->generateObjectFromPost($id."_labelplacement");
+		}
+		if (isset($_REQUEST[$id."_halo"]))
+		{
+			$this->halo = new Halo();
+			$this->halo->generateObjectFromPost($id."_halo");
+		}
+		if (isset($_REQUEST[$id."_fill"]))
+		{
+			$this->fill = new Fill();
+			$this->fill->generateObjectFromPost($id."_fill");
+		}
+	}
 }
-?>
+?>

Modified: branches/print_dev/http/sld/classes/UnaryLogicOp.php
===================================================================
--- branches/print_dev/http/sld/classes/UnaryLogicOp.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/UnaryLogicOp.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,191 +1,191 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the UnaryLogicOp-element
- *
- * @package filter_classes
- * @author Markus Krzyzanowski
- */
-class UnaryLogicOp
-{
-	/**
-	 * Defines the type of logical operation.
-	 * Possible value: not
-	 * @var string
-	 */
-	var $name = "";
-	
-	/**
-	 * Array containing the operations of this filter
-	 * @see UnaryLogicOp
-	 * @see BinaryLogicOp
-	 * @see BinaryComparisonOp
-	 * @see PropertyIsLike
-	 * @see PropertyIsNull
-	 * @see PropertyIsBetween
-	 * @var array
-	 */
-	var $operations = array();
-	
-	/**
-	 * Index of this object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	
-	/**
-	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * constructor tha directly fills the $name variable
-	 * @param string $name the type of this logical operation
-	 */
-	function UnaryLogicOp($name)
-	{
-		$this->name = $name;
-	}
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<".$this->name.">\n";
-		foreach($this->operations as $operation)
-		{
-			$temp .= $operation->generateXml($offset." ");
-		}
-		$temp .= $offset."</".$this->name.">\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id = "", $offset = "")
-	{
-		$temp = "";
-		
-		$temp .= $offset."<tr>\n";
-		$temp .= $offset." <td>\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"unaryLogicOp\">\n";
-		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."_name\" value=\"".$this->name."\">\n";
-		$temp .= $offset."  ".$this->name."<br>\n";
-		
-		$number = split("_", $id);
-		$number = $number[count($number)-1];
-		$temp .= $offset."   <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
-		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
-				
-		$temp .= $offset." </td>\n";
-		$temp .= $offset." <td colspan=\"3\" valign=\"top\">\n";
-		//Only 1 operation
-		if (count($this->operations) < 1)
-		{
-			$addOperationModule = new AddOperationModule($this->id, $id);
-			$temp .= $addOperationModule->generateHtmlForm($offset."   ");
-		}
-		else
-		{
-			$temp .= $offset."  <table>\n";
-			$displayOperationModule = new DisplayOperationModule();
-			$temp .= $displayOperationModule->generateHtmlForm($offset."   ", $this->operations, $id);
-			$temp .= $offset."  </table>\n";
-		}
-		
-		$temp .= $offset." </td>\n";
-		$temp .= $offset."</tr>\n";
-		
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$this->name = $_REQUEST[$id."_name"];
-		$countOperations = 0;
-		while (isset($_REQUEST[$id."_operation_".$countOperations]))
-		{
-			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryComparisonOp")
-			{
-				$operation = new BinaryComparisonOp();
-			}
-//			if ($_REQUEST[$id."_operation_".$countOperations] == "unaryComparisonOp")
-//			{
-//				$operation = new UnaryComparisonOp();
-//			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryLogicOp")
-			{
-				$operation = new BinaryLogicOp();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "unaryLogicOp")
-			{
-				$operation = new UnaryLogicOp();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsLike")
-			{
-				$operation = new PropertyIsLike();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsNull")
-			{
-				$operation = new PropertyIsNull();
-			}
-			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsBetween")
-			{
-				$operation = new PropertyIsBetween();
-			}
-			$operation->generateObjectFromPost($id."_operation_".$countOperations);
-			$this->operations[] = $operation;
-			$countOperations++;
-		}
-	}
-	
-	/**
-	 * deletes the rule with the given index from the $operations array
-	 * @param int $index index of the operation that has to be deleted
-	 */
-	function deleteOperation($index)
-	{
-		array_splice($this->operations, $index, 1);
-	}
+/**
+ * Implementation of the UnaryLogicOp-element
+ *
+ * @package filter_classes
+ * @author Markus Krzyzanowski
+ */
+class UnaryLogicOp
+{
+	/**
+	 * Defines the type of logical operation.
+	 * Possible value: not
+	 * @var string
+	 */
+	var $name = "";
+	
+	/**
+	 * Array containing the operations of this filter
+	 * @see UnaryLogicOp
+	 * @see BinaryLogicOp
+	 * @see BinaryComparisonOp
+	 * @see PropertyIsLike
+	 * @see PropertyIsNull
+	 * @see PropertyIsBetween
+	 * @var array
+	 */
+	var $operations = array();
+	
+	/**
+	 * Index of this object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	
+	/**
+	 * Index of this object's parent object in the $_SESSION("sld_filter_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * constructor tha directly fills the $name variable
+	 * @param string $name the type of this logical operation
+	 */
+	function UnaryLogicOp($name)
+	{
+		$this->name = $name;
+	}
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<".$this->name.">\n";
+		foreach($this->operations as $operation)
+		{
+			$temp .= $operation->generateXml($offset." ");
+		}
+		$temp .= $offset."</".$this->name.">\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id = "", $offset = "")
+	{
+		$temp = "";
+		
+		$temp .= $offset."<tr>\n";
+		$temp .= $offset." <td>\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."\" value=\"unaryLogicOp\">\n";
+		$temp .= $offset."  <input type=\"hidden\" name=\"".$id."_name\" value=\"".$this->name."\">\n";
+		$temp .= $offset."  ".$this->name."<br>\n";
+		
+		$number = split("_", $id);
+		$number = $number[count($number)-1];
+		$temp .= $offset."   <a class=\"edit\" href=\"?function=deleteoperation&id=".$this->parent."&number=".$number."\">";
+		$temp .= "<img src='./img/minus.gif' border='0'>&nbsp;l&ouml;schen</a>\n";
+				
+		$temp .= $offset." </td>\n";
+		$temp .= $offset." <td colspan=\"3\" valign=\"top\">\n";
+		//Only 1 operation
+		if (count($this->operations) < 1)
+		{
+			$addOperationModule = new AddOperationModule($this->id, $id);
+			$temp .= $addOperationModule->generateHtmlForm($offset."   ");
+		}
+		else
+		{
+			$temp .= $offset."  <table>\n";
+			$displayOperationModule = new DisplayOperationModule();
+			$temp .= $displayOperationModule->generateHtmlForm($offset."   ", $this->operations, $id);
+			$temp .= $offset."  </table>\n";
+		}
+		
+		$temp .= $offset." </td>\n";
+		$temp .= $offset."</tr>\n";
+		
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$this->name = $_REQUEST[$id."_name"];
+		$countOperations = 0;
+		while (isset($_REQUEST[$id."_operation_".$countOperations]))
+		{
+			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryComparisonOp")
+			{
+				$operation = new BinaryComparisonOp();
+			}
+//			if ($_REQUEST[$id."_operation_".$countOperations] == "unaryComparisonOp")
+//			{
+//				$operation = new UnaryComparisonOp();
+//			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "binaryLogicOp")
+			{
+				$operation = new BinaryLogicOp();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "unaryLogicOp")
+			{
+				$operation = new UnaryLogicOp();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsLike")
+			{
+				$operation = new PropertyIsLike();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsNull")
+			{
+				$operation = new PropertyIsNull();
+			}
+			if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsBetween")
+			{
+				$operation = new PropertyIsBetween();
+			}
+			$operation->generateObjectFromPost($id."_operation_".$countOperations);
+			$this->operations[] = $operation;
+			$countOperations++;
+		}
+	}
+	
+	/**
+	 * deletes the rule with the given index from the $operations array
+	 * @param int $index index of the operation that has to be deleted
+	 */
+	function deleteOperation($index)
+	{
+		array_splice($this->operations, $index, 1);
+	}
 }
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/classes/UserStyle.php
===================================================================
--- branches/print_dev/http/sld/classes/UserStyle.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/classes/UserStyle.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,110 +1,110 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
 
-/**
- * Implementation of the UserStyle-element
- *
- * @package sld_classes
- * @author Markus Krzyzanowski
- */
-class UserStyle extends NamedLayer
-{
-	/**
-	 * Array containing the FeatureTypeStyle-objects.
-	 *
-	 * @see FeatureTypeStyle
-	 * @var string
-	 */
-	var $featuretypestyles = array();
-	
-	/**
-	 * Index identifying the object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $id = "";
-	/**
-	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
-	 * @var int
-	 */
-	var $parent = "";
-	
-	/**
-	 * creates the xml for this object and its child objects
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the xml-fragment
-	 */
-	function generateXml($offset = "")
-	{
-		$temp = $offset."<UserStyle>\n";
-		foreach($this->featuretypestyles as $style)
-		{
-			$temp .= $style->generateXml($offset." ");
-		}
-		$temp .= $offset."</UserStyle>\n";
-		return $temp;
-	}
-	
-	/**
-	 * creates the html-form-fragment for this object
-	 *
-	 * @param $id string containing a prefix that should be used to identify this
-	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
-	 * function can address the fields belonging to this object in the http-post.
-	 *
-	 * @param string $offset string used for formatting the output
-	 * @return string containing the html-form-fragment
-	 */
-	function generateHtmlForm($id, $offset = "")
-	{
-		$temp = "";
-		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"userstyle\">\n";
-		$featuretypestyle_id = 0;
-		foreach ($this->featuretypestyles as $featuretypestyle)
-		{
-			$temp .= $featuretypestyle->generateHtmlForm($id."_featuretypestyle_".$featuretypestyle_id, $offset);
-			$featuretypestyle_id++;
-		}
-		return $temp;
-	}
-	
-	/**
-	 * populates the member fields of a new object from the data in the http-post-request
-	 * to rebuild the object after the submission of the html-form.
-	 *
-	 * creates its own child objects from the post parameters and calls their
-	 * generateObjectFromPost(...) function
-	 *
-	 * @param string $id string that contains a prefix for the html-form-fields
-	 * that is common to all of the fields belonging to this object
-	 */
-	function generateObjectFromPost($id = "")
-	{
-		$countFeatureTypeStyles = 0;
-		while (isset($_REQUEST[$id."_featuretypestyle_".$countFeatureTypeStyles]))
-		{
-			$featuretypestyle = new FeatureTypeStyle();
-			$featuretypestyle->generateObjectFromPost($id."_featuretypestyle_".$countFeatureTypeStyles);
-			$this->featuretypestyles[] = $featuretypestyle;
-			$countFeatureTypeStyles++;
-		}
-	}
-}
+/**
+ * Implementation of the UserStyle-element
+ *
+ * @package sld_classes
+ * @author Markus Krzyzanowski
+ */
+class UserStyle extends NamedLayer
+{
+	/**
+	 * Array containing the FeatureTypeStyle-objects.
+	 *
+	 * @see FeatureTypeStyle
+	 * @var string
+	 */
+	var $featuretypestyles = array();
+	
+	/**
+	 * Index identifying the object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $id = "";
+	/**
+	 * Index identifying the object's parent object in the $_SESSION("sld_objects") array.
+	 * @var int
+	 */
+	var $parent = "";
+	
+	/**
+	 * creates the xml for this object and its child objects
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the xml-fragment
+	 */
+	function generateXml($offset = "")
+	{
+		$temp = $offset."<UserStyle>\n";
+		foreach($this->featuretypestyles as $style)
+		{
+			$temp .= $style->generateXml($offset." ");
+		}
+		$temp .= $offset."</UserStyle>\n";
+		return $temp;
+	}
+	
+	/**
+	 * creates the html-form-fragment for this object
+	 *
+	 * @param $id string containing a prefix that should be used to identify this
+	 * object's html fields. This must be done, so that the generateObjectFromPost(...)
+	 * function can address the fields belonging to this object in the http-post.
+	 *
+	 * @param string $offset string used for formatting the output
+	 * @return string containing the html-form-fragment
+	 */
+	function generateHtmlForm($id, $offset = "")
+	{
+		$temp = "";
+		$temp .= $offset."<input type=\"hidden\" name=\"".$id."\" value=\"userstyle\">\n";
+		$featuretypestyle_id = 0;
+		foreach ($this->featuretypestyles as $featuretypestyle)
+		{
+			$temp .= $featuretypestyle->generateHtmlForm($id."_featuretypestyle_".$featuretypestyle_id, $offset);
+			$featuretypestyle_id++;
+		}
+		return $temp;
+	}
+	
+	/**
+	 * populates the member fields of a new object from the data in the http-post-request
+	 * to rebuild the object after the submission of the html-form.
+	 *
+	 * creates its own child objects from the post parameters and calls their
+	 * generateObjectFromPost(...) function
+	 *
+	 * @param string $id string that contains a prefix for the html-form-fields
+	 * that is common to all of the fields belonging to this object
+	 */
+	function generateObjectFromPost($id = "")
+	{
+		$countFeatureTypeStyles = 0;
+		while (isset($_REQUEST[$id."_featuretypestyle_".$countFeatureTypeStyles]))
+		{
+			$featuretypestyle = new FeatureTypeStyle();
+			$featuretypestyle->generateObjectFromPost($id."_featuretypestyle_".$countFeatureTypeStyles);
+			$this->featuretypestyles[] = $featuretypestyle;
+			$countFeatureTypeStyles++;
+		}
+	}
+}
 
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/sld_config.php
===================================================================
--- branches/print_dev/http/sld/sld_config.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_config.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,77 +1,77 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-/**
- * This file contains some global configuration variables for the sld-editor
- *
- * @package sld_config
- * @author Markus Krzyzanowski
- */
-
-include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-include_once(dirname(__FILE__)."/sld_parse.php");
-
-// this should come from mapbender.conf
-$SLD_MAIN = "sld_main.php?".$urlParameters;
-$SLD_FUNCTION_HANDLER = "sld_function_handler.php?".$urlParameters;
-$MAPBENDER_URL = "http://".$_SERVER["HTTP_HOST"].dirname($_SERVER['PHP_SELF']);
-
-function char_encode($s){
-	if(CHARSET == 'UTF-8'){
-		$s = utf8_encode($s);
-	}
-	return $s;
-}
-
-if (isset($_REQUEST["sld_wms_id"]) && isset($_REQUEST["sld_gui_id"]))
-{
-	$_SESSION["sld_wms_id"] = $_REQUEST["sld_wms_id"];
-	$_SESSION["sld_gui_id"] = $_REQUEST["sld_gui_id"];
-}
-
-if (isset($_REQUEST["sld_layer_name"]))
-{
-	$_SESSION["sld_layer_name"] = $_REQUEST["sld_layer_name"];
-}
-
-if (isset($_SESSION["sld_wms_id"]) && isset($_SESSION["sld_layer_name"]))
-{
-	$layer_name = $_SESSION["sld_layer_name"];
-	$wms_id = $_SESSION["sld_wms_id"];
-
-	//Read from DB
-	require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-	$con = db_connect($DBSERVER,$OWNER,$PW);
-	db_select_db($DB,$con);
-	$sql = "SELECT * FROM wms WHERE wms_id = $1"; 
-	$v = array($wms_id);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	
-	$mapfileUrl = "";
-	if ( db_fetch_row($res, 0) )
-	{
-		$mapfileUrl = db_result($res, 0, "wms_getmap");
-		//echo $mapfileUrl;
-	}
-	
-}
-
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
+
+/**
+ * This file contains some global configuration variables for the sld-editor
+ *
+ * @package sld_config
+ * @author Markus Krzyzanowski
+ */
+
+include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include_once(dirname(__FILE__)."/sld_parse.php");
+
+// this should come from mapbender.conf
+$SLD_MAIN = "sld_main.php?".$urlParameters;
+$SLD_FUNCTION_HANDLER = "sld_function_handler.php?".$urlParameters;
+$MAPBENDER_URL = "http://".$_SERVER["HTTP_HOST"].dirname($_SERVER['PHP_SELF']);
+
+function char_encode($s){
+	if(CHARSET == 'UTF-8'){
+		$s = utf8_encode($s);
+	}
+	return $s;
+}
+
+if (isset($_REQUEST["sld_wms_id"]) && isset($_REQUEST["sld_gui_id"]))
+{
+	$_SESSION["sld_wms_id"] = $_REQUEST["sld_wms_id"];
+	$_SESSION["sld_gui_id"] = $_REQUEST["sld_gui_id"];
+}
+
+if (isset($_REQUEST["sld_layer_name"]))
+{
+	$_SESSION["sld_layer_name"] = $_REQUEST["sld_layer_name"];
+}
+
+if (isset($_SESSION["sld_wms_id"]) && isset($_SESSION["sld_layer_name"]))
+{
+	$layer_name = $_SESSION["sld_layer_name"];
+	$wms_id = $_SESSION["sld_wms_id"];
+
+	//Read from DB
+	require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+	$con = db_connect($DBSERVER,$OWNER,$PW);
+	db_select_db($DB,$con);
+	$sql = "SELECT * FROM wms WHERE wms_id = $1"; 
+	$v = array($wms_id);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	
+	$mapfileUrl = "";
+	if ( db_fetch_row($res, 0) )
+	{
+		$mapfileUrl = db_result($res, 0, "wms_getmap");
+		//echo $mapfileUrl;
+	}
+	
+}
+
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/sld_edit_filter.php
===================================================================
--- branches/print_dev/http/sld/sld_edit_filter.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_edit_filter.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,275 +1,275 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD/
-# 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.
-
-/**
- * This file contains the source of the filter-expression-editor-module.
- * This was separated from the sld-editor's parsing and functionhandling
- * due to readability reasons.
- * Contains all the source for displaying the form and the functionhandling.
- *
- * @package filter_editor
- * @author Markus Krzyzanowski
- */
-
-
-
-
-include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
-require_once(dirname(__FILE__)."/sld_config.php");
-include_once(dirname(__FILE__)."/sld_filter_parse.php");
-
-//get the neccessary variables from the request or from the session
-//if from request set up the session variables
-
-$sld_objects = $_SESSION["sld_objects"];
-
-if ( isset($_REQUEST["sld_form_element_id"]) && isset($_REQUEST["sld_objects_rule_id"]) )
-{
-	$first_load = 1;
-	$sld_form_element_id = $_REQUEST["sld_form_element_id"];
-	$_SESSION["sld_form_element_id"] = $sld_form_element_id;
-	
-	$sld_objects_rule_id = $_REQUEST["sld_objects_rule_id"];
-	$_SESSION["sld_objects_rule_id"] = $sld_objects_rule_id;
-	
-	$filter = $sld_objects[$sld_objects_rule_id]->filter;
-	$_SESSION["sld_filter"] = $filter;
-}
-else
-{
-	$first_load = 0;
-	$sld_form_element_id = $_SESSION["sld_form_element_id"];
-	$sld_objects_rule_id = $_SESSION["sld_objects_rule_id"];
-	$filter = $_SESSION["sld_filter"];
-}
-
-//Parse the Filter Expression
-$filterObj = parseFilter($filter);
-if ($filterObj == "")
-{
-	//$filterObj = new Filter();
-}
-
-
-
-//Function handling
-if (isset($_REQUEST["function"]))
-{
-	$function = $_REQUEST["function"];
-	//Handle the requested functions
-	if ($function == "addoperation")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_REQUEST["operation"]) )
-		{
-			$operation = $_REQUEST["operation"];
-			
-			switch(strtoupper($operation))
-			{
-				case "OR":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryLogicOp("Or");
-					break;
-				case "AND":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryLogicOp("And");
-					break;
-				case "NOT":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new UnaryLogicOp("Not");
-					break;
-				case "PROPERTYISEQUALTO":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsEqualTo");
-					break;
-				case "PROPERTYISNOTEQUALTO":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsNotEqualTo");
-					break;
-				case "PROPERTYISGREATERTHAN":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsGreaterThan");
-					break;
-				case "PROPERTYISGREATERTHANOREQUALTO":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsGreaterThanOrEqualTo");
-					break;
-				case "PROPERTYISLESSTHAN":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsLessThan");
-					break;
-				case "PROPERTYISLESSTHANOREQUALTO":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsLessThanOrEqualTo");
-					break;
-				case "PROPERTYISLIKE":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new PropertyIsLike();
-					break;
-				case "PROPERTYISNULL":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new PropertyIsNull();
-					break;
-				case "PROPERTYISBETWEEN":
-					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new PropertyIsBetween();
-					break;
-			}
-			$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
-		}
-	}
-	else if ($function == "deleteoperation")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_REQUEST["number"]) )
-		{
-			$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->deleteOperation($_REQUEST["number"]);
-			$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
-		}
-	}
-	else if ($function == "addfilter")
-	{
-		if ( isset($_REQUEST["type"]) )
-		{
-			if ($_REQUEST["type"] == "filter")
-			{
-				$_SESSION["sld_filter_objects"][0] = new Filter();
-				$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
-			}
-			else if ($_REQUEST["type"] == "elsefilter")
-			{
-				$_SESSION["sld_filter_objects"][0] = new ElseFilter();
-				$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
-			}
-		}
-	}
-	else if ($function == "deletefilter")
-	{
-		$_SESSION["sld_filter_objects"][0] = "";
-		$_SESSION["sld_filter"] = "";
-	}
-	else if ($function == "save")
-	{
-		if( isset($_REQUEST["filter"]) )
-		{
-			$filter = new Filter();
-			$filter->generateObjectFromPost();
-			$_SESSION["sld_filter"] = $filter->generateXml();
-		}
-		else if( isset($_REQUEST["elsefilter"]) )
-		{
-			$filter = new ElseFilter();
-			$_SESSION["sld_filter"] = $filter->generateXml();
-		}
-		else
-		{
-			$_SESSION["sld_filter"] = "";
-		}
-	}
-	else
-	{
-		echo "Die Funktion: ".$function." wird nicht unterst�tzt.";
-		exit();
-	}
-	
-	
-	header("Location: sld_edit_filter.php?".$urlParameters);
-	exit();
-}
-else
-{
-	//Write the new filter expression to the sld objects
-	if ($filterObj != "")
-	{
-		$sld_objects[$sld_objects_rule_id]->filter = $filterObj->generateXml();
-	}
-	else
-	{
-		$sld_objects[$sld_objects_rule_id]->filter = "";
-	}
-	//display the html form
-	echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
-        echo "<html>\n";
-        echo "<head>\n";
-        echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
-        echo "<meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">\n";
-        echo "<META HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO-CACHE\">\n";
-	echo "<title>Filter-Editor</title>\n";
-	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/sldEditor.css\">\n";
-	echo "<script Language=\"JavaScript\">\n";
-	
-	//write the filter expression into the hidden field in the sld editor on load automatically
-	echo "function setFilter()\n";
-	echo "{\n";
-	echo "var filter = document.getElementById(\"filter_textarea\").value;\n";
-	echo "window.opener.document.getElementById(\"sld_editor_form\").".$sld_form_element_id.".value = filter;\n";
-	echo "//window.opener.document.getElementById(\"sld_editor_form\").submit();\n";
-	echo "}\n";
-	
-	echo "function updateFilter()\n";
-	echo "{\n";
-	echo "//var filter = document.getElementById(\"filter_textarea\").value;\n";
-	echo "//window.opener.document.getElementById(\"sld_editor_form\").".$sld_form_element_id.".value = filter;\n";
-	echo "window.opener.document.getElementById(\"sld_editor_form\").submit();\n";
-	echo "}\n";	
-	
-	echo "</script>\n";
-	echo "</head>\n";
-	echo "<body";
-	if ($first_load != 1) echo " onLoad=\"setFilter();\"";
-	echo ">\n";
-	
-	echo "<form name=\"editFilter\" action=\"sld_edit_filter.php?".$urlParameters."\" method=\"post\">\n";
-	
-	echo "<table cellspacing=\"0\" cellpadding=\"0\">\n";
-	echo "<tr align=\"center\"><td class=\"bg2 text3\">Filter bearbeiten</td></tr>\n";
-	echo "<tr><td class=\"line_left2 line_down2 line_right2 bg text1\">\n";
-	
-	if ($filterObj != "")
-	{
-		echo "<input type=\"hidden\" name=\"function\" value=\"save\">\n";
-		echo $filterObj->generateHtmlForm();
-		echo "<input class=\"edit hand\" type=\"submit\" value=\"Aktualisieren\">\n";
-		echo "<input class=\"edit hand\" type=\"button\" value=\"&Auml;nderungen speichern\" onclick=\"updateFilter()\">\n";
-		
-	}
-	else
-	{
-		echo "Filter oder ElseFilter?<br>";
-		echo "<input type=\"radio\" name=\"type\" value=\"filter\" onClick=\"submit()\">Filter<br>\n";
-		echo "<input type=\"radio\" name=\"type\" value=\"elsefilter\" onClick=\"submit()\">ElseFilter<br>\n";
-		echo "<input type=\"hidden\" name=\"function\" value=\"addfilter\">\n";
-	}
-	echo "</td></tr>\n";
-	
-	echo "<tr><td>&nbsp;</td></tr>\n";
-	
-	echo "<tr align=\"center\"><td class=\"bg2 text3\">Vorschau</td></tr>\n";
-	echo "<tr><td class=\"line_left2 line_down2 line_right2 bg text1\">\n";
-	
-	if ($filterObj != "")
-	{
-		echo "<pre>\n";
-		echo htmlspecialchars($filterObj->generateXml());
-		print_r ($_SESSION["sld_filter_objects"]);
-		echo "</pre>\n";
-		echo "<textarea  id=\"filter_textarea\" style=\"visibility:hidden;\">\n";
-		echo htmlspecialchars($filterObj->generateXml());
-		echo "</textarea>\n";
-	}
-	else
-	{
-		echo "&nbsp;\n";
-	}
-	
-	echo "</td></tr>\n";
-	echo "</table>\n";
-	echo "</form>\n";
-	
-	echo "</body>\n";
-	echo "</html>";
-
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD/
+# 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.
+
+/**
+ * This file contains the source of the filter-expression-editor-module.
+ * This was separated from the sld-editor's parsing and functionhandling
+ * due to readability reasons.
+ * Contains all the source for displaying the form and the functionhandling.
+ *
+ * @package filter_editor
+ * @author Markus Krzyzanowski
+ */
+
+
+
+
+include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
+require_once(dirname(__FILE__)."/sld_config.php");
+include_once(dirname(__FILE__)."/sld_filter_parse.php");
+
+//get the neccessary variables from the request or from the session
+//if from request set up the session variables
+
+$sld_objects = $_SESSION["sld_objects"];
+
+if ( isset($_REQUEST["sld_form_element_id"]) && isset($_REQUEST["sld_objects_rule_id"]) )
+{
+	$first_load = 1;
+	$sld_form_element_id = $_REQUEST["sld_form_element_id"];
+	$_SESSION["sld_form_element_id"] = $sld_form_element_id;
+	
+	$sld_objects_rule_id = $_REQUEST["sld_objects_rule_id"];
+	$_SESSION["sld_objects_rule_id"] = $sld_objects_rule_id;
+	
+	$filter = $sld_objects[$sld_objects_rule_id]->filter;
+	$_SESSION["sld_filter"] = $filter;
+}
+else
+{
+	$first_load = 0;
+	$sld_form_element_id = $_SESSION["sld_form_element_id"];
+	$sld_objects_rule_id = $_SESSION["sld_objects_rule_id"];
+	$filter = $_SESSION["sld_filter"];
+}
+
+//Parse the Filter Expression
+$filterObj = parseFilter($filter);
+if ($filterObj == "")
+{
+	//$filterObj = new Filter();
+}
+
+
+
+//Function handling
+if (isset($_REQUEST["function"]))
+{
+	$function = $_REQUEST["function"];
+	//Handle the requested functions
+	if ($function == "addoperation")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_REQUEST["operation"]) )
+		{
+			$operation = $_REQUEST["operation"];
+			
+			switch(strtoupper($operation))
+			{
+				case "OR":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryLogicOp("Or");
+					break;
+				case "AND":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryLogicOp("And");
+					break;
+				case "NOT":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new UnaryLogicOp("Not");
+					break;
+				case "PROPERTYISEQUALTO":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsEqualTo");
+					break;
+				case "PROPERTYISNOTEQUALTO":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsNotEqualTo");
+					break;
+				case "PROPERTYISGREATERTHAN":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsGreaterThan");
+					break;
+				case "PROPERTYISGREATERTHANOREQUALTO":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsGreaterThanOrEqualTo");
+					break;
+				case "PROPERTYISLESSTHAN":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsLessThan");
+					break;
+				case "PROPERTYISLESSTHANOREQUALTO":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new BinaryComparisonOp("PropertyIsLessThanOrEqualTo");
+					break;
+				case "PROPERTYISLIKE":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new PropertyIsLike();
+					break;
+				case "PROPERTYISNULL":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new PropertyIsNull();
+					break;
+				case "PROPERTYISBETWEEN":
+					$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->operations[] = new PropertyIsBetween();
+					break;
+			}
+			$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
+		}
+	}
+	else if ($function == "deleteoperation")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_REQUEST["number"]) )
+		{
+			$_SESSION["sld_filter_objects"][$_REQUEST["id"]]->deleteOperation($_REQUEST["number"]);
+			$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
+		}
+	}
+	else if ($function == "addfilter")
+	{
+		if ( isset($_REQUEST["type"]) )
+		{
+			if ($_REQUEST["type"] == "filter")
+			{
+				$_SESSION["sld_filter_objects"][0] = new Filter();
+				$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
+			}
+			else if ($_REQUEST["type"] == "elsefilter")
+			{
+				$_SESSION["sld_filter_objects"][0] = new ElseFilter();
+				$_SESSION["sld_filter"] = $_SESSION["sld_filter_objects"][0]->generateXml();
+			}
+		}
+	}
+	else if ($function == "deletefilter")
+	{
+		$_SESSION["sld_filter_objects"][0] = "";
+		$_SESSION["sld_filter"] = "";
+	}
+	else if ($function == "save")
+	{
+		if( isset($_REQUEST["filter"]) )
+		{
+			$filter = new Filter();
+			$filter->generateObjectFromPost();
+			$_SESSION["sld_filter"] = $filter->generateXml();
+		}
+		else if( isset($_REQUEST["elsefilter"]) )
+		{
+			$filter = new ElseFilter();
+			$_SESSION["sld_filter"] = $filter->generateXml();
+		}
+		else
+		{
+			$_SESSION["sld_filter"] = "";
+		}
+	}
+	else
+	{
+		echo "Die Funktion: ".$function." wird nicht unterst�tzt.";
+		exit();
+	}
+	
+	
+	header("Location: sld_edit_filter.php?".$urlParameters);
+	exit();
+}
+else
+{
+	//Write the new filter expression to the sld objects
+	if ($filterObj != "")
+	{
+		$sld_objects[$sld_objects_rule_id]->filter = $filterObj->generateXml();
+	}
+	else
+	{
+		$sld_objects[$sld_objects_rule_id]->filter = "";
+	}
+	//display the html form
+	echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
+        echo "<html>\n";
+        echo "<head>\n";
+        echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
+        echo "<meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">\n";
+        echo "<META HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO-CACHE\">\n";
+	echo "<title>Filter-Editor</title>\n";
+	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/sldEditor.css\">\n";
+	echo "<script Language=\"JavaScript\">\n";
+	
+	//write the filter expression into the hidden field in the sld editor on load automatically
+	echo "function setFilter()\n";
+	echo "{\n";
+	echo "var filter = document.getElementById(\"filter_textarea\").value;\n";
+	echo "window.opener.document.getElementById(\"sld_editor_form\").".$sld_form_element_id.".value = filter;\n";
+	echo "//window.opener.document.getElementById(\"sld_editor_form\").submit();\n";
+	echo "}\n";
+	
+	echo "function updateFilter()\n";
+	echo "{\n";
+	echo "//var filter = document.getElementById(\"filter_textarea\").value;\n";
+	echo "//window.opener.document.getElementById(\"sld_editor_form\").".$sld_form_element_id.".value = filter;\n";
+	echo "window.opener.document.getElementById(\"sld_editor_form\").submit();\n";
+	echo "}\n";	
+	
+	echo "</script>\n";
+	echo "</head>\n";
+	echo "<body";
+	if ($first_load != 1) echo " onLoad=\"setFilter();\"";
+	echo ">\n";
+	
+	echo "<form name=\"editFilter\" action=\"sld_edit_filter.php?".$urlParameters."\" method=\"post\">\n";
+	
+	echo "<table cellspacing=\"0\" cellpadding=\"0\">\n";
+	echo "<tr align=\"center\"><td class=\"bg2 text3\">Filter bearbeiten</td></tr>\n";
+	echo "<tr><td class=\"line_left2 line_down2 line_right2 bg text1\">\n";
+	
+	if ($filterObj != "")
+	{
+		echo "<input type=\"hidden\" name=\"function\" value=\"save\">\n";
+		echo $filterObj->generateHtmlForm();
+		echo "<input class=\"edit hand\" type=\"submit\" value=\"Aktualisieren\">\n";
+		echo "<input class=\"edit hand\" type=\"button\" value=\"&Auml;nderungen speichern\" onclick=\"updateFilter()\">\n";
+		
+	}
+	else
+	{
+		echo "Filter oder ElseFilter?<br>";
+		echo "<input type=\"radio\" name=\"type\" value=\"filter\" onClick=\"submit()\">Filter<br>\n";
+		echo "<input type=\"radio\" name=\"type\" value=\"elsefilter\" onClick=\"submit()\">ElseFilter<br>\n";
+		echo "<input type=\"hidden\" name=\"function\" value=\"addfilter\">\n";
+	}
+	echo "</td></tr>\n";
+	
+	echo "<tr><td>&nbsp;</td></tr>\n";
+	
+	echo "<tr align=\"center\"><td class=\"bg2 text3\">Vorschau</td></tr>\n";
+	echo "<tr><td class=\"line_left2 line_down2 line_right2 bg text1\">\n";
+	
+	if ($filterObj != "")
+	{
+		echo "<pre>\n";
+		echo htmlspecialchars($filterObj->generateXml());
+		print_r ($_SESSION["sld_filter_objects"]);
+		echo "</pre>\n";
+		echo "<textarea  id=\"filter_textarea\" style=\"visibility:hidden;\">\n";
+		echo htmlspecialchars($filterObj->generateXml());
+		echo "</textarea>\n";
+	}
+	else
+	{
+		echo "&nbsp;\n";
+	}
+	
+	echo "</td></tr>\n";
+	echo "</table>\n";
+	echo "</form>\n";
+	
+	echo "</body>\n";
+	echo "</html>";
+
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/sld_filter_parse.php
===================================================================
--- branches/print_dev/http/sld/sld_filter_parse.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_filter_parse.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,369 +1,369 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD/
-# 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.
-
-/**
- * This file parses the filter expressions and creates the corresponding objects.
- *
- * @package filter_editor
- * @author Markus Krzyzanowski
- */
-
-
-
-include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-/**
- * Parses a given filter expression and creates the object structure.
- * @param string $data filter expression that has to be parsed
- * @return Filter root object of the filter expression
- */
-function parseFilter($data)
-{
-	$xml_parser = xml_parser_create_ns();
-	xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
-	xml_parse_into_struct($xml_parser, $data, $vals, $index);
-	xml_parser_free($xml_parser);
-	
-	
-	$filter;
-	$parent = array();
-	$objects = array();
-	$parentactual = 0;
-	
-	for ($i=0; $i<count($vals); $i++)
-	{
-		$element = $vals[$i];
-		$tag = $element["tag"];
-		$tagname=strtoupper($tag);
-		switch($tagname)
-		{
-			case "FILTER":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = false;
-					$parentactual = 0;
-					$filter = new Filter();
-					$filter->id = 0;
-					$filter->parent = false;
-					$objects[] = &$filter;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = false;
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "ELSEFILTER":
-				if ($element["type"] == "complete")
-				{
-					$parent[] = false;
-					$parentactual = 0;
-					$filter = new ElseFilter();
-					$filter->id = 0;
-					$filter->parent = false;
-					$objects[] = &$filter;
-				}
-				break;
-			case "OR":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryLogicOp("Or");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "AND":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryLogicOp("And");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "NOT":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new UnaryLogicOp("Not");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISEQUALTO":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsEqualTo");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISNOTEQUALTO":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsNotEqualTo");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISGREATERTHAN":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsGreaterThan");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISGREATERTHANOREQUALTO":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsGreaterThanOrEqualTo");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISLESSTHAN":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsLessThan");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISLESSTHANOREQUALTO":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsLessThanOrEqualTo");
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISLIKE":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new PropertyIsLike();
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[count($parent)-1]->wildCard = $element["attributes"]["wildCard"];
-					$objects[count($parent)-1]->singleChar = $element["attributes"]["singleChar"];
-					$objects[count($parent)-1]->escape = $element["attributes"]["escape"];
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISNULL":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new PropertyIsNull();
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "PROPERTYISBETWEEN":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new PropertyIsBetween();
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-
-			case "LITERAL":
-				if ($element["type"] == "complete")
-				{
-					if ($boundary == "upper")
-					{
-						$objects[$parentactual]->upperBoundary = $element["value"];
-					}
-					else if ($boundary == "lower")
-					{
-						$objects[$parentactual]->lowerBoundary = $element["value"];
-					}
-					else
-					{
-						$objects[$parentactual]->ogcLiteral = $element["value"];
-					}
-				}
-				break;
-			case "PROPERTYNAME":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->ogcPropertyName = $element["value"];
-				}
-				break;
-			case "LOWERBOUNDARY":
-				if ($element["type"] == "open")
-				{
-					$boundary = "lower";
-				}
-				else if ($element["type"] == "close")
-				{
-					$boundary = "";
-				}
-				break;
-			case "UPPERBOUNDARY":
-				if ($element["type"] == "open")
-				{
-					$boundary = "upper";
-				}
-				else if ($element["type"] == "close")
-				{
-					$boundary = "";
-				}
-				break;
-		}
-	}
-	
-	$_SESSION["sld_filter_objects"] = $objects;
-	
-	return $filter;
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD/
+# 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.
+
+/**
+ * This file parses the filter expressions and creates the corresponding objects.
+ *
+ * @package filter_editor
+ * @author Markus Krzyzanowski
+ */
+
+
+
+include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+/**
+ * Parses a given filter expression and creates the object structure.
+ * @param string $data filter expression that has to be parsed
+ * @return Filter root object of the filter expression
+ */
+function parseFilter($data)
+{
+	$xml_parser = xml_parser_create_ns();
+	xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
+	xml_parse_into_struct($xml_parser, $data, $vals, $index);
+	xml_parser_free($xml_parser);
+	
+	
+	$filter;
+	$parent = array();
+	$objects = array();
+	$parentactual = 0;
+	
+	for ($i=0; $i<count($vals); $i++)
+	{
+		$element = $vals[$i];
+		$tag = $element["tag"];
+		$tagname=strtoupper($tag);
+		switch($tagname)
+		{
+			case "FILTER":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = false;
+					$parentactual = 0;
+					$filter = new Filter();
+					$filter->id = 0;
+					$filter->parent = false;
+					$objects[] = &$filter;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = false;
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "ELSEFILTER":
+				if ($element["type"] == "complete")
+				{
+					$parent[] = false;
+					$parentactual = 0;
+					$filter = new ElseFilter();
+					$filter->id = 0;
+					$filter->parent = false;
+					$objects[] = &$filter;
+				}
+				break;
+			case "OR":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryLogicOp("Or");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "AND":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryLogicOp("And");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "NOT":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new UnaryLogicOp("Not");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISEQUALTO":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsEqualTo");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISNOTEQUALTO":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsNotEqualTo");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISGREATERTHAN":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsGreaterThan");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISGREATERTHANOREQUALTO":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsGreaterThanOrEqualTo");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISLESSTHAN":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsLessThan");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISLESSTHANOREQUALTO":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new BinaryComparisonOp("PropertyIsLessThanOrEqualTo");
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISLIKE":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new PropertyIsLike();
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[count($parent)-1]->wildCard = $element["attributes"]["wildCard"];
+					$objects[count($parent)-1]->singleChar = $element["attributes"]["singleChar"];
+					$objects[count($parent)-1]->escape = $element["attributes"]["escape"];
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISNULL":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new PropertyIsNull();
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "PROPERTYISBETWEEN":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new PropertyIsBetween();
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[$parentactual]->operations[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+
+			case "LITERAL":
+				if ($element["type"] == "complete")
+				{
+					if ($boundary == "upper")
+					{
+						$objects[$parentactual]->upperBoundary = $element["value"];
+					}
+					else if ($boundary == "lower")
+					{
+						$objects[$parentactual]->lowerBoundary = $element["value"];
+					}
+					else
+					{
+						$objects[$parentactual]->ogcLiteral = $element["value"];
+					}
+				}
+				break;
+			case "PROPERTYNAME":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->ogcPropertyName = $element["value"];
+				}
+				break;
+			case "LOWERBOUNDARY":
+				if ($element["type"] == "open")
+				{
+					$boundary = "lower";
+				}
+				else if ($element["type"] == "close")
+				{
+					$boundary = "";
+				}
+				break;
+			case "UPPERBOUNDARY":
+				if ($element["type"] == "open")
+				{
+					$boundary = "upper";
+				}
+				else if ($element["type"] == "close")
+				{
+					$boundary = "";
+				}
+				break;
+		}
+	}
+	
+	$_SESSION["sld_filter_objects"] = $objects;
+	
+	return $filter;
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/sld_function_getusersld.php
===================================================================
--- branches/print_dev/http/sld/sld_function_getusersld.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_function_getusersld.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,141 +1,141 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-/**
- * This file realizes the function handling for the sld editor.
- * Requests from the sld_edit_form are forwarded to this page.
- * After processing the requested function this file forwards to the
- * sld_main.php.
- * Only if the request is to get the sld it will not forward to sld_main.php - 
- * in this case this file will return the requested sld-document instead.
- * 
- * @package sld_function_handler
- * @author Markus Krzyzanowski
- */
-
-include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
-include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-include_once(dirname(__FILE__)."/../../core/globalSettings.php");
-include_once(dirname(__FILE__)."/sld_parse.php");
-
-/**
- * This function saves the data into the database
- * @param string $data the content of the sld-document to be stored inside the database
- */
-
-if (isset($_REQUEST["function"]))
-{
-	// the function "getusersld" is called by the mapserver to get the user's sld
-	if ($_REQUEST["function"] == "getusersld")
-	{
-		if ( isset($_REQUEST["sld_layer_id"]) && isset($_REQUEST["sld_gui_id"]) && isset($_REQUEST["user_id"]) )
-		{ //Used for the preview
-			$con = db_connect($DBSERVER,$OWNER,$PW);
-			db_select_db($DB,$con);
-			$sql = "SELECT * FROM sld_user_layer WHERE fkey_gui_id=$1 AND fkey_layer_id=$2 AND fkey_mb_user_id=$3";
-			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_layer_id"], $_REQUEST["user_id"]);
-			$t = array('s', 'i', 'i');
-			$res = db_prep_query($sql,$v,$t);			
-
-			if ( db_fetch_row($res, 0) )
-			{
-				//forcesld is used for the preview image to force the sld
-				if ( db_result($res, 0, "use_sld") == "1" || $_REQUEST["forcesld"] == "1" )
-				{
-					echo db_result($res, 0, "sld_xml");
-				}
-			}
-		} //Used for mapbender integration - old deprecated
-		else if ( isset($_REQUEST["sld_layer_names"]) && isset($_REQUEST["user_id"]) )
-		{
-			$layer_names = split(",", urldecode($_REQUEST["sld_layer_names"]));
-			
-			$con = db_connect($DBSERVER,$OWNER,$PW);
-			db_select_db($DB,$con);
-			
-			/*$sld_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<StyledLayerDescriptor version=\"1.0.0\">\n";*/
-			$sld_xml = "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";
-			
-			foreach ($layer_names as $layer_name)
-			{
-				$sql = "SELECT * FROM layer WHERE layer_name=$1";
-				$v = array($layer_name);
-				$t = array('s');
-				$res = db_prep_query($sql,$v,$t);				
-
-				$layer_id = "";
-				if ( db_fetch_row($res, 0) )
-				{
-					$layer_id = db_result($res, 0, "fkey_layer_id");
-					$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_mb_user_id=$2";
-					$v = array($layer_id, $_REQUEST["user_id"]);
-					$t = array('i', 'i');
-					$res = db_prep_query($sql,$v,$t);
-					
-					if ( db_fetch_row($res, 0) )
-					{
-						if ( db_result($res, 0, "use_sld") == "1" )
-						{
-							$data = db_result($res, 0, "sld_xml");
-							$styledlayerdescriptor = parseSld($data);
-							$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
-						}
-					}
-				}
-			}
-			$sld_xml .= "</StyledLayerDescriptor>";
-			echo $sld_xml;
-		} //Used for mapbender integration
-		else if ( isset($_REQUEST["sld_wms_id"]) && isset($_REQUEST["sld_gui_id"]) )
-		{
-		
-			$con = db_connect($DBSERVER,$OWNER,$PW);
-			db_select_db($DB,$con);
-			$sql = "SELECT fkey_layer_id FROM gui_layer WHERE fkey_gui_id=$1 AND gui_layer_wms_id=$2";
-			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_wms_id"]);
-			$t = array('s', 'i');
-			$res = db_prep_query($sql,$v,$t);
-			
-			$sld_xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
-			$sld_xml .= "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";			
-
-			while ($row = db_fetch_row($res))
-			{
-				$layer_id = $row[0];
-				$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_gui_id=$2";
-				$v = array($layer_id, $_REQUEST["sld_gui_id"]);
-				$t = array('i', 's');
-				$res2 = db_prep_query($sql,$v,$t);
-
-				if ( db_fetch_row($res2, 0) )
-				{
-					if ( db_result($res2, 0, "use_sld") == "1" )
-					{
-						$data = db_result($res2, 0, "sld_xml");
-						$styledlayerdescriptor = parseSld($data);
-						$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
-					}
-				}
-			}
-			$sld_xml .= "</StyledLayerDescriptor>";
-			echo $sld_xml;
-		}
-	}
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
+
+/**
+ * This file realizes the function handling for the sld editor.
+ * Requests from the sld_edit_form are forwarded to this page.
+ * After processing the requested function this file forwards to the
+ * sld_main.php.
+ * Only if the request is to get the sld it will not forward to sld_main.php - 
+ * in this case this file will return the requested sld-document instead.
+ * 
+ * @package sld_function_handler
+ * @author Markus Krzyzanowski
+ */
+
+include_once(dirname(__FILE__)."/classes/StyledLayerDescriptor.php");
+include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+include_once(dirname(__FILE__)."/../../core/globalSettings.php");
+include_once(dirname(__FILE__)."/sld_parse.php");
+
+/**
+ * This function saves the data into the database
+ * @param string $data the content of the sld-document to be stored inside the database
+ */
+
+if (isset($_REQUEST["function"]))
+{
+	// the function "getusersld" is called by the mapserver to get the user's sld
+	if ($_REQUEST["function"] == "getusersld")
+	{
+		if ( isset($_REQUEST["sld_layer_id"]) && isset($_REQUEST["sld_gui_id"]) && isset($_REQUEST["user_id"]) )
+		{ //Used for the preview
+			$con = db_connect($DBSERVER,$OWNER,$PW);
+			db_select_db($DB,$con);
+			$sql = "SELECT * FROM sld_user_layer WHERE fkey_gui_id=$1 AND fkey_layer_id=$2 AND fkey_mb_user_id=$3";
+			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_layer_id"], $_REQUEST["user_id"]);
+			$t = array('s', 'i', 'i');
+			$res = db_prep_query($sql,$v,$t);			
+
+			if ( db_fetch_row($res, 0) )
+			{
+				//forcesld is used for the preview image to force the sld
+				if ( db_result($res, 0, "use_sld") == "1" || $_REQUEST["forcesld"] == "1" )
+				{
+					echo db_result($res, 0, "sld_xml");
+				}
+			}
+		} //Used for mapbender integration - old deprecated
+		else if ( isset($_REQUEST["sld_layer_names"]) && isset($_REQUEST["user_id"]) )
+		{
+			$layer_names = split(",", urldecode($_REQUEST["sld_layer_names"]));
+			
+			$con = db_connect($DBSERVER,$OWNER,$PW);
+			db_select_db($DB,$con);
+			
+			/*$sld_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<StyledLayerDescriptor version=\"1.0.0\">\n";*/
+			$sld_xml = "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";
+			
+			foreach ($layer_names as $layer_name)
+			{
+				$sql = "SELECT * FROM layer WHERE layer_name=$1";
+				$v = array($layer_name);
+				$t = array('s');
+				$res = db_prep_query($sql,$v,$t);				
+
+				$layer_id = "";
+				if ( db_fetch_row($res, 0) )
+				{
+					$layer_id = db_result($res, 0, "fkey_layer_id");
+					$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_mb_user_id=$2";
+					$v = array($layer_id, $_REQUEST["user_id"]);
+					$t = array('i', 'i');
+					$res = db_prep_query($sql,$v,$t);
+					
+					if ( db_fetch_row($res, 0) )
+					{
+						if ( db_result($res, 0, "use_sld") == "1" )
+						{
+							$data = db_result($res, 0, "sld_xml");
+							$styledlayerdescriptor = parseSld($data);
+							$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
+						}
+					}
+				}
+			}
+			$sld_xml .= "</StyledLayerDescriptor>";
+			echo $sld_xml;
+		} //Used for mapbender integration
+		else if ( isset($_REQUEST["sld_wms_id"]) && isset($_REQUEST["sld_gui_id"]) )
+		{
+		
+			$con = db_connect($DBSERVER,$OWNER,$PW);
+			db_select_db($DB,$con);
+			$sql = "SELECT fkey_layer_id FROM gui_layer WHERE fkey_gui_id=$1 AND gui_layer_wms_id=$2";
+			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_wms_id"]);
+			$t = array('s', 'i');
+			$res = db_prep_query($sql,$v,$t);
+			
+			$sld_xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
+			$sld_xml .= "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";			
+
+			while ($row = db_fetch_row($res))
+			{
+				$layer_id = $row[0];
+				$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_gui_id=$2";
+				$v = array($layer_id, $_REQUEST["sld_gui_id"]);
+				$t = array('i', 's');
+				$res2 = db_prep_query($sql,$v,$t);
+
+				if ( db_fetch_row($res2, 0) )
+				{
+					if ( db_result($res2, 0, "use_sld") == "1" )
+					{
+						$data = db_result($res2, 0, "sld_xml");
+						$styledlayerdescriptor = parseSld($data);
+						$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
+					}
+				}
+			}
+			$sld_xml .= "</StyledLayerDescriptor>";
+			echo $sld_xml;
+		}
+	}
+}
+?>

Modified: branches/print_dev/http/sld/sld_function_handler.php
===================================================================
--- branches/print_dev/http/sld/sld_function_handler.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_function_handler.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,452 +1,452 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-/**
- * This file realizes the function handling for the sld editor.
- * Requests from the sld_edit_form are forwarded to this page.
- * After processing the requested function this file forwards to the
- * sld_main.php.
- * Only if the request is to get the sld it will not forward to sld_main.php - 
- * in this case this file will return the requested sld-document instead.
- * 
- * @package sld_function_handler
- * @author Markus Krzyzanowski
- */
-
-include_once(dirname(__FILE__)."/sld_config.php");
-include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-
-/**
- * This function saves the data into the database
- * @param string $data the content of the sld-document to be stored inside the database
- */
-function saveSld($data)
-{	
-	$con = db_connect($DBSERVER,$OWNER,$PW);
-	db_select_db($DB,$con);
-	$sql = "UPDATE sld_user_layer SET sld_xml=$1 WHERE fkey_gui_id=$2 AND fkey_layer_id=$3 AND fkey_mb_user_id=$4";
-	$v = array($data, $_SESSION["sld_gui_id"], $_SESSION["sld_layer_id"], $_SESSION["mb_user_id"]);
-	$t = array('s', 's', 'i', 'i');
-	$res = db_prep_query($sql,$v,$t);
-}
-
-
-if (isset($_REQUEST["function"]))
-{
-	//MAIN FUNCTIONS:
-	if ($_REQUEST["function"] == "getdefaultsld")
-	{
-		$file = $mapfileUrl."VERSION=1.1.1&REQUEST=GetStyles&LAYERS=".urlencode($layer_name);
-		$data = readSld($file);
-		$data = char_encode($data);
-		saveSld($data);
-	}
-	else if ($_REQUEST["function"] == "save")
-	{
-		$styledlayerdescriptor = new StyledLayerDescriptor();
-		$styledlayerdescriptor->generateObjectFromPost();
-		saveSld($styledlayerdescriptor->generateXml());
-	}
-	/* the function "getusersld" is called by the mapserver to get the user's sld
-	else if ($_REQUEST["function"] == "getusersld")
-	{
-		if ( isset($_REQUEST["sld_layer_id"]) && isset($_REQUEST["sld_gui_id"]) && isset($_REQUEST["user_id"]) )
-		{ //Used for the preview
-			$con = db_connect($DBSERVER,$OWNER,$PW);
-			db_select_db($DB,$con);
-			$sql = "SELECT * FROM sld_user_layer WHERE fkey_gui_id=$1 AND fkey_layer_id=$2 AND fkey_mb_user_id=$3";
-			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_layer_id"], $_REQUEST["user_id"]);
-			$t = array('s', 'i', 'i');
-			$res = db_prep_query($sql,$v,$t);
-			if ( db_fetch_row($res, 0) )
-			{
-				//forcesld is used for the preview image to force the sld
-				if ( db_result($res, 0, "use_sld") == "1" || $_REQUEST["forcesld"] == "1" )
-				{
-					echo db_result($res, 0, "sld_xml");
-				}
-			}
-		} //Used for mapbender integration - old deprecated
-			else if ( isset($_REQUEST["layer_names"]) && isset($_REQUEST["user_id"]) )
-		{
-			$layer_names = split(",", urldecode($_REQUEST["layer_names"]));
-			
-			$con = db_connect($DBSERVER,$OWNER,$PW);
-			db_select_db($DB,$con);
-			
-			#$sld_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<StyledLayerDescriptor version=\"1.0.0\">\n";
-			$sld_xml = "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";
-			
-			foreach ($layer_names as $layer_name)
-			{
-				$sql = "SELECT * FROM layer WHERE layer_name=$1";
-				$v = array($layer_name);
-				$t = array('s');
-				$res = db_prep_query($sql,$v,$t);
-
-				$layer_id = "";
-				if ( db_fetch_row($res, 0) )
-				{
-					$layer_id = db_result($res, 0, "fkey_layer_id");
-					$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_mb_user_id=$2";
-					$v = array($layer_id, $_REQUEST["user_id"]);
-					$t = array('i', 'i');
-					$res = db_prep_query($sql,$v,$t);
-					if ( db_fetch_row($res, 0) )
-					{
-						if ( db_result($res, 0, "use_sld") == "1" )
-						{
-							$data = db_result($res, 0, "sld_xml");
-							$styledlayerdescriptor = parseSld($data);
-							$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
-						}
-					}
-				}
-			}
-			$sld_xml .= "</StyledLayerDescriptor>";
-			echo $sld_xml;
-		} //Used for mapbender integration
-			else if ( isset($_REQUEST["sld_wms_id"]) && isset($_REQUEST["sld_gui_id"]) )
-		{
-		
-			$con = db_connect($DBSERVER,$OWNER,$PW);
-			db_select_db($DB,$con);
-			$sql = "SELECT fkey_layer_id FROM gui_layer WHERE fkey_gui_id=$1 AND gui_layer_wms_id=$2";
-			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_wms_id"]);
-			$t = array('s', 'i');
-			$res = db_prep_query($sql,$v,$t);
-			
-			$sld_xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
-			$sld_xml .= "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";			
-
-			while ($row = db_fetch_row($res))
-			{
-				$layer_id = $row[0];
-				$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_gui_id=$2";
-				$v = array($layer_id, $_REQUEST["sld_gui_id"]);
-				$t = array('i', 's');
-				$res2 = db_prep_query($sql,$v,$t);
-				if ( db_fetch_row($res2, 0) )
-				{
-					if ( db_result($res2, 0, "use_sld") == "1" )
-					{
-						$data = db_result($res2, 0, "sld_xml");
-						$styledlayerdescriptor = parseSld($data);
-						$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
-					}
-				}
-			}
-			$sld_xml .= "</StyledLayerDescriptor>";
-			echo $sld_xml;
-		}
-	} */
-	// sets whether the user wishes to use a sld for this layer
-	else if ($_REQUEST["function"] == "usesld")
-	{
-		if ( isset($_REQUEST["use_sld"]) )
-		{
-			$con = db_connect($DBSERVER,$OWNER,$PW);
-			db_select_db($DB,$con);
-			$sql = "UPDATE sld_user_layer SET use_sld=$1 WHERE fkey_gui_id=$2 AND fkey_layer_id=$3 AND fkey_mb_user_id=$4";
-			$v = array($_REQUEST["use_sld"], $_SESSION["sld_gui_id"], $_SESSION["sld_layer_id"], $_SESSION["mb_user_id"]);
-			$t = array('i', 's', 'i', 'i');
-			$res = db_prep_query($sql,$v,$t);
-			
-			# update gui_wms_sldurl
-			if ($_REQUEST["use_sld"]=="1") {
-				$sld_url = $_REQUEST["mb_sld_url"];
-				$sql = "UPDATE gui_wms SET gui_wms_sldurl=$1 WHERE fkey_gui_id=$2 AND fkey_wms_id=$3";
-				$v = array($sld_url, $_SESSION["sld_gui_id"], $_SESSION["sld_wms_id"]);
-				$t = array('s', 's', 'i');
-				$res = db_prep_query($sql,$v,$t); 
-			}
-		}
-	}
-	
-	
-	
-	
-	//MANIPULATE SLD FUNCTIONS - ADD & DELETE
-	else if ($_REQUEST["function"] == "addrule")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->addRule();
-		}
-	}
-	else if ($_REQUEST["function"] == "deleterule")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_REQUEST["number"]) && isset($_SESSION["sld"]) )
-		{
-			$number = $_REQUEST["number"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->deleteRule($number);
-		}
-	}
-	else if ($_REQUEST["function"] == "addsymbolizer")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"]))&&(isset($_REQUEST["symbolizer"])))
-		{
-			$symbolizer = $_REQUEST["symbolizer"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->addSymbolizer($symbolizer);
-		}
-	}
-	else if ($_REQUEST["function"] == "deletesymbolizer")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
-		{
-			$number = $_REQUEST["number"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->deleteSymbolizer($number);
-		}
-	}
-	else if ($_REQUEST["function"] == "addcssparameter")
-	{
-		if (isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["cssparameter"]))
-		{
-			$cssparameter = $_REQUEST["cssparameter"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->addCssParameter($cssparameter);
-		}
-	}
-	else if ($_REQUEST["function"] == "deletecssparameter")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
-		{
-			$number = $_REQUEST["number"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->deleteCssParameter($number);
-		}
-	}
-
-	else if ($_REQUEST["function"] == "addlegendgraphic")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->legendgraphic = new LegendGraphic();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletelegendgraphic")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->legendgraphic = "";
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addcolormapentry")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->addColorMapEntry();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletecolormapentry")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
-		{
-			$number = $_REQUEST["number"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->deleteColorMapEntry($number);
-		}
-	}
-
-	else if ($_REQUEST["function"] == "addexternalgraphicormark")
-	{
-		if ((isset($_REQUEST["id"])) && (isset($_SESSION["sld"])) && isset($_REQUEST["externalgraphicormark"]))
-		{
-			$externalgraphicormark = $_REQUEST["externalgraphicormark"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->addExternalGraphicOrMark($externalgraphicormark);
-		}
-	}
-	else if ($_REQUEST["function"] == "deleteexternalgraphicormark")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
-		{
-			$number = $_REQUEST["number"];
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->deleteExternalGraphicOrMark($number);
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addgraphic")
-	{
-		if ((isset($_REQUEST["id"])) && (isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->graphic = new Graphic();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletegraphic")
-	{
-		if ((isset($_REQUEST["id"])) && (isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->graphic = "";
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addcolormap")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->colormap = new ColorMap();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletecolormap")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->colormap = "";
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addfont")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->font = new Font();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletefont")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->font = "";
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addlabelplacement")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->labelplacement = new LabelPlacement();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletelabelplacement")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->labelplacement = "";
-		}
-	}
-
-	else if ($_REQUEST["function"] == "addhalo")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->halo = new Halo();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletehalo")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->halo = "";
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addfill")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->fill = new Fill();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletefill")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->fill = "";
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addstroke")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->stroke = new Stroke();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletestroke")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->stroke = "";
-		}
-	}
-	
-	else if ($_REQUEST["function"] == "addgraphicfill")
-	{
-		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->graphicfill = new GraphicFill();
-		}
-	}
-	else if ($_REQUEST["function"] == "deletegraphicfill")
-	{
-		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
-		{
-			$id = $_REQUEST["id"];
-			$_SESSION["sld_objects"][$id]->graphicfill = "";
-		}
-	}
-	//TODO:
-	//graphicstroke???
-	
-	else
-	{
-		echo "function ".$_REQUEST["function"]." is not defined!";
-	}
-	
-	
-	
-	if ( $_REQUEST["function"] != "getdefaultsld" && $_REQUEST["function"] != "save" && $_REQUEST["function"] != "getusersld")
-	{
-		//Create the new SLD XML
-		saveSld($_SESSION["sld_objects"][0]->generateXml());
-	}
-	if ( $_REQUEST["function"] != "getusersld" )
-	{
-		//header("Location: ".$MAPBENDER_URL."/sld/".$SLD_MAIN);
-		//is ist faster to leave away the http?
-		//redirect to a local file or to a http ressource?
-		header("Location: ".$SLD_MAIN);
-	}
-}
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
+
+/**
+ * This file realizes the function handling for the sld editor.
+ * Requests from the sld_edit_form are forwarded to this page.
+ * After processing the requested function this file forwards to the
+ * sld_main.php.
+ * Only if the request is to get the sld it will not forward to sld_main.php - 
+ * in this case this file will return the requested sld-document instead.
+ * 
+ * @package sld_function_handler
+ * @author Markus Krzyzanowski
+ */
+
+include_once(dirname(__FILE__)."/sld_config.php");
+include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+
+/**
+ * This function saves the data into the database
+ * @param string $data the content of the sld-document to be stored inside the database
+ */
+function saveSld($data)
+{	
+	$con = db_connect($DBSERVER,$OWNER,$PW);
+	db_select_db($DB,$con);
+	$sql = "UPDATE sld_user_layer SET sld_xml=$1 WHERE fkey_gui_id=$2 AND fkey_layer_id=$3 AND fkey_mb_user_id=$4";
+	$v = array($data, $_SESSION["sld_gui_id"], $_SESSION["sld_layer_id"], $_SESSION["mb_user_id"]);
+	$t = array('s', 's', 'i', 'i');
+	$res = db_prep_query($sql,$v,$t);
+}
+
+
+if (isset($_REQUEST["function"]))
+{
+	//MAIN FUNCTIONS:
+	if ($_REQUEST["function"] == "getdefaultsld")
+	{
+		$file = $mapfileUrl."VERSION=1.1.1&REQUEST=GetStyles&LAYERS=".urlencode($layer_name);
+		$data = readSld($file);
+		$data = char_encode($data);
+		saveSld($data);
+	}
+	else if ($_REQUEST["function"] == "save")
+	{
+		$styledlayerdescriptor = new StyledLayerDescriptor();
+		$styledlayerdescriptor->generateObjectFromPost();
+		saveSld($styledlayerdescriptor->generateXml());
+	}
+	/* the function "getusersld" is called by the mapserver to get the user's sld
+	else if ($_REQUEST["function"] == "getusersld")
+	{
+		if ( isset($_REQUEST["sld_layer_id"]) && isset($_REQUEST["sld_gui_id"]) && isset($_REQUEST["user_id"]) )
+		{ //Used for the preview
+			$con = db_connect($DBSERVER,$OWNER,$PW);
+			db_select_db($DB,$con);
+			$sql = "SELECT * FROM sld_user_layer WHERE fkey_gui_id=$1 AND fkey_layer_id=$2 AND fkey_mb_user_id=$3";
+			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_layer_id"], $_REQUEST["user_id"]);
+			$t = array('s', 'i', 'i');
+			$res = db_prep_query($sql,$v,$t);
+			if ( db_fetch_row($res, 0) )
+			{
+				//forcesld is used for the preview image to force the sld
+				if ( db_result($res, 0, "use_sld") == "1" || $_REQUEST["forcesld"] == "1" )
+				{
+					echo db_result($res, 0, "sld_xml");
+				}
+			}
+		} //Used for mapbender integration - old deprecated
+			else if ( isset($_REQUEST["layer_names"]) && isset($_REQUEST["user_id"]) )
+		{
+			$layer_names = split(",", urldecode($_REQUEST["layer_names"]));
+			
+			$con = db_connect($DBSERVER,$OWNER,$PW);
+			db_select_db($DB,$con);
+			
+			#$sld_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<StyledLayerDescriptor version=\"1.0.0\">\n";
+			$sld_xml = "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";
+			
+			foreach ($layer_names as $layer_name)
+			{
+				$sql = "SELECT * FROM layer WHERE layer_name=$1";
+				$v = array($layer_name);
+				$t = array('s');
+				$res = db_prep_query($sql,$v,$t);
+
+				$layer_id = "";
+				if ( db_fetch_row($res, 0) )
+				{
+					$layer_id = db_result($res, 0, "fkey_layer_id");
+					$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_mb_user_id=$2";
+					$v = array($layer_id, $_REQUEST["user_id"]);
+					$t = array('i', 'i');
+					$res = db_prep_query($sql,$v,$t);
+					if ( db_fetch_row($res, 0) )
+					{
+						if ( db_result($res, 0, "use_sld") == "1" )
+						{
+							$data = db_result($res, 0, "sld_xml");
+							$styledlayerdescriptor = parseSld($data);
+							$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
+						}
+					}
+				}
+			}
+			$sld_xml .= "</StyledLayerDescriptor>";
+			echo $sld_xml;
+		} //Used for mapbender integration
+			else if ( isset($_REQUEST["sld_wms_id"]) && isset($_REQUEST["sld_gui_id"]) )
+		{
+		
+			$con = db_connect($DBSERVER,$OWNER,$PW);
+			db_select_db($DB,$con);
+			$sql = "SELECT fkey_layer_id FROM gui_layer WHERE fkey_gui_id=$1 AND gui_layer_wms_id=$2";
+			$v = array($_REQUEST["sld_gui_id"], $_REQUEST["sld_wms_id"]);
+			$t = array('s', 'i');
+			$res = db_prep_query($sql,$v,$t);
+			
+			$sld_xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
+			$sld_xml .= "<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\">\n";			
+
+			while ($row = db_fetch_row($res))
+			{
+				$layer_id = $row[0];
+				$sql = "SELECT * FROM sld_user_layer WHERE fkey_layer_id=$1 AND fkey_gui_id=$2";
+				$v = array($layer_id, $_REQUEST["sld_gui_id"]);
+				$t = array('i', 's');
+				$res2 = db_prep_query($sql,$v,$t);
+				if ( db_fetch_row($res2, 0) )
+				{
+					if ( db_result($res2, 0, "use_sld") == "1" )
+					{
+						$data = db_result($res2, 0, "sld_xml");
+						$styledlayerdescriptor = parseSld($data);
+						$sld_xml .= $styledlayerdescriptor->layers[0]->generateXml(" ");
+					}
+				}
+			}
+			$sld_xml .= "</StyledLayerDescriptor>";
+			echo $sld_xml;
+		}
+	} */
+	// sets whether the user wishes to use a sld for this layer
+	else if ($_REQUEST["function"] == "usesld")
+	{
+		if ( isset($_REQUEST["use_sld"]) )
+		{
+			$con = db_connect($DBSERVER,$OWNER,$PW);
+			db_select_db($DB,$con);
+			$sql = "UPDATE sld_user_layer SET use_sld=$1 WHERE fkey_gui_id=$2 AND fkey_layer_id=$3 AND fkey_mb_user_id=$4";
+			$v = array($_REQUEST["use_sld"], $_SESSION["sld_gui_id"], $_SESSION["sld_layer_id"], $_SESSION["mb_user_id"]);
+			$t = array('i', 's', 'i', 'i');
+			$res = db_prep_query($sql,$v,$t);
+			
+			# update gui_wms_sldurl
+			if ($_REQUEST["use_sld"]=="1") {
+				$sld_url = $_REQUEST["mb_sld_url"];
+				$sql = "UPDATE gui_wms SET gui_wms_sldurl=$1 WHERE fkey_gui_id=$2 AND fkey_wms_id=$3";
+				$v = array($sld_url, $_SESSION["sld_gui_id"], $_SESSION["sld_wms_id"]);
+				$t = array('s', 's', 'i');
+				$res = db_prep_query($sql,$v,$t); 
+			}
+		}
+	}
+	
+	
+	
+	
+	//MANIPULATE SLD FUNCTIONS - ADD & DELETE
+	else if ($_REQUEST["function"] == "addrule")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->addRule();
+		}
+	}
+	else if ($_REQUEST["function"] == "deleterule")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_REQUEST["number"]) && isset($_SESSION["sld"]) )
+		{
+			$number = $_REQUEST["number"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->deleteRule($number);
+		}
+	}
+	else if ($_REQUEST["function"] == "addsymbolizer")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"]))&&(isset($_REQUEST["symbolizer"])))
+		{
+			$symbolizer = $_REQUEST["symbolizer"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->addSymbolizer($symbolizer);
+		}
+	}
+	else if ($_REQUEST["function"] == "deletesymbolizer")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
+		{
+			$number = $_REQUEST["number"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->deleteSymbolizer($number);
+		}
+	}
+	else if ($_REQUEST["function"] == "addcssparameter")
+	{
+		if (isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["cssparameter"]))
+		{
+			$cssparameter = $_REQUEST["cssparameter"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->addCssParameter($cssparameter);
+		}
+	}
+	else if ($_REQUEST["function"] == "deletecssparameter")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
+		{
+			$number = $_REQUEST["number"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->deleteCssParameter($number);
+		}
+	}
+
+	else if ($_REQUEST["function"] == "addlegendgraphic")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->legendgraphic = new LegendGraphic();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletelegendgraphic")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->legendgraphic = "";
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addcolormapentry")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->addColorMapEntry();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletecolormapentry")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
+		{
+			$number = $_REQUEST["number"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->deleteColorMapEntry($number);
+		}
+	}
+
+	else if ($_REQUEST["function"] == "addexternalgraphicormark")
+	{
+		if ((isset($_REQUEST["id"])) && (isset($_SESSION["sld"])) && isset($_REQUEST["externalgraphicormark"]))
+		{
+			$externalgraphicormark = $_REQUEST["externalgraphicormark"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->addExternalGraphicOrMark($externalgraphicormark);
+		}
+	}
+	else if ($_REQUEST["function"] == "deleteexternalgraphicormark")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) && isset($_REQUEST["number"]) )
+		{
+			$number = $_REQUEST["number"];
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->deleteExternalGraphicOrMark($number);
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addgraphic")
+	{
+		if ((isset($_REQUEST["id"])) && (isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->graphic = new Graphic();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletegraphic")
+	{
+		if ((isset($_REQUEST["id"])) && (isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->graphic = "";
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addcolormap")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->colormap = new ColorMap();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletecolormap")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->colormap = "";
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addfont")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->font = new Font();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletefont")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->font = "";
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addlabelplacement")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->labelplacement = new LabelPlacement();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletelabelplacement")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->labelplacement = "";
+		}
+	}
+
+	else if ($_REQUEST["function"] == "addhalo")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->halo = new Halo();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletehalo")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->halo = "";
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addfill")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->fill = new Fill();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletefill")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->fill = "";
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addstroke")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->stroke = new Stroke();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletestroke")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->stroke = "";
+		}
+	}
+	
+	else if ($_REQUEST["function"] == "addgraphicfill")
+	{
+		if ((isset($_REQUEST["id"]))&&(isset($_SESSION["sld"])))
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->graphicfill = new GraphicFill();
+		}
+	}
+	else if ($_REQUEST["function"] == "deletegraphicfill")
+	{
+		if ( isset($_REQUEST["id"]) && isset($_SESSION["sld"]) )
+		{
+			$id = $_REQUEST["id"];
+			$_SESSION["sld_objects"][$id]->graphicfill = "";
+		}
+	}
+	//TODO:
+	//graphicstroke???
+	
+	else
+	{
+		echo "function ".$_REQUEST["function"]." is not defined!";
+	}
+	
+	
+	
+	if ( $_REQUEST["function"] != "getdefaultsld" && $_REQUEST["function"] != "save" && $_REQUEST["function"] != "getusersld")
+	{
+		//Create the new SLD XML
+		saveSld($_SESSION["sld_objects"][0]->generateXml());
+	}
+	if ( $_REQUEST["function"] != "getusersld" )
+	{
+		//header("Location: ".$MAPBENDER_URL."/sld/".$SLD_MAIN);
+		//is ist faster to leave away the http?
+		//redirect to a local file or to a http ressource?
+		header("Location: ".$SLD_MAIN);
+	}
+}
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/sld_main.php
===================================================================
--- branches/print_dev/http/sld/sld_main.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_main.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,298 +1,298 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD
-# 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.
-
-/**
- * This is the main page of the sld-editor.
- * It displays the preview images and creates the sld_edit_form
- * used for editing the sld.
- *
- * @package sld_main
- * @author Markus Krzyzanowski
- */
-
-require_once(dirname(__FILE__)."/sld_config.php");
-require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
-$classWfsConf = new wfs_conf();
-
-//read custom sld for this user&wms&layer&gui from the db instead using sld.xml
-
-$con = db_connect($DBSERVER,$OWNER,$PW);
-db_select_db($DB,$con);
-
-//Read the layer_id from the DB
-$dbutils = new DbUtils();
-$layer_id = $dbutils->getLayerIdFromLayerName($_SESSION["sld_wms_id"], $_SESSION["sld_layer_name"]);
-if ( $layer_id )
-{
-	$_SESSION["sld_layer_id"] = $layer_id;
-}
-
-//Read the mb_user_id from the Session
-$mb_user_id = $_SESSION["mb_user_id"];
-
-
-//if layer is not found in DB
-if (!$layer_id)
-{
-	echo "layer existiert nicht in Datenbank";
-	exit();
-}
-else
-{
-	//Try to read sld from the DB
-	$sql = "SELECT * FROM sld_user_layer WHERE fkey_gui_id = $1 AND fkey_layer_id = $2 AND fkey_mb_user_id = $3";
-	$v = array($_SESSION["sld_gui_id"], $layer_id, $mb_user_id);
-	$t = array('s', 'i', 'i');
-	$res = db_prep_query($sql,$v,$t);
-	if (!$res || db_numrows($res)== 0)
-	{
-		//No user specific sld found in DB -> get it from the mapserver
-		$file = $mapfileUrl."SERVICE=WMS&VERSION=1.1.1&REQUEST=GetStyles&LAYERS=".urlencode($layer_name);
-		$data = readSld($file);
-		$data = char_encode($data);
-		//write the sld to the DB
-		$sql = "INSERT INTO sld_user_layer(fkey_mb_user_id, fkey_layer_id, sld_xml, use_sld, fkey_gui_id) VALUES ($1, $2, $3, 0, $4);";
-		$v = array($mb_user_id, $layer_id, $data, $_SESSION["sld_gui_id"]);
-		$t = array('i', 'i', 's', 's');
-		$res = @db_prep_query($sql,$v,$t);
-		//Use the new sld
-	}
-	else
-	{
-		$data = db_result($res, 0, "sld_xml");
-		$use_sld = db_result($res, 0, "use_sld");
-	}
-}
-
-//$file = "sld.xml";
-//$data = readSld($file);
-
-$styledlayerdescriptor = parseSld($data);
-$_SESSION["sld"] = $data;
-
-/* Check for a related WFS featuretype */
-$wfs_conf_id = $dbutils->getLayerWfsConfId($_SESSION["sld_gui_id"], $layer_id);
-if ( $wfs_conf_id ) {
-	$featuretype_id = $dbutils->getWfsConfFeatureTypeId($wfs_conf_id);
-	$classWfsConf->getelements($featuretype_id);
-	$wfs_element = $classWfsConf->elements;
-	$fts = $styledlayerdescriptor->layers[0]->styles[0]->featuretypestyles[0];
-	$fts->setElementArray("element_id",$wfs_element->element_id);
-	$fts->setElementArray("element_name",$wfs_element->element_name);
-} else {
-	$wfs_element = false;
-}
-
-/* create getMap-Url for preview with/without sld */
-$previewMapUrl = $dbutils->getPreviewMapUrl($_SESSION["sld_gui_id"], $layer_id, $_SESSION["sld_wms_id"]);
-
-echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
-echo "<html>\n";
-echo "<head>\n";
-echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n";
-echo "<meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">\n";
-echo "<META HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO-CACHE\">\n";
-echo "<title>Mapbender - SLD Editor</title>\n";
-echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/sldEditor.css\">\n";
-echo "</head>\n";
-echo "<body leftmargin=\"10\" topmargin=\"0\">\n";
-
-## - Fensteranfang
-echo "<table width=\"800px\"  border='0' cellspacing='0'>\n"; 	      
-## - 1.Zeile
-echo " <tr>\n";
-echo "  <td class='text2 bg2' colspan='2'>\n";
-echo "   &nbsp;&nbsp;Vorschau mit SLD:\n";
-echo "  </td>\n";
-echo "  <td>\n";
-echo "   &nbsp;\n";
-echo "  </td>\n";
-echo "  <td class='text2 bg2' colspan='2'>\n";
-echo "   &nbsp;&nbsp;Original ohne SLD:\n";
-echo "  </td>\n";
-echo " </tr>\n";
-
-## - Build URL to SLD
-$sld_url = "";
-$mb_sld_url = "";
-//$sld_url = "http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/sld_function_handler.php?function=getusersld&layer_id=".$layer_id."&user_id=".$mb_user_id."&forcesld=1";
-$sld_url = $MAPBENDER_URL."/sld_function_getusersld.php?function=getusersld&sld_gui_id=".$_SESSION["sld_gui_id"]."&sld_layer_id=".$layer_id."&user_id=".$mb_user_id."&forcesld=1";
-$mb_sld_url = $MAPBENDER_URL."/sld_function_getusersld.php?function=getusersld&sld_gui_id=".$_SESSION["sld_gui_id"]."&sld_wms_id=".$_SESSION["sld_wms_id"]."&user_id=".$mb_user_id;
-echo "<!-- $sld_url -->";
-echo "<!-- $previewMapUrl -->";
-## - 2.Zeile
-/*
-echo " <tr align='right'>\n";
-echo "  <td class='line_left2 text4'>\n";
-echo "   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Karte";
-echo "  </td>\n";
-echo "  <td class='line_right2'>\n";
-echo "   <img src='./img/map_magnify.png' border='0' alt='Originalgr&ouml;&szlig;e im neuen Fenster anzeigen' onClick=\"window.open('map.php','','fullsreen=yes,resizable=no,scrollbars=yes');\">\n";
-echo "  </td>\n";
-echo "  <td>\n";
-echo "   &nbsp;\n";
-echo "  </td>\n";
-echo "  <td class='line_left2 text4'>\n";
-echo "   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Karte";
-echo "  </td>\n";
-echo "  <td class='line_right2'>\n";
-echo "   <img src='./img/map_magnify.png' border='0' alt='Originalgr&ouml;&szlig;e im neuen Fenster anzeigen' onClick=\"window.open('map_original.php','','fullsreen=yes,resizable=no,scrollbars=yes');\">\n";
-echo "  </td>\n";
-echo " </tr>\n";
-*/
-
-## - 3.Zeile
-echo " <tr align='center'>\n";
-echo "  <td class='line_left2 line_right2' colspan='2'>\n";
-
-## - Map with SLD
-//Added rand(...) to force a reload of the image because the url should be different
-echo "   <img src=\"".$previewMapUrl."&WIDTH=320&HEIGHT=240&sld=".urlencode($sld_url)."&".rand(0,10000)."\" border=\"0\" width=\"320\" height=\"240\">";
-echo "  </td>\n";
-
-echo "  <td>\n";
-echo "   &nbsp;\n";
-echo "  </td>\n";
-
-echo "  <td class='line_left2 line_right2' colspan='2'>\n";
-
-## - Map without SLD
-echo "   <img src=\"".$previewMapUrl."&WIDTH=320&HEIGHT=240\" border=\"0\" width=\"320\" height=\"240\">";
-echo "  </td>\n";
-
-#4.Zeile
-echo " <tr>\n";
-echo "  <td class='line_left2 line_right2 text4' colspan='2'>\n";
-echo "   &nbsp;&nbsp;&nbsp;&nbsp;Legende\n";
-echo "  </td>\n";
-echo "  <td>\n";
-echo "   &nbsp;\n";
-echo "  </td>\n";
-echo "  <td class='line_left2 line_right2 text4' colspan='2'>\n";
-echo "   &nbsp;&nbsp;&nbsp;&nbsp;Legende\n";
-echo "  </td>\n";
-echo " </tr>\n";
-
-#5.Zeile
-echo " <tr>\n";
-echo "  <td class='line_left2 line_down2 line_right2' colspan='2'>\n";
-echo "   &nbsp;\n";
-## - Legend with SLD
-echo "   <img src=\"".$mapfileUrl."VERSION=1.1.0&REQUEST=GetLegendGraphic&SERVICE=WMS&LAYER=".urlencode($layer_name)."&FORMAT=image/png&sld=".urlencode($sld_url)."&".rand(0,10000)."\">\n";
-echo "  </td>\n";
-echo "   &nbsp;\n";
-echo "  <td>\n";
-echo "   &nbsp;\n";
-echo "  </td>\n";
-echo "  <td class='line_left2 line_down2 line_right2' colspan='2'>\n";
-echo "   &nbsp;\n";
-## - Legend without SLD
-echo "   <img src=\"".$mapfileUrl."VERSION=1.1.0&REQUEST=GetLegendGraphic&SERVICE=WMS&LAYER=".urlencode($layer_name)."&FORMAT=image/png\">";
-echo "  </td>\n";
-echo " </tr>\n";
-echo "</table>\n";
-
-echo "<br>\n";
-
-echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
-echo " <tr valign=\"top\">\n";
-echo "  <td>\n";
-
-echo "   <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
-echo "    <tr align=\"center\">\n";
-echo "     <td class=\"bg2 text3\">MENU</td>\n";
-echo "    </tr>\n";
-echo "    <tr>\n";
-echo "     <td class=\"line_left2 line_down2 line_right2 text4 bg_menu\">\n";
-
-//echo "      <form name=\"use_sld\" action=\"http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
-echo "      <form name=\"use_sld\" action=\"".$MAPBENDER_URL."/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
-echo "      <input type=\"hidden\" name=\"function\" value=\"usesld\">\n";
-echo "      <input type=\"hidden\" name=\"sld_url\" value=\"".$sld_url."\">\n";
-echo "      <input type=\"hidden\" name=\"mb_sld_url\" value=\"".$mb_sld_url."\">\n";
-echo "      &nbsp;&nbsp;Ansicht in Mapbender&nbsp;&nbsp;<br>\n";
-	
-echo "      <input type=\"radio\" name=\"use_sld\" value=\"0\"";
-if ($use_sld == 0) echo " checked";
-echo " onClick=\"submit()\">\n";
-echo "      &nbsp;Original ohne SLD&nbsp;&nbsp;<br>";
-
-echo "      <input type=\"radio\" name=\"use_sld\" value=\"1\"";
-if ($use_sld == 1) echo " checked";
-echo " onClick=\"submit()\">\n";
-echo "      &nbsp;mit SLD&nbsp;&nbsp;<br>";
-echo "      </form>\n";
-echo "     </td>\n";
-echo "    </tr>\n";
-echo "    <tr align=\"left\">\n";
-echo "     <td class=\"line_left2 line_down2 line_right2 text1 bg_menu\" style=\"padding:3px;\">\n";
-
-//echo "      <form id=\"sld_editor_form\" action=\"http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
-echo "      <form id=\"sld_editor_form\" action=\"".$MAPBENDER_URL."/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
-
-echo "      <a href='".$SLD_FUNCTION_HANDLER."&function=getdefaultsld' onclick='if(!confirm(\"Aktuelle SLD-Definition ersetzen?\")) return false;'>\n";
-echo "      <img src='./img/script.png' border='0' alt='Standard SLD aus WMS auslesen'>\n";
-echo "      </a> Standard &ouml;ffnen<br /><br />\n";
-
-echo "      <input type='image' src='./img/script_save.png' border='0' alt='Änderungen an die Map senden'>\n";
-echo "      SLD speichern<br>\n";
-echo "      <input type='hidden' name='function' value='save'>\n";
-echo "      <br /><a href=\"".$sld_url."\" target=_new>";	
-echo "      <img src='./img/script_code_red.png' border='0' alt='SLD anzeigen'>\n";
-echo "      </a>";
-echo "      SLD anzeigen";
-
-echo "     </td>\n";
-echo "    </tr>\n";
-echo "   </table>\n";
-
-echo "  </td>\n";
-echo "  <td>\n";
-echo "   &nbsp;&nbsp;&nbsp;";
-echo "  </td>\n";
-echo "  <td>\n";
-
-##  -  Fenster Eigenschaft
-echo "   <table border='0' cellspacing='0' cellpadding='0'>\n";
-echo "    <tr align='center'>\n";
-echo "     <td class='bg2 text3'>SLD Eigenschaften</td>\n";
-echo "    </tr>\n";
-echo "    <tr>\n";
-echo "     <td class='line_left2 line_down2 line_right2'>\n";
-
-echo $styledlayerdescriptor->generateHtmlForm("","      ");
-
-echo "     </td>\n";
-echo "    </tr>\n";
-echo "   </table>\n";
-echo "   </form>\n";
-
-echo "  </td>\n";
-echo " </tr>\n";
-echo "</table>\n";
-echo "<!-- ";
-print_r ($wfs_element);
-print_r ($_SESSION["sld_objects"][3]);
-echo "-->";
-echo "</body>\n";
-echo "</html>\n";
-##Debug
-//echo "------------------------------------------------------------------\n";
-//echo $styledlayerdescriptor->generateXml();
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD
+# 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.
+
+/**
+ * This is the main page of the sld-editor.
+ * It displays the preview images and creates the sld_edit_form
+ * used for editing the sld.
+ *
+ * @package sld_main
+ * @author Markus Krzyzanowski
+ */
+
+require_once(dirname(__FILE__)."/sld_config.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
+$classWfsConf = new wfs_conf();
+
+//read custom sld for this user&wms&layer&gui from the db instead using sld.xml
+
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db($DB,$con);
+
+//Read the layer_id from the DB
+$dbutils = new DbUtils();
+$layer_id = $dbutils->getLayerIdFromLayerName($_SESSION["sld_wms_id"], $_SESSION["sld_layer_name"]);
+if ( $layer_id )
+{
+	$_SESSION["sld_layer_id"] = $layer_id;
+}
+
+//Read the mb_user_id from the Session
+$mb_user_id = $_SESSION["mb_user_id"];
+
+
+//if layer is not found in DB
+if (!$layer_id)
+{
+	echo "layer existiert nicht in Datenbank";
+	exit();
+}
+else
+{
+	//Try to read sld from the DB
+	$sql = "SELECT * FROM sld_user_layer WHERE fkey_gui_id = $1 AND fkey_layer_id = $2 AND fkey_mb_user_id = $3";
+	$v = array($_SESSION["sld_gui_id"], $layer_id, $mb_user_id);
+	$t = array('s', 'i', 'i');
+	$res = db_prep_query($sql,$v,$t);
+	if (!$res || db_numrows($res)== 0)
+	{
+		//No user specific sld found in DB -> get it from the mapserver
+		$file = $mapfileUrl."SERVICE=WMS&VERSION=1.1.1&REQUEST=GetStyles&LAYERS=".urlencode($layer_name);
+		$data = readSld($file);
+		$data = char_encode($data);
+		//write the sld to the DB
+		$sql = "INSERT INTO sld_user_layer(fkey_mb_user_id, fkey_layer_id, sld_xml, use_sld, fkey_gui_id) VALUES ($1, $2, $3, 0, $4);";
+		$v = array($mb_user_id, $layer_id, $data, $_SESSION["sld_gui_id"]);
+		$t = array('i', 'i', 's', 's');
+		$res = @db_prep_query($sql,$v,$t);
+		//Use the new sld
+	}
+	else
+	{
+		$data = db_result($res, 0, "sld_xml");
+		$use_sld = db_result($res, 0, "use_sld");
+	}
+}
+
+//$file = "sld.xml";
+//$data = readSld($file);
+
+$styledlayerdescriptor = parseSld($data);
+$_SESSION["sld"] = $data;
+
+/* Check for a related WFS featuretype */
+$wfs_conf_id = $dbutils->getLayerWfsConfId($_SESSION["sld_gui_id"], $layer_id);
+if ( $wfs_conf_id ) {
+	$featuretype_id = $dbutils->getWfsConfFeatureTypeId($wfs_conf_id);
+	$classWfsConf->getelements($featuretype_id);
+	$wfs_element = $classWfsConf->elements;
+	$fts = $styledlayerdescriptor->layers[0]->styles[0]->featuretypestyles[0];
+	$fts->setElementArray("element_id",$wfs_element->element_id);
+	$fts->setElementArray("element_name",$wfs_element->element_name);
+} else {
+	$wfs_element = false;
+}
+
+/* create getMap-Url for preview with/without sld */
+$previewMapUrl = $dbutils->getPreviewMapUrl($_SESSION["sld_gui_id"], $layer_id, $_SESSION["sld_wms_id"]);
+
+echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
+echo "<html>\n";
+echo "<head>\n";
+echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n";
+echo "<meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">\n";
+echo "<META HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO-CACHE\">\n";
+echo "<title>Mapbender - SLD Editor</title>\n";
+echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/sldEditor.css\">\n";
+echo "</head>\n";
+echo "<body leftmargin=\"10\" topmargin=\"0\">\n";
+
+## - Fensteranfang
+echo "<table width=\"800px\"  border='0' cellspacing='0'>\n"; 	      
+## - 1.Zeile
+echo " <tr>\n";
+echo "  <td class='text2 bg2' colspan='2'>\n";
+echo "   &nbsp;&nbsp;Vorschau mit SLD:\n";
+echo "  </td>\n";
+echo "  <td>\n";
+echo "   &nbsp;\n";
+echo "  </td>\n";
+echo "  <td class='text2 bg2' colspan='2'>\n";
+echo "   &nbsp;&nbsp;Original ohne SLD:\n";
+echo "  </td>\n";
+echo " </tr>\n";
+
+## - Build URL to SLD
+$sld_url = "";
+$mb_sld_url = "";
+//$sld_url = "http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/sld_function_handler.php?function=getusersld&layer_id=".$layer_id."&user_id=".$mb_user_id."&forcesld=1";
+$sld_url = $MAPBENDER_URL."/sld_function_getusersld.php?function=getusersld&sld_gui_id=".$_SESSION["sld_gui_id"]."&sld_layer_id=".$layer_id."&user_id=".$mb_user_id."&forcesld=1";
+$mb_sld_url = $MAPBENDER_URL."/sld_function_getusersld.php?function=getusersld&sld_gui_id=".$_SESSION["sld_gui_id"]."&sld_wms_id=".$_SESSION["sld_wms_id"]."&user_id=".$mb_user_id;
+echo "<!-- $sld_url -->";
+echo "<!-- $previewMapUrl -->";
+## - 2.Zeile
+/*
+echo " <tr align='right'>\n";
+echo "  <td class='line_left2 text4'>\n";
+echo "   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Karte";
+echo "  </td>\n";
+echo "  <td class='line_right2'>\n";
+echo "   <img src='./img/map_magnify.png' border='0' alt='Originalgr&ouml;&szlig;e im neuen Fenster anzeigen' onClick=\"window.open('map.php','','fullsreen=yes,resizable=no,scrollbars=yes');\">\n";
+echo "  </td>\n";
+echo "  <td>\n";
+echo "   &nbsp;\n";
+echo "  </td>\n";
+echo "  <td class='line_left2 text4'>\n";
+echo "   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Karte";
+echo "  </td>\n";
+echo "  <td class='line_right2'>\n";
+echo "   <img src='./img/map_magnify.png' border='0' alt='Originalgr&ouml;&szlig;e im neuen Fenster anzeigen' onClick=\"window.open('map_original.php','','fullsreen=yes,resizable=no,scrollbars=yes');\">\n";
+echo "  </td>\n";
+echo " </tr>\n";
+*/
+
+## - 3.Zeile
+echo " <tr align='center'>\n";
+echo "  <td class='line_left2 line_right2' colspan='2'>\n";
+
+## - Map with SLD
+//Added rand(...) to force a reload of the image because the url should be different
+echo "   <img src=\"".$previewMapUrl."&WIDTH=320&HEIGHT=240&sld=".urlencode($sld_url)."&".rand(0,10000)."\" border=\"0\" width=\"320\" height=\"240\">";
+echo "  </td>\n";
+
+echo "  <td>\n";
+echo "   &nbsp;\n";
+echo "  </td>\n";
+
+echo "  <td class='line_left2 line_right2' colspan='2'>\n";
+
+## - Map without SLD
+echo "   <img src=\"".$previewMapUrl."&WIDTH=320&HEIGHT=240\" border=\"0\" width=\"320\" height=\"240\">";
+echo "  </td>\n";
+
+#4.Zeile
+echo " <tr>\n";
+echo "  <td class='line_left2 line_right2 text4' colspan='2'>\n";
+echo "   &nbsp;&nbsp;&nbsp;&nbsp;Legende\n";
+echo "  </td>\n";
+echo "  <td>\n";
+echo "   &nbsp;\n";
+echo "  </td>\n";
+echo "  <td class='line_left2 line_right2 text4' colspan='2'>\n";
+echo "   &nbsp;&nbsp;&nbsp;&nbsp;Legende\n";
+echo "  </td>\n";
+echo " </tr>\n";
+
+#5.Zeile
+echo " <tr>\n";
+echo "  <td class='line_left2 line_down2 line_right2' colspan='2'>\n";
+echo "   &nbsp;\n";
+## - Legend with SLD
+echo "   <img src=\"".$mapfileUrl."VERSION=1.1.0&REQUEST=GetLegendGraphic&SERVICE=WMS&LAYER=".urlencode($layer_name)."&FORMAT=image/png&sld=".urlencode($sld_url)."&".rand(0,10000)."\">\n";
+echo "  </td>\n";
+echo "   &nbsp;\n";
+echo "  <td>\n";
+echo "   &nbsp;\n";
+echo "  </td>\n";
+echo "  <td class='line_left2 line_down2 line_right2' colspan='2'>\n";
+echo "   &nbsp;\n";
+## - Legend without SLD
+echo "   <img src=\"".$mapfileUrl."VERSION=1.1.0&REQUEST=GetLegendGraphic&SERVICE=WMS&LAYER=".urlencode($layer_name)."&FORMAT=image/png\">";
+echo "  </td>\n";
+echo " </tr>\n";
+echo "</table>\n";
+
+echo "<br>\n";
+
+echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
+echo " <tr valign=\"top\">\n";
+echo "  <td>\n";
+
+echo "   <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
+echo "    <tr align=\"center\">\n";
+echo "     <td class=\"bg2 text3\">MENU</td>\n";
+echo "    </tr>\n";
+echo "    <tr>\n";
+echo "     <td class=\"line_left2 line_down2 line_right2 text4 bg_menu\">\n";
+
+//echo "      <form name=\"use_sld\" action=\"http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
+echo "      <form name=\"use_sld\" action=\"".$MAPBENDER_URL."/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
+echo "      <input type=\"hidden\" name=\"function\" value=\"usesld\">\n";
+echo "      <input type=\"hidden\" name=\"sld_url\" value=\"".$sld_url."\">\n";
+echo "      <input type=\"hidden\" name=\"mb_sld_url\" value=\"".$mb_sld_url."\">\n";
+echo "      &nbsp;&nbsp;Ansicht in Mapbender&nbsp;&nbsp;<br>\n";
+	
+echo "      <input type=\"radio\" name=\"use_sld\" value=\"0\"";
+if ($use_sld == 0) echo " checked";
+echo " onClick=\"submit()\">\n";
+echo "      &nbsp;Original ohne SLD&nbsp;&nbsp;<br>";
+
+echo "      <input type=\"radio\" name=\"use_sld\" value=\"1\"";
+if ($use_sld == 1) echo " checked";
+echo " onClick=\"submit()\">\n";
+echo "      &nbsp;mit SLD&nbsp;&nbsp;<br>";
+echo "      </form>\n";
+echo "     </td>\n";
+echo "    </tr>\n";
+echo "    <tr align=\"left\">\n";
+echo "     <td class=\"line_left2 line_down2 line_right2 text1 bg_menu\" style=\"padding:3px;\">\n";
+
+//echo "      <form id=\"sld_editor_form\" action=\"http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
+echo "      <form id=\"sld_editor_form\" action=\"".$MAPBENDER_URL."/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
+
+echo "      <a href='".$SLD_FUNCTION_HANDLER."&function=getdefaultsld' onclick='if(!confirm(\"Aktuelle SLD-Definition ersetzen?\")) return false;'>\n";
+echo "      <img src='./img/script.png' border='0' alt='Standard SLD aus WMS auslesen'>\n";
+echo "      </a> Standard &ouml;ffnen<br /><br />\n";
+
+echo "      <input type='image' src='./img/script_save.png' border='0' alt='�nderungen an die Map senden'>\n";
+echo "      SLD speichern<br>\n";
+echo "      <input type='hidden' name='function' value='save'>\n";
+echo "      <br /><a href=\"".$sld_url."\" target=_new>";	
+echo "      <img src='./img/script_code_red.png' border='0' alt='SLD anzeigen'>\n";
+echo "      </a>";
+echo "      SLD anzeigen";
+
+echo "     </td>\n";
+echo "    </tr>\n";
+echo "   </table>\n";
+
+echo "  </td>\n";
+echo "  <td>\n";
+echo "   &nbsp;&nbsp;&nbsp;";
+echo "  </td>\n";
+echo "  <td>\n";
+
+##  -  Fenster Eigenschaft
+echo "   <table border='0' cellspacing='0' cellpadding='0'>\n";
+echo "    <tr align='center'>\n";
+echo "     <td class='bg2 text3'>SLD Eigenschaften</td>\n";
+echo "    </tr>\n";
+echo "    <tr>\n";
+echo "     <td class='line_left2 line_down2 line_right2'>\n";
+
+echo $styledlayerdescriptor->generateHtmlForm("","      ");
+
+echo "     </td>\n";
+echo "    </tr>\n";
+echo "   </table>\n";
+echo "   </form>\n";
+
+echo "  </td>\n";
+echo " </tr>\n";
+echo "</table>\n";
+echo "<!-- ";
+print_r ($wfs_element);
+print_r ($_SESSION["sld_objects"][3]);
+echo "-->";
+echo "</body>\n";
+echo "</html>\n";
+##Debug
+//echo "------------------------------------------------------------------\n";
+//echo $styledlayerdescriptor->generateXml();
 ?>
\ No newline at end of file

Modified: branches/print_dev/http/sld/sld_parse.php
===================================================================
--- branches/print_dev/http/sld/sld_parse.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_parse.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,906 +1,906 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD/sld_config.php
-# 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.
-
-/**
- * Parses the sld-documents and creates the object structure.
- * This file does the parsing of the sld-data.
- * For all sld-elements that cannot be converted to a trivial datatype
- * a corresponding object is created.
- *
- * Creates the sld_objects and the sld_parent $_SESSION variables.
- * sld_objects is an array that contains the objects.
- * sld_parent is an array that contains the index of the object's parent object in sld_objects.
- * These variables are used to easily access the objects.
- *
- * @see sld_classes.php contains the class definitions
- * @package sld_parse
- * @author Markus Krzyzanowski
- */
-
-//require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-/**
- *  Creates a empty SLD object up to the rule object
- * 
- *  @return StyledLayerDescriptor
- */
-function createEmptySLD() {
-	$styledlayerdescriptor = new StyledLayerDescriptor();
-	$layer = new NamedLayer();
-	$style = new UserStyle();
-	$fts = new FeatureTypeStyle();
-	$rule = new Rule();
-	
-	$fts->rules[] = $rule;
-	$style->featuretypestyles[] = $fts;
-	$layer->styles[] = $style;
-	$layer->name = $_SESSION["sld_layer_name"];
-	$styledlayerdescriptor->layers[] = $layer;
-	$styledlayerdescriptor->version = "1.0.0";
-	$styledlayerdescriptor->id = 0;
-	$styledlayerdescriptor->parent = false;
-	
-	return $styledlayerdescriptor;
-}
-
-/**
- * Opens the file at the specified URL and returns the content.
- *
- * @param string $file URL of the file
- * @return string content of the file
- */
-function readSld($file)
-{
-	if (!($fp = fopen($file, "rb")))
-	{
-		die("could not open XML input - ".$file);
-	}
-	
-	$data = "";
-	
-	while(!feof($fp))
-	{
-		$data .= fread($fp, 1024);
-
-	}
-	return $data;
-}
-
-/**
- * Parses the data and creates the object structure.
- *
- * @param string $data data to be parsed
- * @return StyledLayerDesciptor root object of the sld-document
- */
-function parseSld($data)
-{
-	$xml_parser = xml_parser_create();
-	xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
-	xml_parse_into_struct($xml_parser, $data, $vals, $index);
-	xml_parser_free($xml_parser);
-	
-	$styledlayerdescriptor;
-	$parent = array();
-	$objects = array();
-	$parentactual = 0;
-	
-	for ($i=0; $i<count($vals); $i++)
-	{
-		$element = $vals[$i];
-		$tag = $element["tag"];
-		$tagname=strtoupper($tag);
-		switch($tagname)
-		{
-			// uh, the server responded with an error, should be break or start with an empty sld?
-			case "SERVICEEXCEPTIONREPORT":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = false;
-					$parentactual = 0;
-					/*
-					$styledlayerdescriptor = new StyledLayerDescriptor();
-					$styledlayerdescriptor->version = "1.0.0";
-					//Experimental:
-					*/
-					$styledlayerdescriptor = createEmptySLD();
-					$styledlayerdescriptor->id = 0;
-					$styledlayerdescriptor->parent = false;
-					//END Experimental
-					$objects[] = &$styledlayerdescriptor;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = false;
-					}
-					$_SESSION["sld_objects"] = $objects;
-					$_SESSION["sld_parent"] = $parent;
-					return $styledlayerdescriptor;
-				}				
-			case "STYLEDLAYERDESCRIPTOR":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = false;
-					$parentactual = 0;
-					$styledlayerdescriptor = new StyledLayerDescriptor();
-					$styledlayerdescriptor->version = $element["attributes"]["version"];
-					//Experimental:
-					$styledlayerdescriptor->id = 0;
-					$styledlayerdescriptor->parent = false;
-					//END Experimental
-					$objects[] = &$styledlayerdescriptor;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = false;
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "NAMEDLAYER":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new NamedLayer();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->layers[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "NAME":
-				if ($element["type"] == "complete")
-				{
-					//TODO - workaround suchen...!!!
-					//echo "-------------\n";
-					//echo $element["value"]."\n";
-					//$element["value"] = str_replace("<","&lt;",$element["value"]);
-					//$element["value"] = str_replace(">","&gt;",$element["value"]);
-					$objects[$parentactual]->name = $element["value"];
-				}
-				break;
-			case "TITLE":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->title = $element["value"];
-				}break;
-			case "ABSTRACT":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->abstract = $element["value"];
-				}
-				break;
-			case "MINSCALEDENOMINATOR":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->minscaledenominator = $element["value"];
-				}
-				break;
-			case "MAXSCALEDENOMINATOR":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->maxscaledenominator = $element["value"];
-				}
-				break;
-			case "USERSTYLE":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new UserStyle();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->styles[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "FEATURETYPESTYLE":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new FeatureTypeStyle();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->featuretypestyles[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "RULE":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Rule();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->rules[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "LINESYMBOLIZER":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new LineSymbolizer();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "POLYGONSYMBOLIZER":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new PolygonSymbolizer();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "POINTSYMBOLIZER":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new PointSymbolizer();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "TEXTSYMBOLIZER":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new TextSymbolizer();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "RASTERSYMBOLIZER":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new RasterSymbolizer();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "LEGENDGRAPHIC":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new LegendGraphic();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->legendgraphic = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-	//Commented out - Filters will be created through the creation of xml in the default case
-	//		case "ELSEFILTER":
-	//			if ($element["type"] == "complete")
-	//			{
-	//				$objects[$parentactual]->filter = new ElseFilter();
-	//			}
-	//			break;
-	//		case "OGC:FILTER": //TODO
-	//			if ($element["type"] == "complete")
-	//			{
-	//				//Create a new ElseFilter and write it to the parent object
-	//				$objects[$parentactual]->filter = new ElseFilter();
-	//			}
-	//			break;
-			case "GRAPHIC":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Graphic();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					
-					$objects[$parentactual]->graphic = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "EXTERNALGRAPHIC":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new ExternalGraphic();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->externalgraphicsormarks[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "ONLINERESOURCE":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->onlineresource = $element["attributes"]["xlink:href"];
-				}
-				break;
-			case "FORMAT":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->format = $element["value"];
-				}
-				break;
-			case "STROKE":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Stroke();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->stroke = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "CSSPARAMETER":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->cssparameters[] = new CssParameter();
-					//Experimental:
-					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->id = count($parent)-1;
-					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->name = $element["attributes"]["name"];
-					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->value = $element["value"];
-				}
-				break;
-			case "GRAPHICFILL":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new GraphicFill();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					
-					
-					//print_r($objects[count($parent)-1]);
-					
-					$objects[$parentactual]->graphicfill = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "GRAPHICSTROKE":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new GraphicStroke();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->graphicstroke = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "FILL":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Fill();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->fill = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-					}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "MARK":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Mark();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->externalgraphicsormarks[] = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "WELLKNOWNNAME":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->wellknownname = $element["value"];
-				}
-				break;
-			case "FONT":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Font();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->font = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "LABELPLACEMENT":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new LabelPlacement();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->labelplacement = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "POINTPLACEMENT":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new PointPlacement();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->placement = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "ANCHORPOINT":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new AnchorPoint();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->anchorpoint = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "DISPLACEMENT":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Displacement();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->displacement = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "HALO":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new Halo();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->halo = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "COLORMAP":
-				if ($element["type"] == "open" || $element["type"] == "complete")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new ColorMap();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->colormap = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					if ($element["type"] == "complete")
-					{
-						$parentactual = $parent[$parentactual];
-					}
-				}
-				else if($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "COLORMAPENTRY":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->colormapentries[] = new ColorMapEntry();
-					//Experimental:
-					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->id = count($parent)-1;
-					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->color = $element["attributes"]["color"];
-					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->opacity = $element["attributes"]["opacity"];
-					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->quantity = $element["attributes"]["quantity"];
-					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->label = $element["attributes"]["label"];
-				}
-				break;
-			case "LABEL":
-				if ($element["type"] == "complete")
-				{
-					//Kl�ren, ob Label nur so vorkommen kann - TODO
-					//$objects[$parentactual]->label = $element["value"];
-					
-					//use the new ParameterValue class to store the mixed content value
-					//simple case no extra markup ...
-					//the label is instanciated by TextSymbolizer
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new ParameterValue();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					$objects[count($parent)-1]->value = $element["value"];
-					//END Experimental
-					$objects[$parentactual]->label = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-					$parentactual = $parent[$parentactual];
-				}				
-				elseif ($element["type"] == "open")
-				{
-					$parent[] = $parentactual;
-					$objects[count($parent)-1] = new ParameterValue();
-					//Experimental:
-					$objects[count($parent)-1]->id = count($parent)-1;
-					$objects[count($parent)-1]->parent = $parentactual;
-					//END Experimental
-					$objects[$parentactual]->label = &$objects[count($parent)-1];
-					$parentactual = count($parent)-1;
-				}
-				elseif ($element["type"] == "close")
-				{
-					$parentactual = $parent[$parentactual];
-				}
-				break;
-			case "RADIUS":
-				if ($element["type"] == "complete")
-				{
-					//Kl�ren, ob Radius nur so vorkommen kann - TODO
-					$objects[$parentactual]->radius = $element["value"];
-				}
-				break;
-			case "OPACITY":
-				if ($element["type"] == "complete")
-				{
-					//Kl�ren, ob Opacity nur so vorkommen kann - TODO
-					$objects[$parentactual]->opacity = $element["value"];
-				}
-				break;
-			case "SIZE":
-				if ($element["type"] == "complete")
-				{
-					//Kl�ren, ob Size nur so vorkommen kann - TODO
-					$objects[$parentactual]->size = $element["value"];
-				}
-				break;
-			case "ROTATION":
-				if ($element["type"] == "complete")
-				{
-					//Kl�ren, ob Rotation nur so vorkommen kann - TODO
-					$objects[$parentactual]->rotation = $element["value"];
-				}
-				break;
-			case "ANCHORPOINTX":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->anchorpointx = $element["value"];
-				}
-				break;
-			case "ANCHORPOINTY":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->anchorpointy = $element["value"];
-				}
-				break;
-			case "DISPLACEMENTX":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->displacementx = $element["value"];
-				}
-				break;
-			case "DISPLACEMENTY":
-				if ($element["type"] == "complete")
-				{
-					$objects[$parentactual]->displacementy = $element["value"];
-				}
-				break;
-			//TODO: Kl�ren mit sld:parameterValueType
-			//bei den folgenden XML Elementen
-			case "PROPERTYNAME":
-				if ($element["type"] == "complete")
-				{
-					if ($temp == "") {
-						$objects[$parentactual]->value = $element["value"];
-						$parentactual = count($parent)-1;
-					}
-					else {
-						die($temp);
-					}
-				}
-				break;
-			//END TODO
-			//von den vorhergegangenen XML Elementen
-			
-			
-			default:
-					$temp = "";
-					if ($element["type"] == "open")
-					{
-						$temp .= "<".$tag;
-						if ($element["attributes"] != "")
-						{
-							$keys = array_keys($element["attributes"]);
-							foreach ($keys as $key)
-							{
-								$temp .= " ".$key."=\"".$element["attributes"][$key]."\"";
-							}
-						}
-						$temp .= ">";
-					}
-					if ($element["type"] == "close")
-					{
-						$temp .= "</".$tag.">";
-					}
-					if ($element["type"] == "complete")
-					{
-						$temp .= "<".$tag.">";
-						$temp .= $element["value"];
-						$temp .= "</".$tag.">";
-					}
-					//Wenn Parent vom Typ Rule, dann muss es ein Filter sein, also hinzuf�gen
-					if (strtoupper(get_class($objects[$parentactual])) == "RULE")
-					{
-						$objects[$parentactual]->filter .= $temp;
-						$temp = "";
-					}
-		}
-	}
-	
-	
-	//print_r($objects);
-	
-	
-	$_SESSION["sld_objects"] = $objects;
-	$_SESSION["sld_parent"] = $parent;
-	
-	return $styledlayerdescriptor;
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD/sld_config.php
+# 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.
+
+/**
+ * Parses the sld-documents and creates the object structure.
+ * This file does the parsing of the sld-data.
+ * For all sld-elements that cannot be converted to a trivial datatype
+ * a corresponding object is created.
+ *
+ * Creates the sld_objects and the sld_parent $_SESSION variables.
+ * sld_objects is an array that contains the objects.
+ * sld_parent is an array that contains the index of the object's parent object in sld_objects.
+ * These variables are used to easily access the objects.
+ *
+ * @see sld_classes.php contains the class definitions
+ * @package sld_parse
+ * @author Markus Krzyzanowski
+ */
+
+//require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+/**
+ *  Creates a empty SLD object up to the rule object
+ * 
+ *  @return StyledLayerDescriptor
+ */
+function createEmptySLD() {
+	$styledlayerdescriptor = new StyledLayerDescriptor();
+	$layer = new NamedLayer();
+	$style = new UserStyle();
+	$fts = new FeatureTypeStyle();
+	$rule = new Rule();
+	
+	$fts->rules[] = $rule;
+	$style->featuretypestyles[] = $fts;
+	$layer->styles[] = $style;
+	$layer->name = $_SESSION["sld_layer_name"];
+	$styledlayerdescriptor->layers[] = $layer;
+	$styledlayerdescriptor->version = "1.0.0";
+	$styledlayerdescriptor->id = 0;
+	$styledlayerdescriptor->parent = false;
+	
+	return $styledlayerdescriptor;
+}
+
+/**
+ * Opens the file at the specified URL and returns the content.
+ *
+ * @param string $file URL of the file
+ * @return string content of the file
+ */
+function readSld($file)
+{
+	if (!($fp = fopen($file, "rb")))
+	{
+		die("could not open XML input - ".$file);
+	}
+	
+	$data = "";
+	
+	while(!feof($fp))
+	{
+		$data .= fread($fp, 1024);
+
+	}
+	return $data;
+}
+
+/**
+ * Parses the data and creates the object structure.
+ *
+ * @param string $data data to be parsed
+ * @return StyledLayerDesciptor root object of the sld-document
+ */
+function parseSld($data)
+{
+	$xml_parser = xml_parser_create();
+	xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
+	xml_parse_into_struct($xml_parser, $data, $vals, $index);
+	xml_parser_free($xml_parser);
+	
+	$styledlayerdescriptor;
+	$parent = array();
+	$objects = array();
+	$parentactual = 0;
+	
+	for ($i=0; $i<count($vals); $i++)
+	{
+		$element = $vals[$i];
+		$tag = $element["tag"];
+		$tagname=strtoupper($tag);
+		switch($tagname)
+		{
+			// uh, the server responded with an error, should be break or start with an empty sld?
+			case "SERVICEEXCEPTIONREPORT":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = false;
+					$parentactual = 0;
+					/*
+					$styledlayerdescriptor = new StyledLayerDescriptor();
+					$styledlayerdescriptor->version = "1.0.0";
+					//Experimental:
+					*/
+					$styledlayerdescriptor = createEmptySLD();
+					$styledlayerdescriptor->id = 0;
+					$styledlayerdescriptor->parent = false;
+					//END Experimental
+					$objects[] = &$styledlayerdescriptor;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = false;
+					}
+					$_SESSION["sld_objects"] = $objects;
+					$_SESSION["sld_parent"] = $parent;
+					return $styledlayerdescriptor;
+				}				
+			case "STYLEDLAYERDESCRIPTOR":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = false;
+					$parentactual = 0;
+					$styledlayerdescriptor = new StyledLayerDescriptor();
+					$styledlayerdescriptor->version = $element["attributes"]["version"];
+					//Experimental:
+					$styledlayerdescriptor->id = 0;
+					$styledlayerdescriptor->parent = false;
+					//END Experimental
+					$objects[] = &$styledlayerdescriptor;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = false;
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "NAMEDLAYER":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new NamedLayer();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->layers[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "NAME":
+				if ($element["type"] == "complete")
+				{
+					//TODO - workaround suchen...!!!
+					//echo "-------------\n";
+					//echo $element["value"]."\n";
+					//$element["value"] = str_replace("<","&lt;",$element["value"]);
+					//$element["value"] = str_replace(">","&gt;",$element["value"]);
+					$objects[$parentactual]->name = $element["value"];
+				}
+				break;
+			case "TITLE":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->title = $element["value"];
+				}break;
+			case "ABSTRACT":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->abstract = $element["value"];
+				}
+				break;
+			case "MINSCALEDENOMINATOR":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->minscaledenominator = $element["value"];
+				}
+				break;
+			case "MAXSCALEDENOMINATOR":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->maxscaledenominator = $element["value"];
+				}
+				break;
+			case "USERSTYLE":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new UserStyle();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->styles[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "FEATURETYPESTYLE":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new FeatureTypeStyle();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->featuretypestyles[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "RULE":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Rule();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->rules[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "LINESYMBOLIZER":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new LineSymbolizer();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "POLYGONSYMBOLIZER":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new PolygonSymbolizer();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "POINTSYMBOLIZER":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new PointSymbolizer();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "TEXTSYMBOLIZER":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new TextSymbolizer();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "RASTERSYMBOLIZER":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new RasterSymbolizer();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->symbolizers[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "LEGENDGRAPHIC":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new LegendGraphic();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->legendgraphic = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+	//Commented out - Filters will be created through the creation of xml in the default case
+	//		case "ELSEFILTER":
+	//			if ($element["type"] == "complete")
+	//			{
+	//				$objects[$parentactual]->filter = new ElseFilter();
+	//			}
+	//			break;
+	//		case "OGC:FILTER": //TODO
+	//			if ($element["type"] == "complete")
+	//			{
+	//				//Create a new ElseFilter and write it to the parent object
+	//				$objects[$parentactual]->filter = new ElseFilter();
+	//			}
+	//			break;
+			case "GRAPHIC":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Graphic();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					
+					$objects[$parentactual]->graphic = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "EXTERNALGRAPHIC":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new ExternalGraphic();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->externalgraphicsormarks[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "ONLINERESOURCE":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->onlineresource = $element["attributes"]["xlink:href"];
+				}
+				break;
+			case "FORMAT":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->format = $element["value"];
+				}
+				break;
+			case "STROKE":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Stroke();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->stroke = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "CSSPARAMETER":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->cssparameters[] = new CssParameter();
+					//Experimental:
+					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->id = count($parent)-1;
+					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->name = $element["attributes"]["name"];
+					$objects[$parentactual]->cssparameters[count($objects[$parentactual]->cssparameters)-1]->value = $element["value"];
+				}
+				break;
+			case "GRAPHICFILL":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new GraphicFill();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					
+					
+					//print_r($objects[count($parent)-1]);
+					
+					$objects[$parentactual]->graphicfill = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "GRAPHICSTROKE":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new GraphicStroke();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->graphicstroke = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "FILL":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Fill();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->fill = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+					}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "MARK":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Mark();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->externalgraphicsormarks[] = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "WELLKNOWNNAME":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->wellknownname = $element["value"];
+				}
+				break;
+			case "FONT":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Font();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->font = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "LABELPLACEMENT":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new LabelPlacement();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->labelplacement = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "POINTPLACEMENT":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new PointPlacement();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->placement = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "ANCHORPOINT":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new AnchorPoint();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->anchorpoint = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "DISPLACEMENT":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Displacement();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->displacement = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "HALO":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new Halo();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->halo = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "COLORMAP":
+				if ($element["type"] == "open" || $element["type"] == "complete")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new ColorMap();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->colormap = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					if ($element["type"] == "complete")
+					{
+						$parentactual = $parent[$parentactual];
+					}
+				}
+				else if($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "COLORMAPENTRY":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->colormapentries[] = new ColorMapEntry();
+					//Experimental:
+					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->id = count($parent)-1;
+					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->color = $element["attributes"]["color"];
+					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->opacity = $element["attributes"]["opacity"];
+					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->quantity = $element["attributes"]["quantity"];
+					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->label = $element["attributes"]["label"];
+				}
+				break;
+			case "LABEL":
+				if ($element["type"] == "complete")
+				{
+					//Kl�ren, ob Label nur so vorkommen kann - TODO
+					//$objects[$parentactual]->label = $element["value"];
+					
+					//use the new ParameterValue class to store the mixed content value
+					//simple case no extra markup ...
+					//the label is instanciated by TextSymbolizer
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new ParameterValue();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[count($parent)-1]->value = $element["value"];
+					//END Experimental
+					$objects[$parentactual]->label = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					$parentactual = $parent[$parentactual];
+				}				
+				elseif ($element["type"] == "open")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new ParameterValue();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->label = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+				}
+				elseif ($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
+				break;
+			case "RADIUS":
+				if ($element["type"] == "complete")
+				{
+					//Kl�ren, ob Radius nur so vorkommen kann - TODO
+					$objects[$parentactual]->radius = $element["value"];
+				}
+				break;
+			case "OPACITY":
+				if ($element["type"] == "complete")
+				{
+					//Kl�ren, ob Opacity nur so vorkommen kann - TODO
+					$objects[$parentactual]->opacity = $element["value"];
+				}
+				break;
+			case "SIZE":
+				if ($element["type"] == "complete")
+				{
+					//Kl�ren, ob Size nur so vorkommen kann - TODO
+					$objects[$parentactual]->size = $element["value"];
+				}
+				break;
+			case "ROTATION":
+				if ($element["type"] == "complete")
+				{
+					//Kl�ren, ob Rotation nur so vorkommen kann - TODO
+					$objects[$parentactual]->rotation = $element["value"];
+				}
+				break;
+			case "ANCHORPOINTX":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->anchorpointx = $element["value"];
+				}
+				break;
+			case "ANCHORPOINTY":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->anchorpointy = $element["value"];
+				}
+				break;
+			case "DISPLACEMENTX":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->displacementx = $element["value"];
+				}
+				break;
+			case "DISPLACEMENTY":
+				if ($element["type"] == "complete")
+				{
+					$objects[$parentactual]->displacementy = $element["value"];
+				}
+				break;
+			//TODO: Kl�ren mit sld:parameterValueType
+			//bei den folgenden XML Elementen
+			case "PROPERTYNAME":
+				if ($element["type"] == "complete")
+				{
+					if ($temp == "") {
+						$objects[$parentactual]->value = $element["value"];
+						$parentactual = count($parent)-1;
+					}
+					else {
+						die($temp);
+					}
+				}
+				break;
+			//END TODO
+			//von den vorhergegangenen XML Elementen
+			
+			
+			default:
+					$temp = "";
+					if ($element["type"] == "open")
+					{
+						$temp .= "<".$tag;
+						if ($element["attributes"] != "")
+						{
+							$keys = array_keys($element["attributes"]);
+							foreach ($keys as $key)
+							{
+								$temp .= " ".$key."=\"".$element["attributes"][$key]."\"";
+							}
+						}
+						$temp .= ">";
+					}
+					if ($element["type"] == "close")
+					{
+						$temp .= "</".$tag.">";
+					}
+					if ($element["type"] == "complete")
+					{
+						$temp .= "<".$tag.">";
+						$temp .= $element["value"];
+						$temp .= "</".$tag.">";
+					}
+					//Wenn Parent vom Typ Rule, dann muss es ein Filter sein, also hinzuf�gen
+					if (strtoupper(get_class($objects[$parentactual])) == "RULE")
+					{
+						$objects[$parentactual]->filter .= $temp;
+						$temp = "";
+					}
+		}
+	}
+	
+	
+	//print_r($objects);
+	
+	
+	$_SESSION["sld_objects"] = $objects;
+	$_SESSION["sld_parent"] = $parent;
+	
+	return $styledlayerdescriptor;
+}
+?>

Modified: branches/print_dev/http/sld/sld_pick_color.php
===================================================================
--- branches/print_dev/http/sld/sld_pick_color.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/http/sld/sld_pick_color.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,330 +1,330 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/SLD/
-# 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.
-
-/**
- * Color-picker module.
- * This file realizes a color-picker module for the sld-editor so that
- * the users do not have to work with RGB values.
- * A number of colors from a wide spectrum is available with a preview
- * of each color.
- * Choosing a color and submitting the form will also submit the sld_edit_form
- * to directly save the changes to the sld.
- *
- * @package sld_pick_color
- * @author Markus Krzyzanowski, Design by Bao Ngan
- */
-
-
-session_start();
-$id = $_REQUEST["id"];
-$color= $_REQUEST["color"];
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<html>
-<head>
-<link rel="stylesheet" type="text/css" href="../css/sldEditor.css">
-<script Language="JavaScript">
-function returnToMain()
-{
-	window.opener.document.getElementById("<?php echo $id; ?>").value = document.getElementById('color').value;
-	var preview = window.opener.document.getElementById('<?php echo $id; ?>_preview');
-	preview.style.background = document.getElementById('color').value;
-	window.opener.document.getElementById("sld_editor_form").submit();
-	window.close();
-}
-function showColor(color)
-{
-	document.getElementById('color').value = color;
-	document.getElementById('preview').style.background = color;
-}
-function showColor_over(color)
-{
-	document.getElementById('preview_over').style.background = color;
-}
-</script>
-</head>
-<body leftmargin="2" topmargin="2">
-<!------ Rahmentabelle ------>
-<table width="294" height="188" border="0" cellpadding="0" cellspacing="0">
-  <tr>
-    <td height="14" colspan="4" align="center" class="text3 bg2">Farbpalette</td>
-  </tr>
-  <tr>
-    <td width="33" height="135" class="line_left2 ">
-	  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid black; background-color: #FFFFFF">
-    	<tr>
-      	 <td height="132" id="preview_over" width="100%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-    	</tr>
-      </table>
-    </td>
-    <td width="4">&nbsp;</td>
-    <td colspan="2" class="line_right2 ">
-	  <table style="border:1px solid black;" cellspacing="1" cellpadding="1" width="87%">
-	   <tr>
-  	  	<td width="10" style="width: 10px; background-color: #00FF00;" onClick="showColor('#00FF00');"   onMouseOver="showColor_over('#00FF00');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #00FF33;" onClick="showColor('#00FF33');"   onMouseOver="showColor_over('#00FF33');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #00FF66;" onClick="showColor('#00FF66');"   onMouseOver="showColor_over('#00FF66');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #00FF99;" onClick="showColor('#00FF99');"   onMouseOver="showColor_over('#00FF99');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #00FFCC;" onClick="showColor('#00FFCC');"   onMouseOver="showColor_over('#00FFCC');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #00FFFF;" onClick="showColor('#00FFFF');"    onMouseOver="showColor_over('#00FFFF');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #33FF00;" onClick="showColor('#33FF00');"   onMouseOver="showColor_over('#33FF00');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #33FF33;" onClick="showColor('#33FF33');"   onMouseOver="showColor_over('#33FF33');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #33FF66;" onClick="showColor('#33FF66');"   onMouseOver="showColor_over('#33FF66');">&nbsp;</td>
-  	  	<td width="10" style="width: 10px; background-color: #33FF99;" onClick="showColor('#33FF99');"   onMouseOver="showColor_over('#33FF99');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #33FFCC;" onClick="showColor('#33FFCC');"   onMouseOver="showColor_over('#33FFCC');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #33FFFF;" onClick="showColor('#33FFFF');"    onMouseOver="showColor_over('#33FFFF');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #66FF00;" onClick="showColor('#66FF00');"   onMouseOver="showColor_over('#66FF00');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #66FF33;" onClick="showColor('#66FF33');"   onMouseOver="showColor_over('#66FF33');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #66FF66;" onClick="showColor('#66FF66');"   onMouseOver="showColor_over('#66FF66');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #66FF99;" onClick="showColor('#66FF99');"   onMouseOver="showColor_over('#66FF99');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #66FFCC;" onClick="showColor('#66FFCC');"   onMouseOver="showColor_over('#66FFCC');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #66FFFF;" onClick="showColor('#66FFFF');"    onMouseOver="showColor_over('#66FFFF');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #99FF00;" onClick="showColor('#99FF00');"   onMouseOver="showColor_over('#99FF00');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #99FF33;" onClick="showColor('#99FF33');"   onMouseOver="showColor_over('#99FF33');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #99FF66;" onClick="showColor('#99FF66');"   onMouseOver="showColor_over('#99FF66');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #99FF99;" onClick="showColor('#99FF99');"   onMouseOver="showColor_over('#99FF99');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #99FFCC;" onClick="showColor('#99FFCC');"   onMouseOver="showColor_over('#99FFCC');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #99FFFF;" onClick="showColor('#99FFFF');"    onMouseOver="showColor_over('#99FFFF');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #CCFF00;" onClick="showColor('#CCFF00');"   onMouseOver="showColor_over('#CCFF00');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #CCFF33;" onClick="showColor('#CCFF33');"   onMouseOver="showColor_over('#CCFF33');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #CCFF66;" onClick="showColor('#CCFF66');"   onMouseOver="showColor_over('#CCFF66');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #CCFF99;" onClick="showColor('#CCFF99');"   onMouseOver="showColor_over('#CCFF99');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #CCFFCC;" onClick="showColor('#CCFFCC');"   onMouseOver="showColor_over('#CCFFCC');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #CCFFFF;" onClick="showColor('#CCFFFF');"    onMouseOver="showColor_over('#CCFFFF');">&nbsp;</td>
-    	<td width="10" style="width: 10px; background-color: #FFFF00;" onClick="showColor('#FFFF00');"    onMouseOver="showColor_over('#FFFF00');">&nbsp;</td>
-		<td width="10" style="width: 10px; background-color: #FFFF33;" onClick="showColor('#FFFF33');"    onMouseOver="showColor_over('#FFFF33');">&nbsp;</td>
-		<td width="10" style="width: 10px; background-color: #FFFF66;" onClick="showColor('#FFFF66');"    onMouseOver="showColor_over('#FFFF66');">&nbsp;</td>
-		<td width="10" style="width: 10px; background-color: #FFFF99;" onClick="showColor('#FFFF99');"    onMouseOver="showColor_over('#FFFF99');">&nbsp;</td>
-		<td width="10" style="width: 10px; background-color: #FFFFCC;" onClick="showColor('#FFFFCC');"    onMouseOver="showColor_over('#FFFFCC');">&nbsp;</td>
-		<td width="10" style="width: 10px; background-color: #FFFFFF;" onClick="showColor('#FFFFFF');"    onMouseOver="showColor_over('#FFFFFF');">&nbsp;</td>
-	   </tr>
-	   <tr>                                                                                         
-        <td style="width: 10px; background-color: #00CC00;" onClick="showColor('#00CC00');"		onMouseOver="showColor_over('#00CC00');">&nbsp;</td>
-		<td style="width: 10px; background-color: #00CC33;" onClick="showColor('#00CC33');"		onMouseOver="showColor_over('#00CC33');">&nbsp;</td>
-		<td style="width: 10px; background-color: #00CC66;" onClick="showColor('#00CC66');"		onMouseOver="showColor_over('#00CC66');">&nbsp;</td>
-		<td style="width: 10px; background-color: #00CC99;" onClick="showColor('#00CC99');"		onMouseOver="showColor_over('#00CC99');">&nbsp;</td>
-		<td style="width: 10px; background-color: #00CCCC;" onClick="showColor('#00CCCC');"		onMouseOver="showColor_over('#00CCCC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #00CCFF;" onClick="showColor('#00CCFF');"		onMouseOver="showColor_over('#00CCFF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #33CC00;" onClick="showColor('#33CC00');"		onMouseOver="showColor_over('#33CC00');">&nbsp;</td>
-		<td style="width: 10px; background-color: #33CC33;" onClick="showColor('#33CC33');"		onMouseOver="showColor_over('#33CC33');">&nbsp;</td>
-		<td style="width: 10px; background-color: #33CC66;" onClick="showColor('#33CC66');"		onMouseOver="showColor_over('#33CC66');">&nbsp;</td>
-		<td style="width: 10px; background-color: #33CC99;" onClick="showColor('#33CC99');"		onMouseOver="showColor_over('#33CC99');">&nbsp;</td>
-		<td style="width: 10px; background-color: #33CCCC;" onClick="showColor('#33CCCC');"		onMouseOver="showColor_over('#33CCCC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #33CCFF;" onClick="showColor('#33CCFF');"		onMouseOver="showColor_over('#33CCFF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #66CC00;" onClick="showColor('#66CC00');"		onMouseOver="showColor_over('#66CC00');">&nbsp;</td>
-		<td style="width: 10px; background-color: #66CC33;" onClick="showColor('#66CC33');"		onMouseOver="showColor_over('#66CC33');">&nbsp;</td>
-		<td style="width: 10px; background-color: #66CC66;" onClick="showColor('#66CC66');"		onMouseOver="showColor_over('#66CC66');">&nbsp;</td>
-		<td style="width: 10px; background-color: #66CC99;" onClick="showColor('#66CC99');"		onMouseOver="showColor_over('#66CC99');">&nbsp;</td>
-		<td style="width: 10px; background-color: #66CCCC;" onClick="showColor('#66CCCC');"		onMouseOver="showColor_over('#66CCCC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #66CCFF;" onClick="showColor('#66CCFF');"		onMouseOver="showColor_over('#66CCFF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #99CC00;" onClick="showColor('#99CC00');"		onMouseOver="showColor_over('#99CC00');">&nbsp;</td>
-		<td style="width: 10px; background-color: #99CC33;" onClick="showColor('#99CC33');"		onMouseOver="showColor_over('#99CC33');">&nbsp;</td>
-		<td style="width: 10px; background-color: #99CC66;" onClick="showColor('#99CC66');"		onMouseOver="showColor_over('#99CC66');">&nbsp;</td>
-		<td style="width: 10px; background-color: #99CC99;" onClick="showColor('#99CC99');"		onMouseOver="showColor_over('#99CC99');">&nbsp;</td>
-		<td style="width: 10px; background-color: #99CCCC;" onClick="showColor('#99CCCC');"		onMouseOver="showColor_over('#99CCCC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #99CCFF;" onClick="showColor('#99CCFF');"		onMouseOver="showColor_over('#99CCFF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CCCC00;" onClick="showColor('#CCCC00');"		onMouseOver="showColor_over('#CCCC00');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CCCC33;" onClick="showColor('#CCCC33');"		onMouseOver="showColor_over('#CCCC33');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CCCC66;" onClick="showColor('#CCCC66');"		onMouseOver="showColor_over('#CCCC66');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CCCC99;" onClick="showColor('#CCCC99');"		onMouseOver="showColor_over('#CCCC99');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CCCCCC;" onClick="showColor('#CCCCCC');"		onMouseOver="showColor_over('#CCCCCC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CCCCFF;" onClick="showColor('#CCCCFF');"		onMouseOver="showColor_over('#CCCCFF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FFCC00;" onClick="showColor('#FFCC00');"		onMouseOver="showColor_over('#FFCC00');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FFCC33;" onClick="showColor('#FFCC33');"		onMouseOver="showColor_over('#FFCC33');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FFCC66;" onClick="showColor('#FFCC66');"		onMouseOver="showColor_over('#FFCC66');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FFCC99;" onClick="showColor('#FFCC99');"		onMouseOver="showColor_over('#FFCC99');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FFCCCC;" onClick="showColor('#FFCCCC');"		onMouseOver="showColor_over('#FFCCCC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FFCCFF;" onClick="showColor('#FFCCFF');"		onMouseOver="showColor_over('#FFCCFF');">&nbsp;</td>
-       </tr>
-	   <tr>                                                                         	          
-		<td style="width: 10px; background-color: #009900;" onClick="showColor('#009900');"		onMouseOver="showColor_over('#009900');">&nbsp;</td>
-		<td style="width: 10px; background-color: #009933;" onClick="showColor('#009933');"		onMouseOver="showColor_over('#009933');">&nbsp;</td>
-		<td style="width: 10px; background-color: #009966;" onClick="showColor('#009966');"		onMouseOver="showColor_over('#009966');">&nbsp;</td>
-		<td style="width: 10px; background-color: #009999;" onClick="showColor('#009999');"		onMouseOver="showColor_over('#009999');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0099CC;" onClick="showColor('#0099CC');"		onMouseOver="showColor_over('#0099CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0099FF;" onClick="showColor('#0099FF');"		onMouseOver="showColor_over('#0099FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #339900;" onClick="showColor('#339900');"		onMouseOver="showColor_over('#339900');">&nbsp;</td>
-		<td style="width: 10px; background-color: #339933;" onClick="showColor('#339933');"		onMouseOver="showColor_over('#339933');">&nbsp;</td>
-		<td style="width: 10px; background-color: #339966;" onClick="showColor('#339966');"		onMouseOver="showColor_over('#339966');">&nbsp;</td>
-		<td style="width: 10px; background-color: #339999;" onClick="showColor('#339999');"		onMouseOver="showColor_over('#339999');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3399CC;" onClick="showColor('#3399CC');"		onMouseOver="showColor_over('#3399CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3399FF;" onClick="showColor('#3399FF');"		onMouseOver="showColor_over('#3399FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #669900;" onClick="showColor('#669900');"		onMouseOver="showColor_over('#669900');">&nbsp;</td>
-		<td style="width: 10px; background-color: #669933;" onClick="showColor('#669933');"		onMouseOver="showColor_over('#669933');">&nbsp;</td>
-		<td style="width: 10px; background-color: #669966;" onClick="showColor('#669966');"		onMouseOver="showColor_over('#669966');">&nbsp;</td>
-		<td style="width: 10px; background-color: #669999;" onClick="showColor('#669999');"		onMouseOver="showColor_over('#669999');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6699CC;" onClick="showColor('#6699CC');"		onMouseOver="showColor_over('#6699CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6699FF;" onClick="showColor('#6699FF');"		onMouseOver="showColor_over('#6699FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #999900;" onClick="showColor('#999900');"		onMouseOver="showColor_over('#999900');">&nbsp;</td>
-		<td style="width: 10px; background-color: #999933;" onClick="showColor('#999933');"		onMouseOver="showColor_over('#999933');">&nbsp;</td>
-		<td style="width: 10px; background-color: #999966;" onClick="showColor('#999966');"		onMouseOver="showColor_over('#999966');">&nbsp;</td>
-		<td style="width: 10px; background-color: #999999;" onClick="showColor('#999999');"		onMouseOver="showColor_over('#999999');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9999CC;" onClick="showColor('#9999CC');"		onMouseOver="showColor_over('#9999CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9999FF;" onClick="showColor('#9999FF');"		onMouseOver="showColor_over('#9999FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC9900;" onClick="showColor('#CC9900');"		onMouseOver="showColor_over('#CC9900');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC9933;" onClick="showColor('#CC9933');"		onMouseOver="showColor_over('#CC9933');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC9966;" onClick="showColor('#CC9966');"		onMouseOver="showColor_over('#CC9966');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC9999;" onClick="showColor('#CC9999');"		onMouseOver="showColor_over('#CC9999');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC99CC;" onClick="showColor('#CC99CC');"		onMouseOver="showColor_over('#CC99CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC99FF;" onClick="showColor('#CC99FF');"		onMouseOver="showColor_over('#CC99FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF9900;" onClick="showColor('#FF9900');"		onMouseOver="showColor_over('#FF9900');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF9933;" onClick="showColor('#FF9933');"		onMouseOver="showColor_over('#FF9933');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF9966;" onClick="showColor('#FF9966');"		onMouseOver="showColor_over('#FF9966');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF9999;" onClick="showColor('#FF9999');"		onMouseOver="showColor_over('#FF9999');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF99CC;" onClick="showColor('#FF99CC');"		onMouseOver="showColor_over('#FF99CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF99FF;" onClick="showColor('#FF99FF');"		onMouseOver="showColor_over('#FF99FF');">&nbsp;</td>
-       </tr>
-	   <tr>                                                                          		           
-		<td style="width: 10px; background-color: #006600;" onClick="showColor('#006600');"		onMouseOver="showColor_over('#006600');">&nbsp;</td>
-		<td style="width: 10px; background-color: #006633;" onClick="showColor('#006633');"		onMouseOver="showColor_over('#006633');">&nbsp;</td>
-		<td style="width: 10px; background-color: #006666;" onClick="showColor('#006666');"		onMouseOver="showColor_over('#006666');">&nbsp;</td>
-		<td style="width: 10px; background-color: #006699;" onClick="showColor('#006699');"		onMouseOver="showColor_over('#006699');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0066CC;" onClick="showColor('#0066CC');"		onMouseOver="showColor_over('#0066CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0066FF;" onClick="showColor('#0066FF');"		onMouseOver="showColor_over('#0066FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #336600;" onClick="showColor('#336600');"		onMouseOver="showColor_over('#336600');">&nbsp;</td>
-		<td style="width: 10px; background-color: #336633;" onClick="showColor('#336633');"		onMouseOver="showColor_over('#336633');">&nbsp;</td>
-		<td style="width: 10px; background-color: #336666;" onClick="showColor('#336666');"		onMouseOver="showColor_over('#336666');">&nbsp;</td>
-		<td style="width: 10px; background-color: #336699;" onClick="showColor('#336699');"		onMouseOver="showColor_over('#336699');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3366CC;" onClick="showColor('#3366CC');"		onMouseOver="showColor_over('#3366CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3366FF;" onClick="showColor('#3366FF');"		onMouseOver="showColor_over('#3366FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #666600;" onClick="showColor('#666600');"		onMouseOver="showColor_over('#666600');">&nbsp;</td>
-		<td style="width: 10px; background-color: #666633;" onClick="showColor('#666633');"		onMouseOver="showColor_over('#666633');">&nbsp;</td>
-		<td style="width: 10px; background-color: #666666;" onClick="showColor('#666666');"		onMouseOver="showColor_over('#666666');">&nbsp;</td>
-		<td style="width: 10px; background-color: #666699;" onClick="showColor('#666699');"		onMouseOver="showColor_over('#666699');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6666CC;" onClick="showColor('#6666CC');"		onMouseOver="showColor_over('#6666CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6666FF;" onClick="showColor('#6666FF');"		onMouseOver="showColor_over('#6666FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #996600;" onClick="showColor('#996600');"		onMouseOver="showColor_over('#996600');">&nbsp;</td>
-		<td style="width: 10px; background-color: #996633;" onClick="showColor('#996633');"		onMouseOver="showColor_over('#996633');">&nbsp;</td>
-		<td style="width: 10px; background-color: #996666;" onClick="showColor('#996666');"		onMouseOver="showColor_over('#996666');">&nbsp;</td>
-		<td style="width: 10px; background-color: #996699;" onClick="showColor('#996699');"		onMouseOver="showColor_over('#996699');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9966CC;" onClick="showColor('#9966CC');"		onMouseOver="showColor_over('#9966CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9966FF;" onClick="showColor('#9966FF');"		onMouseOver="showColor_over('#9966FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC6600;" onClick="showColor('#CC6600');"		onMouseOver="showColor_over('#CC6600');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC6633;" onClick="showColor('#CC6633');"		onMouseOver="showColor_over('#CC6633');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC6666;" onClick="showColor('#CC6666');"		onMouseOver="showColor_over('#CC6666');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC6699;" onClick="showColor('#CC6699');"		onMouseOver="showColor_over('#CC6699');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC66CC;" onClick="showColor('#CC66CC');"		onMouseOver="showColor_over('#CC66CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC66FF;" onClick="showColor('#CC66FF');"		onMouseOver="showColor_over('#CC66FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF6600;" onClick="showColor('#FF6600');"		onMouseOver="showColor_over('#FF6600');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF6633;" onClick="showColor('#FF6633');"		onMouseOver="showColor_over('#FF6633');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF6666;" onClick="showColor('#FF6666');"		onMouseOver="showColor_over('#FF6666');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF6699;" onClick="showColor('#FF6699');"		onMouseOver="showColor_over('#FF6699');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF66CC;" onClick="showColor('#FF66CC');"		onMouseOver="showColor_over('#FF66CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF66FF;" onClick="showColor('#FF66FF');"		onMouseOver="showColor_over('#FF66FF');">&nbsp;</td>
-	   </tr>
-	   <tr>                                                                          		            
-		<td style="width: 10px; background-color: #003300;" onClick="showColor('#003300');"		onMouseOver="showColor_over('#003300');">&nbsp;</td>
-		<td style="width: 10px; background-color: #003333;" onClick="showColor('#003333');"		onMouseOver="showColor_over('#003333');">&nbsp;</td>
-		<td style="width: 10px; background-color: #003366;" onClick="showColor('#003366');"		onMouseOver="showColor_over('#003366');">&nbsp;</td>
-		<td style="width: 10px; background-color: #003399;" onClick="showColor('#003399');"		onMouseOver="showColor_over('#003399');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0033CC;" onClick="showColor('#0033CC');"		onMouseOver="showColor_over('#0033CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0033FF;" onClick="showColor('#0033FF');"		onMouseOver="showColor_over('#0033FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #333300;" onClick="showColor('#333300');"		onMouseOver="showColor_over('#333300');">&nbsp;</td>
-		<td style="width: 10px; background-color: #333333;" onClick="showColor('#333333');"		onMouseOver="showColor_over('#333333');">&nbsp;</td>
-		<td style="width: 10px; background-color: #333366;" onClick="showColor('#333366');"		onMouseOver="showColor_over('#333366');">&nbsp;</td>
-		<td style="width: 10px; background-color: #333399;" onClick="showColor('#333399');"		onMouseOver="showColor_over('#333399');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3333CC;" onClick="showColor('#3333CC');"		onMouseOver="showColor_over('#3333CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3333FF;" onClick="showColor('#3333FF');"		onMouseOver="showColor_over('#3333FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #663300;" onClick="showColor('#663300');"		onMouseOver="showColor_over('#663300');">&nbsp;</td>
-		<td style="width: 10px; background-color: #663333;" onClick="showColor('#663333');"		onMouseOver="showColor_over('#663333');">&nbsp;</td>
-		<td style="width: 10px; background-color: #663366;" onClick="showColor('#663366');"		onMouseOver="showColor_over('#663366');">&nbsp;</td>
-		<td style="width: 10px; background-color: #663399;" onClick="showColor('#663399');"		onMouseOver="showColor_over('#663399');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6633CC;" onClick="showColor('#6633CC');"		onMouseOver="showColor_over('#6633CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6633FF;" onClick="showColor('#6633FF');"		onMouseOver="showColor_over('#6633FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #993300;" onClick="showColor('#993300');"		onMouseOver="showColor_over('#993300');">&nbsp;</td>
-		<td style="width: 10px; background-color: #993333;" onClick="showColor('#993333');"		onMouseOver="showColor_over('#993333');">&nbsp;</td>
-		<td style="width: 10px; background-color: #993366;" onClick="showColor('#993366');"		onMouseOver="showColor_over('#993366');">&nbsp;</td>
-		<td style="width: 10px; background-color: #993399;" onClick="showColor('#993399');"		onMouseOver="showColor_over('#993399');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9933CC;" onClick="showColor('#9933CC');"		onMouseOver="showColor_over('#9933CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9933FF;" onClick="showColor('#9933FF');"		onMouseOver="showColor_over('#9933FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC3300;" onClick="showColor('#CC3300');"		onMouseOver="showColor_over('#CC3300');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC3333;" onClick="showColor('#CC3333');"		onMouseOver="showColor_over('#CC3333');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC3366;" onClick="showColor('#CC3366');"		onMouseOver="showColor_over('#CC3366');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC3399;" onClick="showColor('#CC3399');"		onMouseOver="showColor_over('#CC3399');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC33CC;" onClick="showColor('#CC33CC');"		onMouseOver="showColor_over('#CC33CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC33FF;" onClick="showColor('#CC33FF');"		onMouseOver="showColor_over('#CC33FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF3300;" onClick="showColor('#FF3300');"		onMouseOver="showColor_over('#FF3300');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF3333;" onClick="showColor('#FF3333');"		onMouseOver="showColor_over('#FF3333');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF3366;" onClick="showColor('#FF3366');"		onMouseOver="showColor_over('#FF3366');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF3399;" onClick="showColor('#FF3399');"		onMouseOver="showColor_over('#FF3399');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF33CC;" onClick="showColor('#FF33CC');"		onMouseOver="showColor_over('#FF33CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF33FF;" onClick="showColor('#FF33FF');"		onMouseOver="showColor_over('#FF33FF');">&nbsp;</td>
-	   </tr>
-	   <tr>                                                                          		                                                                                      		          
-		<td height="21" style="width: 10px; background-color: #000000;" onClick="showColor('#000000');"		onMouseOver="showColor_over('#000000');">&nbsp;</td>
-		<td style="width: 10px; background-color: #000033;" onClick="showColor('#000033');"		onMouseOver="showColor_over('#000033');">&nbsp;</td>
-		<td style="width: 10px; background-color: #000066;" onClick="showColor('#000066');"		onMouseOver="showColor_over('#000066');">&nbsp;</td>
-		<td style="width: 10px; background-color: #000099;" onClick="showColor('#000099');"		onMouseOver="showColor_over('#000099');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0000CC;" onClick="showColor('#0000CC');"		onMouseOver="showColor_over('#0000CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #0000FF;" onClick="showColor('#0000FF');"		onMouseOver="showColor_over('#0000FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #330000;" onClick="showColor('#330000');"		onMouseOver="showColor_over('#330000');">&nbsp;</td>
-		<td style="width: 10px; background-color: #330033;" onClick="showColor('#330033');"		onMouseOver="showColor_over('#330033');">&nbsp;</td>
-		<td style="width: 10px; background-color: #330066;" onClick="showColor('#330066');"		onMouseOver="showColor_over('#330066');">&nbsp;</td>
-		<td style="width: 10px; background-color: #330099;" onClick="showColor('#330099');"		onMouseOver="showColor_over('#330099');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3300CC;" onClick="showColor('#3300CC');"		onMouseOver="showColor_over('#3300CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #3300FF;" onClick="showColor('#3300FF');"		onMouseOver="showColor_over('#3300FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #660000;" onClick="showColor('#660000');"		onMouseOver="showColor_over('#660000');">&nbsp;</td>
-		<td style="width: 10px; background-color: #660033;" onClick="showColor('#660033');"		onMouseOver="showColor_over('#660033');">&nbsp;</td>
-		<td style="width: 10px; background-color: #660066;" onClick="showColor('#660066');"		onMouseOver="showColor_over('#660066');">&nbsp;</td>
-		<td style="width: 10px; background-color: #660099;" onClick="showColor('#660099');"		onMouseOver="showColor_over('#660099');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6600CC;" onClick="showColor('#6600CC');"		onMouseOver="showColor_over('#6600CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #6600FF;" onClick="showColor('#6600FF');"		onMouseOver="showColor_over('#6600FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #990000;" onClick="showColor('#990000');"		onMouseOver="showColor_over('#990000');">&nbsp;</td>
-		<td style="width: 10px; background-color: #990033;" onClick="showColor('#990033');"		onMouseOver="showColor_over('#990033');">&nbsp;</td>
-		<td style="width: 10px; background-color: #990066;" onClick="showColor('#990066');"		onMouseOver="showColor_over('#990066');">&nbsp;</td>
-		<td style="width: 10px; background-color: #990099;" onClick="showColor('#990099');"		onMouseOver="showColor_over('#990099');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9900CC;" onClick="showColor('#9900CC');"		onMouseOver="showColor_over('#9900CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #9900FF;" onClick="showColor('#9900FF');"		onMouseOver="showColor_over('#9900FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC0000;" onClick="showColor('#CC0000');"		onMouseOver="showColor_over('#CC0000');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC0033;" onClick="showColor('#CC0033');"		onMouseOver="showColor_over('#CC0033');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC0066;" onClick="showColor('#CC0066');"		onMouseOver="showColor_over('#CC0066');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC0099;" onClick="showColor('#CC0099');"		onMouseOver="showColor_over('#CC0099');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC00CC;" onClick="showColor('#CC00CC');"		onMouseOver="showColor_over('#CC00CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #CC00FF;" onClick="showColor('#CC00FF');"		onMouseOver="showColor_over('#CC00FF');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF0000;" onClick="showColor('#FF0000');"		onMouseOver="showColor_over('#FF0000');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF0033;" onClick="showColor('#FF0033');"		onMouseOver="showColor_over('#FF0033');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF0066;" onClick="showColor('#FF0066');"		onMouseOver="showColor_over('#FF0066');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF0099;" onClick="showColor('#FF0099');"		onMouseOver="showColor_over('#FF0099');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF00CC;" onClick="showColor('#FF00CC');"		onMouseOver="showColor_over('#FF00CC');">&nbsp;</td>
-		<td style="width: 10px; background-color: #FF00FF;" onClick="showColor('#FF00FF');"		onMouseOver="showColor_over('#FF00FF');">&nbsp;</td>
-       </tr>
-      </table>
-	</td>
-  </tr>
-  <tr align="center">
-    <td height="14" colspan="4" class="line_left2 line_right2 text3 bg2">&nbsp;Ausgew�hlte Farbe:</td>
-  </tr>
-  <tr>
-    <td height="25" class="line_left2 line_down2 text1">
-	   <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid black; background-color: #FFFFFF">
-    	<tr>
-      	  <td id="preview" width="100%">&nbsp;</td>
-    	</tr>
-      </table>
-	</td>
-    <td class="line_down2">&nbsp;</td>
-    <td width="38" class="text1 line_down2"><input id="color" value="#000000" size="6" readonly class="inputfield"></td>
-    <td width="364" class="line_down2 line_right2" align="right">
-	<input type="button" value="Speichern" onClick="returnToMain();" class="button">
-	<input type="button" value="Abbruch" onClick="window.close();" class="button">    
-	</td>
-  </tr>
-</table>
-</body>
-</html>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD/
+# 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.
+
+/**
+ * Color-picker module.
+ * This file realizes a color-picker module for the sld-editor so that
+ * the users do not have to work with RGB values.
+ * A number of colors from a wide spectrum is available with a preview
+ * of each color.
+ * Choosing a color and submitting the form will also submit the sld_edit_form
+ * to directly save the changes to the sld.
+ *
+ * @package sld_pick_color
+ * @author Markus Krzyzanowski, Design by Bao Ngan
+ */
+
+
+session_start();
+$id = $_REQUEST["id"];
+$color= $_REQUEST["color"];
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+?>
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="../css/sldEditor.css">
+<script Language="JavaScript">
+function returnToMain()
+{
+	window.opener.document.getElementById("<?php echo $id; ?>").value = document.getElementById('color').value;
+	var preview = window.opener.document.getElementById('<?php echo $id; ?>_preview');
+	preview.style.background = document.getElementById('color').value;
+	window.opener.document.getElementById("sld_editor_form").submit();
+	window.close();
+}
+function showColor(color)
+{
+	document.getElementById('color').value = color;
+	document.getElementById('preview').style.background = color;
+}
+function showColor_over(color)
+{
+	document.getElementById('preview_over').style.background = color;
+}
+</script>
+</head>
+<body leftmargin="2" topmargin="2">
+<!------ Rahmentabelle ------>
+<table width="294" height="188" border="0" cellpadding="0" cellspacing="0">
+  <tr>
+    <td height="14" colspan="4" align="center" class="text3 bg2">Farbpalette</td>
+  </tr>
+  <tr>
+    <td width="33" height="135" class="line_left2 ">
+	  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid black; background-color: #FFFFFF">
+    	<tr>
+      	 <td height="132" id="preview_over" width="100%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+    	</tr>
+      </table>
+    </td>
+    <td width="4">&nbsp;</td>
+    <td colspan="2" class="line_right2 ">
+	  <table style="border:1px solid black;" cellspacing="1" cellpadding="1" width="87%">
+	   <tr>
+  	  	<td width="10" style="width: 10px; background-color: #00FF00;" onClick="showColor('#00FF00');"   onMouseOver="showColor_over('#00FF00');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #00FF33;" onClick="showColor('#00FF33');"   onMouseOver="showColor_over('#00FF33');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #00FF66;" onClick="showColor('#00FF66');"   onMouseOver="showColor_over('#00FF66');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #00FF99;" onClick="showColor('#00FF99');"   onMouseOver="showColor_over('#00FF99');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #00FFCC;" onClick="showColor('#00FFCC');"   onMouseOver="showColor_over('#00FFCC');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #00FFFF;" onClick="showColor('#00FFFF');"    onMouseOver="showColor_over('#00FFFF');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #33FF00;" onClick="showColor('#33FF00');"   onMouseOver="showColor_over('#33FF00');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #33FF33;" onClick="showColor('#33FF33');"   onMouseOver="showColor_over('#33FF33');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #33FF66;" onClick="showColor('#33FF66');"   onMouseOver="showColor_over('#33FF66');">&nbsp;</td>
+  	  	<td width="10" style="width: 10px; background-color: #33FF99;" onClick="showColor('#33FF99');"   onMouseOver="showColor_over('#33FF99');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #33FFCC;" onClick="showColor('#33FFCC');"   onMouseOver="showColor_over('#33FFCC');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #33FFFF;" onClick="showColor('#33FFFF');"    onMouseOver="showColor_over('#33FFFF');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #66FF00;" onClick="showColor('#66FF00');"   onMouseOver="showColor_over('#66FF00');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #66FF33;" onClick="showColor('#66FF33');"   onMouseOver="showColor_over('#66FF33');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #66FF66;" onClick="showColor('#66FF66');"   onMouseOver="showColor_over('#66FF66');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #66FF99;" onClick="showColor('#66FF99');"   onMouseOver="showColor_over('#66FF99');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #66FFCC;" onClick="showColor('#66FFCC');"   onMouseOver="showColor_over('#66FFCC');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #66FFFF;" onClick="showColor('#66FFFF');"    onMouseOver="showColor_over('#66FFFF');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #99FF00;" onClick="showColor('#99FF00');"   onMouseOver="showColor_over('#99FF00');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #99FF33;" onClick="showColor('#99FF33');"   onMouseOver="showColor_over('#99FF33');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #99FF66;" onClick="showColor('#99FF66');"   onMouseOver="showColor_over('#99FF66');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #99FF99;" onClick="showColor('#99FF99');"   onMouseOver="showColor_over('#99FF99');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #99FFCC;" onClick="showColor('#99FFCC');"   onMouseOver="showColor_over('#99FFCC');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #99FFFF;" onClick="showColor('#99FFFF');"    onMouseOver="showColor_over('#99FFFF');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #CCFF00;" onClick="showColor('#CCFF00');"   onMouseOver="showColor_over('#CCFF00');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #CCFF33;" onClick="showColor('#CCFF33');"   onMouseOver="showColor_over('#CCFF33');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #CCFF66;" onClick="showColor('#CCFF66');"   onMouseOver="showColor_over('#CCFF66');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #CCFF99;" onClick="showColor('#CCFF99');"   onMouseOver="showColor_over('#CCFF99');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #CCFFCC;" onClick="showColor('#CCFFCC');"   onMouseOver="showColor_over('#CCFFCC');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #CCFFFF;" onClick="showColor('#CCFFFF');"    onMouseOver="showColor_over('#CCFFFF');">&nbsp;</td>
+    	<td width="10" style="width: 10px; background-color: #FFFF00;" onClick="showColor('#FFFF00');"    onMouseOver="showColor_over('#FFFF00');">&nbsp;</td>
+		<td width="10" style="width: 10px; background-color: #FFFF33;" onClick="showColor('#FFFF33');"    onMouseOver="showColor_over('#FFFF33');">&nbsp;</td>
+		<td width="10" style="width: 10px; background-color: #FFFF66;" onClick="showColor('#FFFF66');"    onMouseOver="showColor_over('#FFFF66');">&nbsp;</td>
+		<td width="10" style="width: 10px; background-color: #FFFF99;" onClick="showColor('#FFFF99');"    onMouseOver="showColor_over('#FFFF99');">&nbsp;</td>
+		<td width="10" style="width: 10px; background-color: #FFFFCC;" onClick="showColor('#FFFFCC');"    onMouseOver="showColor_over('#FFFFCC');">&nbsp;</td>
+		<td width="10" style="width: 10px; background-color: #FFFFFF;" onClick="showColor('#FFFFFF');"    onMouseOver="showColor_over('#FFFFFF');">&nbsp;</td>
+	   </tr>
+	   <tr>                                                                                         
+        <td style="width: 10px; background-color: #00CC00;" onClick="showColor('#00CC00');"		onMouseOver="showColor_over('#00CC00');">&nbsp;</td>
+		<td style="width: 10px; background-color: #00CC33;" onClick="showColor('#00CC33');"		onMouseOver="showColor_over('#00CC33');">&nbsp;</td>
+		<td style="width: 10px; background-color: #00CC66;" onClick="showColor('#00CC66');"		onMouseOver="showColor_over('#00CC66');">&nbsp;</td>
+		<td style="width: 10px; background-color: #00CC99;" onClick="showColor('#00CC99');"		onMouseOver="showColor_over('#00CC99');">&nbsp;</td>
+		<td style="width: 10px; background-color: #00CCCC;" onClick="showColor('#00CCCC');"		onMouseOver="showColor_over('#00CCCC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #00CCFF;" onClick="showColor('#00CCFF');"		onMouseOver="showColor_over('#00CCFF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #33CC00;" onClick="showColor('#33CC00');"		onMouseOver="showColor_over('#33CC00');">&nbsp;</td>
+		<td style="width: 10px; background-color: #33CC33;" onClick="showColor('#33CC33');"		onMouseOver="showColor_over('#33CC33');">&nbsp;</td>
+		<td style="width: 10px; background-color: #33CC66;" onClick="showColor('#33CC66');"		onMouseOver="showColor_over('#33CC66');">&nbsp;</td>
+		<td style="width: 10px; background-color: #33CC99;" onClick="showColor('#33CC99');"		onMouseOver="showColor_over('#33CC99');">&nbsp;</td>
+		<td style="width: 10px; background-color: #33CCCC;" onClick="showColor('#33CCCC');"		onMouseOver="showColor_over('#33CCCC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #33CCFF;" onClick="showColor('#33CCFF');"		onMouseOver="showColor_over('#33CCFF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #66CC00;" onClick="showColor('#66CC00');"		onMouseOver="showColor_over('#66CC00');">&nbsp;</td>
+		<td style="width: 10px; background-color: #66CC33;" onClick="showColor('#66CC33');"		onMouseOver="showColor_over('#66CC33');">&nbsp;</td>
+		<td style="width: 10px; background-color: #66CC66;" onClick="showColor('#66CC66');"		onMouseOver="showColor_over('#66CC66');">&nbsp;</td>
+		<td style="width: 10px; background-color: #66CC99;" onClick="showColor('#66CC99');"		onMouseOver="showColor_over('#66CC99');">&nbsp;</td>
+		<td style="width: 10px; background-color: #66CCCC;" onClick="showColor('#66CCCC');"		onMouseOver="showColor_over('#66CCCC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #66CCFF;" onClick="showColor('#66CCFF');"		onMouseOver="showColor_over('#66CCFF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #99CC00;" onClick="showColor('#99CC00');"		onMouseOver="showColor_over('#99CC00');">&nbsp;</td>
+		<td style="width: 10px; background-color: #99CC33;" onClick="showColor('#99CC33');"		onMouseOver="showColor_over('#99CC33');">&nbsp;</td>
+		<td style="width: 10px; background-color: #99CC66;" onClick="showColor('#99CC66');"		onMouseOver="showColor_over('#99CC66');">&nbsp;</td>
+		<td style="width: 10px; background-color: #99CC99;" onClick="showColor('#99CC99');"		onMouseOver="showColor_over('#99CC99');">&nbsp;</td>
+		<td style="width: 10px; background-color: #99CCCC;" onClick="showColor('#99CCCC');"		onMouseOver="showColor_over('#99CCCC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #99CCFF;" onClick="showColor('#99CCFF');"		onMouseOver="showColor_over('#99CCFF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CCCC00;" onClick="showColor('#CCCC00');"		onMouseOver="showColor_over('#CCCC00');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CCCC33;" onClick="showColor('#CCCC33');"		onMouseOver="showColor_over('#CCCC33');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CCCC66;" onClick="showColor('#CCCC66');"		onMouseOver="showColor_over('#CCCC66');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CCCC99;" onClick="showColor('#CCCC99');"		onMouseOver="showColor_over('#CCCC99');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CCCCCC;" onClick="showColor('#CCCCCC');"		onMouseOver="showColor_over('#CCCCCC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CCCCFF;" onClick="showColor('#CCCCFF');"		onMouseOver="showColor_over('#CCCCFF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FFCC00;" onClick="showColor('#FFCC00');"		onMouseOver="showColor_over('#FFCC00');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FFCC33;" onClick="showColor('#FFCC33');"		onMouseOver="showColor_over('#FFCC33');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FFCC66;" onClick="showColor('#FFCC66');"		onMouseOver="showColor_over('#FFCC66');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FFCC99;" onClick="showColor('#FFCC99');"		onMouseOver="showColor_over('#FFCC99');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FFCCCC;" onClick="showColor('#FFCCCC');"		onMouseOver="showColor_over('#FFCCCC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FFCCFF;" onClick="showColor('#FFCCFF');"		onMouseOver="showColor_over('#FFCCFF');">&nbsp;</td>
+       </tr>
+	   <tr>                                                                         	          
+		<td style="width: 10px; background-color: #009900;" onClick="showColor('#009900');"		onMouseOver="showColor_over('#009900');">&nbsp;</td>
+		<td style="width: 10px; background-color: #009933;" onClick="showColor('#009933');"		onMouseOver="showColor_over('#009933');">&nbsp;</td>
+		<td style="width: 10px; background-color: #009966;" onClick="showColor('#009966');"		onMouseOver="showColor_over('#009966');">&nbsp;</td>
+		<td style="width: 10px; background-color: #009999;" onClick="showColor('#009999');"		onMouseOver="showColor_over('#009999');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0099CC;" onClick="showColor('#0099CC');"		onMouseOver="showColor_over('#0099CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0099FF;" onClick="showColor('#0099FF');"		onMouseOver="showColor_over('#0099FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #339900;" onClick="showColor('#339900');"		onMouseOver="showColor_over('#339900');">&nbsp;</td>
+		<td style="width: 10px; background-color: #339933;" onClick="showColor('#339933');"		onMouseOver="showColor_over('#339933');">&nbsp;</td>
+		<td style="width: 10px; background-color: #339966;" onClick="showColor('#339966');"		onMouseOver="showColor_over('#339966');">&nbsp;</td>
+		<td style="width: 10px; background-color: #339999;" onClick="showColor('#339999');"		onMouseOver="showColor_over('#339999');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3399CC;" onClick="showColor('#3399CC');"		onMouseOver="showColor_over('#3399CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3399FF;" onClick="showColor('#3399FF');"		onMouseOver="showColor_over('#3399FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #669900;" onClick="showColor('#669900');"		onMouseOver="showColor_over('#669900');">&nbsp;</td>
+		<td style="width: 10px; background-color: #669933;" onClick="showColor('#669933');"		onMouseOver="showColor_over('#669933');">&nbsp;</td>
+		<td style="width: 10px; background-color: #669966;" onClick="showColor('#669966');"		onMouseOver="showColor_over('#669966');">&nbsp;</td>
+		<td style="width: 10px; background-color: #669999;" onClick="showColor('#669999');"		onMouseOver="showColor_over('#669999');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6699CC;" onClick="showColor('#6699CC');"		onMouseOver="showColor_over('#6699CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6699FF;" onClick="showColor('#6699FF');"		onMouseOver="showColor_over('#6699FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #999900;" onClick="showColor('#999900');"		onMouseOver="showColor_over('#999900');">&nbsp;</td>
+		<td style="width: 10px; background-color: #999933;" onClick="showColor('#999933');"		onMouseOver="showColor_over('#999933');">&nbsp;</td>
+		<td style="width: 10px; background-color: #999966;" onClick="showColor('#999966');"		onMouseOver="showColor_over('#999966');">&nbsp;</td>
+		<td style="width: 10px; background-color: #999999;" onClick="showColor('#999999');"		onMouseOver="showColor_over('#999999');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9999CC;" onClick="showColor('#9999CC');"		onMouseOver="showColor_over('#9999CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9999FF;" onClick="showColor('#9999FF');"		onMouseOver="showColor_over('#9999FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC9900;" onClick="showColor('#CC9900');"		onMouseOver="showColor_over('#CC9900');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC9933;" onClick="showColor('#CC9933');"		onMouseOver="showColor_over('#CC9933');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC9966;" onClick="showColor('#CC9966');"		onMouseOver="showColor_over('#CC9966');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC9999;" onClick="showColor('#CC9999');"		onMouseOver="showColor_over('#CC9999');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC99CC;" onClick="showColor('#CC99CC');"		onMouseOver="showColor_over('#CC99CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC99FF;" onClick="showColor('#CC99FF');"		onMouseOver="showColor_over('#CC99FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF9900;" onClick="showColor('#FF9900');"		onMouseOver="showColor_over('#FF9900');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF9933;" onClick="showColor('#FF9933');"		onMouseOver="showColor_over('#FF9933');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF9966;" onClick="showColor('#FF9966');"		onMouseOver="showColor_over('#FF9966');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF9999;" onClick="showColor('#FF9999');"		onMouseOver="showColor_over('#FF9999');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF99CC;" onClick="showColor('#FF99CC');"		onMouseOver="showColor_over('#FF99CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF99FF;" onClick="showColor('#FF99FF');"		onMouseOver="showColor_over('#FF99FF');">&nbsp;</td>
+       </tr>
+	   <tr>                                                                          		           
+		<td style="width: 10px; background-color: #006600;" onClick="showColor('#006600');"		onMouseOver="showColor_over('#006600');">&nbsp;</td>
+		<td style="width: 10px; background-color: #006633;" onClick="showColor('#006633');"		onMouseOver="showColor_over('#006633');">&nbsp;</td>
+		<td style="width: 10px; background-color: #006666;" onClick="showColor('#006666');"		onMouseOver="showColor_over('#006666');">&nbsp;</td>
+		<td style="width: 10px; background-color: #006699;" onClick="showColor('#006699');"		onMouseOver="showColor_over('#006699');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0066CC;" onClick="showColor('#0066CC');"		onMouseOver="showColor_over('#0066CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0066FF;" onClick="showColor('#0066FF');"		onMouseOver="showColor_over('#0066FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #336600;" onClick="showColor('#336600');"		onMouseOver="showColor_over('#336600');">&nbsp;</td>
+		<td style="width: 10px; background-color: #336633;" onClick="showColor('#336633');"		onMouseOver="showColor_over('#336633');">&nbsp;</td>
+		<td style="width: 10px; background-color: #336666;" onClick="showColor('#336666');"		onMouseOver="showColor_over('#336666');">&nbsp;</td>
+		<td style="width: 10px; background-color: #336699;" onClick="showColor('#336699');"		onMouseOver="showColor_over('#336699');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3366CC;" onClick="showColor('#3366CC');"		onMouseOver="showColor_over('#3366CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3366FF;" onClick="showColor('#3366FF');"		onMouseOver="showColor_over('#3366FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #666600;" onClick="showColor('#666600');"		onMouseOver="showColor_over('#666600');">&nbsp;</td>
+		<td style="width: 10px; background-color: #666633;" onClick="showColor('#666633');"		onMouseOver="showColor_over('#666633');">&nbsp;</td>
+		<td style="width: 10px; background-color: #666666;" onClick="showColor('#666666');"		onMouseOver="showColor_over('#666666');">&nbsp;</td>
+		<td style="width: 10px; background-color: #666699;" onClick="showColor('#666699');"		onMouseOver="showColor_over('#666699');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6666CC;" onClick="showColor('#6666CC');"		onMouseOver="showColor_over('#6666CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6666FF;" onClick="showColor('#6666FF');"		onMouseOver="showColor_over('#6666FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #996600;" onClick="showColor('#996600');"		onMouseOver="showColor_over('#996600');">&nbsp;</td>
+		<td style="width: 10px; background-color: #996633;" onClick="showColor('#996633');"		onMouseOver="showColor_over('#996633');">&nbsp;</td>
+		<td style="width: 10px; background-color: #996666;" onClick="showColor('#996666');"		onMouseOver="showColor_over('#996666');">&nbsp;</td>
+		<td style="width: 10px; background-color: #996699;" onClick="showColor('#996699');"		onMouseOver="showColor_over('#996699');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9966CC;" onClick="showColor('#9966CC');"		onMouseOver="showColor_over('#9966CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9966FF;" onClick="showColor('#9966FF');"		onMouseOver="showColor_over('#9966FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC6600;" onClick="showColor('#CC6600');"		onMouseOver="showColor_over('#CC6600');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC6633;" onClick="showColor('#CC6633');"		onMouseOver="showColor_over('#CC6633');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC6666;" onClick="showColor('#CC6666');"		onMouseOver="showColor_over('#CC6666');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC6699;" onClick="showColor('#CC6699');"		onMouseOver="showColor_over('#CC6699');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC66CC;" onClick="showColor('#CC66CC');"		onMouseOver="showColor_over('#CC66CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC66FF;" onClick="showColor('#CC66FF');"		onMouseOver="showColor_over('#CC66FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF6600;" onClick="showColor('#FF6600');"		onMouseOver="showColor_over('#FF6600');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF6633;" onClick="showColor('#FF6633');"		onMouseOver="showColor_over('#FF6633');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF6666;" onClick="showColor('#FF6666');"		onMouseOver="showColor_over('#FF6666');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF6699;" onClick="showColor('#FF6699');"		onMouseOver="showColor_over('#FF6699');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF66CC;" onClick="showColor('#FF66CC');"		onMouseOver="showColor_over('#FF66CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF66FF;" onClick="showColor('#FF66FF');"		onMouseOver="showColor_over('#FF66FF');">&nbsp;</td>
+	   </tr>
+	   <tr>                                                                          		            
+		<td style="width: 10px; background-color: #003300;" onClick="showColor('#003300');"		onMouseOver="showColor_over('#003300');">&nbsp;</td>
+		<td style="width: 10px; background-color: #003333;" onClick="showColor('#003333');"		onMouseOver="showColor_over('#003333');">&nbsp;</td>
+		<td style="width: 10px; background-color: #003366;" onClick="showColor('#003366');"		onMouseOver="showColor_over('#003366');">&nbsp;</td>
+		<td style="width: 10px; background-color: #003399;" onClick="showColor('#003399');"		onMouseOver="showColor_over('#003399');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0033CC;" onClick="showColor('#0033CC');"		onMouseOver="showColor_over('#0033CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0033FF;" onClick="showColor('#0033FF');"		onMouseOver="showColor_over('#0033FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #333300;" onClick="showColor('#333300');"		onMouseOver="showColor_over('#333300');">&nbsp;</td>
+		<td style="width: 10px; background-color: #333333;" onClick="showColor('#333333');"		onMouseOver="showColor_over('#333333');">&nbsp;</td>
+		<td style="width: 10px; background-color: #333366;" onClick="showColor('#333366');"		onMouseOver="showColor_over('#333366');">&nbsp;</td>
+		<td style="width: 10px; background-color: #333399;" onClick="showColor('#333399');"		onMouseOver="showColor_over('#333399');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3333CC;" onClick="showColor('#3333CC');"		onMouseOver="showColor_over('#3333CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3333FF;" onClick="showColor('#3333FF');"		onMouseOver="showColor_over('#3333FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #663300;" onClick="showColor('#663300');"		onMouseOver="showColor_over('#663300');">&nbsp;</td>
+		<td style="width: 10px; background-color: #663333;" onClick="showColor('#663333');"		onMouseOver="showColor_over('#663333');">&nbsp;</td>
+		<td style="width: 10px; background-color: #663366;" onClick="showColor('#663366');"		onMouseOver="showColor_over('#663366');">&nbsp;</td>
+		<td style="width: 10px; background-color: #663399;" onClick="showColor('#663399');"		onMouseOver="showColor_over('#663399');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6633CC;" onClick="showColor('#6633CC');"		onMouseOver="showColor_over('#6633CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6633FF;" onClick="showColor('#6633FF');"		onMouseOver="showColor_over('#6633FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #993300;" onClick="showColor('#993300');"		onMouseOver="showColor_over('#993300');">&nbsp;</td>
+		<td style="width: 10px; background-color: #993333;" onClick="showColor('#993333');"		onMouseOver="showColor_over('#993333');">&nbsp;</td>
+		<td style="width: 10px; background-color: #993366;" onClick="showColor('#993366');"		onMouseOver="showColor_over('#993366');">&nbsp;</td>
+		<td style="width: 10px; background-color: #993399;" onClick="showColor('#993399');"		onMouseOver="showColor_over('#993399');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9933CC;" onClick="showColor('#9933CC');"		onMouseOver="showColor_over('#9933CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9933FF;" onClick="showColor('#9933FF');"		onMouseOver="showColor_over('#9933FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC3300;" onClick="showColor('#CC3300');"		onMouseOver="showColor_over('#CC3300');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC3333;" onClick="showColor('#CC3333');"		onMouseOver="showColor_over('#CC3333');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC3366;" onClick="showColor('#CC3366');"		onMouseOver="showColor_over('#CC3366');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC3399;" onClick="showColor('#CC3399');"		onMouseOver="showColor_over('#CC3399');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC33CC;" onClick="showColor('#CC33CC');"		onMouseOver="showColor_over('#CC33CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC33FF;" onClick="showColor('#CC33FF');"		onMouseOver="showColor_over('#CC33FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF3300;" onClick="showColor('#FF3300');"		onMouseOver="showColor_over('#FF3300');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF3333;" onClick="showColor('#FF3333');"		onMouseOver="showColor_over('#FF3333');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF3366;" onClick="showColor('#FF3366');"		onMouseOver="showColor_over('#FF3366');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF3399;" onClick="showColor('#FF3399');"		onMouseOver="showColor_over('#FF3399');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF33CC;" onClick="showColor('#FF33CC');"		onMouseOver="showColor_over('#FF33CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF33FF;" onClick="showColor('#FF33FF');"		onMouseOver="showColor_over('#FF33FF');">&nbsp;</td>
+	   </tr>
+	   <tr>                                                                          		                                                                                      		          
+		<td height="21" style="width: 10px; background-color: #000000;" onClick="showColor('#000000');"		onMouseOver="showColor_over('#000000');">&nbsp;</td>
+		<td style="width: 10px; background-color: #000033;" onClick="showColor('#000033');"		onMouseOver="showColor_over('#000033');">&nbsp;</td>
+		<td style="width: 10px; background-color: #000066;" onClick="showColor('#000066');"		onMouseOver="showColor_over('#000066');">&nbsp;</td>
+		<td style="width: 10px; background-color: #000099;" onClick="showColor('#000099');"		onMouseOver="showColor_over('#000099');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0000CC;" onClick="showColor('#0000CC');"		onMouseOver="showColor_over('#0000CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #0000FF;" onClick="showColor('#0000FF');"		onMouseOver="showColor_over('#0000FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #330000;" onClick="showColor('#330000');"		onMouseOver="showColor_over('#330000');">&nbsp;</td>
+		<td style="width: 10px; background-color: #330033;" onClick="showColor('#330033');"		onMouseOver="showColor_over('#330033');">&nbsp;</td>
+		<td style="width: 10px; background-color: #330066;" onClick="showColor('#330066');"		onMouseOver="showColor_over('#330066');">&nbsp;</td>
+		<td style="width: 10px; background-color: #330099;" onClick="showColor('#330099');"		onMouseOver="showColor_over('#330099');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3300CC;" onClick="showColor('#3300CC');"		onMouseOver="showColor_over('#3300CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #3300FF;" onClick="showColor('#3300FF');"		onMouseOver="showColor_over('#3300FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #660000;" onClick="showColor('#660000');"		onMouseOver="showColor_over('#660000');">&nbsp;</td>
+		<td style="width: 10px; background-color: #660033;" onClick="showColor('#660033');"		onMouseOver="showColor_over('#660033');">&nbsp;</td>
+		<td style="width: 10px; background-color: #660066;" onClick="showColor('#660066');"		onMouseOver="showColor_over('#660066');">&nbsp;</td>
+		<td style="width: 10px; background-color: #660099;" onClick="showColor('#660099');"		onMouseOver="showColor_over('#660099');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6600CC;" onClick="showColor('#6600CC');"		onMouseOver="showColor_over('#6600CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #6600FF;" onClick="showColor('#6600FF');"		onMouseOver="showColor_over('#6600FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #990000;" onClick="showColor('#990000');"		onMouseOver="showColor_over('#990000');">&nbsp;</td>
+		<td style="width: 10px; background-color: #990033;" onClick="showColor('#990033');"		onMouseOver="showColor_over('#990033');">&nbsp;</td>
+		<td style="width: 10px; background-color: #990066;" onClick="showColor('#990066');"		onMouseOver="showColor_over('#990066');">&nbsp;</td>
+		<td style="width: 10px; background-color: #990099;" onClick="showColor('#990099');"		onMouseOver="showColor_over('#990099');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9900CC;" onClick="showColor('#9900CC');"		onMouseOver="showColor_over('#9900CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #9900FF;" onClick="showColor('#9900FF');"		onMouseOver="showColor_over('#9900FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC0000;" onClick="showColor('#CC0000');"		onMouseOver="showColor_over('#CC0000');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC0033;" onClick="showColor('#CC0033');"		onMouseOver="showColor_over('#CC0033');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC0066;" onClick="showColor('#CC0066');"		onMouseOver="showColor_over('#CC0066');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC0099;" onClick="showColor('#CC0099');"		onMouseOver="showColor_over('#CC0099');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC00CC;" onClick="showColor('#CC00CC');"		onMouseOver="showColor_over('#CC00CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #CC00FF;" onClick="showColor('#CC00FF');"		onMouseOver="showColor_over('#CC00FF');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF0000;" onClick="showColor('#FF0000');"		onMouseOver="showColor_over('#FF0000');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF0033;" onClick="showColor('#FF0033');"		onMouseOver="showColor_over('#FF0033');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF0066;" onClick="showColor('#FF0066');"		onMouseOver="showColor_over('#FF0066');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF0099;" onClick="showColor('#FF0099');"		onMouseOver="showColor_over('#FF0099');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF00CC;" onClick="showColor('#FF00CC');"		onMouseOver="showColor_over('#FF00CC');">&nbsp;</td>
+		<td style="width: 10px; background-color: #FF00FF;" onClick="showColor('#FF00FF');"		onMouseOver="showColor_over('#FF00FF');">&nbsp;</td>
+       </tr>
+      </table>
+	</td>
+  </tr>
+  <tr align="center">
+    <td height="14" colspan="4" class="line_left2 line_right2 text3 bg2">&nbsp;Ausgew�hlte Farbe:</td>
+  </tr>
+  <tr>
+    <td height="25" class="line_left2 line_down2 text1">
+	   <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid black; background-color: #FFFFFF">
+    	<tr>
+      	  <td id="preview" width="100%">&nbsp;</td>
+    	</tr>
+      </table>
+	</td>
+    <td class="line_down2">&nbsp;</td>
+    <td width="38" class="text1 line_down2"><input id="color" value="#000000" size="6" readonly class="inputfield"></td>
+    <td width="364" class="line_down2 line_right2" align="right">
+	<input type="button" value="Speichern" onClick="returnToMain();" class="button">
+	<input type="button" value="Abbruch" onClick="window.close();" class="button">    
+	</td>
+  </tr>
+</table>
+</body>
+</html>

Modified: branches/print_dev/lib/point.js
===================================================================
--- branches/print_dev/lib/point.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/lib/point.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,172 +1,172 @@
-/* 
-* $Id:point.js 2476 2008-05-28 15:03:41Z christoph $
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
-*/
-//http://www.mapbender.org/index.php/point.js
-
-/**
- * @class A class representing a two-dimensional point.
- *
- * @constructor
- * @param {Float} x x value of the {@link Point}
- * @param {Float} y y value of the {@link Point}
- */
- function Point(x, y, z){
- 	/**
- 	 * x value of the {@link Point}
- 	 *
-	 * @type Float
-	 */
-//	this.x = parseFloat(x);
-	this.x = x;
- 	/**
- 	 * y value of the {@link Point}
-	 *
-	 * @type Float
-	 */
-//	this.y = parseFloat(y);
-	this.y = y;
-	
-	this.z = z;
-	
-}
-/**
- * computes the distance between a {@link Point} p and this {@link Point}
- *
- * @param {Point} p the distance between this {@link Point} and the {@link Point} p is computed.
- * @return {Float} the distance between the two {@link Point} objects.
- */
-Point.prototype.dist = function(p){
-	return Math.sqrt(Math.pow(this.y-p.y,2) + Math.pow(this.x-p.x,2)) ;
-};
-/**
- * checks if the coordinates of this {@link Point} match the coordinates of a {@link Point} p
- *
- * @param {Point} p 
- * @return {Boolean} true if the two points are equal; elso false
- */
-Point.prototype.equals = function(p){
-	if (this.x == p.x && this.y == p.y) {return true;}
-	return false;
-};
-/**
- * subtracts a {@link Point} p from this {@link Point}
- *
- * @param {Point} p 
- * @return a new {@link Point} with the difference of the two points
- */
-Point.prototype.minus = function(p){
-	return new Point(this.x-p.x, this.y-p.y);
-};
-/**
- * adds this {@link Point} to a {@link Point} p
- *
- * @param {Point} p 
- * @return a new {@link Point} with the sum of the two points
- */
-Point.prototype.plus = function(p){
-	return new Point(this.x+p.x, this.y+p.y);
-};
-/**
- * divides this {@link Point} by a scalar c
- *
- * @param {Float} c divisor
- * @return a new {@link Point} divided by c
- */
-Point.prototype.dividedBy = function(c){
-	if (c !== 0) {
-		return new Point(this.x/c, this.y/c);
-	}
-	var e = new Mb_exception("Point.dividedBy: Division by zero");
-	return false;
-};
-/**
- * multiplies this {@link Point} by a scalar c
- *
- * @param {Float} c factor
- * @return a new {@link Point} multiplied by c
- */
-Point.prototype.times = function(c){
-	return new Point(this.x*c, this.y*c);
-};
-/**
- * rounds the coordinates to numOfDigits digits
- *
- * @param numOfDigits the coordinate will be rounded to numOfDigits digits
- * @return a new {@link Point} rounded to numOfDigits digits
- * @type Point
- */
-Point.prototype.round = function(numOfDigits){
-	return new Point(roundToDigits(this.x, numOfDigits), roundToDigits(this.y, numOfDigits));
-};
-/**
- * @returns a {String} representation of this Point
- * @type String
- */
-Point.prototype.toString = function(){
-	if (typeof(this.z == "undefined")) {
-		return "[" + this.x + ", " + this.y + "]";
-	}
-	else {
-		return "[" + this.x + ", " + this.y + ", " + this.z + "]";
-	}
-};
-
-
-//------------------------------------------------------------------------
-// possible improvement: point has flag: map OR real. additional functions: toReal, toMap
-/**
- * @ignore
- */
-function mapToReal(frameName, aPoint) {
-	var ind = getMapObjIndexByName(frameName);
-	return mb_mapObj[ind].convertPixelToReal(aPoint);
-}
-/**
- * @ignore
- */
-function realToMap(frameName, aPoint) {
-	var ind = getMapObjIndexByName(frameName);
-	return mb_mapObj[ind].convertRealToPixel(aPoint);
-}
-/**
- * @ignore
- */
-function mb_calcExtent(frameName, min, max) {
-	var ind;
-	if (typeof(mb_mapObj) == 'object') {
-		ind = getMapObjIndexByName(frameName);
-	}
-	else if (typeof(parent.mb_mapObj) == 'object') {
-		ind = parent.getMapObjIndexByName(frameName);
-	}
-	else {
-		var e = new Mb_exception('Point.mb_calcExtent: function getMapObjIndexByName not found');
-	}
-	var extent = max.minus(min);
-	var center = extent.dividedBy(2).plus(min);
-	
-	var relation_px_x = mb_mapObj[ind].width / mb_mapObj[ind].height;
-	var relation_px_y = mb_mapObj[ind].height / mb_mapObj[ind].width;
-	var relation_bbox_x = extent.x / extent.y;     
-	
-	var new_min;
-	var new_max;
-	
-	if(relation_bbox_x <= relation_px_x){                
-		new_min = new Point(center.x - relation_px_x * extent.y / 2, min.y);
-		new_max = new Point(center.x + relation_px_x * extent.y / 2, max.y);
-	}
-	else if(relation_bbox_x > relation_px_x){                
-		new_min = new Point(min.x, center.y - relation_px_y * extent.x / 2);
-		new_max = new Point(max.x, center.y + relation_px_y * extent.x / 2);
-	}
-	mb_mapObj[ind].extent = new_min.x +","+ new_min.y +","+ new_max.x  +","+ new_max.y;
-}
-/**
- * @ignore
- */
-function roundToDigits(aFloat, numberOfDigits) {
-	return Math.round(aFloat*Math.pow(10, parseInt(numberOfDigits, 10)))/Math.pow(10, parseInt(numberOfDigits, 10));
-}
+/* 
+* $Id:point.js 2476 2008-05-28 15:03:41Z christoph $
+* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
+*/
+//http://www.mapbender.org/index.php/point.js
+
+/**
+ * @class A class representing a two-dimensional point.
+ *
+ * @constructor
+ * @param {Float} x x value of the {@link Point}
+ * @param {Float} y y value of the {@link Point}
+ */
+ function Point(x, y, z){
+ 	/**
+ 	 * x value of the {@link Point}
+ 	 *
+	 * @type Float
+	 */
+//	this.x = parseFloat(x);
+	this.x = x;
+ 	/**
+ 	 * y value of the {@link Point}
+	 *
+	 * @type Float
+	 */
+//	this.y = parseFloat(y);
+	this.y = y;
+	
+	this.z = z;
+	
+}
+/**
+ * computes the distance between a {@link Point} p and this {@link Point}
+ *
+ * @param {Point} p the distance between this {@link Point} and the {@link Point} p is computed.
+ * @return {Float} the distance between the two {@link Point} objects.
+ */
+Point.prototype.dist = function(p){
+	return Math.sqrt(Math.pow(this.y-p.y,2) + Math.pow(this.x-p.x,2)) ;
+};
+/**
+ * checks if the coordinates of this {@link Point} match the coordinates of a {@link Point} p
+ *
+ * @param {Point} p 
+ * @return {Boolean} true if the two points are equal; elso false
+ */
+Point.prototype.equals = function(p){
+	if (this.x == p.x && this.y == p.y) {return true;}
+	return false;
+};
+/**
+ * subtracts a {@link Point} p from this {@link Point}
+ *
+ * @param {Point} p 
+ * @return a new {@link Point} with the difference of the two points
+ */
+Point.prototype.minus = function(p){
+	return new Point(this.x-p.x, this.y-p.y);
+};
+/**
+ * adds this {@link Point} to a {@link Point} p
+ *
+ * @param {Point} p 
+ * @return a new {@link Point} with the sum of the two points
+ */
+Point.prototype.plus = function(p){
+	return new Point(this.x+p.x, this.y+p.y);
+};
+/**
+ * divides this {@link Point} by a scalar c
+ *
+ * @param {Float} c divisor
+ * @return a new {@link Point} divided by c
+ */
+Point.prototype.dividedBy = function(c){
+	if (c !== 0) {
+		return new Point(this.x/c, this.y/c);
+	}
+	var e = new Mb_exception("Point.dividedBy: Division by zero");
+	return false;
+};
+/**
+ * multiplies this {@link Point} by a scalar c
+ *
+ * @param {Float} c factor
+ * @return a new {@link Point} multiplied by c
+ */
+Point.prototype.times = function(c){
+	return new Point(this.x*c, this.y*c);
+};
+/**
+ * rounds the coordinates to numOfDigits digits
+ *
+ * @param numOfDigits the coordinate will be rounded to numOfDigits digits
+ * @return a new {@link Point} rounded to numOfDigits digits
+ * @type Point
+ */
+Point.prototype.round = function(numOfDigits){
+	return new Point(roundToDigits(this.x, numOfDigits), roundToDigits(this.y, numOfDigits));
+};
+/**
+ * @returns a {String} representation of this Point
+ * @type String
+ */
+Point.prototype.toString = function(){
+	if (typeof(this.z == "undefined")) {
+		return "[" + this.x + ", " + this.y + "]";
+	}
+	else {
+		return "[" + this.x + ", " + this.y + ", " + this.z + "]";
+	}
+};
+
+
+//------------------------------------------------------------------------
+// possible improvement: point has flag: map OR real. additional functions: toReal, toMap
+/**
+ * @ignore
+ */
+function mapToReal(frameName, aPoint) {
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].convertPixelToReal(aPoint);
+}
+/**
+ * @ignore
+ */
+function realToMap(frameName, aPoint) {
+	var ind = getMapObjIndexByName(frameName);
+	return mb_mapObj[ind].convertRealToPixel(aPoint);
+}
+/**
+ * @ignore
+ */
+function mb_calcExtent(frameName, min, max) {
+	var ind;
+	if (typeof(mb_mapObj) == 'object') {
+		ind = getMapObjIndexByName(frameName);
+	}
+	else if (typeof(parent.mb_mapObj) == 'object') {
+		ind = parent.getMapObjIndexByName(frameName);
+	}
+	else {
+		var e = new Mb_exception('Point.mb_calcExtent: function getMapObjIndexByName not found');
+	}
+	var extent = max.minus(min);
+	var center = extent.dividedBy(2).plus(min);
+	
+	var relation_px_x = mb_mapObj[ind].width / mb_mapObj[ind].height;
+	var relation_px_y = mb_mapObj[ind].height / mb_mapObj[ind].width;
+	var relation_bbox_x = extent.x / extent.y;     
+	
+	var new_min;
+	var new_max;
+	
+	if(relation_bbox_x <= relation_px_x){                
+		new_min = new Point(center.x - relation_px_x * extent.y / 2, min.y);
+		new_max = new Point(center.x + relation_px_x * extent.y / 2, max.y);
+	}
+	else if(relation_bbox_x > relation_px_x){                
+		new_min = new Point(min.x, center.y - relation_px_y * extent.x / 2);
+		new_max = new Point(max.x, center.y + relation_px_y * extent.x / 2);
+	}
+	mb_mapObj[ind].extent = new_min.x +","+ new_min.y +","+ new_max.x  +","+ new_max.y;
+}
+/**
+ * @ignore
+ */
+function roundToDigits(aFloat, numberOfDigits) {
+	return Math.round(aFloat*Math.pow(10, parseInt(numberOfDigits, 10)))/Math.pow(10, parseInt(numberOfDigits, 10));
+}

Modified: branches/print_dev/lib/style.js
===================================================================
--- branches/print_dev/lib/style.js	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/lib/style.js	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,54 +1,54 @@
-/**
- * creates a style tag in the head of the document.
- *
- */
-var StyleTag = function() {
-
-	/**
-	 * Creates the style tag in the head of the document. Something like a constructor. 
-	 *
-	 */
-	var createStyleTag = function() {
-		// TODO: Internet Explorer routine seems a little buggy
-		if ($.browser.msie) {
-			// create a Style Sheet object (IE only)
-			//styleSheetObj=document.createStyleSheet();
-			// get the DOM node of the style sheet object, set the type
-			//styleObj=styleSheetObj.owningElement || styleSheetObj.ownerNode;
-			//styleObj.setAttribute("type","text/css");
-			
-			// alternative way for IE: take existing styleSheet with index 0 instead of creating a new one
-			styleSheetObj=document.styleSheets[0];
-		}
-		else {
-			// create the style node, set the style
-			styleObj=document.createElement("style");
-			styleObj.setAttribute("type","text/css");
-			// append the node to the head
-			document.getElementsByTagName("head")[0].appendChild(styleObj);
-		}
-	};
-	
-	/**
-	 * Adds a class className with the CSS in cssString
-	 */
-	this.addClass = function(className,cssString) {
-		// TODO: Internet Explorer routine seems a little buggy
-		if ($.browser.msie) {
-			//add new style declaration to chosen styleSheet 
-			var cssRules = cssString.split(";");
-			for (i=0; i<cssRules.length-1; i++){
-				styleSheetObj.addRule("."+className,cssRules[i]);
-			}
-		}
-		else {
-			// insert the content via createTextNode
-			styleObj.appendChild(document.createTextNode("."+className+"{\n\t"+cssString+"\n}\n"));				
-		}
-	};
-	
-	var styleObj;
-	var styleSheetObj; //IE only...
-	
-	createStyleTag();
-};
+/**
+ * creates a style tag in the head of the document.
+ *
+ */
+var StyleTag = function() {
+
+	/**
+	 * Creates the style tag in the head of the document. Something like a constructor. 
+	 *
+	 */
+	var createStyleTag = function() {
+		// TODO: Internet Explorer routine seems a little buggy
+		if ($.browser.msie) {
+			// create a Style Sheet object (IE only)
+			//styleSheetObj=document.createStyleSheet();
+			// get the DOM node of the style sheet object, set the type
+			//styleObj=styleSheetObj.owningElement || styleSheetObj.ownerNode;
+			//styleObj.setAttribute("type","text/css");
+			
+			// alternative way for IE: take existing styleSheet with index 0 instead of creating a new one
+			styleSheetObj=document.styleSheets[0];
+		}
+		else {
+			// create the style node, set the style
+			styleObj=document.createElement("style");
+			styleObj.setAttribute("type","text/css");
+			// append the node to the head
+			document.getElementsByTagName("head")[0].appendChild(styleObj);
+		}
+	};
+	
+	/**
+	 * Adds a class className with the CSS in cssString
+	 */
+	this.addClass = function(className,cssString) {
+		// TODO: Internet Explorer routine seems a little buggy
+		if ($.browser.msie) {
+			//add new style declaration to chosen styleSheet 
+			var cssRules = cssString.split(";");
+			for (i=0; i<cssRules.length-1; i++){
+				styleSheetObj.addRule("."+className,cssRules[i]);
+			}
+		}
+		else {
+			// insert the content via createTextNode
+			styleObj.appendChild(document.createTextNode("."+className+"{\n\t"+cssString+"\n}\n"));				
+		}
+	};
+	
+	var styleObj;
+	var styleSheetObj; //IE only...
+	
+	createStyleTag();
+};

Modified: branches/print_dev/license/license_js.txt
===================================================================
--- branches/print_dev/license/license_js.txt	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/license/license_js.txt	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,2 +1,2 @@
-/* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+/* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
 *  License (>=v2). Read the file COPYING that comes with Mapbender for details. */
\ No newline at end of file

Modified: branches/print_dev/owsproxy/http/index.php
===================================================================
--- branches/print_dev/owsproxy/http/index.php	2009-03-13 09:39:43 UTC (rev 3699)
+++ branches/print_dev/owsproxy/http/index.php	2009-03-13 12:02:19 UTC (rev 3700)
@@ -1,106 +1,106 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Owsproxy
-# Module maintainer Uli
-# 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.
-
-require(dirname(__FILE__) . "/../../conf/mapbender.conf");
-require(dirname(__FILE__) . "/../../http/classes/class_administration.php");
-require(dirname(__FILE__) . "/../../http/classes/class_connector.php");
-require_once(dirname(__FILE__) . "/../../http/classes/class_mb_exception.php");
-require(dirname(__FILE__) . "/./classes/class_QueryHandler.php");
-
-/***** conf *****/
-$imageformats = array("image/png","image/gif","image/jpeg", "image/jpg");
-/***** conf *****/
-
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Owsproxy
+# Module maintainer Uli
+# 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.
 
-$postdata = $HTTP_RAW_POST_DATA;
-
-$owsproxyService = $_REQUEST['wms']; //ToDo: change this to 'service' in the apache url-rewriting
-$query = new QueryHandler();
-
-// an array with keys and values toLoserCase -> caseinsensitiv
-$reqParams = $query->getRequestParams();
-
-$notice = new mb_notice("owsproxy id:".$query->getOwsproxyServiceId());
+require(dirname(__FILE__) . "/../../conf/mapbender.conf");
+require(dirname(__FILE__) . "/../../http/classes/class_administration.php");
+require(dirname(__FILE__) . "/../../http/classes/class_connector.php");
+require_once(dirname(__FILE__) . "/../../http/classes/class_mb_exception.php");
+require(dirname(__FILE__) . "/./classes/class_QueryHandler.php");
 
-// check session
-session_regenerate_id();
-session_destroy();
-session_id($_REQUEST["sid"]);
-session_start();
-if(!$_SESSION['mb_user_id']){
-	$notice = new mb_notice("Permission denied");
+/***** conf *****/
+$imageformats = array("image/png","image/gif","image/jpeg", "image/jpg");
+/***** conf *****/
+
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+$postdata = $HTTP_RAW_POST_DATA;
+
+$owsproxyService = $_REQUEST['wms']; //ToDo: change this to 'service' in the apache url-rewriting
+$query = new QueryHandler();
+
+// an array with keys and values toLoserCase -> caseinsensitiv
+$reqParams = $query->getRequestParams();
+
+$notice = new mb_notice("owsproxy id:".$query->getOwsproxyServiceId());
+
+// check session
+session_regenerate_id();
+session_destroy();
+session_id($_REQUEST["sid"]);
+session_start();
+if(!$_SESSION['mb_user_id']){
+	$notice = new mb_notice("Permission denied");
 	throwE("Permission denied");
-	die();
-}
-
-//if($_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']){
-//	throwE(array("No session data available.","Permission denied.","Please authenticate."));
-//	die();	
-//}
-
-/*************  workflow ************/
+	die();
+}
+
+//if($_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']){
+//	throwE(array("No session data available.","Permission denied.","Please authenticate."));
+//	die();	
+//}
+
+/*************  workflow ************/
 $n = new administration();
-switch (strtolower($reqParams['request'])) {
-	case 'getcapabilities':
-		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
-		$query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
-		$request = $query->getRequest();
-		getCapabilities($request);
-		break;
-	case 'getfeatureinfo':
-		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
-		$query->setOnlineResource($arrayOnlineresources['wms_getfeatureinfo']);
-		$request = $query->getRequest();
-		getFeatureInfo($request);
-		break;
-	case 'getmap':
-		$arrayOnlineresources = checkWmsPermission($owsproxyService);
-		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
-		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
+switch (strtolower($reqParams['request'])) {
+	case 'getcapabilities':
+		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
+		$query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
+		$request = $query->getRequest();
+		getCapabilities($request);
+		break;
+	case 'getfeatureinfo':
+		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
+		$query->setOnlineResource($arrayOnlineresources['wms_getfeatureinfo']);
+		$request = $query->getRequest();
+		getFeatureInfo($request);
+		break;
+	case 'getmap':
+		$arrayOnlineresources = checkWmsPermission($owsproxyService);
+		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
+		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
 		if($layers===""){
 			throwE("Permission denied");
 			die();
 		}
-		$query->setParam("layers",$layers);
-		$request = $query->getRequest();
+		$query->setParam("layers",$layers);
+		$request = $query->getRequest();
 		getImage($request);
-		break;
-	case 'map':
-		$arrayOnlineresources = checkWmsPermission($owsproxyService);
-		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
-		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
-		if($layers===""){
-			throwE("Permission denied");
-			die();
-		}
-		$query->setParam("layers",$layers);
-		$request = $query->getRequest();
-		getImage($request);
+		break;
+	case 'map':
+		$arrayOnlineresources = checkWmsPermission($owsproxyService);
+		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
+		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
+		if($layers===""){
+			throwE("Permission denied");
+			die();
+		}
+		$query->setParam("layers",$layers);
+		$request = $query->getRequest();
+		getImage($request);
 		break;	
 	case 'getlegendgraphic':
 		$url = getLegendUrl($query->getOwsproxyServiceId());
 		getImage($url);
-		break;
-	case 'external':
+		break;
+	case 'external':
 		getExternalRequest($query->getOwsproxyServiceId());
 		break; 
 	case 'getfeature':
@@ -119,84 +119,84 @@
 		$request = $query->getRequest();
 		doTransaction($request, $HTTP_RAW_POST_DATA);
 		break;
-	default:
-		
-}
-/*********************************************************/
-function throwE($e){
-	global $reqParams, $imageformats;
-	if(in_array($reqParams['format'],$imageformats)){
-		throwImage($e);
-	}
-	else{
-		throwText($e);	
-	}
+	default:
+		
 }
-
-function throwImage($e){
-	global $width,$height;
-	$image = imagecreate($width,$height);
-	$transparent = ImageColorAllocate($image,155,155,155); 
-	ImageFilledRectangle($image,0,0,$width,$height,$transparent);
-	imagecolortransparent($image, $transparent);
-	$text_color = ImageColorAllocate ($image, 233, 14, 91);
-	for($i=0; $i<count($e); $i++){
-		ImageString ($image, 3, 5, $i*20, $e[$i], $text_color);
-	}
-	responseImage($image);
-}
-function throwText($e){
-	echo join(" ", $e);
-}
-function responseImage($im){
-	global $reqParams;
-	$format = $reqParams['format'];
-	if($format == 'image/png'){header("Content-Type: image/png");}
-	if($format == 'image/jpeg' || $format == 'image/jpg'){header("Content-Type: image/jpeg");}
-	if($format == 'image/gif'){header("Content-Type: image/gif");}
-		 
-	if($format == 'image/png'){imagepng($im);}
-	if($format == 'image/jpeg' || $format == 'image/jpg'){imagejpeg($im);}
-	if($format == 'image/gif'){imagegif($im);}	
-}
-function completeURL($url){
-	global $reqParams;
-	$mykeys = array_keys($reqParams);
-	for($i=0; $i<count($mykeys);$i++){
-		if($i > 0){ $url .= "&"; }
-		$url .= $mykeys[$i]."=".urlencode($reqParams[$mykeys[$i]]);
-	}
-	return $url;
-}
+/*********************************************************/
+function throwE($e){
+	global $reqParams, $imageformats;
+	if(in_array($reqParams['format'],$imageformats)){
+		throwImage($e);
+	}
+	else{
+		throwText($e);	
+	}
+}
 
+function throwImage($e){
+	global $width,$height;
+	$image = imagecreate($width,$height);
+	$transparent = ImageColorAllocate($image,155,155,155); 
+	ImageFilledRectangle($image,0,0,$width,$height,$transparent);
+	imagecolortransparent($image, $transparent);
+	$text_color = ImageColorAllocate ($image, 233, 14, 91);
+	for($i=0; $i<count($e); $i++){
+		ImageString ($image, 3, 5, $i*20, $e[$i], $text_color);
+	}
+	responseImage($image);
+}
+function throwText($e){
+	echo join(" ", $e);
+}
+function responseImage($im){
+	global $reqParams;
+	$format = $reqParams['format'];
+	if($format == 'image/png'){header("Content-Type: image/png");}
+	if($format == 'image/jpeg' || $format == 'image/jpg'){header("Content-Type: image/jpeg");}
+	if($format == 'image/gif'){header("Content-Type: image/gif");}
+		 
+	if($format == 'image/png'){imagepng($im);}
+	if($format == 'image/jpeg' || $format == 'image/jpg'){imagejpeg($im);}
+	if($format == 'image/gif'){imagegif($im);}	
+}
+function completeURL($url){
+	global $reqParams;
+	$mykeys = array_keys($reqParams);
+	for($i=0; $i<count($mykeys);$i++){
+		if($i > 0){ $url .= "&"; }
+		$url .= $mykeys[$i]."=".urlencode($reqParams[$mykeys[$i]]);
+	}
+	return $url;
+}
+
 /**
  * fetch and returns an image to client
  * 
  * @param string the original url of the image to send
  */
-
-function getImage($or){
-	global $reqParams;
-	header("Content-Type: ".$reqParams['format']);
-	echo getDocumentContent($or);
-}
-
-/**
- * fetchs and returns the content of the FeatureInfo Response
- * 
- * @param string the url of the FeatureInfoRequest
- * @return string the content of the FeatureInfo document
- */
-function getFeatureInfo($url){
-	global $info_format;
-	//$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
-	header("Content-Type: ".$info_format);
-	$content = getDocumentContent($url);
-	$content = matchUrls($content);
-	echo $content;
+
+function getImage($or){
+	global $reqParams;
+	header("Content-Type: ".$reqParams['format']);
+	echo getDocumentContent($or);
 }
 
 /**
+ * fetchs and returns the content of the FeatureInfo Response
+ * 
+ * @param string the url of the FeatureInfoRequest
+ * @return string the content of the FeatureInfo document
+ */
+function getFeatureInfo($url){
+	global $info_format;
+	//$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
+	header("Content-Type: ".$info_format);
+	$content = getDocumentContent($url);
+	$content = matchUrls($content);
+	echo $content;
+}
+
+/**
  * fetchs and returns the content of WFS GetFeature response
  * 
  * @param string the url of the GetFeature request
@@ -311,95 +311,95 @@
 	$result = mb_eregi_replace("[^>]*$", "", $result);
 	
 	echo $result;
-}
-
-function matchUrls($content){
-	if(!session_is_registered("owsproxyUrls")){
-		$_SESSION["owsproxyUrls"] = array();
-		$_SESSION["owsproxyUrls"]["id"] = array();
-		$_SESSION["owsproxyUrls"]["url"] = array();
-	}
-	$pattern = "/[\"|\'](https*:\/\/[^\"|^\']*)[\"|\']/";
-	preg_match_all($pattern,$content,$matches);
-	for($i=0; $i<count($matches[1]); $i++){
-		$req = $matches[1][$i];
-		$id = registerURL($req);
-		$extReq = setExternalRequest($id);
-		$content = str_replace($req,$extReq,$content);
-	}
-	return $content;
 }
-
-function setExternalRequest($id){
-	global $reqParams,$query;
-	$extReq = OWSPROXY ."/". $reqParams['sid'] ."/".$id."?request=external";
-	return $extReq;
-}
-function getExternalRequest($id){
-	for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
-		if($id == $_SESSION["owsproxyUrls"]["id"][$i]){
-			$cUrl = $_SESSION["owsproxyUrls"]["url"][$i];
-			$query_string = removeOWSGetParams($_SERVER["QUERY_STRING"]);
-			if($query_string != ''){
-				$cUrl .= getConjunctionCharacter($cUrl).$query_string;
-			}	
-			$metainfo = get_headers($cUrl,1);
-			// just for the stupid InternetExplorer
-			header('Pragma: private');
-			header('Cache-control: private, must-revalidate');
-			
-			header("Content-Type: ".$metainfo['Content-Type']);
-			
-			$content = getDocumentContent($cUrl);
-			$content = matchUrls($content);			
-			echo $content; 
-		}	
-	} 
-}
-function removeOWSGetParams($query_string){
-	$r = preg_replace("/.*request=external&/","",$query_string);
-	return $r;
-}
-function getConjunctionCharacter($url){
-	if(strpos($url,"?")){ 
-		if(strpos($url,"?") == strlen($url)){ 
-			$cchar = "";
-		}else if(strpos($url,"&") == strlen($url)){
-			$cchar = "";
-		}else{
-			$cchar = "&";
-		}
-	}
-	if(strpos($url,"?") === false){
-		$cchar = "?";
-	} 
-	return $cchar;  
-}
-function registerUrl($url){	
-	if(!in_array($url,$_SESSION["owsproxyUrls"]["url"])){
-		$id = md5($url);
-		array_push($_SESSION["owsproxyUrls"]["url"],$url);
-		array_push($_SESSION["owsproxyUrls"]["id"], $id);
-	}
-	else{
-		for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
-			if($url == $_SESSION["owsproxyUrls"]["url"][$i]){
-				$id = $_SESSION["owsproxyUrls"]["id"][$i];
-			}			
-		}
-	}
-	return $id;
-}
-function getCapabilities($url){
-	global $arrayOnlineresources;
-	global $sid,$wms;
-	$t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["$wms_getfeatureinfo"]));
-	$new = OWSPROXY ."/". $sid ."/".$wms."?";
-	$r = str_replace($t,$new,$arrayOnlineresources["wms_getcapabilities_doc"]);
-	header("Content-Type: application/xml");
-	echo $r;
+
+function matchUrls($content){
+	if(!session_is_registered("owsproxyUrls")){
+		$_SESSION["owsproxyUrls"] = array();
+		$_SESSION["owsproxyUrls"]["id"] = array();
+		$_SESSION["owsproxyUrls"]["url"] = array();
+	}
+	$pattern = "/[\"|\'](https*:\/\/[^\"|^\']*)[\"|\']/";
+	preg_match_all($pattern,$content,$matches);
+	for($i=0; $i<count($matches[1]); $i++){
+		$req = $matches[1][$i];
+		$id = registerURL($req);
+		$extReq = setExternalRequest($id);
+		$content = str_replace($req,$extReq,$content);
+	}
+	return $content;
 }
 
+function setExternalRequest($id){
+	global $reqParams,$query;
+	$extReq = OWSPROXY ."/". $reqParams['sid'] ."/".$id."?request=external";
+	return $extReq;
+}
+function getExternalRequest($id){
+	for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
+		if($id == $_SESSION["owsproxyUrls"]["id"][$i]){
+			$cUrl = $_SESSION["owsproxyUrls"]["url"][$i];
+			$query_string = removeOWSGetParams($_SERVER["QUERY_STRING"]);
+			if($query_string != ''){
+				$cUrl .= getConjunctionCharacter($cUrl).$query_string;
+			}	
+			$metainfo = get_headers($cUrl,1);
+			// just for the stupid InternetExplorer
+			header('Pragma: private');
+			header('Cache-control: private, must-revalidate');
+			
+			header("Content-Type: ".$metainfo['Content-Type']);
+			
+			$content = getDocumentContent($cUrl);
+			$content = matchUrls($content);			
+			echo $content; 
+		}	
+	} 
+}
+function removeOWSGetParams($query_string){
+	$r = preg_replace("/.*request=external&/","",$query_string);
+	return $r;
+}
+function getConjunctionCharacter($url){
+	if(strpos($url,"?")){ 
+		if(strpos($url,"?") == strlen($url)){ 
+			$cchar = "";
+		}else if(strpos($url,"&") == strlen($url)){
+			$cchar = "";
+		}else{
+			$cchar = "&";
+		}
+	}
+	if(strpos($url,"?") === false){
+		$cchar = "?";
+	} 
+	return $cchar;  
+}
+function registerUrl($url){	
+	if(!in_array($url,$_SESSION["owsproxyUrls"]["url"])){
+		$id = md5($url);
+		array_push($_SESSION["owsproxyUrls"]["url"],$url);
+		array_push($_SESSION["owsproxyUrls"]["id"], $id);
+	}
+	else{
+		for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
+			if($url == $_SESSION["owsproxyUrls"]["url"][$i]){
+				$id = $_SESSION["owsproxyUrls"]["id"][$i];
+			}			
+		}
+	}
+	return $id;
+}
+function getCapabilities($url){
+	global $arrayOnlineresources;
+	global $sid,$wms;
+	$t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["$wms_getfeatureinfo"]));
+	$new = OWSPROXY ."/". $sid ."/".$wms."?";
+	$r = str_replace($t,$new,$arrayOnlineresources["wms_getcapabilities_doc"]);
+	header("Content-Type: application/xml");
+	echo $r;
+}
+
 /**
  * gets the original url of the requested legend graphic
  * 
@@ -444,34 +444,34 @@
  * 
  * @param string OWSPROXY md5
  * @return array array with detailed information about requested wms
- */
-function checkWmsPermission($wms){
+ */
+function checkWmsPermission($wms){
 	global $con, $n;
-	$myguis = $n->getGuisByPermission($_SESSION["mb_user_id"],true);
-	$mywms = $n->getWmsByOwnGuis($myguis);
-
-	$sql = "SELECT * FROM wms WHERE wms_owsproxy = $1";
-	$v = array($wms);
-	$t = array("s");
-	$res = db_prep_query($sql, $v, $t);
-	$service = array();
-	if($row = db_fetch_array($res)){
-		$service["wms_id"] = $row["wms_id"];
-		$service["wms_getcapabilities"] = $row["wms_getcapabilities"];	
-		$service["wms_getmap"] = $row["wms_getmap"];
-		$service["wms_getfeatureinfo"] = $row["wms_getfeatureinfo"];
-		$service["wms_getcapabilities_doc"] = $row["wms_getcapabilities_doc"];
-	}
-	if(!$row || count($mywms) == 0){
-		throwE(array("No wms data available."));
-		die();	
-	}
-	
-	if(!in_array($service["wms_id"], $mywms)){
-		throwE(array("Permission denied."," -> ".$service["wms_id"], implode(",", $mywms)));
-		die();
-	}
-	return $service;
+	$myguis = $n->getGuisByPermission($_SESSION["mb_user_id"],true);
+	$mywms = $n->getWmsByOwnGuis($myguis);
+
+	$sql = "SELECT * FROM wms WHERE wms_owsproxy = $1";
+	$v = array($wms);
+	$t = array("s");
+	$res = db_prep_query($sql, $v, $t);
+	$service = array();
+	if($row = db_fetch_array($res)){
+		$service["wms_id"] = $row["wms_id"];
+		$service["wms_getcapabilities"] = $row["wms_getcapabilities"];	
+		$service["wms_getmap"] = $row["wms_getmap"];
+		$service["wms_getfeatureinfo"] = $row["wms_getfeatureinfo"];
+		$service["wms_getcapabilities_doc"] = $row["wms_getcapabilities_doc"];
+	}
+	if(!$row || count($mywms) == 0){
+		throwE(array("No wms data available."));
+		die();	
+	}
+	
+	if(!in_array($service["wms_id"], $mywms)){
+		throwE(array("Permission denied."," -> ".$service["wms_id"], implode(",", $mywms)));
+		die();
+	}
+	return $service;
 }
 /**
  * validates the access permission by getting the appropriate wfs_conf
@@ -538,22 +538,22 @@
 
 	return $service;
 }
-
-function checkLayerPermission($wms_id,$l){
-	global $n, $owsproxyService;
-//	$notice = new mb_notice("owsproxy: checkLayerpermission: wms: ".$wms_id.", layer: ".$l);
-	$myl = split(",",$l);
-	$r = array();
-	foreach($myl as $mysl){
-		if($n->getLayerPermission($wms_id, $mysl, $_SESSION["mb_user_id"]) === true){
-			array_push($r, $mysl);
-		}		
-	}
-	$ret = implode(",",$r);
-	return $ret;
-}
-function getDocumentContent($url){
-	$d = new connector($url);
-	return $d->file;
-}
+
+function checkLayerPermission($wms_id,$l){
+	global $n, $owsproxyService;
+//	$notice = new mb_notice("owsproxy: checkLayerpermission: wms: ".$wms_id.", layer: ".$l);
+	$myl = split(",",$l);
+	$r = array();
+	foreach($myl as $mysl){
+		if($n->getLayerPermission($wms_id, $mysl, $_SESSION["mb_user_id"]) === true){
+			array_push($r, $mysl);
+		}		
+	}
+	$ret = implode(",",$r);
+	return $ret;
+}
+function getDocumentContent($url){
+	$d = new connector($url);
+	return $d->file;
+}
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list