[DebianGIS-dev] r910 - in packages/musmap: . branches branches/upstream branches/upstream/current branches/upstream/current/admin branches/upstream/current/cache branches/upstream/current/data branches/upstream/current/data/lang branches/upstream/current/data/lang/en branches/upstream/current/data/lang/fr branches/upstream/current/images branches/upstream/current/images/cursors branches/upstream/current/images/tool branches/upstream/current/include branches/upstream/current/include/auth branches/upstream/current/include/conf branches/upstream/current/include/contrib branches/upstream/current/include/contrib/metadata branches/upstream/current/include/database branches/upstream/current/include/framework branches/upstream/current/include/framework/html branches/upstream/current/include/library branches/upstream/current/include/model branches/upstream/current/include/sql branches/upstream/current/js branches/upstream/current/js/contrib branches/upstream/current/js/contrib/mygosumenu branches/upstream/current/js/contrib/mygosumenu/1.5 branches/upstream/current/js/contrib/mygosumenu/1.5/images branches/upstream/current/js/contrib/mygosumenu/1.5/tests branches/upstream/current/log branches/upstream/current/print branches/upstream/current/srvtmp branches/upstream/current/webtmp

frankie at alioth.debian.org frankie at alioth.debian.org
Sat Jun 23 22:17:08 UTC 2007


Author: frankie
Date: 2007-06-23 22:17:08 +0000 (Sat, 23 Jun 2007)
New Revision: 910

Added:
   packages/musmap/branches/
   packages/musmap/branches/upstream/
   packages/musmap/branches/upstream/current/
   packages/musmap/branches/upstream/current/CHANGELOG
   packages/musmap/branches/upstream/current/COPYRIGHT
   packages/musmap/branches/upstream/current/INSTALL
   packages/musmap/branches/upstream/current/LICENCE.LGPL
   packages/musmap/branches/upstream/current/LICENSE
   packages/musmap/branches/upstream/current/README
   packages/musmap/branches/upstream/current/TODO
   packages/musmap/branches/upstream/current/about.php
   packages/musmap/branches/upstream/current/admin/
   packages/musmap/branches/upstream/current/admin/build_dependency_tree.php
   packages/musmap/branches/upstream/current/admin/build_spatial_indexes.php
   packages/musmap/branches/upstream/current/admin/check_integrity.php
   packages/musmap/branches/upstream/current/admin/clean_dir.php
   packages/musmap/branches/upstream/current/admin/create_tables.php
   packages/musmap/branches/upstream/current/admin/data_sources_explorer.php
   packages/musmap/branches/upstream/current/admin/fw.test.php
   packages/musmap/branches/upstream/current/admin/index.php
   packages/musmap/branches/upstream/current/admin/info.php
   packages/musmap/branches/upstream/current/admin/localization.php
   packages/musmap/branches/upstream/current/admin/logs.php
   packages/musmap/branches/upstream/current/admin/model.php
   packages/musmap/branches/upstream/current/admin/sessions.php
   packages/musmap/branches/upstream/current/admin/settings.php
   packages/musmap/branches/upstream/current/admin/users.php
   packages/musmap/branches/upstream/current/cache/
   packages/musmap/branches/upstream/current/cache/.htaccess
   packages/musmap/branches/upstream/current/change_password.php
   packages/musmap/branches/upstream/current/color_picker.php
   packages/musmap/branches/upstream/current/data/
   packages/musmap/branches/upstream/current/data/.htaccess
   packages/musmap/branches/upstream/current/data/lang/
   packages/musmap/branches/upstream/current/data/lang/en/
   packages/musmap/branches/upstream/current/data/lang/en/javascript.lang.js
   packages/musmap/branches/upstream/current/data/lang/en/main.lang.php
   packages/musmap/branches/upstream/current/data/lang/en/model.lang.php
   packages/musmap/branches/upstream/current/data/lang/fr/
   packages/musmap/branches/upstream/current/data/lang/fr/javascript.lang.js
   packages/musmap/branches/upstream/current/data/lang/fr/main.lang.php
   packages/musmap/branches/upstream/current/data/lang/fr/model.lang.php
   packages/musmap/branches/upstream/current/doc.php
   packages/musmap/branches/upstream/current/get_tables_wizard.php
   packages/musmap/branches/upstream/current/images/
   packages/musmap/branches/upstream/current/images/arrow_down.gif
   packages/musmap/branches/upstream/current/images/arrow_up.gif
   packages/musmap/branches/upstream/current/images/bg.gif
   packages/musmap/branches/upstream/current/images/cursors/
   packages/musmap/branches/upstream/current/images/cursors/zoomin.cur
   packages/musmap/branches/upstream/current/images/cursors/zoomout.cur
   packages/musmap/branches/upstream/current/images/eye.png
   packages/musmap/branches/upstream/current/images/eye_hidden.png
   packages/musmap/branches/upstream/current/images/help.png
   packages/musmap/branches/upstream/current/images/moins.gif
   packages/musmap/branches/upstream/current/images/palette.jpeg
   packages/musmap/branches/upstream/current/images/paletteBW.jpeg
   packages/musmap/branches/upstream/current/images/plus.gif
   packages/musmap/branches/upstream/current/images/tool/
   packages/musmap/branches/upstream/current/images/tool/logout.gif
   packages/musmap/branches/upstream/current/images/tool/measure.gif
   packages/musmap/branches/upstream/current/images/tool/pan.gif
   packages/musmap/branches/upstream/current/images/tool/print.gif
   packages/musmap/branches/upstream/current/images/tool/querypoint.gif
   packages/musmap/branches/upstream/current/images/tool/queryrect.gif
   packages/musmap/branches/upstream/current/images/tool/refresh.gif
   packages/musmap/branches/upstream/current/images/tool/zoomin.gif
   packages/musmap/branches/upstream/current/images/tool/zoominit.gif
   packages/musmap/branches/upstream/current/images/tool/zoomout.gif
   packages/musmap/branches/upstream/current/images/white_pixel.gif
   packages/musmap/branches/upstream/current/import_mapfile.php
   packages/musmap/branches/upstream/current/include/
   packages/musmap/branches/upstream/current/include/.htaccess
   packages/musmap/branches/upstream/current/include/auth/
   packages/musmap/branches/upstream/current/include/auth/auth.inc.php
   packages/musmap/branches/upstream/current/include/auth/basic.auth.class.php
   packages/musmap/branches/upstream/current/include/auth/basic.ldap.auth.class.php
   packages/musmap/branches/upstream/current/include/auth/cookies.auth.class.php
   packages/musmap/branches/upstream/current/include/auth/db.auth.class.php
   packages/musmap/branches/upstream/current/include/auth/ldap.auth.class.php
   packages/musmap/branches/upstream/current/include/badlog.tmpl.php
   packages/musmap/branches/upstream/current/include/colors.inc.php
   packages/musmap/branches/upstream/current/include/conf.inc.php
   packages/musmap/branches/upstream/current/include/conf/
   packages/musmap/branches/upstream/current/include/conf/blank.map
   packages/musmap/branches/upstream/current/include/conf/config.php
   packages/musmap/branches/upstream/current/include/conf/db_config.php
   packages/musmap/branches/upstream/current/include/conf/fonts.list
   packages/musmap/branches/upstream/current/include/conf/modules.conf.php
   packages/musmap/branches/upstream/current/include/conf/scales.txt
   packages/musmap/branches/upstream/current/include/contrib/
   packages/musmap/branches/upstream/current/include/contrib/metadata/
   packages/musmap/branches/upstream/current/include/contrib/metadata/esri_meta.inc.php
   packages/musmap/branches/upstream/current/include/data_sources.inc.php
   packages/musmap/branches/upstream/current/include/database/
   packages/musmap/branches/upstream/current/include/database/db.class.php
   packages/musmap/branches/upstream/current/include/database/db.inc.php
   packages/musmap/branches/upstream/current/include/database/dbase.db.class.php
   packages/musmap/branches/upstream/current/include/database/dbase_file.db.class.php
   packages/musmap/branches/upstream/current/include/database/firebird.db.class.php
   packages/musmap/branches/upstream/current/include/database/mapserver.db.class.php
   packages/musmap/branches/upstream/current/include/database/mysql.db.class.php
   packages/musmap/branches/upstream/current/include/database/odbc.db.class.php
   packages/musmap/branches/upstream/current/include/database/ogr.db.class.php
   packages/musmap/branches/upstream/current/include/database/postgresql.db.class.php
   packages/musmap/branches/upstream/current/include/database/sqlite.db.class.php
   packages/musmap/branches/upstream/current/include/error.inc.php
   packages/musmap/branches/upstream/current/include/framework/
   packages/musmap/branches/upstream/current/include/framework/framework.class.php
   packages/musmap/branches/upstream/current/include/framework/framework.inc.php
   packages/musmap/branches/upstream/current/include/framework/html/
   packages/musmap/branches/upstream/current/include/framework/html/htmlframework.class.php
   packages/musmap/branches/upstream/current/include/library/
   packages/musmap/branches/upstream/current/include/library/attributefilter.class.php
   packages/musmap/branches/upstream/current/include/library/attributes.class.php
   packages/musmap/branches/upstream/current/include/library/collection.class.php
   packages/musmap/branches/upstream/current/include/library/collectionitem.class.php
   packages/musmap/branches/upstream/current/include/library/collectionitems.class.php
   packages/musmap/branches/upstream/current/include/library/enum.class.php
   packages/musmap/branches/upstream/current/include/library/event.class.php
   packages/musmap/branches/upstream/current/include/library/mutation.evt.class.php
   packages/musmap/branches/upstream/current/include/library/object.class.php
   packages/musmap/branches/upstream/current/include/library/type.class.php
   packages/musmap/branches/upstream/current/include/localization.inc.php
   packages/musmap/branches/upstream/current/include/log.class.php
   packages/musmap/branches/upstream/current/include/map.class.php
   packages/musmap/branches/upstream/current/include/map.inc.php
   packages/musmap/branches/upstream/current/include/misc.inc.php
   packages/musmap/branches/upstream/current/include/model/
   packages/musmap/branches/upstream/current/include/model/class.class.php
   packages/musmap/branches/upstream/current/include/model/component.class.php
   packages/musmap/branches/upstream/current/include/model/component.inc.php
   packages/musmap/branches/upstream/current/include/model/connection.class.php
   packages/musmap/branches/upstream/current/include/model/data_column.class.php
   packages/musmap/branches/upstream/current/include/model/data_source.class.php
   packages/musmap/branches/upstream/current/include/model/dbrecordbinding.class.php
   packages/musmap/branches/upstream/current/include/model/dbrecordexplorer.class.php
   packages/musmap/branches/upstream/current/include/model/extent.class.php
   packages/musmap/branches/upstream/current/include/model/group.class.php
   packages/musmap/branches/upstream/current/include/model/label.class.php
   packages/musmap/branches/upstream/current/include/model/list.class.php
   packages/musmap/branches/upstream/current/include/model/map_reference.class.php
   packages/musmap/branches/upstream/current/include/model/profile.class.php
   packages/musmap/branches/upstream/current/include/model/profile_data.class.php
   packages/musmap/branches/upstream/current/include/model/profiles_columns.class.php
   packages/musmap/branches/upstream/current/include/model/projection.class.php
   packages/musmap/branches/upstream/current/include/model/query_form.class.php
   packages/musmap/branches/upstream/current/include/model/query_result.class.php
   packages/musmap/branches/upstream/current/include/model/session.class.php
   packages/musmap/branches/upstream/current/include/model/style.class.php
   packages/musmap/branches/upstream/current/include/model/symbol.class.php
   packages/musmap/branches/upstream/current/include/model/user.class.php
   packages/musmap/branches/upstream/current/include/musmap_meta.inc.php
   packages/musmap/branches/upstream/current/include/pre.inc.php
   packages/musmap/branches/upstream/current/include/pre_admin.inc.php
   packages/musmap/branches/upstream/current/include/sql/
   packages/musmap/branches/upstream/current/include/sql/create_tables.firebird.sql
   packages/musmap/branches/upstream/current/include/sql/create_tables.mysql.sql
   packages/musmap/branches/upstream/current/include/sql/create_tables.postgresql.sql
   packages/musmap/branches/upstream/current/include/sql/create_tables.sql
   packages/musmap/branches/upstream/current/include/sql/create_tables.sqlite.sql
   packages/musmap/branches/upstream/current/include/user.inc.php
   packages/musmap/branches/upstream/current/include/visual.inc.php
   packages/musmap/branches/upstream/current/index.php
   packages/musmap/branches/upstream/current/js/
   packages/musmap/branches/upstream/current/js/color_picker.js
   packages/musmap/branches/upstream/current/js/colors.js
   packages/musmap/branches/upstream/current/js/contrib/
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.css
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.js
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.txt
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTreeBuilder.js
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/actions.js
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example1.html
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example2.html
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/help.html
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/delete.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/info.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/insert.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveDown.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveLeft.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveRight.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveUp.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-branch.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-doc.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-folder-open.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-folder.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-leaf-end.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-leaf.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-end.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-open-end.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-open.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree.gif
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/plugins.js
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/foldersAsLinks.html
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test1.html
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test2.html
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/ie5.js
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/license.txt
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/readme.txt
   packages/musmap/branches/upstream/current/js/contrib/mygosumenu/todo.txt
   packages/musmap/branches/upstream/current/js/contrib/xb.js
   packages/musmap/branches/upstream/current/js/contrib/xbgeo.js
   packages/musmap/branches/upstream/current/js/events.js
   packages/musmap/branches/upstream/current/js/explorer.js
   packages/musmap/branches/upstream/current/js/l10n.php
   packages/musmap/branches/upstream/current/js/layers.js
   packages/musmap/branches/upstream/current/js/map.class.js
   packages/musmap/branches/upstream/current/js/mapinfos.js
   packages/musmap/branches/upstream/current/js/presentation_wizard.js
   packages/musmap/branches/upstream/current/js/top.js
   packages/musmap/branches/upstream/current/layers.php
   packages/musmap/branches/upstream/current/log/
   packages/musmap/branches/upstream/current/log/.htaccess
   packages/musmap/branches/upstream/current/log/musmap.sql
   packages/musmap/branches/upstream/current/log/remove.txt
   packages/musmap/branches/upstream/current/main.php
   packages/musmap/branches/upstream/current/map.css
   packages/musmap/branches/upstream/current/presentation_wizard.php
   packages/musmap/branches/upstream/current/print.php
   packages/musmap/branches/upstream/current/print/
   packages/musmap/branches/upstream/current/print/default.css
   packages/musmap/branches/upstream/current/print_execute.php
   packages/musmap/branches/upstream/current/privileges.php
   packages/musmap/branches/upstream/current/profile_wizard.php
   packages/musmap/branches/upstream/current/profiles_explorer.php
   packages/musmap/branches/upstream/current/query.php
   packages/musmap/branches/upstream/current/query_form.php
   packages/musmap/branches/upstream/current/socket.php
   packages/musmap/branches/upstream/current/srvtmp/
   packages/musmap/branches/upstream/current/srvtmp/.htaccess
   packages/musmap/branches/upstream/current/srvtmp/remove.txt
   packages/musmap/branches/upstream/current/tools.php
   packages/musmap/branches/upstream/current/webtmp/
   packages/musmap/branches/upstream/current/webtmp/1137358597250821.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508210.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508211.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508212.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508213.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508214.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508215.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508216.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508217.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508218.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508219.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250822.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508220.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508221.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508222.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508223.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508224.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508225.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508226.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508227.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508228.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508229.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250823.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508230.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508231.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508232.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508233.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508234.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508235.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508236.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508237.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508238.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508239.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250824.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508240.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508241.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508242.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508243.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508244.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508245.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508246.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508247.png
   packages/musmap/branches/upstream/current/webtmp/11373585972508248.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250825.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250826.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250827.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250828.png
   packages/musmap/branches/upstream/current/webtmp/1137358597250829.png
   packages/musmap/branches/upstream/current/webtmp/11373586003191.png
   packages/musmap/branches/upstream/current/webtmp/11373586003192.png
   packages/musmap/branches/upstream/current/webtmp/11373586173191.png
   packages/musmap/branches/upstream/current/webtmp/11373586173192.png
   packages/musmap/branches/upstream/current/webtmp/11373586263191.png
   packages/musmap/branches/upstream/current/webtmp/11373586263192.png
   packages/musmap/branches/upstream/current/webtmp/11373586333191.png
   packages/musmap/branches/upstream/current/webtmp/11373586333192.png
   packages/musmap/branches/upstream/current/webtmp/remove.txt
   packages/musmap/tags/
Log:
[svn-inject] Installing original source of musmap

Added: packages/musmap/branches/upstream/current/CHANGELOG
===================================================================
--- packages/musmap/branches/upstream/current/CHANGELOG	                        (rev 0)
+++ packages/musmap/branches/upstream/current/CHANGELOG	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,241 @@
+* 0.9.2 2005-11-?
+  o Authentification via LDAP (RFE #1262144)
+    mathieuparent - 2005-12-21
+  o No message is map reference path is empty: simply load extent
+    mathieuparent - 2005-12-08
+  o New Auth mecanism: easier to maintain and enhance
+    mathieuparent - 2005-11-30
+  o  Auto focus user_name field on login
+    mathieuparent - 2005-11-30
+  o Avoid image bounce when panning
+    mathieuparent - 2005-11-11
+  o Profile wizard is now part of standard interface (not admin) (RFE 1338952)
+    mathieuparent - 2005-10-27
+  o Smaller plot in HTML polygons
+    mathieuparent - 2005-10-26
+  o Implement $user::CanReadFile(), used for reference map images and symbols
+    mathieuparent - 2005-10-26
+  o More explicit errors when deleting children nodes
+    mathieuparent - 2005-10-26
+  o Fixed bug to allow profile_extents cloning (Bug 1292323)
+    mathieuparent - 2005-10-26
+* 0.9.0 2005-10-25
+  o Solved Bug #1292323 Can't delete profile extent (write privilege)
+    mathieuparent - 2005-09-15
+  o Automaticaly load mapscript if not loaded
+    mathieuparent - 2005-08-29
+  o Better random password
+    mathieuparent - 2005-08-15
+  o Avoid reload in explorer after a change
+    mathieuparent - 2005-08-15
+  o Firebird support (EXPERIMENTAL)
+    mathieu parent - 2005-07-11
+  o SVG output (in the print dialog)
+    mathieu parent - 2005-06-15
+  o Real symbol management (not in the template map file) (RFE #1114571)
+    mathieu parent - 2005-06-15
+  o Date display using client time zone if available
+    mathieu parent - 2005-05-31
+  o Measure tool now draws polygons (SVG for Gecko and VML for IE)
+    mathieu parent - 2005-05-31
+  o Read privileges are now effective: not readable objects are not loaded
+    mathieu parent - 2005-05-27
+  o More complete musmap capabilities description in about.php
+    mathieu parent - 2005-05-09
+  o OGR support for SQL and GetInformationSchema
+    mathieu parent - 2005-05-09
+  o GetInformationSchema supported by Shapefiles, dbf, mysql, postgresql
+    mathieu parent - 2005-05-04
+  o Explorer: Get all table info automaticaly (using GetInformationSchema)
+    mathieu parent - 2005-05-04
+  o Model: adding connections (parent of data_sources)
+    mathieu parent - 2005-05-04
+  o Complete rewrite of the model hierarchy API using collections
+    mathieu parent - 2005-04-05
+  o Explorers: Allow child nodes batch deletion
+    mathieu parent - 2005-03-23
+  o Import ESRI XML metadata for shapefiles (need PHP5 which has DOM extension)
+    mathieu parent - 2005-03-23
+  o Zoom to layer
+    mathieu parent - 2005-03-22
+  o Query results are lost if layer index changes (Bug #1123873)
+    mathieu parent - 2005-02-16
+  o Ability to change parent node
+    mathieu parent - 2005-02-16
+* 0.8.1 2005-02-14
+  o Bugfix release
+* 0.8.0 2005-02-14
+  o Contextual help (RFE #1114591)
+    mathieu parent - 2005-02-10
+  o Query forms administration
+    mathieu parent - 2005-01-22
+  o Better csv import
+    mathieu parent - 2005-01-21
+  o Selection memory (child node of user)
+    mathieu parent - 2005-01-14
+  o Sessions manager (view and delete obsolete sessions)
+    mathieu parent - 2005-01-05
+  o "Sort by" in attributes tables (for every database engine except mapserver)
+    mathieu parent - 2005-01-05
+  o reordering of layers within profile, class within layer, styles within 
+      class,... with move up/move down buttons
+    mathieu parent - 2005-01-04
+* 0.7.0 2005-01-04
+  o More powerfull privilege management (owner user, reader goup, writer group)
+    mathieu parent - 2005-01-04
+  o Change node from its parent in explorer
+    mathieu parent - 2004-12-28
+  o Attribute table 
+    (one row per result instead of one table)
+    mathieu parent - 2004-12-28
+  o Mapfiles (.map) importation
+    mathieu parent - 2004-12-17
+  o Display objects in explorer with a tree-view
+    mathieu parent - 2004-12-09
+  o Mapserver Mapfiles (.map) shown in explorer
+    mathieu parent - 2004-11-29
+  o Toolbar reorganisation
+    Mouse tools are more intuitive (like other GIS)
+    mathieu parent - 2004-11-29
+  o A pan tool
+    mathieu parent - 2004-11-29
+  o A measure tool
+    mathieu parent - 2004-11-26
+  o SQLite as database engine for musmap (some changes in SQL)
+    mathieu parent - 2004-11-14
+  o Label character encoding (using iconv)
+    mathieu parent - 2004-11-11
+  o Projections
+    mathieu parent - 2004-11-11
+* 0.6.3 2004-11-11
+  o New column type: image (generate an <img> tag)
+    mathieu parent - 2004-11-11
+  o Wizard to create many classes quickly
+    mathieu parent - 2004-11-11
+* 0.6.2 2004-10-23
+  o Nicer selection (green border and semi-transparent background)
+    mathieu parent - 2004-10-15
+  o Show layers real visibility (according to scale) in legend
+    (using an eye icon for example, like photoshop)
+    mathieu parent - 2004-10-15
+* 0.6.1 2004-10-10
+  o Virtual columns (calculated)
+    mathieu parent - 2004-10-09
+  o Dynamic links to html websites
+    mathieu parent - 2004-10-09
+  o PHP 5 compatibility
+    mathieu parent - 2004-10-07
+  o Konqueror compatibility (JavaScript)
+    mathieu parent - 2004-10-07
+  o Documentation of layers inside musmap
+    mathieu parent - 2004-10-05
+  o New legend display (more compehensive)
+    mathieu parent - 2004-10-01
+* 0.6.0 2004-09-30
+  o Better mapserver errors handling
+    mathieu parent - 2004-09-30
+  o metadata caching (performance:
+    8 times faster in Datasources explorer !)
+    mathieu parent - 2004-09-29
+  o Better model queries (performance)
+    mathieu parent - 2004-09-28
+* 0.5.5 2004-09-28
+  o Increase performance (about 25% faster) on model loading
+    mathieu parent - 2004-09-27
+  o Documentation effort (phpDocumentor)
+    mathieu parent - 2004-09-25
+  o Setting extent properties to the current extent
+    mathieu parent - 2004-09-21
+* 0.5.4 2004-09-20
+  o New database structure with privileges management
+    (not yet inplemented)
+    mathieu parent - 2004-09-20
+  o Direct access to dBase files via ODBC
+    mathieu parent - 2004-09-18
+  o Data column chooser for relations
+    mathieu parent - 2004-09-18
+  o New explorer : multi purpose : profiles, extents,
+    map references
+    mathieu parent - 2004-09-17
+* 0.5.3 2004-09-17
+  o Performance acceleration
+    mathieu parent - 2004-09-17
+  o Complete rewrite of the database bindings
+    mathieu parent - 2004-09-16
+  o
+        + A new table : extents (id,name,minx,miny,maxx,maxy)
+        + References images should be in metadata (and not in mapfile)
+        + Multiple extents on profiles (if none : reference extent)
+        + Summary of the 3 previous points (metamodel) :
+ at pre on
+|EXTENTS     |     /-1,1--|REFERENCES     |
+|ID_EXTENT   |-0,n-/      |ID_REF         |-0,n-\
+|EXTENT_MINX | 0,n-\      |REF_NAME       |     |                   
+|EXTENT_MINY |     |      |REF_IMAGE_PATH |     \-1,1--|PROFILES   |
+|EXTENT_MAXX |     |                            /-0,n  |ID_PROFILE |
+|EXTENT_MAXY |     |                            |      |...        |
+                   \____________________________/
+ at pre off
+    mathieu parent - 2004-09-14
+  o User interface for profile columns visibility
+    mathieu parent - 2004-09-13
+  o User password change
+    mathieu parent - 2004-09-13
+* 0.5.2 2004-09-13
+  o Integrity checking in the musmap database (no orphans in LAYERS, CLASSES, 
+      ...)
+    mathieu parent - 2004-09-07
+  o Administration login (previously security was based on IP address)
+    mathieu parent - 2004-09-07
+  o Add support for PostGIS, OracleSpacial, OGR and all format supported by 
+      MapServer
+    mathieu parent - 2004-09-02
+* 0.5.1 2004-09-01
+  o PostgreSQL support
+    mathieu parent - 2004-09-01
+* 0.5.0 2004-08-31
+  o Columns visibility (default)
+    mathieu parent - 2004-08-26
+  o Columns visibility (profile override). Caution : No user interface for this 
+      enhancement
+    mathieu parent - 2004-08-26
+  o i18n (internationalization) & l10n (localization) / javascript part
+    mathieu parent - 2004-08-26
+  o User deletion. You should choose between deleting profiles or assigning 
+      them to another user
+    mathieu parent - 2004-08-26
+  o Links from Primary Key to Foreign Key (to alpha tables)  (RFE #1003231)
+    mathieu parent - 2004-08-26
+  o Profile explorer in the profiles menu
+    Profile explorer as a small window, closing when login out
+    mathieu parent - 2004-08-25
+  o i18n (internationalization) & l10n (localization)
+    mathieu parent - 2004-08-08
+  o Links from Primary Key to Foreign Key (works only with shapefiles)
+    mathieu parent - 2004-08-08
+* 0.4.3 2004-08-08
+  o Login message is now part of settings (admin)
+    mathieu parent - 2004-08-08
+  o New data_source type : links (for n -> m links): type is B - Relations table
+    mathieu parent - 2004-08-07
+  o i18n (internationalization) architecture
+    mathieu parent - 2004-08-07
+  o Class order (draw order)
+    mathieu parent - 2004-08-07
+  o Style order (draw order)
+    mathieu parent - 2004-08-07
+  o Show minscale & maxscale in the legend (using tips)
+    mathieu parent - 2004-08-06
+* 0.4.x:
+  0.4.2 2004-08-04
+  0.4.1 2004-08-03
+  0.4.0 2004-07-29
+  o Queries enhancements,
+    Links foreign keys to primary keys, ...
+* 0.3.x 2004-07
+  o Metadata model, ...
+* 0.2.x 2004-06
+  o Graphic queries and attribute queries
+    Adding APUR specific features, ...
+* 0.1.x 2004-06
+  o First version, using static mapfiles 

Added: packages/musmap/branches/upstream/current/COPYRIGHT
===================================================================
--- packages/musmap/branches/upstream/current/COPYRIGHT	                        (rev 0)
+++ packages/musmap/branches/upstream/current/COPYRIGHT	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,40 @@
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+    see LICENSE for complete license
+
+------------------------------------------------------------------------+
+Musmap uses :
+------------
+* Javscript cross-browser library:
+    - js/contrib/xb.js
+    - js/contrib/xbgeo.js
+  which are released under LGPL
+      see LICENSE.LGPL for complete license
+* mygosumenu
+    - js/contrib/mygosumenu/*
+  which is released under a BSD-style licence
+      see js/contrib/mygosumenu/license.txt for complete license

Added: packages/musmap/branches/upstream/current/INSTALL
===================================================================
--- packages/musmap/branches/upstream/current/INSTALL	                        (rev 0)
+++ packages/musmap/branches/upstream/current/INSTALL	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,76 @@
+===========================================================
+Copyright and license :
+===========================================================
+See COPYRIGHT
+
+===========================================================
+Installation instructions :
+===========================================================
+Complete installation instructions can be found here:
+http://musmap.sourceforge.net/mediawiki/index.php/Installation
+
+
+===========================================================
+Basic Installation instructions :
+===========================================================
+* Requires :
+  - Install Apache 2 or another web server
+      (http://httpd.apache.org)
+  - Install PHP + PHP/Mapscript (same version)
+      (http://www.php.net)
+      (http://maptools.org/php_mapscript/)
+  - Install MySQL or PostgreSQL or SQLite
+      (http://www.mysql.com)
+      (http://www.postgresql.org)
+      (http://www.sqlite.org)
+
+
+* Unzip musmap.zip in your "DocumentRoot" directory
+
+* start services/daemons (apache, mysql/postgresql/sqlite)
+
+* Change the server file permissions so that musmap
+  can write into:
+    musmap/log/*
+    musmap/srvtmp/*
+    musmap/webtmp/*
+  NB: musmap has the server privileges.
+
+* edit the file include/conf/db_config.php
+  you just have to set these configs :
+  - Conf::Set('db_engine', 'mysql' or 'postgresql' or 'sqlite');
+  - $db_params[<your db engine>] = ...;
+      for postgresql, the params are :
+        user,password,dbname,host (localhost),port (5432)
+      for mysql, the params are :
+        user,password,dbname,host (localhost),port (3306)
+      for sqlite, the params are :
+        filename
+
+* create the database from a db prompt:
+  CREATE DATABASE musmap;
+  ('mysql' or 'postgresql')
+
+* Go to http://127.0.0.1/musmap/admin/
+
+* Click on the Install link (this will create musmap tables and fill some of them)
+
+* Go to  Musmap settings (http://127.0.0.1/musmap/settings.php)
+** Set musmap_root_url (if not good)
+** Set others parameters if needed
+
+* Go to the connections explorer (http://127.0.0.1/musmap/admin/data_sources_explorer.php)
+** set a first connection with for example:
+*** driver:shapefile
+*** params:dirname=path/to/your/shapefiles/folder
+** Click "Get Tables" to automaticaly find all shapefiles in this directory
+
+* Go to  Create a profile (http://127.0.0.1/musmap/admin/create_default_profile.php)
+** Select all needed tables with the conrol key
+
+* Go to http://127.0.0.1/musmap/ to test wit the amin password given above
+
+Send any bug, request to the sourceforge project:
+  http://sourceforge.net/projects/musmap/
+or email me:
+  <mathieuparent at users.sourceforge.net>

Added: packages/musmap/branches/upstream/current/LICENCE.LGPL
===================================================================
--- packages/musmap/branches/upstream/current/LICENCE.LGPL	                        (rev 0)
+++ packages/musmap/branches/upstream/current/LICENCE.LGPL	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+

Added: packages/musmap/branches/upstream/current/LICENSE
===================================================================
--- packages/musmap/branches/upstream/current/LICENSE	                        (rev 0)
+++ packages/musmap/branches/upstream/current/LICENSE	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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 of the License, 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: packages/musmap/branches/upstream/current/README
===================================================================
--- packages/musmap/branches/upstream/current/README	                        (rev 0)
+++ packages/musmap/branches/upstream/current/README	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,28 @@
+Musmap is a web mapping interface which has an advanced users/profiles 
+management system.
+.
+Features:
+ Can open all file formats supported by UMN Mapserver (shapefiles, PostGIS,
+ OGR, OracleSpacial, ...)
+ Can open Rasters (geotiff, ecw, jpeg, ...) tile-indexed
+ Management of display properties (via profiles)
+  > Users
+   > Profiles (aka maps)
+    > data (alpha or shape or raster)
+     > classes (=legend elements)
+      > styles (colors, symbols, ...)
+      > labels (...)
+   > Overviews (reference maps)
+   > Extents (to quickly zoom)
+   > ...
+ Easy administration: 
+  give a list of connections, Musmap will find all the data!
+  Adding/removing users
+  Adding/removing data-sources
+  Importing or changing metadata (data labels, joins, ...)
+ Tools (build spacial indexes, automatic metadata creation, ...)
+ Tested with many browsers (Requires Javascript):
+  Gecko (Mozilla Suite, Firefox, Netscape, ...),
+  KHTML (Konqueror, Safari, ...),
+  Internet explorer >5, ...
+ Under GNU General Public License (GPL). Free as beer and free as speech !

Added: packages/musmap/branches/upstream/current/TODO
===================================================================
--- packages/musmap/branches/upstream/current/TODO	                        (rev 0)
+++ packages/musmap/branches/upstream/current/TODO	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,10 @@
+* HighPriority
+  o Make tutorial and screenshots
+  o Enhance the presentation wizard (RFE #1168106)
+  o Measure tool for existing features (polygons ->perimeters/area, lines ->length,...) (RFE #1114562)
+* LowPriority
+  o User ability to add features (lines, polygons, rectangles, texts, pushpins) and remove them (RFE #1114559)
+  o Geoprocessing : buffer, intersects, contains, ... (RFE #1114566)
+* Ideas
+  o Image maps and/or SVG and/or Flash maps (RFE #1114577)
+  o Musmap on read-only discs (RFE #1123893)
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/about.php
===================================================================
--- packages/musmap/branches/upstream/current/about.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/about.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,112 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Renseignements sur musmap
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  ?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo ucfirst(html_l10n('used technologies'));?></title>
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+  <style type="text/css">
+  <!--
+    .tech {
+      border:2px #9966AA inset;
+      margin:3px;
+      color:black;
+      font-family:monospace;
+      padding:5px;
+      border-spacing:5px;
+      background-color:#CCCCFF;
+    }
+    
+   
+    a {
+      color: gray;
+      font-weight: bold;
+    }
+    
+    p {
+      margin : 0px;
+      padding:0px;
+    }
+  -->
+  </style>
+</head>
+
+<body>
+  <div class="tech">
+    <?php echo $_SERVER['SERVER_SOFTWARE'];?>
+  </div>
+  <div class="tech">
+    <p><a href="http://www.php.net">PHP</a> 
+    <?php echo phpversion()?></p>
+  </div>
+  <div class="tech">
+    <p>
+      <a href="http://mapserver.gis.umn.edu/">UMN MapServer</a>,
+      <a href="http://maptools.org/php_mapscript/index.phtml">
+        PHP MapScript</a>
+    </p>
+    <p style="padding-left:10pt;"><?php echo ms_GetVersion();?></p>
+  </div>
+  <div class="tech">
+    <p>
+      <a href="<?php echo $db->website;?>"><?php echo $db->engine;?></a>
+    </p>
+    <pre style="padding-left:10pt;"><?php echo $db->EngineVersion();?></pre>
+  </div>
+  <div class="tech">
+    <p>
+      <a href="http://musmap.sourceforge.net/">Musmap</a>
+      <?php echo MUSMAP_VERSION;?>
+    </p>
+    <ul style="padding-left:10pt;"><?php
+      foreach(Conf::getMusmapInputFormats() As $item) {
+        echo "<li>$item</li>\n";
+      }
+      ?></ul>
+  </div>
+  <div class="tech">
+    <a href="<?php echo Conf::get('musmap_root_url').'/';?>">
+      <?php echo Conf::get('musmap_root_url').'/';?></a>
+  </div>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/build_dependency_tree.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/build_dependency_tree.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/build_dependency_tree.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,310 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+  /**
+   * build dependency tree
+   *
+   * Catching all include and require statements 
+   * to build a tree showing file dependencies
+   *
+   * @package admin
+   * @subpackage development
+   */
+   
+
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+function get_files_by_ext($dir_path,$ext='.php',$relative_path='') {
+  global $file_list;
+  $dir_o=dir($dir_path);
+  while(false !== ($entry=$dir_o->read())) {
+    if ($entry=='.' || $entry=='..') {
+      continue;
+    } elseif (!is_link($dir_path.'/'.$entry)
+        && is_dir($dir_path.'/'.$entry)) {
+      get_files_by_ext($dir_path.'/'.$entry,$ext,$relative_path.$entry.'/');
+    } elseif (substr($entry,-4,4)==$ext) {
+      $file_list[]=Array($dir_path.'/'.$entry,$relative_path.$entry);
+    }
+  }
+  $dir_o->close();
+}
+
+/**
+ * Node corresponding to a file
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package admin
+ * @since 2004-07-21
+ */
+
+  class TTreeNode {
+    var $children;
+    var $path;
+    var $name;
+    var $parents;
+    
+    /**
+     * Constructor
+     *
+     * @param string $path
+     * @param string[] $children
+     */
+    function TTreeNode($path,$children) {
+      $this->parents=Array();
+      $this->children=$children;
+      $this->path=$path;
+      $this->name=basename($this->path);
+    }
+    
+    function print_tree($rec=10,$done=Array(),$link_type=0) {
+      global $tree_nodes,$unknown_nodes;
+      if($rec<=0) {
+        ?>
+        <li>
+        ...
+        </li>
+        <?php
+        return;
+      }
+      if(in_array($this->path,$done)){
+        ?>
+        <li>
+        <b>REC <?php echo $this->path;?></b>
+        </li>
+        <?php
+        return;
+      }
+      $done[]=$this->path;
+      ?>
+      <li><?php echo $this->path;?>
+        (<?php
+        switch($link_type) {
+          case T_REQUIRE:
+            echo 'R';
+            break;
+          case T_REQUIRE_ONCE:
+            echo 'R1';
+            break;
+          case T_INCLUDE:
+            echo 'I';
+            break;
+          case T_INCLUDE_ONCE:
+            echo 'I1';
+            break;
+          default:
+            echo '';
+        }
+        ?>)
+        <?php
+        $n=0;
+        foreach($this->children AS $child_name=>$v) {
+          if($n==0) {
+            ?>
+            <ul>
+            <?php
+          }
+          $n++;
+          if(isset($tree_nodes[$child_name])) {
+            $tree_nodes[$child_name]->print_tree($rec-1,$done,$v);
+            $tree_nodes[$child_name]->parents[$this->path]=$this->path;
+          } else {
+            $unknown_nodes[$child_name][]=$v;
+            ?>
+            <li>
+            <i><?php echo $child_name;?>[?]</i>
+            </li>
+            <?php
+          }
+        }
+        if($n>0) {
+            ?>
+          </ul>
+          <?php
+        }
+        ?>
+      </li>
+      <?php
+    }
+  }
+  
+  
+  $tree_nodes=Array();
+  $file_list=Array();
+  get_files_by_ext('..');
+  for($i=0;$i<sizeof($file_list);$i++) {
+    $sub_list=Array();
+    $tokens=token_get_all(file_get_contents($file_list[$i][0]));
+    for($j=0;$j<sizeof($tokens);$j++) {
+      if(isset($tokens[$j][0])
+          && in_array($tokens[$j][0],
+                Array(T_REQUIRE,T_REQUIRE_ONCE,T_INCLUDE,T_INCLUDE_ONCE))) {
+        $k=$j+2;
+        $fname='';
+        $parentheses_count=0;
+        while(true) {
+          if(isset($tokens[$k][1])) {
+            $fname.=$tokens[$k][1];
+          } else {
+            if ($tokens[$k]=='(') {
+              $parentheses_count++;
+            } elseif ($tokens[$k]==')') {
+              $parentheses_count--;
+            }
+            $fname.=$tokens[$k];
+          }
+          $k++;
+          if(($tokens[$k]==')') && $parentheses_count==0) {
+            break;
+          }
+        }
+        $fname=substr($fname,1,-1);
+        $sub_list[basename($fname)]=$tokens[$j][0];
+      }
+    }
+    $tree_nodes[basename($file_list[$i][1])]=
+        new TTreeNode($file_list[$i][1],$sub_list);
+  }
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Show dependencies tree');?></title>
+</head>
+<body>
+<p>
+<a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<ul>
+<?php
+function path_sort($a,$b) {
+  return strcmp($a->path,$b->path);
+}
+
+uasort($tree_nodes,'path_sort');
+
+$tree_nodes['about.php']->print_tree();
+$tree_nodes['change_password.php']->print_tree();
+$tree_nodes['color_picker.php']->print_tree();
+$tree_nodes['doc.php']->print_tree();
+$tree_nodes['get_tables_wizard.php']->print_tree();
+$tree_nodes['import_mapfile.php']->print_tree();
+$tree_nodes['index.php']->print_tree();
+$tree_nodes['layers.php']->print_tree();
+$tree_nodes['main.php']->print_tree();
+$tree_nodes['presentation_wizard.php']->print_tree();
+$tree_nodes['print.php']->print_tree();
+$tree_nodes['print_execute.php']->print_tree();
+$tree_nodes['privileges.php']->print_tree();
+$tree_nodes['profiles_explorer.php']->print_tree();
+$tree_nodes['profile_wizard.php']->print_tree();
+$tree_nodes['query.php']->print_tree();
+$tree_nodes['query_form.php']->print_tree();
+$tree_nodes['socket.php']->print_tree();
+$tree_nodes['tools.php']->print_tree();
+
+// Admin
+$tree_nodes['build_dependency_tree.php']->print_tree();
+$tree_nodes['build_spatial_indexes.php']->print_tree();
+$tree_nodes['check_integrity.php']->print_tree();
+$tree_nodes['clean_dir.php']->print_tree();
+$tree_nodes['create_tables.php']->print_tree();
+$tree_nodes['data_sources_explorer.php']->print_tree();
+$tree_nodes['index.php']->print_tree();
+$tree_nodes['info.php']->print_tree();
+$tree_nodes['localization.php']->print_tree();
+$tree_nodes['logs.php']->print_tree();
+$tree_nodes['model.php']->print_tree();
+$tree_nodes['sessions.php']->print_tree();
+$tree_nodes['settings.php']->print_tree();
+$tree_nodes['users.php']->print_tree();
+
+?><br>
+</ul>
+<hr>
+<table border=1>
+<tr>
+  <th>&nbsp;</th>
+  <th>needs</th>
+  <th>needed by</th>
+<tr>
+<?php
+foreach($tree_nodes AS $node) {
+  ?>
+  <tr><td>
+    <a name="<?php echo $node->path;?>">
+      <?php echo $node->path;?></a>
+  </td>
+  <td>
+  <table>
+  <?php
+  foreach($node->children AS $child_name=>$k) {
+    ?>
+    <tr><td><a href="#<?php echo $child_name;?>">
+      <?php echo $child_name;?></a></td></tr>
+    <?php
+  }
+  ?>
+  </table>
+  </td>
+  <td>
+  <table>
+  <?php
+  foreach($node->parents AS $parent_name) {
+    ?>
+    <tr><td><a href="#<?php echo $parent_name;?>">
+      <?php echo $parent_name;?></a></td></tr>
+    <?php
+  }
+  ?>
+  </table>
+  </td>
+  </tr>
+  <?php
+}
+?>
+</table>
+<p>
+<b>Unknown nodes :</b><br>
+<?php
+foreach($unknown_nodes AS $node_name=>$k) {
+  echo "$node_name<br>";
+}
+?>
+</p>
+<p>
+<a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/build_spatial_indexes.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/build_spatial_indexes.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/build_spatial_indexes.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,111 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * build spatial indexes
+   * @package admin
+   */
+   
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+
+function shptree_dir($dir) {
+  global $shptree_path;
+  if(file_exists($dir) && is_dir($dir)) {
+    $dir_obj=dir($dir);
+    if($dir_obj) {
+      while(false !== ($entry = $dir_obj->read())) {
+        if($entry=='.' || $entry=='..') {
+          continue;
+        }
+        if(is_readable($dir_obj->path.'/'.$entry)) {
+          if(is_dir($dir_obj->path.'/'.$entry)) {
+            
+            shptree_dir($dir_obj->path.'/'.$entry);
+          } elseif(strtolower(substr($entry,-4,4)=='.shp')) {
+            echo '<li>shptree "'.$dir_obj->path.'/'.$entry.'"'."</b><br>\n";
+            system($shptree_path.' "'.$dir_obj->path.'/'.$entry.'"');
+            echo '</li>';
+            flush();
+          }
+        } else {
+          add_error(sprintf(l10n('Musmap can\'t read "%s".'),
+            $dir_obj->path.'/'.$entry));
+        }
+      }
+      $dir_obj->close();
+    } else {
+      Warning(l10n('Unable to read directory.'));
+    }
+  } else {
+    Warning(l10n('Please specify a valid directory.'));
+  }
+}
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Admin');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+</head>
+<body>
+<?php
+if(!isset($_GET['dir_path'])) {
+  ?>
+  <h1><?php echo html_l10n('Build spatial indexes');?></h1>
+  <form action="build_spatial_indexes.php" name="default">
+    <?php echo html_l10n('Folder:');?>
+    <input type="text" name="dir_path" value=""><br>
+    <input type="submit" value="OK">
+  </form>
+  <?php
+
+} else {
+  //shptree should be in PATH environement variable
+  if(substr(PHP_OS,0,3)=='WIN') {
+    $shptree_path='shptree.exe';
+  } else {
+    $shptree_path='shptree';
+  }
+  ?>
+  <ol>
+  <?php
+  shptree_dir($_GET['dir_path']);
+  ?>
+  </ol>
+  <?php
+}
+?>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/check_integrity.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/check_integrity.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/check_integrity.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,188 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Checking db integrity
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package admin
+ * @since 2004-09
+ */
+ 
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+ 
+  /**
+   * Musmap meta
+   */
+  require_once('musmap_meta.inc.php');
+ 
+ 
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Check database integrity');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+  <style type="text/css">
+    .result-table {
+      border:1px solid black;
+      background-color: #AAAAFF;
+    }
+    
+    .result-table tr td {
+      border:1px solid black;
+    }
+    
+    h1 {
+      font-size:12pt;
+      margin: 0px;
+      padding: 0px;
+    }
+    
+    .confirmation {
+      margin-left:10pt;
+    }
+  </style>
+</head>
+<body>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<p>
+  <a href="check_integrity.php"><?php echo html_l10n('Reload');?></a>
+</p>
+<?php
+?>
+<form method="POST" action="check_integrity.php">
+<?php
+  $query_no=0;
+  foreach($relations AS $table_name=>$relation_of_table) {
+    foreach($relation_of_table AS $relation) {
+      if(empty($relation[2])) {
+        $relation[2]=$relation[0];
+      }
+      if(empty($relation[3])) {
+        $relation[3]=Array();
+      }
+      if(!isset($relation[4])) {
+        $relation[4]= true;
+      }
+      $q="SELECT ".
+          //$db->QuoteIdentifier($table_name).".* \n".//SQLite <2.8.15 bug
+          $table_name.".* \n".
+          "FROM ".$db->QuoteIdentifier($table_name). " \n".
+          "LEFT JOIN ".$db->QuoteIdentifier($relation[1]). " ".
+            "ON ".$db->QuoteIdentifier($table_name).".".$db->QuoteIdentifier($relation[0]). 
+              "=".$db->QuoteIdentifier($relation[1]).".".$db->QuoteIdentifier($relation[2])." \n".
+          "WHERE ".$db->QuoteIdentifier($relation[1]).".".$db->QuoteIdentifier($relation[2])." ".
+          "IS NULL \n".
+          "ORDER BY ".$db->QuoteIdentifier($table_name).".".$db->QuoteIdentifier($relation[0]).";";
+      echo "<h1>$table_name.$relation[0] =&gt; $relation[1].$relation[2]</h1>\n";
+      $query_r=$db->query($q);
+      $row_no=0;
+      echo '  <table class="result-table">'."\n";
+      $delete_sql='0=1';
+      $last_value='';
+      while($row=$db->FetchAssoc($query_r)) {
+        if(!array_key_exists($relation[0], $row)) {//SQLite fix
+          $row[$relation[0]]= $row[$table_name.'.'.$relation[0]];
+        }
+        if(!in_array($row[$relation[0]],$relation[3]) && $relation[4]) {
+          if($row_no==0) {
+            echo "    <tr>\n";
+            foreach($row AS $item=>$value) {
+              echo "      <th>$item</th>\n";
+            }
+            echo "    </tr>\n";
+          }
+          echo "    <tr>";
+          if($last_value!=$row[$relation[0]]) {
+            $delete_sql.=" OR ".$db->QuoteIdentifier($relation[0]).
+                "=".$db->Quote($row[$relation[0]])."\n";
+            $last_value=$row[$relation[0]];
+          }
+          foreach($row AS $item=>$value) {
+            echo "      <td>".htmlentities($value)."</td>\n";
+          }
+          echo "    </tr>\n";
+        }
+        $row_no++;
+      }
+      echo "  </table>\n";
+      $db->FreeResult($query_r);
+      if($delete_sql!='0=1') {
+        $delete_sql="DELETE FROM ".$db->QuoteIdentifier($table_name)." \n".
+          "WHERE ".$delete_sql;
+        echo '  <div class="confirmation"><input type="checkbox" name="query_'.$query_no.'" checked>'.($query_no+1).":";
+        echo '  '.$delete_sql.'</div>'."\n";
+        if(isset($_POST["query_$query_no"])) {
+          $db->StartTransaction();
+          $db->Query($delete_sql);
+          $db->commit();
+          echo '[DONE]';
+        }
+      } else {
+        echo html_l10n('OK');
+      }
+      $query_no++;
+    }
+  }
+?>
+<p>
+<input type="submit">
+</p>
+<hr>
+<?php
+  foreach($primary_keys AS $table_name=>$pkey_infos) {
+    if(empty($pkey_infos[0]) || count($pkey_infos[0])>1) {
+      continue;
+    }
+    $max_q=$db->query('SELECT '.
+      'MAX('.($db->QuoteIdentifier($pkey_infos[0])).') '.
+      'FROM '.($db->QuoteIdentifier($table_name)).' ');
+    $max_r=$db->FetchNum($max_q);
+    if($max_r) {
+      if($max_r[0]>0) {
+        $db->set_next_insert_row_id($table_name,$pkey_infos[0],$max_r[0]+1);
+        echo 'nextval('.$table_name.'.'.$pkey_infos[0].')='.($max_r[0]+1).'<br>';
+      }
+    }
+    $db->FreeResult($max_q);
+  }
+?>
+</form>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/clean_dir.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/clean_dir.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/clean_dir.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,55 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Nettoyage du dossier temporaire
+   * @package admin
+   */
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Clean temp dir');?></title>
+</head>
+<body>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<?php
+LibMisc::DeleteTemporaryFiles(true);
+?>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/admin/create_tables.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/create_tables.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/create_tables.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,206 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Création des tables
+   * @package admin
+   */
+
+  /**
+   * Used in include\conf.inc.php
+   */
+  define('MUSMAP_FILE_CREATE_TABLES', 1);
+  
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Create database structure');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+</head>
+<body>
+<?php
+//Debugging flags
+// If you want to execute only some steps
+// Default: all true
+define('DO_CREATE_TABLES', true);
+define('DO_CREATE_TABLES_SPECIFIC', true);
+define('DO_CREATE_SYMBOLS', true);
+
+
+if(!isset($_GET['go'])) {
+  echo '<form action="create_tables.php">'."\n";
+  echo '  '.html_l10n('Do you want to create the musmap tables?')."<br>\n";
+  echo '  <input type="submit" name="go" value="'.html_l10n('Yes').'">'."\n";
+  echo '</form>'."\n";
+} else {
+  $db->StartTransaction();
+  $bRolledBack= false;
+  if(DO_CREATE_TABLES) {
+    $sql_query=file_get_contents('../include/sql/create_tables.sql');
+    foreach ( explode(";", "$sql_query") as $sql_line) {
+      if(trim($sql_line)!='')
+        if(!$db->Query($sql_line)) {
+          Warning(
+            sprintf(l10n('Unable to execute query "%s".'), $sql_line)."\n".
+            l10n('Database error: rolling back.'));
+          $db->rollback();
+          $bRolledBack= true;
+          break;
+        }
+    }
+  }
+  if(DO_CREATE_TABLES_SPECIFIC && !$bRolledBack) {
+    $sql_query=file_get_contents(
+      '../include/sql/create_tables.'.Conf::get('db_engine').'.sql');
+    foreach ( explode(";;", "$sql_query") as $sql_line) {
+      if(trim($sql_line)!='') {
+        if(!$db->Query($sql_line)) {
+          Warning(
+            sprintf(l10n('Unable to execute query "%s".'), $sql_line)."\n".
+            l10n('Database error: rolling back.'));
+          $db->rollback();
+          $bRolledBack= true;
+          break;
+        }
+      }
+    }
+  }
+  if(!$bRolledBack) {
+    $db->commit();
+    Information(l10n('Database is now installed.'));
+    if(DO_CREATE_SYMBOLS) {
+      // Creating symbols:
+      $oSymbols= & LibComponent::Load('symbols');
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"circle",
+          "symbol_type"=>"E",
+          "symbol_filled"=>"1",
+          "symbol_points"=>"1 1",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"cross",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"0",
+          "symbol_points"=>"2 0 2 4 -99 -99 0 2 4 2",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"star",
+          "symbol_type"=>"T",
+          "symbol_filled"=>"0",
+          "symbol_font"=>"arial",
+          "symbol_points"=>"",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"triangle",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"1",
+          "symbol_points"=>"0 4 2 0 4 4 0 4",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"diagonal_1",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"0",
+          "symbol_points"=>"0 1 1 0",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"diagonal_2",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"0",
+          "symbol_points"=>"0 0 1 1",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"hachures_vert",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"0",
+          "symbol_points"=>"1 0 1 2",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"hachures_hor",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"0",
+          "symbol_points"=>"0 1 2 1",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"quadrillage_diag",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"0",
+          "symbol_points"=>"0 2 2 0 -99 -99 0 0 2 2",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"quadrillage_ortho",
+          "symbol_type"=>"V",
+          "symbol_filled"=>"0",
+          "symbol_points"=>"2 0 2 4 -99 -99 0 2 4 2",
+          "symbol_style"=>""));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"pointille_10_10",
+          "symbol_type"=>"E",
+          "symbol_filled"=>"1",
+          "symbol_points"=>"1 1",
+          "symbol_style"=>"10 10"));
+      $oSymbols->add_child('symbol',
+        Array("symbol_family"=>"symbol",
+          "symbol_name"=>"pointille_20_10_10_10",
+          "symbol_type"=>"E",
+          "symbol_filled"=>"1",
+          "symbol_points"=>"1 1",
+          "symbol_style"=>"20 10 10 10"));
+    }
+    echo '<p>'.sprintf(html_l10n('Now that the database is installed, you can set %s.'),
+      '<a href="settings.php">'.html_l10n('Musmap settings').'</a>').'</p>';
+  } else {
+    Information(l10n('Some errors occured when creating musmap tables.'),
+      l10n('Error'),
+      'Support',
+      'Ask for help',//no l10n
+      NULL);
+  }
+}
+?>
+<p>
+<a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/admin/data_sources_explorer.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/data_sources_explorer.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/data_sources_explorer.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,113 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Résultat des requètes
+ * @package admin
+ */
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+  require_once('../include/model/connection.class.php');
+  require_once('../include/model/projection.class.php');
+  require_once('../include/model/symbol.class.php');
+
+  $INPUT=$_REQUEST;
+  if(!isset($_GET['explore'])) {
+    $_GET['explore']='connections_list';
+  }
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Explorer');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript">
+    <!--
+      top.rootDir='..';
+    //-->
+  </script>
+  <script type="text/javascript" language="JavaScript" src="../js/contrib/xb.js"></script>
+  <script type="text/javascript" language="JavaScript" src="../js/explorer.js"></script>
+  <script type="text/javascript" language="JavaScript" src="../js/l10n.php"></script>
+  <!-- mygosuMenu -->
+    <link rel="stylesheet" type="text/css" href="../js/contrib/mygosumenu/1.5/DynamicTree.css">
+    <script type="text/javascript" src="../js/contrib/mygosumenu/ie5.js"></script>
+    <script type="text/javascript" src="../js/contrib/mygosumenu/1.5/DynamicTree.js"></script>
+    <style type="text/css">
+    #tree-plugin, #tree-plugin-button-import-html { display: none; }
+    #tree-plugin-textarea { white-space: nowrap; }
+    </style>
+  <!-- /mygosuMenu -->
+</head>
+<body onload="loadExplorer();" class="explorer">
+<h4 class="hidden"><?php echo html_l10n('Objects:');?></h4>
+<ul class="tabs">
+  <li class="tab" <?php echo $_GET['explore']=='connections_list' ? ' id="tab-selected"':'';?>>
+    <a href="data_sources_explorer.php?explore=connections_list" class="tab-anchor">
+      <?php echo htmlentities(translate('connections_list'));?></a></li>
+  <li class="tab" <?php echo $_GET['explore']=='projections_list' ? ' id="tab-selected"':'';?>>
+    <a href="data_sources_explorer.php?explore=projections_list" class="tab-anchor">
+      <?php echo html_l10n('Projections');?></a></li>
+  <li class="tab" <?php echo $_GET['explore']=='symbols_list' ? ' id="tab-selected"':'';?>>
+    <a href="data_sources_explorer.php?explore=symbols_list" class="tab-anchor">
+      <?php echo html_l10n('Symbols');?></a></li>
+</ul>
+
+<?php
+  switch($_GET['explore']) {
+  case 'projections_list':
+    $obj= & LibComponent::Load('projections');
+    break;
+  case 'symbols_list':
+    if(!isset($map)) {
+      $map = new TMap(Conf::get('blank_map_path'));
+    }
+    $obj= & LibComponent::Load('symbols');
+    $obj->Build();
+    break;
+  case 'connections_list':
+  default:
+    $_GET['explore']= 'connections_list';
+    $obj= & LibComponent::Load('connections');
+  }
+  if($obj) {
+    $obj->Explore();
+  } else {
+    add_error(l10n("Can't load."));
+  }
+?>
+<p>
+<a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/fw.test.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/fw.test.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/fw.test.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,261 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  require_once('../include/pre_admin.inc.php');
+    /*
+    function HTML() {
+      global $db;
+      $r='';
+      $v= & $this->Attribute->Value;
+      switch(strtolower($this->Type)) {
+        case 'bool': 
+          if($this->Attributes->Value('compact')) {
+            $r.= '<input type="radio" '.
+              'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="1"'.($v=='1' ? ' checked' : '').'>'.html_l10n('Y');
+            $r.= '<input type="radio" '.
+              'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="0"'.($v!='1' ? ' checked' : '').'>'.html_l10n('N');
+          } else {
+            $r.= '<input type="radio" name="'.
+              $this->Prefix.$this->Attribute->Name.$this->Suffix.'" value="1"'.
+              ($v=='1' ? ' checked' : '').'>'.html_l10n('Yes').' ';
+            $r.= '<input type="radio" name="'.
+              $this->Prefix.$this->Attribute->Name.$this->Suffix.'" value="0"'.
+              ($v!='1' ? ' checked' : '').'>'.html_l10n('No');
+          }
+          break;
+        case 'color':
+          $color_id = str_replace(Array('[',']'),Array('-','-'),
+            $this->Prefix.$this->Attribute->Name.$this->Suffix);
+          echo '<input type="text" '.
+            'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="'.$v.'" size="7" '.
+              'id="color-'.$color_id.'" maxlength="7">'.
+            '<span style="background:url(\'images/bg.gif\');">'.
+              '<span onmouseover="changeColor(document.getElementById('.
+                '\'color-'.$color_id.'\'),this);" '.
+              'id="color-span-'.$color_id.'" '.
+              'onclick="colorPicker(this,document.getElementById('.
+                '\'color-'.$color_id.'\'));" '.
+              'style="background-color: '.(empty($v) ? 'transparent' : $v).';" '.
+              'class="color-span" title="'.html_l10n('Pick a color').'">'.
+                '&nbsp;&nbsp;&nbsp;&nbsp;'.
+            '</span>'.
+          '</span>'.
+          '&nbsp;'.
+          '<a title="'.html_l10n('No color').'" href="javascript:void(0);" '.
+            'onclick="changeColor('.
+              '\'color-'.$color_id.'\','.
+              '\'color-span-'.$color_id.'\','.
+              '\'\'); return false;" '.
+            'style="color:red;">X</a>';
+          break;
+        case 'fromarray':
+          $a= $this->Attributes->Value('array');
+          switch($this->Attributes->Value('showas')) {
+            case 'label':
+              if(isset($a[$v])) {
+                $r.= $a[$v];
+              } else {
+                $r.= '<i>'.html_l10n('None').'</i>';
+              }
+              break;
+            case 'list':
+              $r.= '<input type="text" name="'.
+                $this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+                'value="'.$v.'">';
+              $r.= '  <select onchange="this.form[\''.
+                  $this->Prefix.$this->Attribute->Name.$this->Suffix.'\']'.
+                  '.value=this.value;">'."\n";
+              if($this->Attributes->Value('allownull')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              foreach($a AS $d_k=>$d_v) {
+                $r.= '    <option value="'.$d_k.'" '.
+                  (($v==$d_k) ? ' selected' : '').'>'.
+                    $d_v.'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+              break;
+            case 'combo':
+            default:
+              $r.= '  <select name="'.
+                  $this->Prefix.$this->Attribute->Name.$this->Suffix.'">'."\n";
+              if($this->Attributes->Value('allownull')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              foreach($a AS $d_k=>$d_v) {
+                $r.= '    <option value="'.$d_k.'" '.
+                  (($v==$d_k) ? ' selected' : '').'>'.
+                    $d_v.'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+          }
+          break;
+       case 'fromtable':
+          $sCodeFieldName= $this->Attributes->Value('codefield');
+          $sLabelFieldName= $this->Attributes->Value('labelfield');
+          switch($this->Attributes->Value('showas')) {
+            case 'label':
+              $oQuery= $db->Select(
+                $this->Attributes->Value('tablecatalog'),
+                $this->Attributes->Value('tableschema'),
+                $this->Attributes->Value('tablename'),
+                $this->Attributes->Value('tableparams'),
+                Array(Array(
+                  $sCodeFieldName,'=',$v,
+                    $this->Attributes->Value('fieldtype')
+                  )),
+                $this->Attributes->Value('orderby'));
+              if($aRow= $db->FetchAssoc($oQuery)) {
+                $r.= $aRow[$sLabelFieldName];
+              } else {
+                $r.= '<i>'.html_l10n('None').'</i>';
+              }
+              break;
+            case 'list':
+              $r.= 'TODO list';
+              break;
+            case 'combo':
+            default:
+              $oQuery= $db->Select(
+                $this->Attributes->Value('tablecatalog'),
+                $this->Attributes->Value('tableschema'),
+                $this->Attributes->Value('tablename'),
+                $this->Attributes->Value('tableparams'),
+                Array(),
+                $this->Attributes->Value('orderby'),
+                Array('code'=>$sCodeFieldName,'label'=>$sLabelFieldName));
+              $r.= '  <select name="'.
+                  $this->Prefix.$this->Attribute->Name.$this->Suffix.'">'."\n";
+              if($this->Attributes->Value('allownull')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              while($aRow= $db->FetchAssoc($oQuery)) {
+                $r.= '    <option value="'.$aRow['code'].'" '.
+                  (($v==$aRow['code']) ? ' selected' : '').'>'.
+                    $aRow['label'].'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+              $db->FreeResult($oQuery);
+          }
+          break;
+        case 'index':
+          echo '<input type="text" '.
+            'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+            'value="'.$v.'" size="2">';
+          $col=$this->Attributes->Value('column');
+          if($this->Attributes->Value('compact')) {
+            echo '<a href="javascript:void(0);" '.
+              'onclick="return moveRow(this.parentNode.parentNode, '.
+                '\'u\', \''.$col.'\')" class="arrow-up">'.
+              '<img alt="^" '.
+                'src="'.Conf::get('musmap_root_url').'/images/arrow_up.gif">'.
+              '</a>';
+            echo '<a href="javascript:void(0);" '.
+              'onclick="return moveRow(this.parentNode.parentNode, '.
+                '\'d\', \''.$col.'\')" class="arrow-down">'.
+              '<img alt="v" '.
+                'src="'.Conf::get('musmap_root_url').'/images/arrow_down.gif">'.
+              '</a>';
+          }
+          break;
+        case 'float':
+          //break;
+        case 'integer':
+          //break;
+        case 'text':
+          if($this->Attributes->Value('memo') 
+              && !$this->Attributes->Value('compact')) {
+            $r.='<textarea name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'cols="'.$this->Attributes->ValueWithDefault('cols',50).'" '.
+              'rows="'.$this->Attributes->ValueWithDefault('rows',3).'">'.$v.'</textarea>';
+
+          } else {
+            $r.= '<input type="text" name="'.
+              $this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="'.$v.'">';
+          }
+          break;
+        case 'time':
+        if($v) {
+          $r.= htmlentities(LibMisc::RelativeDate($v));
+        } else {
+          $r.= '<i>'.html_l10n('None').'</i>';
+        }
+          break;
+        default:
+          $r= '<font color=red>unknown type: "'.$this->Type.'".</font>';
+      }
+      return $r;
+    }
+  }
+  //*/
+  //$INPUT= $_GET;
+  //$oGroups= & LibComponent::Load('users');
+  //$oGroups->Explore();
+  //*
+  $oProfiles= & LibComponent::Load('profiles');
+  $oProfile = &$oProfiles->Items->Each();
+  $oProfileData = & $oProfile->Items->Each();
+  $oClass= & $oProfileData->Items->Each();
+  $oStyle= & $oClass->Items->Each();
+  //$oObject= &$oStyle;
+  //$oObject= &$oClass;
+  $oObject= &$oProfileData;
+  
+  
+  $oTable= &$fw->AddElement('','table');
+  $oObject->Attributes->Reset();
+  while($oAttribute= & $oObject->Attributes->Each()) {
+    $oType= & $oObject->GetFieldType($oAttribute->Name);
+    if($oType->Attributes->Value('ignore')) continue;
+    $oType->Prefix= 'test[';
+    $oType->Suffix= ']';
+    $oRow= & $oTable->AddElement('','row');
+    $oCell = & $oRow->AddElement('','cell');
+    $oCell->AddText(ucfirst(translate($oAttribute->Name)));
+    unset($oCell);
+    $oCell = & $oRow->AddElement('','cell');
+    $oCell->AddElementFromType($oType);
+    unset($oType);
+    unset($oCell);
+    unset($oRow);
+  }
+  //LibMisc::IntelligentVarDump($fw);
+  //*/
+  $fw->Render();
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/admin/index.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/index.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/index.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,139 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Admin homepage
+ * @package admin
+ */
+
+
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Admin');?></title>
+</head>
+<body>
+  <fieldset style="padding:5px;width:50%;">
+    <legend><?php echo html_l10n('Admin');?></legend>
+    <ul>
+      <li>
+        <a href="users.php">
+          <?php echo html_l10n('User accounts management');?>
+        </a>
+      </li>
+      
+      <li>
+        <a href="sessions.php">
+          <?php echo html_l10n('Sessions management');?>
+        </a>
+      </li>
+      
+      <li>
+        <?php echo html_l10n('Explorer:');?>
+        <a href="data_sources_explorer.php">
+          <?php echo htmlentities(translate('connections_list'));?></a>,
+        <a href="data_sources_explorer.php?explore=projections_list">
+          <?php echo htmlentities(translate('projections_list'));?></a>,
+        <a href="data_sources_explorer.php?explore=symbols_list">
+          <?php echo htmlentities(translate('symbols_list'));?></a>
+      </li>
+      
+      <li>
+        <a href="settings.php">
+          <?php echo html_l10n('Musmap settings');?>
+        </a>
+      </li>
+
+    </ul>
+  </fieldset>
+
+  <fieldset style="padding:5px;width:50%;">
+    <legend><?php echo html_l10n('Informations');?></legend>
+    <ul>
+      <li>
+        <a href="../about.php">
+          <?php echo html_l10n('Environement informations');?>
+        </a>
+      </li>
+      <li>
+        <a href="info.php">
+          <?php echo html_l10n('PHP informations');?>
+        </a>
+      </li>
+      <li>
+        <a href="localization.php">
+          <?php echo html_l10n('Localized strings');?>
+        </a>
+      </li>
+      <li>
+        <a href="build_dependency_tree.php">
+          <?php echo html_l10n('Show dependencies tree');?>
+        </a>
+      </li>
+    </ul>
+  </fieldset>
+
+  <fieldset style="padding:5px;width:50%;">
+    <legend><?php echo html_l10n('Tools');?></legend>
+
+    <ul>
+      <li><a href="build_spatial_indexes.php">
+        <?php echo html_l10n('Build spatial indexes');?>
+      </a></li>
+      <li>
+        <a href="clean_dir.php">
+          <?php echo html_l10n('Clean temp dir');?>
+        </a>
+      </li>
+      
+      <li>
+        <a href="check_integrity.php">
+          <?php echo html_l10n('Check database integrity');?>
+        </a>
+      </li>
+      
+      <li>
+        <a href="logs.php">
+          <?php echo html_l10n('Logs');?>
+        </a>
+      </li>
+    </ul>
+  </fieldset>
+  <?php
+  if(isset($user)) {//remote administration
+    $user->print_logout_button();
+  }
+  ?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/info.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/info.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/info.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,113 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Infos PHP
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package admin
+ * @subpackage development
+ * @since 2004-06
+ */
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+?>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+
+<?php
+phpinfo();
+?>
+<hr>
+<div class="center">
+<h1>Globals:</h1>
+<table>
+<?php
+  foreach($GLOBALS AS $var=>$value) {
+    if($var=='GLOBALS') {
+      continue;
+    }
+    echo "<tr><td class=e>$var</td><td class=v><pre>";
+    if($var==='db') {
+      echo '<i>Hidden</i>';
+    } else {
+      print_r($value);
+    }
+    echo "</pre></td></tr>\n";
+    unset($var, $value);
+  }
+?>
+</table>
+<hr>
+<h1>Constants:</h1>
+<table>
+<?php
+  $constants=get_defined_constants();
+  $i=0;
+  foreach($constants AS $var=>$value) {
+    if(($i % 3) == 0) {
+      echo '<tr>';
+    }
+    echo "<td class=e>$var</td><td class=v><pre>";
+    print_r($value);
+    echo "</pre></td>\n";
+    if(($i % 3) == 2) {
+      echo '</tr>';
+    }
+    $i++;
+  }
+  if(($i % 3)!==0) {
+    while(($i % 3) !==0) {
+      echo "<td class=e></td><td class=v></td>";
+      $i++;
+    }
+    echo '</tr>';
+  }
+?>
+</table>
+<hr>
+<h1>Extensions:</h1>
+<table>
+<?php
+  $loaded_extensions= get_loaded_extensions();
+  foreach($loaded_extensions AS $loaded_extension_name) {
+    echo "<tr><td class=e>$loaded_extension_name</td><td class=v>";
+    echo implode(', ', get_extension_funcs($loaded_extension_name));
+    echo "</td></tr>\n";
+  }
+?>
+</table>
+</div>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>

Added: packages/musmap/branches/upstream/current/admin/localization.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/localization.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/localization.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,238 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Taille des lignes
+   *
+   * Pour avoir du code lisible sur les éditeurs
+   * sans retour à la ligne automatique
+   * @package admin
+   * @subpackage development
+   */
+   
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+  
+$root_dir='..';
+global $l10n_references;
+$l10n_references=Array();
+global $untranslated_count;
+$untranslated_count=0;
+
+function l10n_strings($root_dir,$ext='.php',$relative_path='/') {
+  global $l10n,$l10n_references,$untranslated_count;
+  $d = dir($root_dir);
+  while (false !== ($entry = $d->read())) {
+    if($entry=='.' || $entry =='..') {
+      continue;
+    }
+    if(is_dir("$root_dir/$entry")) {
+      l10n_strings("$root_dir/$entry",$ext,"$relative_path$entry/");
+    } else {
+      if(substr($entry,-strlen($ext),strlen($ext))==
+          $ext) {
+        $anchor=str_replace('/','-',"$relative_path$entry");
+        $lines = file("$root_dir/$entry");
+        $j=0;
+        foreach($lines AS $line_no=>$line) {
+          $line_no++;// 0 => 1, ...
+          preg_match_all('/(html_l10n|l10n)\s*\\(\s*((["\']?)(.*?)\\3)\s*\\)/i',$line,$matches);
+          for ($i=0;$i<count($matches[4]);$i++) {
+            if(!empty($matches[3][$i])) {
+              $l10n_references[stripslashes($matches[4][$i])][] =
+                "$relative_path$entry ($line_no)";
+            }
+            echo "<tr>";
+            echo "<td>";
+            echo '<span style="';
+            echo ($matches[1][$i]=='html_l10n') 
+              ? 'background-color:blue' 
+              : 'background-color:gray';
+            echo '">&nbsp;';
+            echo '</span> ';
+            if($j==0)
+              echo "<a href=\"#$anchor\" name=\"$anchor\">";
+            echo  "$relative_path$entry";
+            if($j==0)
+              echo "</a>";
+            echo " ($line_no) ";
+            echo "</td>";
+            echo "<td>";
+            echo htmlspecialchars(stripslashes($matches[4][$i]));
+            echo "</td>";
+            echo "<td>";
+            if(isset($l10n[stripslashes($matches[4][$i])])) {
+              echo html_l10n(stripslashes($matches[4][$i]));
+            } else {
+              $untranslated_count++;
+              echo '<a href="#untranslated-'.($untranslated_count+1).'" '.
+                'name="untranslated-'.($untranslated_count).'">';
+              if(!empty($matches[3][$i])) {
+                echo '<span style="color:red; border:solid 1px red;padding:2px;">'.
+                  '$l10n['.htmlspecialchars($matches[2][$i]).']='.
+                        ''.htmlspecialchars($matches[2][$i]).';'.
+                  '</span>';
+              } else {
+                echo '<span style="color:green;">'.
+                  htmlspecialchars($matches[2][$i]).
+                  '</span>';
+              }
+              echo '</a>';
+            }
+            echo "</td>";
+            echo "</tr>\n";
+            $j++;
+          }
+        }
+      }
+    }
+  }
+  $d->close();
+}
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+<head>
+<title><?php echo html_l10n('Localized strings');?></title>
+<style type="text/css">
+  .locales tr td {
+    border : solid blue 1px;
+  }
+</style>
+</head>
+<body>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<ul>
+  <li><a href="#files">For each file</a>
+    (<a href="#untranslated-1">First untranslated</a>)
+  <li><a href="#model-code">L10n PHP Code for Musmap Model</a>
+  <li><a href="#code">L10n PHP Code</a>
+</ul>
+<h1 id="files">For each file</h1>
+<table style="border:1px outset blue;border-spacing:0px; border-collapse:collapse;" class="locales">
+<?php
+l10n_strings($root_dir);
+?>
+</table>
+<h1 id="model-code">PHP Code for Musmap Model</h1>
+<p>
+<?php
+  $oInformationSchema= $db->GetInformationSchema(NULL,$db->db_params['dbname']);
+  $output='';
+  if(is_array($oInformationSchema)) {
+    foreach($oInformationSchema AS $aSchema) {
+      foreach($aSchema['TABLES'] AS $aTable) {
+        $sTableObjectName= LibComponent::Singular($aTable['TABLE_NAME']);
+        if(!isset($model_l10n[$sTableObjectName])) {
+          $output.='/* UNTRANSLATED: '."\n";
+        }
+        $output.='$model_l10n["'.$sTableObjectName.'"]="'.translate($sTableObjectName).'";'."\n";
+        $output.='$model_l10n["a_'.$sTableObjectName.'"]="'.translate('a_'.$sTableObjectName).'";'."\n";
+        if(!isset($model_l10n[$sTableObjectName])) {
+          $output.='//*/'."\n";
+        }
+        foreach($aTable['COLUMNS'] AS $aColumn) {
+          if((substr($aColumn['COLUMN_NAME'],0,3)==='id_')
+              && (substr($aColumn['COLUMN_NAME'],3)!==$sTableObjectName)) {
+            continue;
+          }
+          if(!isset($model_l10n[$aColumn['COLUMN_NAME']])) {
+            $output.='/* UNTRANSLATED: '."\n";
+          }
+          $output.='$model_l10n["'.$aColumn['COLUMN_NAME'].'"]="'.translate($aColumn['COLUMN_NAME']).'";'."\n";
+          if(!isset($model_l10n[$aColumn['COLUMN_NAME']])) {
+            $output.='//*/'."\n";
+          }
+        }
+        $output.="\n";
+      }
+    }
+    $output.="// Virtual tables\n";
+    $aTables= Array(
+      'connections_list',
+      'extents_list',
+      'map_references_list',
+      'profiles_list',
+      'projections_list',
+      'query_forms_list',
+      'query_results_list',
+      'symbols_list'
+      );
+    foreach($aTables as $sTableObjectName) {
+      if(!isset($model_l10n[$sTableObjectName])) {
+        $output.='/* UNTRANSLATED: '."\n";
+      }
+      $output.='$model_l10n["'.$sTableObjectName.'"]="'.translate($sTableObjectName).'";'."\n";
+      if(!isset($model_l10n[$sTableObjectName])) {
+        $output.='//*/'."\n";
+      }
+    }
+    highlight_string("<?php\n$output?>");
+  } else {
+    echo html_l10n('Unable to get InformationSchema for Musmap database.');
+  }
+?>
+</p>
+<h1 id="code">L10n PHP Code</h1>
+<p>
+<?php
+$output='';
+foreach($l10n AS $str_en=>$str_lang) {
+  if(!isset($l10n_references[$str_en])) {
+    $output.='$l10n["'.str_replace('"','\\"',$str_en).'"]="'.str_replace('"','\\"',l10n($str_en)).'";'."\n";
+  }
+}
+ksort($l10n_references,SORT_STRING);
+foreach($l10n_references AS $str => $files) {
+  if(!isset($l10n[$str]) && Conf::get('client_lang')=='en') {
+    continue;
+  }
+  if(!isset($l10n[$str])) {
+    $output.='/* UNTRANSLATED: '."\n";
+  }
+  $output.='$l10n["'.str_replace('"','\\"',$str).'"] ='."\n".
+           '      "'.str_replace('"','\\"',l10n($str)).'";'."\n";
+  if(!isset($l10n[$str])) {
+    $output.='//*/'."\n";
+  }
+  foreach($files AS $file) {
+    $output.="    // $file\n";
+  }
+}
+highlight_string("<?php\n$output?>");
+?>
+</p>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/logs.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/logs.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/logs.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,99 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Chacking db integrity
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package admin
+ * @since 2004-09
+ */
+ 
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+ 
+ 
+ 
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Logs');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+  <style>
+    .log-table {
+      border:1px solid black;
+      background-color: #AAAAFF;
+    }
+    
+    .log-table tr {
+      vertical-align:top;
+    }
+    .log-table tr td {
+      border:1px solid black;
+    }
+    
+    h1 {
+      font-size:1.5em;
+    }
+    
+    .confirmation {
+      margin-left:10pt;
+    }
+    
+    pre {
+      font-size:0.8em;
+      font-family:monospace;
+    }
+  </style>
+</head>
+<body>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<p>
+  <a href="logs.php"><?php echo html_l10n('Reload');?></a>
+</p>
+<p>
+  <a href="logs.php?truncate=1"><?php echo html_l10n('Clear log');?></a>
+</p>
+<?php
+  if(isset($_GET['truncate'])) {
+    $log->clear();
+  }
+  $log->show();
+?>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/admin/model.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/model.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/model.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,130 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 2005-05                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Chacking db integrity
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-05, Mathieu PARENT
+ * @package admin
+ * @subpackage development
+ * @since 2005-05
+ */
+ 
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+ 
+  /**
+   * Musmap meta
+   */
+  require_once('musmap_meta.inc.php');
+ 
+ 
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Musmap database model');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+  <style type="text/css">
+    .musmap-table {
+      background-color:rgb(255,255,190);
+      border: solid black;
+      border-top-width: 1px;
+      border-left-width: 1px;
+      border-right-width: 2px;
+      border-bottom-width: 2px;
+      margin:1px;
+    }
+    .musmap-table-title {
+      background-color:rgb(255,255,230);
+      border: solid black;
+      border-top-width: 1px;
+      border-left-width: 1px;
+      border-right-width: 2px;
+      border-bottom-width: 2px;
+      font-weight: bold;
+    }
+    .primary-key {
+      text-decoration:underline;
+    }
+  </style>
+</head>
+<body>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<?php
+  
+  $oInformationSchema= $db->GetInformationSchema(NULL,$db->db_params['dbname']);
+  $aSchema= array_pop($oInformationSchema);
+  //FK statistics
+  foreach($aSchema['TABLES'] AS $iTable=>$aTable) {
+    if(isset($relations[$aSchema['TABLES'][$iTable]['TABLE_NAME']])) {
+      foreach($relations[$aSchema['TABLES'][$iTable]['TABLE_NAME']] AS $relation) {
+        if(empty($relation[2])) $relation[2]= $relation[0];
+        if(empty($relation[3])) $relation[3]=Array();
+        if(!isset($relation[4])) $relation[4]= true;
+        foreach($aSchema['TABLES'][$iTable]['COLUMNS'] AS $iColumn=>$aColumn) {
+          if($aColumn['COLUMN_NAME']==$relation[0]) {
+            $aSchema['TABLES'][$iTable]['COLUMNS'][$iColumn]['MUSMAP_FOREIGN_KEY']= $relation[1].'.'.$relation[2];
+          }
+        }
+      }
+    }
+  }
+  
+  //Output
+  foreach($aSchema['TABLES'] AS $iTable=>$aTable) {
+    echo '<table class="musmap-table" id="'.$aSchema['TABLES'][$iTable]['TABLE_NAME'].'">'."\n";
+    echo '  <tr class="musmap-table-title">';
+    echo '<td colspan=2>';
+    echo $aSchema['TABLES'][$iTable]['TABLE_NAME'];
+    echo '</td>';
+    echo '</tr>'."\n";
+    foreach($aSchema['TABLES'][$iTable]['COLUMNS'] AS $aColumn) {
+      echo '  <tr class="musmap-column" id="'.$aSchema['TABLES'][$iTable]['TABLE_NAME'].'.'.$aColumn['COLUMN_NAME'].'">';
+      echo '<td class="'.(in_array($aColumn['COLUMN_NAME'],$primary_keys[$aSchema['TABLES'][$iTable]['TABLE_NAME']]) ? 'primary-key':'').'">';
+      echo $aColumn['COLUMN_NAME'];
+      echo '</td>';
+      echo '<td>';
+      if(isset($aColumn['MUSMAP_FOREIGN_KEY'])) {
+        echo '<a href="#'.$aColumn['MUSMAP_FOREIGN_KEY'].'" title="'.$aColumn['MUSMAP_FOREIGN_KEY'].'">'.
+          '&gt;</a>';
+      }
+      echo '</td>';
+      echo '</tr>'."\n";
+    }
+    echo '</table>'."\n";
+  }
+?>
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/admin/sessions.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/sessions.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/sessions.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,125 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Sessions management
+ * @package admin
+ */
+
+
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Sessions management');?></title>
+</head>
+<body>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<?php
+if(isset($_POST['session']) && isset($_POST['session']['session_id'])) {
+  $db->StartTransaction();
+  foreach($_POST['session']['session_id'] AS $session_id=>$checked) {
+    if($checked == 'on') {
+      printf(
+        l10n('Deleting %s (%s)'),
+        $session_id,
+        translate('session'));
+      $db->query('DELETE FROM sessions '.
+        'WHERE session_id='.$db->Quote($session_id,'N'));
+      echo "<br>\n";
+    }
+  }
+  $db->commit();
+}
+$sessions_q = $db->query(
+  'SELECT '.
+    'users.user_name AS user_name, '.
+    'sessions.session_id AS session_id, '.
+    'sessions.session_creation_time AS session_creation_time, '.
+    'sessions.session_modification_time AS session_modification_time, '.
+    'profiles.profile_name AS profile_name '.
+  'FROM sessions '.
+    'LEFT JOIN users '.
+      'ON sessions.id_user=users.id_user '.
+    'LEFT JOIN profiles '.
+      'ON sessions.id_profile=profiles.id_profile '.
+  'ORDER BY session_modification_time DESC, user_name;');
+  if(!$sessions_q) {
+    
+  } else {
+    echo '<form action="sessions.php" method="GET">'."\n";
+    echo '<input type="submit" value="'.html_l10n('Refresh').'">'."\n";
+    echo '</form>'."\n";
+    echo '<form action="sessions.php" method="POST">'."\n";
+    echo '<input type="submit" value="'.html_l10n('Delete selected sessions').'">'."\n";
+    echo '<table border=1>'."\n";
+    echo '<tr>';
+    echo '<th>'.
+      '&nbsp;'.
+      '</th>';
+    echo '<th>'.htmlentities(ucfirst(translate('user_name'))).'</th>';
+    echo '<th>'.htmlentities(ucfirst(translate('session_creation_time'))).'</th>';
+    echo '<th>'.htmlentities(ucfirst(translate('session_modification_time'))).'</th>';
+    echo '<th>'.htmlentities(ucfirst(translate('profile_name'))).'</th>';
+    echo '</tr>'."\n";
+    $t = time();
+    while($row = $db->FetchAssoc($sessions_q)) {
+      echo '<tr>';
+      echo '<td>'.
+        '<input type="checkbox" name="session[session_id]['.$row['session_id'].']" '.
+        (($t - $row['session_modification_time'] > 3600) ? ' checked' : '').'>'.
+        '</td>';
+      echo '<td>'.htmlentities($row['user_name']).'</td>';
+      echo '<td>'.
+        htmlentities(LibMisc::RelativeDate($row['session_creation_time'])).
+        '</td>';
+      echo '<td>'.
+        htmlentities(LibMisc::RelativeDate($row['session_modification_time'])).
+        '</td>';
+      echo '<td>'.
+        htmlentities($row['profile_name']).
+        '</td>';
+      echo '</tr>'."\n";
+    }
+    echo '</table>'."\n";
+    echo '</form>'."\n";
+    $db->FreeResult($sessions_q);
+  }
+?>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/settings.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/settings.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/settings.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,406 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Changement de la configuration
+ *
+ * Attention : utiliser / plutôt que \\, même sous windows
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package admin
+ * @since 2004-06
+ */
+ 
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+
+ if(isset($_POST['change'])) {
+  $setting_to_change=key($_POST['change']);
+  $new_value=isset($_POST[$setting_to_change]) ? $_POST[$setting_to_change] : '';
+  if(!$conf_array[$setting_to_change]['read_only']) {
+    $db->StartTransaction();
+    $db->Query("DELETE FROM tool_settings ".
+      'WHERE setting_code='.$db->Quote($setting_to_change));
+    switch($conf_array[$setting_to_change]['type']) {
+      case 'debug_level' :
+        $debug=0;
+        foreach($new_value AS $v) {
+          $debug+=$v;
+        }
+        $db->Query("INSERT INTO tool_settings ".
+          '(setting_code,setting_value) '.
+          'VALUES('.$db->Quote($setting_to_change).', '.$db->Quote($debug).')');
+        break;
+      case 'string[s]':
+        if(empty($new_value)) {
+          $new_value=Array();
+        }
+        $new_value_array=Array();
+        foreach($new_value AS $kv) {
+          $new_value_array[$kv['k']]=$kv['v'];
+        }
+        $db->query("INSERT INTO tool_settings ".
+          '(setting_code,setting_value) '.
+          'VALUES('.$db->Quote($setting_to_change).', '.$db->Quote(serialize($new_value_array)).')');
+        break;
+      case 'string[i]':
+        if(empty($new_value)) {
+          $new_value=Array();
+        }
+        $new_value_array=Array();
+        foreach($new_value AS $kv) {
+          $new_value_array[]=$kv['v'];
+        }
+        $db->query("INSERT INTO tool_settings ".
+          '(setting_code,setting_value) '.
+          'VALUES('.$db->Quote($setting_to_change).', '.$db->Quote(serialize($new_value_array)).')');
+        break;
+      case 'dir' :
+        if(substr($new_value,-1)!=='/' && substr($new_value,-1)!=='\\') {
+          $new_value.='/';
+        }
+      case 'file' :
+        $new_value=str_replace('\\','/',$new_value);
+      default :
+        $db->query("INSERT INTO tool_settings ".
+          '(setting_code,setting_value) '.
+          'VALUES('.$db->Quote($setting_to_change).', '.$db->Quote($new_value).')');
+        break;
+    }
+    $db->Commit();
+    Conf::Override();
+  }
+ }
+ if(isset($_POST['to_default'])) {
+  $setting_to_delete=key($_POST['to_default']);
+  $db->Query("DELETE FROM tool_settings ".
+    'WHERE setting_code='.$db->Quote($setting_to_delete).'');
+  $conf_array[$setting_to_delete]['changed']=0;
+  Conf::SetToDefault($setting_to_delete);
+ }
+ 
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Musmap settings');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript">
+  <!--
+  var n=0;
+  function add_row(obj,settingName) {
+    n--;
+    var par=obj.parentNode.parentNode.parentNode;
+    var tr=document.createElement('tr');
+    //
+    var td1=document.createElement('td');
+    tr.appendChild(td1);
+    var i1=document.createElement('input');
+    i1.name=settingName+"["+n+"][k]";
+    td1.appendChild(i1);
+    //
+    var td2=document.createElement('td');
+    tr.appendChild(td2);
+    var i2=document.createElement('input');
+    i2.name=settingName+"["+n+"][v]";
+    td2.appendChild(i2);
+    //
+    var td3=document.createElement('td');
+    tr.appendChild(td3);
+    var i3=document.createElement('input');
+    i3.type="button";
+    //i3.setAttribute('onclick',"remove_row(this);");
+    //i3.setAttribute('onclick',remove_row);
+    i3.onclick=remove_row;
+    i3.value="-";
+    td3.appendChild(i3);
+    par.insertBefore(tr,obj.parentNode.parentNode);
+  }
+  
+  function add_row_i(obj,settingName) {
+    n--;
+    var par=obj.parentNode.parentNode.parentNode;
+    var tr=document.createElement('tr');
+    //
+    var td1=document.createElement('td');
+    tr.appendChild(td1);
+    //
+    var td2=document.createElement('td');
+    tr.appendChild(td2);
+    var i2=document.createElement('input');
+    i2.name=settingName+"["+n+"][v]";
+    td2.appendChild(i2);
+    //
+    var td3=document.createElement('td');
+    tr.appendChild(td3);
+    var i3=document.createElement('input');
+    i3.type="button";
+    //i3.setAttribute('onclick',"remove_row(this);");
+    //i3.setAttribute('onclick',remove_row);
+    i3.onclick=remove_row;
+    i3.value="-";
+    td3.appendChild(i3);
+    par.insertBefore(tr,obj.parentNode.parentNode);
+  }
+
+  function remove_row(e,obj) {
+    if(!obj) {
+      if (!e) e = window.event;
+      if (e.target) obj = e.target;
+      else if (e.srcElement) obj = e.srcElement;
+      if (obj.nodeType == 3) // defeat Safari bug
+        obj = targ.parentNode; 
+    }
+    var par=obj.parentNode.parentNode;
+    par.parentNode.removeChild(par)
+  }
+  -->
+  </script>
+  <style type="text/css">
+  <!--
+    .part {
+      background-color:#DDDDFF;
+    }
+    .button {
+      text-align:right;
+    }
+    body {
+      background-color:#CCCCFF;
+    }
+  -->
+  </style>
+</head>
+<body>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<h1><?php echo html_l10n('Musmap settings');?></h1>
+<form method="POST" action="settings.php">
+<table>
+<?php
+  foreach($conf_array AS $setting_code=>$setting_infos){
+    $setting_infos['read_only']= isset($setting_infos['read_only']) ? $setting_infos['read_only'] : false;
+    //l10n('Unknown setting')
+    $setting_infos['label']= isset($setting_infos['label']) ? $setting_infos['label'] : 'Unknown setting';
+    $setting_infos['type']= isset($setting_infos['type']) ? $setting_infos['type'] : NULL;
+    if(isset($setting_infos['hidden']) && $setting_infos['hidden'])
+      continue;
+?>
+<tr class="part">
+<td>
+<?php $fw->ContextualHelpButton('Category','Settings',$setting_code);
+?>&nbsp;<b><?php echo html_l10n($setting_infos['label']);?></b>
+
+<?php
+  if($setting_infos['read_only']) {
+?>
+<span style="color:red;"><?php echo html_l10n('Read only');?></span>
+<?php
+  }
+?><br>
+<span style="font-size:80%;"><?php echo $setting_code;?></span>
+</td>
+<td>
+<?php
+switch($setting_infos['type']) {
+  case 'lang' :
+    $d=dir(Conf::get("musmap_root_dir").'/data/lang');
+    $langs=Array('en'=>Array('English'));
+    while(false !== ($entry=$d->read())) {
+      if($entry=='.' || $entry=='..' || $entry=='CVS') {
+        continue;
+      }
+      $langs[$entry]=Array($entry);
+    }
+    ?>
+    <select name="<?php echo $setting_code;?>">
+    <?php
+    foreach($langs AS $code=>$infos) {
+    ?>
+    <option value="<?php echo $code;?>"<?php
+      echo $code == Conf::get($setting_code) ? ' selected' : '';?>><?php echo $code;?>
+      
+    <?php
+    }
+    ?>
+    </select>
+    <?php
+    break;
+  case 'debug_level' :
+    $errors=Array(
+      E_MUSMAP_INFORMATION=>'E_MUSMAP_INFORMATION',
+      E_MUSMAP_WARNING=>'E_MUSMAP_WARNING',
+      E_MUSMAP_ERROR=>'E_MUSMAP_ERROR',
+      E_MUSMAP_DEBUG=>'E_MUSMAP_DEBUG',
+      E_MUSMAP_PERFORMANCE=>'E_MUSMAP_PERFORMANCE',
+      E_MUSMAP_SQL_LOG=>'E_MUSMAP_SQL_LOG',
+      //
+      0=>'-',
+      E_ERROR=>'E_ERROR',
+      E_WARNING=>'E_WARNING',
+      E_PARSE=>'E_PARSE',
+      E_NOTICE=>'E_NOTICE',
+      16=>'E_CORE_ERROR',
+      32=>'E_CORE_WARNING',
+      64=>'E_COMPILE_ERROR',
+      128=>'E_COMPILE_WARNING',
+      2048=>'E_STRICT'
+    );
+    ?>
+    <select multiple name="<?php echo $setting_code;?>[]" size=8>
+    <?php
+    foreach($errors AS $n=>$s) {
+    ?>
+    <option value="<?php echo $n;?>"<?php
+      echo $n == 0 ? ' disabled' : '';?><?php
+      echo ($n & Conf::get($setting_code)) ? ' selected' : '';?>><?php echo $s;?>
+      
+    <?php
+    }
+    ?>
+    </select>
+    <?php
+    break;
+  case 'string[s]':
+?>
+<table>
+<?php
+  $i=0;
+  foreach(Conf::get($setting_code) AS $k=>$v) {
+    ?>
+    <tr>
+      <td><input name="<?php echo $setting_code."[$i][k]";?>" value="<?php echo $k;?>"></td>
+      <td><?php if($k!='password') {
+        ?><input name="<?php echo $setting_code."[$i][v]";?>" value="<?php echo $v;?>"><?php
+        } else {
+        ?><input name="<?php echo $setting_code."[$i][v]";?>" value="password hidden" type="password"><?php
+        }
+        ?></td>
+      <td><input type="button"  value="-" onclick="remove_row(0,this);"></td>
+      </tr>
+    <?php
+    $i++;
+  }
+    ?>
+    <tr>
+      <td>&nbsp;</td>
+      <td>&nbsp;</td>
+      <td><input type="button" onclick="add_row(this,'<?php echo $setting_code;?>');" value="+"></td>
+      </tr>
+    <?php
+?>
+</table>
+<?php
+  break;
+  case 'string[i]':
+?>
+<table>
+<?php
+  $i=0;
+  foreach(Conf::get($setting_code) AS $k=>$v) {
+    ?>
+    <tr>
+      <td>&nbsp;</td>
+      <td><input name="<?php echo "$setting_code"."[$i][v]";?>" value="<?php echo $v;?>"></td>
+      <td><input type="button"  value="-" onclick="remove_row(0,this);"></td>
+      </tr>
+    <?php
+    $i++;
+  }
+    ?>
+    <tr>
+      <td>&nbsp;</td>
+      <td>&nbsp;</td>
+      <td><input type="button" onclick="add_row_i(this,'<?php echo $setting_code;?>');" value="+"></td>
+      </tr>
+    <?php
+?>
+</table>
+<?php
+    break;
+  case 'bool':
+?>
+<label><input name="<?php echo $setting_code;?>" type=radio value=1 <?php
+  echo Conf::get($setting_code) ? 'checked' : '';?>>
+  <?php echo html_l10n('Yes');?></label>
+<label><input name="<?php echo $setting_code;?>" type=radio value=0 <?php
+  echo !Conf::get($setting_code) ? 'checked' : '';?>>
+  <?php echo html_l10n('No');?></label>
+<?php
+    break;
+  case 'paswword':
+?>
+<input type="password" name="<?php echo $setting_code;?>" value="******">
+<?php
+    break;
+  default:
+?>
+<textarea name="<?php echo $setting_code;?>" cols=60><?php echo htmlentities(Conf::get($setting_code));?></textarea>
+<?php
+  if($setting_infos['type']=='dir' || $setting_infos['type']=='file') {
+    if( !is_readable(Conf::get($setting_code))) {
+      ?><br>
+      <span style="color:red;"><?php echo html_l10n("The server can't access to this file");?></span><br>
+      <ul>
+        <li><?php echo html_l10n("The file does'nt exists.");?></li>
+        <li><?php echo html_l10n("The server does'nt have the privilege to read the file.");?></li>
+      </ul>
+      <?php
+    }
+  }
+ }
+?>
+</td>
+<td class="button">
+<?php 
+  if(isset($setting_infos['changed']) && $setting_infos['changed']) {
+?>
+<input type="submit" value="<?php echo html_l10n('Reset');?>" name="to_default[<?php echo $setting_code;?>]"><br>
+<?php } ?>
+<?php 
+  if(isset($setting_infos['read_only']) && !$setting_infos['read_only']) {
+?>
+<input type="submit" value="OK" name="change[<?php echo $setting_code;?>]">
+<?php } ?>
+</td>
+</tr>
+<?php
+  }
+?>
+</table>
+</form>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/admin/users.php
===================================================================
--- packages/musmap/branches/upstream/current/admin/users.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/admin/users.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,372 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Gestion des utilisateurs
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package admin
+ * @since 2004-06
+ */
+  /**
+   * Startup
+   */
+  require_once('../include/pre_admin.inc.php');
+  
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('User accounts management');?></title>
+  <link rel="stylesheet" type="text/css" href="../map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript" src="../js/l10n.php">
+  </script>
+  <script type="text/javascript">
+  <!--
+  function add_user(aForm) {
+    if(aForm["add[user_password]"].value!=aForm["add[user_password2]"].value) {
+      alert(l10n('Both passwords should be the same.'));
+      return false;
+    }
+    return confirm(l10n('Are you sure?'));
+  }
+  function change_user(aForm) {
+    return confirm(l10n('Are you sure?'));
+  }
+  function add_group(aForm) {
+    return confirm(l10n('Are you sure?'));
+  }
+  -->
+  </script>
+  <style type="text/css">
+    .with-border {
+      border-spacing:0px;
+      border-collapse:collapse;
+      margin-left:20px;
+    }
+    
+    .with-border td {
+      border:1px solid black;
+    }
+    .action {
+      font-weight: bold;
+    }
+  </style>
+</head>
+<body id="users">
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+<?php
+if(isset($_POST['add']) && isset($_POST['add']['user'])) {
+  if($_POST['add']['user_password']!==$_POST['add']['user_password2']) {
+    Warning(l10n('Both passwords should be equals.')."\n".
+      l10n('Operation aborted.'));
+  } else {
+  ?>
+  <p>
+  <?php echo html_l10n('New user account:');?> <i><?php echo $_POST['add']['user_name'];?></i>
+  </p>
+  <?php
+  $db->StartTransaction();
+  $db->Query("INSERT INTO users ".
+    "(user_name,user_password,id_profile) ".
+    "VALUES (".
+      $db->Quote($_POST['add']['user_name']).", ".
+      $db->Quote(password($_POST['add']['user_password'])).", ".
+      $db->Quote($_POST['add']['id_profile'], 'integer').")");
+  $db->Commit();
+  }
+} elseif(isset($_POST['add']) && isset($_POST['add']['group'])) {
+  Information(sprintf(l10n('Adding group: "%s".'),$_POST['add']['group_name']));
+  $db->StartTransaction();
+  $db->Query("INSERT INTO groups ".
+    "(group_name) VALUES (".$db->Quote($_POST['add']['group_name']).")");
+  $db->Commit();
+} elseif(isset($_POST['del_users'])) {
+  if(!isset($_POST['select'])) {
+    $_POST['select']=Array();
+  }
+  foreach($_POST['select'] AS $user_id=>$txt) {
+    $user_select_q=$db->query("SELECT * ".
+      "FROM users ".
+      "WHERE id_user=".$db->Quote($user_id, "integer"));
+    if($user_row=$db->FetchAssoc($user_select_q)) {
+      $sMessage= '';
+      $db->StartTransaction();
+      $profiles_select_q=$db->query('SELECT * '.
+        'FROM profiles WHERE profile_owner_id='.$db->Quote($user_row['id_user'], 'integer'));
+      while($profile_r=$db->FetchAssoc($profiles_select_q)) {
+        if(($profile_r['profile_is_public'] && $_POST['with_public_profiles']=='delete')
+            || (!$profile_r['profile_is_public'] && $_POST['with_private_profiles']=='delete')) {
+          //delete :
+          $sMessage.=sprintf(l10n('Deleting profile: "%s".'),$profile_r['profile_name'])."\n";
+          $db->query('DELETE FROM profiles WHERE id_profile='.$db->Quote($profile_r['id_profile'], 'integer'));
+        } else {//give to
+          $give_profile_to=$profile_r['profile_is_public'] ?
+              $_POST['give_public_profiles_to'] : $_POST['give_private_profiles_to'];
+          $sMessage.=sprintf(l10n('Giving profile "%s" to user account number %s.'),$profile_r['profile_name'],$give_profile_to)."\n";
+          $db->query('UPDATE profiles SET profile_owner_id='.$db->Quote($give_profile_to).' '.
+              'WHERE id_profile='.$db->Quote($profile_r['id_profile'], 'integer'));
+        }
+      }
+      $db->FreeResult($profiles_select_q);
+      $sMessage.=sprintf(l10n('Deleting user account: "%s".'),$user_row['user_name'])."\n";
+      $db->query('DELETE FROM users WHERE id_user='.$db->Quote($user_id, 'integer'));
+      Information($sMessage);
+      $db->commit();
+      unset($sMessage);
+    } else {
+      Warning(l10n('Invalid user account.'));
+    }
+    $db->FreeResult($user_select_q);
+  }
+} elseif(isset($_POST['clear_passwords'])) {
+  if(!isset($_POST['select'])) {
+    $_POST['select']=Array();
+  }
+  $sMessage= '';
+  foreach($_POST['select'] AS $user_id=>$txt) {
+    $db->StartTransaction();
+    $sMessage.=sprintf(l10n('Clearing password for "%s".'),$txt)."\n";
+    $db->query('UPDATE users SET user_password='.$db->Quote(password('')).
+      'WHERE id_user='.$db->Quote($user_id, 'integer'));
+    $db->commit();
+  }
+  Information($sMessage);
+  unset($sMessage);
+} elseif(isset($_POST['change_groups'])) {
+  if(!isset($_POST['select'])) {
+    $_POST['select']=Array();
+  }
+  if(!isset($_POST['users_groups'])) {
+    $_POST['users_groups']=Array();
+  }
+  $db->StartTransaction();
+  foreach($_POST['select'] AS $user_id=>$txt) {
+    $user_select_q=$db->query("DELETE FROM users_groups WHERE id_user=".$db->Quote($user_id, 'integer'));
+    foreach($_POST['users_groups'] AS $group_id) {
+      $db->query("INSERT INTO users_groups ".
+        "(id_user,id_group) ".
+        "VALUES(".$db->Quote($user_id, 'integer').",".$db->Quote($group_id, 'integer').")");
+    }
+  }
+  $db->commit();
+}
+
+?>
+<fieldset>
+<legend><?php echo html_l10n('User accounts');?></legend>
+<form method="POST" onsubmit="return change_user(this);" action="users.php">
+  <table id="users-list">
+    <tr>
+      <th><?php echo html_l10n('User account');?></th>
+      <th><?php echo html_l10n('Default profile');?></th>
+      <th><?php echo html_l10n('Profiles');?></th>
+      <th><?php echo html_l10n('Groups');?></th>
+      <th>&nbsp;</th>
+    </tr>
+<?php
+    $users_r=$db->query("SELECT ".
+      "users.id_user AS id_user, user_name, profile_name ".
+      "FROM users LEFT JOIN profiles ON users.id_profile=profiles.id_profile ".
+      "ORDER BY user_name");
+    while($aUserRow=$db->FetchAssoc($users_r)){
+      echo '    <tr class="part">'."\n";
+      echo '      <td><b>'.$aUserRow['user_name'].'</b></td>'."\n";
+      echo '      <td>'.$aUserRow['profile_name'].'</td>'."\n";
+      echo '      <td>'."\n";
+      $profiles_r=$db->query("SELECT * FROM profiles ".
+        "WHERE profile_owner_id=".$db->Quote($aUserRow['id_user'], 'integer'));
+      if($db->get_num_rows($profiles_r)!=0) {
+        while($profile=$db->FetchAssoc($profiles_r)) {
+          echo '        '.$profile['profile_name'];
+          echo $profile['profile_is_public'] ? ' <i>('.html_l10n('Public profile').')</i>':'&nbsp;';
+          echo "<br>\n";
+        }
+      }
+      $db->FreeResult($profiles_r);
+      echo '      </td>'."\n";
+      echo '      <td>'."\n";
+      $groups_r=$db->query("SELECT ".
+          "group_name \n".
+        "FROM users_groups ".
+          "LEFT JOIN groups ON users_groups.id_group=groups.id_group \n".
+        "WHERE id_user=".$db->Quote($aUserRow['id_user'], 'integer')." ");
+      if($db->get_num_rows($groups_r)==0) 
+        echo '&nbsp;';
+      while($group=$db->FetchAssoc($groups_r)) {
+        echo '        '.$group['group_name'];
+        echo "<br>\n";
+      }
+      $db->FreeResult($groups_r);
+      echo '      </td>'."\n";
+      echo '      <td>';
+      echo '<input type="checkbox" name="select['.$aUserRow['id_user'].']" value="'.$aUserRow['user_name'].'">';
+      echo '      </td>'."\n";
+      echo '    </tr>'."\n";
+    }
+    $db->FreeResult($users_r);
+  ?>
+  </table>
+  <p>
+  <?php echo html_l10n('With selection:');?>
+  </p>
+  <ul>
+    <li>
+      <input type="submit" name="clear_passwords" value="<?php echo html_l10n('Clean passwords');?>">
+    </li>
+    <li>
+      <span class="action"><?php echo html_l10n('Delete user accounts:');?></span><br>
+        <?php echo html_l10n('With public profiles:');?>
+        <label><input type="radio" name="with_public_profiles" value="delete"><?php echo html_l10n('Delete');?></label>
+        <label><input type="radio" name="with_public_profiles" value="give_to" checked><?php echo html_l10n('Give to:');?>
+        </label>
+        <select name="give_public_profiles_to" onchange="this.form.with_public_profiles[1].checked=true;">
+          <?php
+          $user_select_q=$db->query("SELECT * ".
+            "FROM users ".
+            "ORDER BY user_name;");
+          while($user_r=$db->FetchAssoc($user_select_q)) {
+          ?>
+          <option value="<?php echo $user_r['id_user'];?>"><?php echo $user_r['user_name'];?></option>
+          <?php
+          }
+          $db->FreeResult($user_select_q);
+          ?>
+        </select><br>
+        <?php echo html_l10n('With private profiles:');?>
+        <label><input type="radio" name="with_private_profiles" value="delete" checked><?php echo html_l10n('Delete');?></label>
+        <label><input type="radio" name="with_private_profiles" value="give_to"><?php echo html_l10n('Give to:');?>
+        </label>
+        <select name="give_private_profiles_to" onchange="this.form.with_private_profiles[1].checked=true;">
+          <?php
+          $user_select_q=$db->query("SELECT * ".
+              "FROM users ".
+              "ORDER BY user_name;");
+          while($user_r=$db->FetchAssoc($user_select_q)) {
+          ?>
+          <option value="<?php echo $user_r['id_user'];?>"><?php echo $user_r['user_name'];?></option>
+          <?php
+          }
+          $db->FreeResult($user_select_q);
+          ?>
+        </select><br>
+        <input type="submit" name="del_users" value="<?php echo html_l10n('Delete user accounts');?>"><br>
+    </li>
+    <li>
+      <span class="action"><?php echo html_l10n('Change groups to:');?></span>
+      <select name="users_groups[]" multiple>
+        <?php
+        $groups_select_q=$db->query("SELECT * ".
+          "FROM groups ".
+          "ORDER BY group_name;");
+        while($group_row=$db->FetchAssoc($groups_select_q)) {
+        ?>
+        <option value="<?php echo $group_row['id_group'];?>">
+          <?php echo $group_row['group_name'];?>
+        </option>
+        <?php
+        }
+        $db->FreeResult($groups_select_q);
+        ?>
+      </select>
+      <input type="submit" name="change_groups" value="<?php echo html_l10n('Change groups');?>">
+    </li>
+  </ul>
+</form>
+</fieldset>
+<p>&nbsp;</p>
+<fieldset>
+<legend><?php echo html_l10n('Add an user account:');?></legend>
+<form method="POST" onsubmit="return add_user(this);" action="users.php">
+  <table>
+    <tr>
+      <td>
+        <?php echo html_l10n('User account name:');?>
+      </td>
+      <td>
+        <input type="text" name="add[user_name]">
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <?php echo html_l10n('Password:');?>
+      </td>
+      <td>
+        <input type="password" name="add[user_password]"><br>
+        <input type="password" name="add[user_password2]">
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <?php echo html_l10n('Default profile:');?>
+      </td>
+      <td>
+        <?php
+        t_profiles_list::print_profiles_list("add[id_profile]",'','');
+        ?>
+      </td>
+    </tr>
+    <tr>
+      <td colspan=2>
+        <input type="submit" name="add[user]" value="<?php echo html_l10n('Add');?>">
+      </td>
+    </tr>
+  </table>
+</form>
+</fieldset>
+<p>&nbsp;</p>
+<fieldset>
+<legend><?php echo html_l10n('Add a group:');?></legend>
+<form method="POST" onsubmit="return add_group(this);" action="users.php">
+  <table>
+    <tr>
+      <td>
+        <?php echo html_l10n('Group name:');?>
+      </td>
+      <td>
+        <input type="text" name="add[group_name]">
+      </td>
+    </tr>
+    <tr>
+      <td colspan=2>
+        <input type="submit" name="add[group]" value="<?php echo html_l10n('Add');?>">
+      </td>
+    </tr>
+  </table>
+</form>
+</fieldset>
+<p>
+  <a href="./"><?php echo html_l10n('Back to admin menu');?></a>
+</p>
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/cache/.htaccess
===================================================================
--- packages/musmap/branches/upstream/current/cache/.htaccess	                        (rev 0)
+++ packages/musmap/branches/upstream/current/cache/.htaccess	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from All

Added: packages/musmap/branches/upstream/current/change_password.php
===================================================================
--- packages/musmap/branches/upstream/current/change_password.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/change_password.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,99 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Change password
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  $INPUT=$_POST;
+  $user=new t_user('none');
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Change password');?></title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+</head>
+
+<body class="explorer">
+<?php
+if(!isset($_POST['change_password'])) {
+?>
+  <form method="POST" name="password">
+  <table border="1">
+  <tr>
+  <td>
+    <?php echo html_l10n('User account:');?>
+  </td>
+  <td>
+    <?php echo $user->Attributes->Value('user_name');?>
+  </td>
+  </tr>
+  <tr>
+  <td>
+    <?php echo html_l10n('Old password:');?>
+  </td>
+  <td>
+    <input type="password" name="change_password[old_password]">
+  </td>
+  </tr>
+  <tr>
+  <td>
+    <?php echo html_l10n('New password:');?>
+  </td>
+  <td>
+    <input type="password" name="change_password[new_password]"><br>
+    <input type="password" name="change_password[new_password2]">
+  </td>
+  </tr>
+  <tr>
+  <td colspan=2>
+  <input type="submit" name="add[submit]" value="<?php echo html_l10n('Change password');?>">
+  </td>
+  </tr>
+  </table>
+  </form>
+<?php
+} else {
+  $user->change_password($_POST['change_password']['old_password'],$_POST['change_password']['new_password'],$_POST['change_password']['new_password2']);
+?>
+  <input type="button" onclick="window.close();" value="<?php echo html_l10n('Close');?>">
+<?php
+}
+?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/color_picker.php
===================================================================
--- packages/musmap/branches/upstream/current/color_picker.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/color_picker.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,80 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Color picker
+ * @package interface
+ */
+   
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Color picker');?></title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+<script type="text/javascript" language="JavaScript" src="js/contrib/xb.js">
+</script>
+<script type="text/javascript" language="JavaScript" src="js/contrib/xbgeo.js">
+</script>
+<script type="text/javascript" language="JavaScript" src="js/colors.js">
+</script>
+<script type="text/javascript" language="JavaScript" src="js/color_picker.js">
+</script>
+</head>
+
+<body class="nomargin" onload="load();">
+<form action="color_picker.html">
+  <div id="palette-container" style="width:256px;">
+  <img
+    src="images/palette.jpeg" id="palette"
+    style="filter:alpha(opacity=100)"
+    alt="<?php echo html_l10n('Palette');?>"><img
+    src="images/paletteBW.jpeg" id="paletteBW"
+    alt="<?php echo html_l10n('Palette');?>"></div>
+  <p>
+  <input type="text" size="7" name="mouse_color" class= "color-input">
+  <span id="mousemove_color_square"
+    style="background-color:black;width:10px;height:10px;">
+    &nbsp;&nbsp;&nbsp;</span>
+  <input type="text" size="7" name="click_color" class="color-input">
+  <span id="click_color_square" 
+    style="background-color:black;width:10px;height:10px;">
+    &nbsp;&nbsp;&nbsp;</span>
+  <a href="javascript:window.close();"><?php echo html_l10n('Close');?></a>
+  </p>
+</form>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/data/.htaccess
===================================================================
--- packages/musmap/branches/upstream/current/data/.htaccess	                        (rev 0)
+++ packages/musmap/branches/upstream/current/data/.htaccess	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from All

Added: packages/musmap/branches/upstream/current/data/lang/en/javascript.lang.js
===================================================================
--- packages/musmap/branches/upstream/current/data/lang/en/javascript.lang.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/data/lang/en/javascript.lang.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,35 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * en: javascript
+   * @package lang
+   */
+
+top.l10n_array=new Array();

Added: packages/musmap/branches/upstream/current/data/lang/en/main.lang.php
===================================================================
--- packages/musmap/branches/upstream/current/data/lang/en/main.lang.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/data/lang/en/main.lang.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,43 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * en: main
+   * @package lang
+   * @subpackage en
+   */
+
+// ===================== MS ERRORS =====================
+$l10n['msDrawMap()']='Drawing map';
+$l10n['msSHPOpenFile()']='Opening shape file';
+$l10n["msDBFGetItemIndex()"]="Getting a dbf item";
+
+// 
+$l10n['_date']="Y-n-j H:i:s";
+$l10n['_time']="H:i:s";

Added: packages/musmap/branches/upstream/current/data/lang/en/model.lang.php
===================================================================
--- packages/musmap/branches/upstream/current/data/lang/en/model.lang.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/data/lang/en/model.lang.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,282 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * en: model
+   * @package lang
+   * @subpackage en
+   */
+
+$model_l10n["class"]="class";
+$model_l10n["a_class"]="a class";
+$model_l10n["id_class"]="class";
+$model_l10n["class_name"]="name";
+$model_l10n["class_expression"]="expression";
+$model_l10n["class_index"]="position";
+
+$model_l10n["connection"]="connection";
+$model_l10n["a_connection"]="a connection";
+$model_l10n["id_connection"]="connection";
+$model_l10n["connection_name"]="connection name";
+$model_l10n["connection_driver"]="driver";
+$model_l10n["connection_params"]="connection params";
+$model_l10n["connection_owner_id"]="owner";
+$model_l10n["connection_reader_group_id"]="reader group";
+$model_l10n["connection_writer_group_id"]="writer group";
+$model_l10n["connection_privileges"]="privileges";
+$model_l10n["connection_modification_time"]="modification time";
+
+$model_l10n["data_column"]="column";
+$model_l10n["a_data_column"]="a column";
+$model_l10n["id_data_column"]="data column";
+$model_l10n["column_code"]="column name";
+$model_l10n["column_short_label"]="short label";
+$model_l10n["column_long_label"]="long label";
+$model_l10n["column_visible"]="visible";
+$model_l10n["column_index"]="position";
+$model_l10n["column_is_decodification"]="decodify";
+$model_l10n["column_type"]="type";
+$model_l10n["column_expression"]="expression";
+
+$model_l10n["extent"]="extent";
+$model_l10n["a_extent"]="an extent";
+$model_l10n["id_extent"]="extent";
+$model_l10n["extent_name"]="extent name";
+$model_l10n["extent_minx"]="X min";
+$model_l10n["extent_miny"]="Y min";
+$model_l10n["extent_maxx"]="X max";
+$model_l10n["extent_maxy"]="Y max";
+$model_l10n["extent_owner_id"]="owner";
+$model_l10n["extent_reader_group_id"]="reader group";
+$model_l10n["extent_writer_group_id"]="writer group";
+$model_l10n["extent_privileges"]="privileges";
+$model_l10n["extent_modification_time"]="modification time";
+
+$model_l10n["group"]="group";
+$model_l10n["a_group"]="a group";
+$model_l10n["id_group"]="id group";
+$model_l10n["group_name"]="group name";
+
+$model_l10n["label"]="label";
+$model_l10n["a_label"]="a label";
+$model_l10n["id_label"]="label";
+$model_l10n["label_column"]="column";
+$model_l10n["label_encoding"]="character encoding";
+$model_l10n["label_font"]="font";
+$model_l10n["label_color"]="text color";
+$model_l10n["label_minscale"]="minimum scale";
+$model_l10n["label_maxscale"]="maximum scale";
+$model_l10n["label_force_visibility"]="allow superposition";
+$model_l10n["label_default_size"]="default size";
+$model_l10n["label_size"]="size column";
+$model_l10n["label_default_angle"]="default angle";
+$model_l10n["label_angle"]="angle column";
+$model_l10n["label_position"]="position";
+$model_l10n["label_rect_color"]="rectangle color";
+$model_l10n["label_rect_shadow_color"]="rectangle shadow color";
+$model_l10n["label_rect_shadow_size"]="rectangle shadow size";
+$model_l10n["label_buffer"]="buffer";
+$model_l10n["label_outline_color"]="outline color";
+$model_l10n["label_partials"]="partials";
+$model_l10n["label_shadow_color"]="shadow color";
+$model_l10n["label_shadow_size"]="shadow size";
+
+$model_l10n["map_reference"]="reference map";
+$model_l10n["a_map_reference"]="a reference map";
+$model_l10n["id_map_reference"]="reference map";
+$model_l10n["reference_name"]="reference name";
+$model_l10n["reference_path"]="image path";
+$model_l10n["reference_owner_id"]="owner";
+$model_l10n["reference_reader_group_id"]="reader group";
+$model_l10n["reference_writer_group_id"]="writer group";
+$model_l10n["reference_privileges"]="privileges";
+$model_l10n["reference_modification_time"]="modification time";
+
+$model_l10n["profile_extent"]="profile extent";
+$model_l10n["a_profile_extent"]="a profile extent";
+
+$model_l10n["profile"]="profile";
+$model_l10n["a_profile"]="a profile";
+$model_l10n["id_profile"]="profile";
+$model_l10n["profile_name"]="profile name";
+$model_l10n["profile_is_public"]="public profile";
+$model_l10n["profile_owner_id"]="owner";
+$model_l10n["profile_reader_group_id"]="reader group";
+$model_l10n["profile_writer_group_id"]="writer group";
+$model_l10n["profile_privileges"]="privileges";
+$model_l10n["profile_modification_time"]="modification time";
+
+$model_l10n["profile_column"]="profile column";
+$model_l10n["a_profile_column"]="a profile column";
+$model_l10n["id_profile_column"]="profile column";
+$model_l10n["profile_column_index"]="position";
+$model_l10n["profile_column_visible"]="visible";
+
+$model_l10n["profile_data"]="profile data";
+$model_l10n["a_profile_data"]="a profile data";
+$model_l10n["id_profile_data"]="profile data";
+$model_l10n["profile_data_title"]="profile data name";
+$model_l10n["profile_data_index"]="position";
+$model_l10n["profile_data_visible"]="visible";
+$model_l10n["profile_data_owner_id"]="owner";
+$model_l10n["profile_data_reader_group_id"]="reader group";
+$model_l10n["profile_data_writer_group_id"]="writer group";
+$model_l10n["profile_data_privileges"]="privileges";
+$model_l10n["profile_data_modification_time"]="modification time";
+$model_l10n["layer_minscale"]="min scale";
+$model_l10n["layer_maxscale"]="max scale";
+$model_l10n["layer_group"]="group";
+$model_l10n["layer_symbols_scale"]="reference scale";
+$model_l10n["layer_classitem"]="default column (classitem)";
+$model_l10n["layer_opacity"]="opacity";
+$model_l10n["layer_type"]="layer type (shapes only)";
+$model_l10n["raster_offsite"]="transparent color (OFFSITE)";
+
+$model_l10n["projection"]="projection";
+$model_l10n["a_projection"]="a projection";
+$model_l10n["id_projection"]="projection";
+$model_l10n["projection_name"]="projection name";
+$model_l10n["projection_params"]="projection params";
+$model_l10n["projection_owner_id"]="owner";
+$model_l10n["projection_reader_group_id"]="reader group";
+$model_l10n["projection_writer_group_id"]="writer group";
+$model_l10n["projection_privileges"]="privileges";
+$model_l10n["projection_modification_time"]="modification time";
+
+$model_l10n["query_form"]="form";
+$model_l10n["a_query_form"]="a form";
+$model_l10n["id_query_form"]="form";
+$model_l10n["query_form_menu_title"]="title in the menu";
+$model_l10n["query_form_title"]="window title";
+$model_l10n["query_form_header"]="HTML header";
+$model_l10n["query_form_form"]="HTML form";
+$model_l10n["query_form_params"]="params";
+$model_l10n["query_form_owner_id"]="owner";
+$model_l10n["query_form_reader_group_id"]="reader group";
+$model_l10n["query_form_writer_group_id"]="writer group";
+$model_l10n["query_form_privileges"]="privileges";
+$model_l10n["query_form_modification_time"]="modification time";
+
+$model_l10n["query_result"]="query result";
+$model_l10n["a_query_result"]="a query result";
+$model_l10n["id_query_result"]="query result";
+$model_l10n["query_result_name"]="name";
+$model_l10n["query_result_data"]="query result data";
+$model_l10n["query_result_owner_id"]="owner";
+$model_l10n["query_result_reader_group_id"]="reader group";
+$model_l10n["query_result_writer_group_id"]="writer group";
+$model_l10n["query_result_privileges"]="privileges";
+$model_l10n["query_result_modification_time"]="modification time";
+
+$model_l10n["relation"]="relation";
+$model_l10n["a_relation"]="a relation";
+$model_l10n["id_relation"]="relation";
+$model_l10n["dat_id_data_column"]="destination column (primary key)";
+$model_l10n["relation_label_fk_pk"]="label FK->PK";
+$model_l10n["relation_min_cardinality_fk_pk"]="min cardinality FK->PK";
+$model_l10n["relation_label_pk_fk"]="label PK->FK";
+$model_l10n["relation_min_cardinality_pk_fk"]="min cardinality PK->FK";
+$model_l10n["relation_max_cardinality_pk_fk"]="max cardinality PK->FK";
+
+$model_l10n["session"]="session";
+$model_l10n["a_session"]="a session";
+$model_l10n["session_id"]="session";
+$model_l10n["session_security_id"]="session security id";
+$model_l10n["session_creation_time"]="creation time";
+$model_l10n["session_modification_time"]="modification time";
+
+$model_l10n["style"]="style";
+$model_l10n["a_style"]="a style";
+$model_l10n["id_style"]="style";
+$model_l10n["style_name"]="style name";
+$model_l10n["style_background_color"]="background color";
+$model_l10n["style_color"]="style color";
+$model_l10n["style_outline_color"]="outline color";
+$model_l10n["style_size"]="symbol size";
+$model_l10n["style_symbol_maxsize"]="maximum size";
+$model_l10n["style_symbol_minsize"]="minimum size";
+$model_l10n["style_index"]="position";
+
+$model_l10n["symbol"]="symbol";
+$model_l10n["a_symbol"]="a symbol";
+$model_l10n["id_symbol"]="symbol";
+$model_l10n["symbol_family"]="symbol family";
+$model_l10n["symbol_name"]="symbol name";
+$model_l10n["symbol_type"]="symbol type";
+$model_l10n["symbol_filled"]="filled";
+$model_l10n["symbol_font"]="symbol font";
+$model_l10n["symbol_image_path"]="image path";
+$model_l10n["symbol_points"]="points";
+$model_l10n["symbol_style"]="symbol style";
+$model_l10n["symbol_owner_id"]="owner";
+$model_l10n["symbol_reader_group_id"]="reader group";
+$model_l10n["symbol_writer_group_id"]="writer group";
+$model_l10n["symbol_privileges"]="privileges";
+$model_l10n["symbol_modification_time"]="modification time";
+
+$model_l10n["data_source"]="data source";
+$model_l10n["a_data_source"]="a data source";
+$model_l10n["id_data_source"]="data source";
+$model_l10n["data_source_catalog"]="data source catalog";
+$model_l10n["data_source_schema"]="data source schema";
+$model_l10n["data_source_name"]="data source name";
+$model_l10n["data_source_label"]="data source label";
+$model_l10n["data_source_params"]="data source params";
+$model_l10n["data_source_type"]="data source type";
+$model_l10n["data_source_doc"]="data source documentation";
+$model_l10n["data_source_owner_id"]="owner";
+$model_l10n["data_source_reader_group_id"]="reader group";
+$model_l10n["data_source_writer_group_id"]="writer group";
+$model_l10n["data_source_privileges"]="privileges";
+$model_l10n["data_source_modification_time"]="modification time";
+            
+$model_l10n["tool_setting"]="tool setting";
+$model_l10n["a_tool_setting"]="a tool setting";
+$model_l10n["setting_code"]="setting";
+$model_l10n["setting_value"]="value";
+
+$model_l10n["user"]="user";
+$model_l10n["a_user"]="an user";
+$model_l10n["id_user"]="user";
+$model_l10n["user_name"]="user name";
+$model_l10n["user_password"]="user password";
+
+$model_l10n["users_group"]="users group";
+$model_l10n["a_users_group"]="a group of users";
+
+// Virtual tables
+$model_l10n["connections_list"]="connections";
+$model_l10n["extents_list"]="extents";
+$model_l10n["map_references_list"]="references maps";
+$model_l10n["profiles_list"]="profiles";
+$model_l10n["projections_list"]="projections";
+$model_l10n["query_forms_list"]="forms";
+$model_l10n["query_results_list"]="results";
+$model_l10n["symbols_list"]="symbols";
+?>

Added: packages/musmap/branches/upstream/current/data/lang/fr/javascript.lang.js
===================================================================
--- packages/musmap/branches/upstream/current/data/lang/fr/javascript.lang.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/data/lang/fr/javascript.lang.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,62 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * fr: javascript
+   * @package lang
+   */
+
+top.l10n_array=new Array();
+top.l10n_array['Error']="Erreur";
+
+top.l10n_array['Are you sure?']="Etes vous sûr ?";
+top.l10n_array['Are you sure you want to delete this object and all its children?']="Etes vous sûr de vouloir supprimer cet objet et tous ses enfants ?";
+top.l10n_array['Are you sure you want to duplicate this object and all its children?']="Etes vous sûr de vouloir dupliquer cet objet et tous ses enfants ?";
+
+
+// explorer.js
+top.l10n_array['Unable to find form.']='Impossible de trouver le formulaire.';
+top.l10n_array['Not implemented:']='Non implémenté :';
+
+// map.js
+top.l10n_array['Please enter scale:']="Veuillez entrer l'échelle :";
+top.l10n_array['Invalid command:']='Commande invalide :';
+top.l10n_array['Please select a layer!']='Veuillez sélectionner une couche !';
+
+// top.js
+
+// events.js
+top.l10n_array['Length']="Longueur";
+top.l10n_array['Total']="Total";
+
+// components.class.php
+top.l10n_array['Are you sure you want to duplicate this object?']
+ = 'Etes vous sûr de vouloir dupliquer cet objet ?';
+top.l10n_array['Are you sure you want to delete this object?']
+ = 'Etes vous sûr de vouloir supprimer cet objet ?';
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/data/lang/fr/main.lang.php
===================================================================
--- packages/musmap/branches/upstream/current/data/lang/fr/main.lang.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/data/lang/fr/main.lang.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,1369 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * fr: main
+   * @package lang
+   * @subpackage fr
+   */
+
+$l10n["\"%s\" does'nt respond. Check if it is running."] =
+      "\"%s\" ne répond pas. Vérifiez s'il fontionne.";
+    // /include/database/firebird.db.class.php (82)
+    // /include/database/mysql.db.class.php (81)
+    // /include/database/odbc.db.class.php (71)
+    // /include/database/ogr.db.class.php (68)
+    // /include/database/postgresql.db.class.php (75)
+$l10n["%s %s ago"] =
+      "il y a %s %s";
+    // /include/misc.inc.php (318)
+    // /include/misc.inc.php (324)
+$l10n["%s doesn't support SQL catalogs."] =
+      "%s ne supporte pas les catalogues SQL.";
+    // /include/database/ogr.db.class.php (293)
+    // /include/database/ogr.db.class.php (311)
+    // /include/database/ogr.db.class.php (347)
+$l10n["%s doesn't support SQL schemas."] =
+      "%s ne supporte pas les schémas SQL.";
+    // /include/database/ogr.db.class.php (296)
+    // /include/database/ogr.db.class.php (314)
+    // /include/database/ogr.db.class.php (350)
+$l10n["%s is not installed."] =
+      "%s n'est pas installé.";
+    // /include/database/mapserver.db.class.php (464)
+$l10n["%s not found."] =
+      "%s introuvable.";
+    // /include/map.class.php (486)
+    // /include/model/data_source.class.php (184)
+    // /include/model/query_result.class.php (149)
+$l10n["%s not found: \"%s\"."] =
+      "%s introuvable: \"%s\".";
+    // /include/map.class.php (374)
+    // /include/map.class.php (490)
+    // /include/map.class.php (555)
+    // /include/map.class.php (560)
+    // /include/model/component.class.php (434)
+    // /include/model/query_result.class.php (153)
+    // /include/model/query_result.class.php (158)
+$l10n["(Read & write privileges)"] =
+      "(Lecture & écriture)";
+    // /include/model/profile.class.php (360)
+$l10n["(Read only)"] =
+      "(Lecture seule)";
+    // /include/model/profile.class.php (361)
+$l10n["Add"] =
+      "Ajouter";
+    // /admin/users.php (341)
+    // /admin/users.php (362)
+$l10n["Add %s"] =
+      "Ajouter %s";
+    // /include/model/component.class.php (288)
+$l10n["Add a group:"] =
+      "Ajouter un groupe :";
+    // /admin/users.php (349)
+$l10n["Add an user account:"] =
+      "Ajouter un compte utilisateur :";
+    // /admin/users.php (309)
+$l10n["Adding \"%s\" (%s)."] =
+      "Ajout de \"%s\" (%s).";
+    // /include/model/component.class.php (733)
+$l10n["Adding group: \"%s\"."] =
+      "Ajout du groupe : \"%s\".";
+    // /admin/users.php (109)
+$l10n["Admin"] =
+      "Administration";
+    // /admin/build_spatial_indexes.php (76)
+    // /admin/index.php (44)
+    // /admin/index.php (48)
+$l10n["All layers"] =
+      "Toutes les couches";
+    // /include/map.inc.php (199)
+$l10n["Alpha"] =
+      "Alpha";
+    // /include/model/data_source.class.php (103)
+    // /include/model/data_source.class.php (104)
+    // /include/model/data_source.class.php (105)
+$l10n["Are you sure?"] =
+      "Etes vous sûr ?";
+    // /admin/users.php (59)
+    // /admin/users.php (62)
+    // /admin/users.php (65)
+$l10n["Authentication service is unavailable."] =
+      "Le service d'authentification est indisponibe.";
+    // /include/model/user.class.php (200)
+$l10n["Back to admin menu"] =
+      "Retour au menu administration";
+    // /admin/build_dependency_tree.php (207)
+    // /admin/build_dependency_tree.php (307)
+    // /admin/build_spatial_indexes.php (108)
+    // /admin/check_integrity.php (79)
+    // /admin/check_integrity.php (185)
+    // /admin/clean_dir.php (46)
+    // /admin/clean_dir.php (52)
+    // /admin/create_tables.php (203)
+    // /admin/data_sources_explorer.php (110)
+    // /admin/info.php (45)
+    // /admin/info.php (112)
+    // /admin/localization.php (132)
+    // /admin/localization.php (235)
+    // /admin/logs.php (81)
+    // /admin/logs.php (96)
+    // /admin/model.php (83)
+    // /admin/sessions.php (48)
+    // /admin/sessions.php (122)
+    // /admin/settings.php (205)
+    // /admin/settings.php (403)
+    // /admin/users.php (86)
+    // /admin/users.php (369)
+$l10n["Blue: PROTECTED."] =
+      "Bleu : PROTEGE.";
+    // /include/misc.inc.php (115)
+$l10n["Both passwords should be equals."] =
+      "Les deux mots de passe doivent être identiques.";
+    // /admin/users.php (91)
+$l10n["Both passwords should be the same."] =
+      "Les deux mots de passe doivent être identiques.";
+    // /admin/users.php (56)
+$l10n["Build classes"] =
+      "Constuire les classes";
+    // /presentation_wizard.php (203)
+    // /presentation_wizard.php (212)
+$l10n["Build spatial indexes"] =
+      "Construire des index spaciaux";
+    // /admin/build_spatial_indexes.php (83)
+    // /admin/index.php (112)
+$l10n["Can't find any profile."] =
+      "Impossible de trouver un profil.";
+    // /include/model/profile.class.php (100)
+$l10n["Can't load."] =
+      "Chargement impossible.";
+    // /admin/data_sources_explorer.php (106)
+$l10n["Center"] =
+      "Centre";
+    // /print.php (169)
+$l10n["Change"] =
+      "Changer";
+    // /include/model/component.class.php (187)
+    // /include/model/component.class.php (190)
+    // /include/model/component.class.php (264)
+    // /include/model/component.class.php (271)
+$l10n["Change groups"] =
+      "Changer les groupes";
+    // /admin/users.php (302)
+$l10n["Change groups to:"] =
+      "Changer les groupes en :";
+    // /admin/users.php (286)
+$l10n["Change password"] =
+      "Changer le mot de passe";
+    // /change_password.php (48)
+    // /change_password.php (85)
+    // /include/model/user.class.php (147)
+$l10n["Changing %s (%s)"] =
+      "Changement de '%s' (%s)";
+    // /include/model/component.class.php (544)
+$l10n["Changing privileges ..."] =
+      "Changement des privilèges ...";
+    // /include/model/component.class.php (892)
+$l10n["Check database integrity"] =
+      "Vérifier l'integrité de la base de données";
+    // /admin/check_integrity.php (54)
+    // /admin/index.php (122)
+$l10n["Check for duplicate names."] =
+      "Vérifiez les doublons de nom.";
+    // /import_mapfile.php (174)
+$l10n["Children"] =
+      "Enfants";
+    // /include/model/component.class.php (261)
+$l10n["Classes:"] =
+      "Classes:";
+    // /presentation_wizard.php (216)
+$l10n["Clean passwords"] =
+      "Effacer les mots de passe";
+    // /admin/users.php (245)
+$l10n["Clean temp dir"] =
+      "Nettoyer du dossier temporaire";
+    // /admin/clean_dir.php (42)
+    // /admin/index.php (116)
+$l10n["Clear log"] =
+      "Vider le journal";
+    // /admin/logs.php (87)
+$l10n["Clearing password for \"%s\"."] =
+      "Suppression du mot de passe pour \"%s\".";
+    // /admin/users.php (159)
+$l10n["Click %s  if this page is not automaticaly reloaded."] =
+      "Cliquez %s si cette page n'est pas automatiquement rechargée";
+    // /include/model/component.inc.php (123)
+$l10n["Close"] =
+      "Fermer";
+    // /change_password.php (94)
+    // /color_picker.php (76)
+    // /get_tables_wizard.php (128)
+    // /presentation_wizard.php (292)
+$l10n["Color Scheme:"] =
+      "Famille de couleurs:";
+    // /presentation_wizard.php (179)
+$l10n["Color picker"] =
+      "Sélection de couleur";
+    // /color_picker.php (45)
+$l10n["Connection does not support Drawing."] =
+      "La connection ne supporte pas le dessin.";
+    // /include/model/query_result.class.php (146)
+$l10n["Connection does not support QueryByShape."] =
+      "La connection ne supporte pas QueryByShape (requete spatiale).";
+    // /include/map.class.php (410)
+$l10n["Connection does not support SQL."] =
+      "La connection ne supporte pas le SQL.";
+    // /include/map.class.php (483)
+$l10n["Connection does not support Select."] =
+      "La connection ne supporte pas Select (sélection).";
+    // /include/map.class.php (551)
+$l10n["Connection not found."] =
+      "Connection introuvable.";
+    // /include/map.class.php (414)
+$l10n["Contextual help url"] =
+      "Url de l'aide contextuelle";
+    // /include/conf.inc.php (277)
+$l10n["Count:"] =
+      "Nombre :";
+    // /presentation_wizard.php (185)
+    // /presentation_wizard.php (208)
+$l10n["Create a new profile"] =
+      "Créer un nouveau profil";
+    // /profile_wizard.php (47)
+$l10n["Create database structure"] =
+      "Création de la structure de la base de données";
+    // /admin/create_tables.php (48)
+$l10n["Current database engine can't query by shape (%s)."] =
+      "La base de donnée courante ne peut pas faire de requête graphique (%s).";
+    // /include/database/db.class.php (557)
+$l10n["Current database engine can't sort rows (%s)."] =
+      "La base de donnée courante ne peut pas trier les résultats (%s).";
+    // /include/database/mapserver.db.class.php (128)
+$l10n["DBase folder not found: \"%s\"."] =
+      "Dossier DBase introuvable: \"%s\".";
+    // /include/database/dbase_file.db.class.php (78)
+    // /include/database/dbase_file.db.class.php (88)
+    // /include/database/dbase_file.db.class.php (151)
+$l10n["Data source not found: \"%s\"."] =
+      "Source de données introuvable: \"%s\".";
+    // /include/map.class.php (417)
+    // /include/map.class.php (602)
+$l10n["Database engine"] =
+      "Moteur de base de données";
+    // /include/conf.inc.php (315)
+$l10n["Database engine not found for \"%s\"."] =
+      "Moteur de base de données introuvable pour \"%s\".";
+    // /include/pre.inc.php (187)
+$l10n["Database error: rolling back."] =
+      "Erreur de la base de données : Annulation de la transaction.";
+    // /admin/create_tables.php (76)
+    // /admin/create_tables.php (91)
+    // /include/model/component.class.php (383)
+    // /include/model/component.class.php (710)
+$l10n["Database is now installed."] =
+      "La base de données est maintenant installée.";
+    // /admin/create_tables.php (101)
+$l10n["Database not installed."] =
+      "Base de données non installée.";
+    // /include/conf.inc.php (120)
+$l10n["Database params"] =
+      "Paramètres de la base de données";
+    // /include/conf.inc.php (318)
+$l10n["Dbase file not found: \"%s\"."] =
+      "Fichier Dbase introuvable: \"%s\".";
+    // /include/database/dbase_file.db.class.php (94)
+$l10n["Debug level"] =
+      "Niveau de déboggage";
+    // /include/conf.inc.php (309)
+$l10n["Default"] =
+      "Par défaut";
+    // /print.php (149)
+$l10n["Default lang"] =
+      "Langue par défaut";
+    // /include/conf.inc.php (244)
+$l10n["Default profile"] =
+      "Profil par défaut";
+    // /admin/users.php (192)
+$l10n["Default profile:"] =
+      "Profil par défaut :";
+    // /admin/users.php (331)
+$l10n["Default style:"] =
+      "Style par défaut :";
+    // /presentation_wizard.php (255)
+$l10n["Delete"] =
+      "Supprimer";
+    // /admin/users.php (250)
+    // /admin/users.php (267)
+    // /include/model/component.class.php (197)
+    // /include/model/component.class.php (202)
+$l10n["Delete selected"] =
+      "Supprimer la selection";
+    // /include/model/component.class.php (266)
+    // /include/model/component.class.php (273)
+$l10n["Delete selected sessions"] =
+      "Supprimer les sessions sélectionnées";
+    // /admin/sessions.php (86)
+$l10n["Delete user accounts"] =
+      "Supprimer les comptes utilisateur";
+    // /admin/users.php (283)
+$l10n["Delete user accounts:"] =
+      "Supprimer les comptes utilisateurs :";
+    // /admin/users.php (248)
+$l10n["Deleting %s (%s)"] =
+      "Suppression de '%s' (%s)";
+    // /admin/sessions.php (56)
+    // /include/model/component.class.php (659)
+$l10n["Deleting profile: \"%s\"."] =
+      "Suppression du profil : \"%s\"";
+    // /admin/users.php (131)
+$l10n["Deleting user account: \"%s\"."] =
+      "Suppression du compte utilisateur : \"%s\"";
+    // /admin/users.php (142)
+$l10n["Display"] =
+      "Affichage";
+    // /print.php (181)
+$l10n["Do you want to create the musmap tables?"] =
+      "Voulez-vous créer les tables de musmap ?";
+    // /admin/create_tables.php (63)
+$l10n["Documentation"] =
+      "Documentation";
+    // /doc.php (80)
+$l10n["Domain table"] =
+      "Table de domaine";
+    // /include/model/data_source.class.php (104)
+$l10n["Done"] =
+      "Fait";
+    // /get_tables_wizard.php (119)
+    // /include/model/user.class.php (236)
+$l10n["Drivers for \"%s\" do not support GetInformationSchema."] =
+      "Les pilotes pour \"%s\" ne supportent pas GetInformationSchema.";
+    // /get_tables_wizard.php (69)
+    // /get_tables_wizard.php (123)
+$l10n["Duplicate"] =
+      "Dupliquer";
+    // /include/model/component.class.php (209)
+    // /include/model/component.class.php (214)
+$l10n["Duplicate entry. Rolling back."] =
+      "Enregistrements en double. Annulation.";
+    // /include/model/component.class.php (708)
+$l10n["Duplicating %s (%s)"] =
+      "Duplication de '%s' (%s)";
+    // /include/model/component.class.php (760)
+$l10n["Ellipse"] =
+      "Ellipse";
+    // /include/model/symbol.class.php (144)
+$l10n["Environement informations"] =
+      "Informations sur l'environnement";
+    // /admin/index.php (86)
+$l10n["Error"] =
+      "Erreur";
+    // /admin/create_tables.php (195)
+    // /include/framework/framework.class.php (313)
+$l10n["Error %s:"] =
+      "Erreur %s:";
+    // /include/map.class.php (638)
+    // /include/map.class.php (647)
+    // /include/map.class.php (662)
+$l10n["Error performing query: \"%s\" on data source \"%s\"."] =
+      "Erreur lors de l'exécution de la requête: \"%s\" sur la source de données \"%s\".";
+    // /include/map.class.php (478)
+$l10n["Error!"] =
+      "Erreur !";
+    // /query_form.php (118)
+    // /profile_wizard.php (141)
+$l10n["Explore profiles..."] =
+      "Explorer les profils ...";
+    // /include/model/profile.class.php (143)
+$l10n["Explorer"] =
+      "Explorateur";
+    // /admin/data_sources_explorer.php (51)
+    // /profiles_explorer.php (79)
+$l10n["Explorer:"] =
+      "Explorateur :";
+    // /admin/index.php (63)
+$l10n["Exponential"] =
+      "Exponentielle";
+    // /presentation_wizard.php (201)
+$l10n["Expression:"] =
+      "Expression:";
+    // /presentation_wizard.php (142)
+$l10n["Failed to draw layer named '%s'."] =
+      "Impossible de dessiner la couche '%s'.";
+    // /include/map.class.php (640)
+$l10n["File not found \"%s\"."] =
+      "Fichier introuvable \"%s\".";
+    // /include/database/mapserver.db.class.php (377)
+$l10n["File not found."] =
+      "Fichier introuvable.";
+    // /doc.php (110)
+$l10n["First value:"] =
+      "Première valeur :";
+    // /presentation_wizard.php (187)
+$l10n["Float"] =
+      "Flotant";
+    // /include/model/data_column.class.php (82)
+$l10n["Folder:"] =
+      "Dossier :";
+    // /admin/build_spatial_indexes.php (85)
+$l10n["Font"] =
+      "Police";
+    // /include/model/symbol.class.php (146)
+$l10n["For more informations about Musmap, please look at %s."] =
+      "Pour plus d'informations sur Musmap, regardez les %s.";
+    // /include/badlog.tmpl.php (125)
+$l10n["Force scale"] =
+      "Forcer l'échelle";
+    // /print.php (117)
+$l10n["Get data sources"] =
+      "Obtenir les sources de données";
+    // /include/model/connection.class.php (134)
+$l10n["Get data sources wizard"] =
+      "Assistant Obtenir les sources de données";
+    // /get_tables_wizard.php (50)
+$l10n["Getting data sources"] =
+      "Obtention les sources de données";
+    // /get_tables_wizard.php (64)
+$l10n["Give to:"] =
+      "Donner à :";
+    // /admin/users.php (251)
+    // /admin/users.php (268)
+$l10n["Giving profile \"%s\" to user account number %s."] =
+      "Attribuer le profil \"%s\" au compte utilisateur numéro %s";
+    // /admin/users.php (136)
+$l10n["Graphic scale"] =
+      "Echelle graphique";
+    // /print.php (196)
+$l10n["Green: QUEUED."] =
+      "Vert : EN ATTENTE.";
+    // /include/misc.inc.php (114)
+$l10n["Group name:"] =
+      "Nom du groupe :";
+    // /admin/users.php (354)
+$l10n["Groups"] =
+      "Groupes";
+    // /admin/users.php (194)
+$l10n["HTML page (map in %s)"] =
+      "Page web (carte en %s)";
+    // /print.php (88)
+$l10n["Header and footer"] =
+      "En-tête et pied-de-page";
+    // /print.php (157)
+$l10n["Hide mapfile"] =
+      "Cacher le fichier map";
+    // /include/model/profile.class.php (375)
+$l10n["High quality (%d dpi)"] =
+      "Haute qualité (%d dpi)";
+    // /print.php (140)
+$l10n["Image"] =
+      "Image";
+    // /include/model/data_column.class.php (84)
+    // /include/model/symbol.class.php (145)
+$l10n["Information"] =
+      "Information";
+    // /include/framework/framework.class.php (333)
+$l10n["Informations"] =
+      "Informations";
+    // /admin/index.php (82)
+$l10n["Install database!"] =
+      "Installer la base !";
+    // /include/conf.inc.php (128)
+$l10n["Instantiation of a new map."] =
+      "Instantiation d'une nouvelle carte.";
+    // /include/model/profile.class.php (71)
+$l10n["Intervals"] =
+      "Intervalles";
+    // /presentation_wizard.php (174)
+$l10n["Intervals:"] =
+      "Intervalles :";
+    // /presentation_wizard.php (184)
+$l10n["Invalid command: \"%s\"."] =
+      "Commande invalide: \"%s\".";
+    // /include/map.class.php (607)
+$l10n["Invalid user account."] =
+      "Compte utilisateur invalide.";
+    // /admin/users.php (148)
+$l10n["Item '%s' not found."] =
+      "Element '%s' introuvable.";
+    // /include/map.class.php (649)
+$l10n["Javascript should be enabled!"] =
+      "Javascript doit être activé !";
+    // /main.php (72)
+$l10n["Label"] =
+      "Annotation";
+    // /include/model/data_source.class.php (113)
+    // /include/model/profile_data.class.php (137)
+    // /include/model/profile_data.class.php (144)
+$l10n["Label \"%s\""] =
+      "Etiquette \"%s\"";
+    // /include/model/label.class.php (253)
+$l10n["Last value:"] =
+      "Dernière valeur :";
+    // /presentation_wizard.php (189)
+$l10n["Latest"] =
+      "Dernier";
+    // /include/map.class.php (897)
+$l10n["Layer \"%s\" not found."] =
+      "Couche \"%s\" introuvable.";
+    // /include/map.class.php (327)
+$l10n["Layer not found: \"%s\"."] =
+      "Couche introuvable : \"%s\".";
+    // /include/map.class.php (279)
+    // /include/map.class.php (406)
+    // /include/database/mapserver.db.class.php (159)
+$l10n["Left"] =
+      "Gauche";
+    // /print.php (168)
+$l10n["Legend"] =
+      "Légende";
+    // /print.php (188)
+$l10n["Line"] =
+      "Ligne";
+    // /include/model/data_source.class.php (112)
+    // /include/model/profile_data.class.php (136)
+    // /include/model/profile_data.class.php (143)
+    // /include/model/symbol.class.php (212)
+$l10n["Linear"] =
+      "Linéaire";
+    // /presentation_wizard.php (197)
+$l10n["Link"] =
+      "Lien";
+    // /include/model/data_column.class.php (83)
+$l10n["Load current extent"] =
+      "Charger l'étendue en cours";
+    // /include/model/extent.class.php (152)
+$l10n["Localized strings"] =
+      "Textes localisés";
+    // /admin/index.php (96)
+    // /admin/localization.php (123)
+$l10n["Log out"] =
+      "Quitter";
+    // /include/model/user.class.php (252)
+$l10n["Log out (Q)"] =
+      "Quitter (Q)";
+    // /tools.php (139)
+$l10n["Logarithmic"] =
+      "Logarithmique";
+    // /presentation_wizard.php (199)
+$l10n["Login"] =
+      "Utilisateur";
+    // /include/badlog.tmpl.php (110)
+$l10n["Login message"] =
+      "Message d'accueil";
+    // /include/conf.inc.php (247)
+$l10n["Logs"] =
+      "Journal";
+    // /admin/index.php (128)
+    // /admin/logs.php (50)
+$l10n["Map"] =
+      "Carte";
+    // /print.php (191)
+$l10n["Map file"] =
+      "Fichier map";
+    // /include/model/component.class.php (243)
+$l10n["Map only in %s"] =
+      "Carte seule en %s";
+    // /print.php (93)
+$l10n["Mapfile importation"] =
+      "Importation d'un fichier map";
+    // /import_mapfile.php (46)
+    // /include/model/user.class.php (150)
+$l10n["Measure"] =
+      "Mesure";
+    // /tools.php (119)
+$l10n["Measure (M)"] =
+      "Mesure (M)";
+    // /tools.php (120)
+$l10n["Memo"] =
+      "Mémo";
+    // /include/model/data_column.class.php (85)
+$l10n["Minimum time before deleting temp files (sec)"] =
+      "Temps minimum avant suppression des fichiers temporaires (sec)";
+    // /include/conf.inc.php (274)
+$l10n["Missing parameter: %s for %s connection."] =
+      "Paramètre manquant: %s pour la connection %s.";
+    // /include/database/ogr.db.class.php (72)
+$l10n["Missing query form parameter \"%s\", exiting."] =
+      "Paramètre manquant \"%s\" pour la requète par formulaire. Annulation.";
+    // /include/map.class.php (495)
+    // /include/map.class.php (499)
+    // /include/map.class.php (565)
+    // /include/map.class.php (569)
+$l10n["Missing query form parameter \"%s\", using \"%s\"."] =
+      "Paramètre manquant \"%s\" pour la requète par formulaire. Utilisation de \"%s\".";
+    // /include/map.class.php (436)
+    // /include/map.class.php (512)
+$l10n["Musmap can't read \"%s\"."] =
+      "Musmap ne peut pas lire \"%s\".";
+    // /admin/build_spatial_indexes.php (61)
+$l10n["Musmap database model"] =
+      "Modèle de données de Musmap";
+    // /admin/model.php (55)
+$l10n["Musmap is not able to write SQL log \"%s\"."] =
+      "Musmap ne peut pas écrire le journal SQL \"%s\".";
+    // /include/database/db.class.php (95)
+$l10n["Musmap settings"] =
+      "Paramètres de Musmap";
+    // /admin/create_tables.php (192)
+    // /admin/index.php (74)
+    // /admin/settings.php (115)
+    // /admin/settings.php (207)
+$l10n["Musmap uses frames, please change your browser settings to allow frames."] =
+      "Ce document est composé de cadres (frames), veuillez changez les paramètres de votre navigateur.";
+    // /index.php (87)
+$l10n["MySQL doesn't support SQL catalogs."] =
+      "MySQL ne supporte pas les catalogues SQL.";
+    // /include/database/mysql.db.class.php (246)
+    // /include/database/mysql.db.class.php (271)
+    // /include/database/mysql.db.class.php (302)
+$l10n["N"] =
+      "N";
+    // /admin/fw.test.php (44)
+    // /include/library/type.class.php (119)
+$l10n["New password:"] =
+      "Nouveau mot de passe :";
+    // /change_password.php (76)
+$l10n["New user account:"] =
+      "Nouveau compte utilisateur :";
+    // /admin/users.php (96)
+$l10n["No"] =
+      "Non";
+    // /admin/fw.test.php (51)
+    // /admin/settings.php (358)
+    // /include/library/type.class.php (126)
+$l10n["No children"] =
+      "Pas d'enfant";
+    // /include/model/component.class.php (519)
+$l10n["No color"] =
+      "Pas de couleur";
+    // /admin/fw.test.php (73)
+    // /include/framework/html/htmlframework.class.php (194)
+    // /include/library/type.class.php (148)
+$l10n["No connection."] =
+      "Pas de connection.";
+    // /include/model/data_source.class.php (180)
+$l10n["No data source found."] =
+      "Pas de source de données.";
+    // /get_tables_wizard.php (117)
+$l10n["No database engine!"] =
+      "Pas de moteur de base de données !";
+    // /include/database/db.class.php (114)
+    // /include/database/mapserver.db.class.php (108)
+$l10n["No result."] =
+      "Pas de résultat.";
+    // /include/map.class.php (873)
+$l10n["None"] =
+      "Aucun";
+    // /admin/fw.test.php (87)
+    // /admin/fw.test.php (99)
+    // /admin/fw.test.php (115)
+    // /admin/fw.test.php (144)
+    // /admin/fw.test.php (164)
+    // /admin/fw.test.php (217)
+    // /include/user.inc.php (46)
+    // /include/user.inc.php (66)
+    // /include/framework/html/htmlframework.class.php (211)
+    // /include/framework/html/htmlframework.class.php (223)
+    // /include/framework/html/htmlframework.class.php (239)
+    // /include/framework/html/htmlframework.class.php (268)
+    // /include/framework/html/htmlframework.class.php (288)
+    // /include/framework/html/htmlframework.class.php (375)
+    // /include/framework/framework.class.php (128)
+    // /include/framework/framework.class.php (143)
+    // /include/library/type.class.php (162)
+    // /include/library/type.class.php (174)
+    // /include/library/type.class.php (190)
+    // /include/library/type.class.php (219)
+    // /include/library/type.class.php (239)
+    // /include/library/type.class.php (292)
+    // /include/model/component.class.php (969)
+$l10n["Now"] =
+      "Maintenant";
+    // /include/misc.inc.php (315)
+$l10n["Now that the database is installed, you can set %s."] =
+      "Maintenant que la base est installéé, vous pouvez changer les %s.";
+    // /admin/create_tables.php (191)
+$l10n["Number"] =
+      "Nombre";
+    // /include/model/data_column.class.php (80)
+$l10n["OK"] =
+      "OK";
+    // /admin/check_integrity.php (155)
+    // /print.php (99)
+    // /privileges.php (144)
+    // /include/badlog.tmpl.php (121)
+    // /profile_wizard.php (111)
+$l10n["Object not found."] =
+      "Objet introuvable.";
+    // /privileges.php (157)
+$l10n["Objects:"] =
+      "Objets :";
+    // /admin/data_sources_explorer.php (73)
+    // /profiles_explorer.php (107)
+$l10n["Old password:"] =
+      "Ancien mot de passe :";
+    // /change_password.php (68)
+$l10n["Only the owner can change privileges."] =
+      "Seul le propriétaire peut changer les privilèges.";
+    // /include/model/component.class.php (903)
+$l10n["Operation \"%s\" failed:"] =
+      "Operation \"%s\" echouée:";
+    // /include/map.class.php (326)
+$l10n["Operation aborted."] =
+      "Opération annulée.";
+    // /admin/users.php (92)
+$l10n["Options"] =
+      "Options";
+    // /print.php (123)
+$l10n["Other..."] =
+      "Autre ...";
+    // /tools.php (86)
+$l10n["Output type"] =
+      "Type";
+    // /print.php (80)
+$l10n["Overview"] =
+      "Situation";
+    // /main.php (87)
+$l10n["PHP informations"] =
+      "Informations PHP";
+    // /admin/index.php (91)
+$l10n["Page format"] =
+      "Format";
+    // /print.php (105)
+$l10n["Page setup"] =
+      "Mise en page";
+    // /print.php (57)
+$l10n["Palette"] =
+      "Palette";
+    // /color_picker.php (64)
+    // /color_picker.php (66)
+$l10n["Params for connections (database user and password, ...)"] =
+      "Paramètres de connection (utilisateur et mot de passe de la base de données, ...)";
+    // /include/conf.inc.php (280)
+$l10n["Parent \n(%s)"] =
+      "Parent \n(%s)";
+    // /include/model/component.class.php (164)
+$l10n["Parent node not found for %s: %s."] =
+      "Noeud parent introuvable pour %s : %s.";
+    // /include/model/component.class.php (392)
+$l10n["Password:"] =
+      "Mot de passe :";
+    // /admin/users.php (322)
+    // /include/badlog.tmpl.php (117)
+$l10n["Path to log directory"] =
+      "Ghemin du dossier des logs";
+    // /include/conf.inc.php (262)
+$l10n["Path to temp images"] =
+      "Chemin des images temporaires";
+    // /include/conf.inc.php (256)
+$l10n["Path to temporary directory"] =
+      "Chemin du dossier temporaire";
+    // /include/conf.inc.php (265)
+$l10n["Path to the file listing font files"] =
+      "Chemin du fichier listant les polices";
+    // /include/conf.inc.php (271)
+$l10n["Path to the map template"] =
+      "Chemin du fichier map modèle";
+    // /include/conf.inc.php (268)
+$l10n["Pick a color"] =
+      "Choisir une couleur";
+    // /admin/fw.test.php (68)
+    // /include/framework/html/htmlframework.class.php (189)
+    // /include/library/type.class.php (143)
+$l10n["Please enter valid user name and password."] =
+      "Veuillez entrer un nom d'utilisateur et un mot de passe valide.";
+    // /include/model/user.class.php (193)
+    // /include/model/user.class.php (197)
+    // /include/model/user.class.php (205)
+    // /include/model/user.class.php (209)
+$l10n["Please specify a valid directory."] =
+      "Veuillez spécifier un dossier valide.";
+    // /admin/build_spatial_indexes.php (70)
+$l10n["Please wait..."] =
+      "Veuillez patienter ...";
+    // /query.php (122)
+    // /query_form.php (114)
+    // /main.php (88)
+$l10n["Point"] =
+      "Point";
+    // /include/model/data_source.class.php (111)
+    // /include/model/profile_data.class.php (135)
+    // /include/model/profile_data.class.php (142)
+    // /include/model/symbol.class.php (211)
+$l10n["Polygon"] =
+      "Polygone";
+    // /include/model/data_source.class.php (110)
+    // /include/model/profile_data.class.php (134)
+    // /include/model/profile_data.class.php (141)
+    // /include/model/symbol.class.php (213)
+$l10n["Poor (%d dpi)"] =
+      "Brouillon (%d dpi)";
+    // /print.php (134)
+$l10n["Precision:"] =
+      "Précision:";
+    // /presentation_wizard.php (192)
+$l10n["Presentation wizard"] =
+      "Assistant présentation";
+    // /presentation_wizard.php (59)
+    // /include/model/profile_data.class.php (183)
+$l10n["Print"] =
+      "Imprimer";
+    // /tools.php (125)
+$l10n["Print (%d dpi)"] =
+      "Impression (%d dpi)";
+    // /print.php (137)
+$l10n["Print (P)"] =
+      "Imprimer (P)";
+    // /tools.php (126)
+$l10n["Print preview"] =
+      "Prévisualisation";
+    // /print_execute.php (134)
+$l10n["Privileges"] =
+      "Privilèges";
+    // /privileges.php (93)
+$l10n["Privileges..."] =
+      "Privilèges ...";
+    // /include/model/component.class.php (224)
+    // /include/model/component.class.php (233)
+$l10n["Profile"] =
+      "Profil";
+    // /tools.php (130)
+$l10n["Profile \"%s\" successfully created."] =
+      "Création du profil \"%s\" réussie.";
+    // /profile_wizard.php (200)
+$l10n["Profile wizard"] =
+      "Assistant profil";
+    // /include/model/profile.class.php (156)
+$l10n["Profiles"] =
+      "Profils";
+    // /admin/users.php (193)
+$l10n["Progression:"] =
+      "Progression:";
+    // /presentation_wizard.php (195)
+$l10n["Projections"] =
+      "Projections";
+    // /admin/data_sources_explorer.php (80)
+$l10n["Public profile"] =
+      "Profil public";
+    // /admin/users.php (212)
+$l10n["Queries..."] =
+      "Requêtes ...";
+    // /tools.php (99)
+$l10n["Query by point/rectangle"] =
+      "Requête par point/rectangle";
+    // /tools.php (96)
+$l10n["Query form not found: \"%s\"."] =
+      "Formulaire de requête introuvable : \"%s\".";
+    // /include/map.class.php (581)
+$l10n["Query on point:"] =
+      "Requête au point :";
+    // /query.php (126)
+$l10n["Query on rectangle:"] =
+      "Requête au rectangle :";
+    // /query.php (131)
+$l10n["Query results"] =
+      "Résultats de la requête";
+    // /query.php (61)
+$l10n["Raster"] =
+      "Raster";
+    // /include/model/data_source.class.php (107)
+    // /include/model/data_source.class.php (107)
+    // /include/model/data_source.class.php (108)
+$l10n["Read only"] =
+      "Lecture seule";
+    // /admin/settings.php (227)
+$l10n["Red: DELETED."] =
+      "Rouge : SUPPRIME.";
+    // /include/misc.inc.php (116)
+$l10n["Reference map"] =
+      "Carte de situation";
+    // /print.php (185)
+$l10n["Reference map not found: \"%s\"."] =
+      "Mini-carte introuvable : \"%s\".";
+    // /include/model/map_reference.class.php (111)
+$l10n["Refresh"] =
+      "Mettre à jour";
+    // /admin/sessions.php (83)
+    // /tools.php (88)
+$l10n["Refresh (R)"] =
+      "Mettre à jour (R)";
+    // /tools.php (90)
+$l10n["Relations table"] =
+      "Table de relations";
+    // /include/model/data_source.class.php (105)
+$l10n["Reload"] =
+      "Recharger";
+    // /admin/check_integrity.php (82)
+    // /admin/logs.php (84)
+$l10n["Reload legend"] =
+      "Recharger la légende";
+    // /layers.php (71)
+$l10n["Reload toolbar"] =
+      "Recharger la barre d'outils";
+    // /include/model/profile.class.php (145)
+$l10n["Requesting for an unexisting root: \"%s\"."] =
+      "Recherche d'une racine inexistante : \"%s\".";
+    // /include/model/component.inc.php (81)
+$l10n["Reset"] =
+      "Initialiser";
+    // /admin/settings.php (388)
+$l10n["Resolution"] =
+      "Résolution";
+    // /print.php (127)
+$l10n["Right"] =
+      "Droite";
+    // /print.php (170)
+$l10n["Root dir of musmap"] =
+      "Dossier racine de MUSMAP";
+    // /include/conf.inc.php (250)
+$l10n["SQL catalogs not supported."] =
+      "Catalogues SQL non supportés.";
+    // /include/database/dbase_file.db.class.php (135)
+    // /include/database/dbase_file.db.class.php (157)
+    // /include/database/dbase_file.db.class.php (200)
+$l10n["SQL schema not supported."] =
+      "Schémas SQL non supportés.";
+    // /include/database/dbase_file.db.class.php (138)
+    // /include/database/dbase_file.db.class.php (160)
+    // /include/database/dbase_file.db.class.php (203)
+$l10n["Scale"] =
+      "Echelle";
+    // /tools.php (74)
+    // /main.php (80)
+    // /main.php (81)
+$l10n["Screen (%d dpi)"] =
+      "Ecran (%d dpi)";
+    // /print.php (131)
+$l10n["Send"] =
+      "Envoyer";
+    // /import_mapfile.php (191)
+    // /presentation_wizard.php (285)
+$l10n["Session life time (seconds)"] =
+      "Durée de vie d'une session (secondes)";
+    // /include/conf.inc.php (321)
+$l10n["Sessions management"] =
+      "Gestionnaire de sessions";
+    // /admin/index.php (58)
+    // /admin/sessions.php (44)
+$l10n["Set current extent"] =
+      "Changer l'étendue en cours";
+    // /include/model/extent.class.php (155)
+$l10n["Shape"] =
+      "Shape";
+    // /include/model/data_source.class.php (110)
+    // /include/model/data_source.class.php (111)
+    // /include/model/data_source.class.php (112)
+    // /include/model/data_source.class.php (113)
+$l10n["Show"] =
+      "Afficher";
+    // /include/model/query_result.class.php (103)
+$l10n["Show dependencies tree"] =
+      "Afficher l'arbre des dépendances";
+    // /admin/build_dependency_tree.php (203)
+    // /admin/index.php (101)
+$l10n["Show mapfile"] =
+      "Montrer le fichier map";
+    // /include/model/profile.class.php (372)
+$l10n["Shown always"] =
+      "Affiché toujours";
+    // /include/map.inc.php (58)
+$l10n["Shown from 1/%d"] =
+      "Affiché à partir du %d-ème";
+    // /include/map.inc.php (56)
+$l10n["Shown from 1/%d toward 1/%d"] =
+      "Affiché du %d-ème au %d-ème";
+    // /include/map.inc.php (52)
+$l10n["Shown toward 1/%d"] =
+      "Affiché jusqu'au %d-ème";
+    // /include/map.inc.php (54)
+$l10n["Simple"] =
+      "Simple";
+    // /include/model/symbol.class.php (147)
+$l10n["Some errors occured when creating musmap tables."] =
+      "Des erreurs sont apparues lors de la création des tables de musmap.";
+    // /admin/create_tables.php (194)
+$l10n["String"] =
+      "Chaîne";
+    // /include/model/data_column.class.php (81)
+$l10n["Strings"] =
+      "Textes";
+    // /presentation_wizard.php (175)
+$l10n["Strings:"] =
+      "Textes :";
+    // /presentation_wizard.php (207)
+$l10n["Style"] =
+      "Style";
+    // /print.php (146)
+$l10n["Style:"] =
+      "Style :";
+    // /presentation_wizard.php (222)
+$l10n["Symbols"] =
+      "Symboles";
+    // /admin/data_sources_explorer.php (83)
+$l10n["Table"] =
+      "Table";
+    // /include/model/data_source.class.php (103)
+$l10n["Tables to backup"] =
+      "Tables à archiver";
+    // /include/conf.inc.php (283)
+$l10n["Text scale"] =
+      "Echelle texte";
+    // /print.php (198)
+$l10n["The current framework does'nt render element of type  \"%s\"."] =
+      "Le framework actuel ne supporte pas les élements de type  \"%s\".";
+    // /include/framework/framework.class.php (393)
+$l10n["The current framework does'nt support  \"%s\"."] =
+      "Le framework actuel ne supporte pas  \"%s\".";
+    // /include/framework/framework.class.php (278)
+$l10n["The file does'nt exists."] =
+      "Le fichier n'existe pas.";
+    // /admin/settings.php (375)
+$l10n["The label column of layer \"%s\" is not set."] =
+      "La colonne de l'étiquette de la couche \"%s\" n'est pas spécifiée.";
+    // /include/model/label.class.php (55)
+$l10n["The old password is not good!"] =
+      "L'ancien mot de passe n'est pas bon !";
+    // /include/model/user.class.php (238)
+$l10n["The server can't access to this file"] =
+      "Le serveur n'a pas accès au fichier";
+    // /admin/settings.php (373)
+$l10n["The server does'nt have the privilege to read the file."] =
+      "Le serveur n'a pas le droit d'écrire le fichier.";
+    // /admin/settings.php (376)
+$l10n["This tool permit to import Mapserver mapfiles."] =
+      "Cet outil permet d'importer des fichiers map de Mapserver.";
+    // /import_mapfile.php (184)
+$l10n["Tile (Raster)"] =
+      "Tuile (Raster)";
+    // /include/model/data_source.class.php (108)
+$l10n["Tomorrow"] =
+      "Demain";
+    // /include/misc.inc.php (336)
+$l10n["Tools"] =
+      "Outils";
+    // /admin/index.php (108)
+$l10n["Tree View"] =
+      "Arborescence";
+    // /include/model/dbrecordexplorer.class.php (134)
+$l10n["Type of form query unknown: \"%s\"."] =
+      "Type de requête par formulaire inconnu : \"%s\".";
+    // /include/map.class.php (576)
+$l10n["Unable to change %s (%s)"] =
+      "Impossible de changer %s (%s)";
+    // /include/model/component.class.php (582)
+$l10n["Unable to change layer type (layer not loaded)."] =
+      "Impossible de changer le type de couche (couche non chargée).";
+    // /include/model/profile_data.class.php (259)
+$l10n["Unable to clone %s: %s."] =
+      "Impossible de cloner %s : %s.";
+    // /include/model/component.class.php (386)
+$l10n["Unable to create profile."] =
+      "Impossible de créer le profil.";
+    // /import_mapfile.php (173)
+    // /profile_wizard.php (141)
+$l10n["Unable to execute query \"%s\"."] =
+      "Impossible d'exécuter la requête \"%s\".";
+    // /admin/create_tables.php (75)
+    // /admin/create_tables.php (90)
+$l10n["Unable to find %s field definition for field \"%s\" in table \"%s\"."] =
+      "Impossible de trouver la définition du champ %s \"%s\" dans la table \"%s\".";
+    // /include/database/ogr.db.class.php (378)
+$l10n["Unable to find %s table \"%s\"."] =
+      "Impossible de trouver la table %s \"%s\".";
+    // /include/database/ogr.db.class.php (335)
+    // /include/database/ogr.db.class.php (388)
+$l10n["Unable to find %s table definition for table \"%s\"."] =
+      "Impossible de trouver la définition de la table %s \"%s\".";
+    // /include/database/ogr.db.class.php (331)
+    // /include/database/ogr.db.class.php (384)
+$l10n["Unable to get InformationSchema for Musmap database."] =
+      "Impossible d'obtenir InformationSchema pour la base Musmap.";
+    // /admin/localization.php (201)
+$l10n["Unable to get layer type (layer not loaded)."] =
+      "Impossible d'obtenir le type de couche (couche non chargée).";
+    // /include/model/profile_data.class.php (226)
+$l10n["Unable to join column \"%s\" to \"%s\"."] =
+      "Impossible de joindre  la colonne \"%s\" `a \"%s\".";
+    // /include/model/data_column.class.php (209)
+$l10n["Unable to load documentation."] =
+      "Impossible de charger la documentation.";
+    // /doc.php (93)
+    // /doc.php (109)
+$l10n["Unable to load map. Check if data sources exists."] =
+      "Impossible de charger la carte. Vérifiez que les sources de données existent.";
+    // /include/map.class.php (715)
+$l10n["Unable to open file \"%s\"."] =
+      "Impossible d'ouvrir le fichier \"%s\".";
+    // /include/database/db.class.php (374)
+    // /include/database/db.class.php (504)
+$l10n["Unable to open the mapfile."] =
+      "Impossible d'ouvrir le fichier .map.";
+    // /import_mapfile.php (177)
+$l10n["Unable to read directory."] =
+      "Impossible de lire le dossier.";
+    // /admin/build_spatial_indexes.php (67)
+$l10n["Unknow connection type: %s."] =
+      "Type de connection inconnu : %s.";
+    // /include/data_sources.inc.php (121)
+$l10n["Unknow layer type: \"%s\"."] =
+      "Type de couche inconnu : \"%s\".";
+    // /include/model/profile_data.class.php (251)
+    // /include/model/profile_data.class.php (289)
+$l10n["Unknown %s type \"%s\"."] =
+      "Type %s inconnu \"%s\".";
+    // /include/database/ogr.db.class.php (415)
+$l10n["Unknown %s type: \"%s\"."] =
+      "Type %s inconnu: \"%s\".";
+    // /include/database/db.class.php (759)
+    // /include/database/dbase_file.db.class.php (258)
+    // /include/database/mysql.db.class.php (442)
+    // /include/database/ogr.db.class.php (188)
+    // /include/database/ogr.db.class.php (243)
+$l10n["Unknown database engine."] =
+      "Moteur de bases de données inconnu.";
+    // /include/database/db.class.php (62)
+$l10n["Unknown format : \"%s\""] =
+      "Format inconnu : \"%s\"";
+    // /print_execute.php (96)
+$l10n["Unknown framework element type: \"%s\"."] =
+      "Type d'élement de framework inconnu : \"%s\".";
+    // /include/framework/framework.class.php (396)
+$l10n["Unknown query shape object."] =
+      "Objet graphique de requête inconnu.";
+    // /include/database/mapserver.db.class.php (330)
+$l10n["Unknown setting"] =
+      "Paramètre inconnu";
+    // /admin/settings.php (213)
+$l10n["Unknown shape file type \"%s\" for file \"%s\" ."] =
+      "Type de fichier shape inconnu \"%s\" pour le fichier \"%s\" .";
+    // /include/database/mapserver.db.class.php (371)
+$l10n["Unknown symbol type: \"%s\"."] =
+      "Type de symbole inconnu : \"%s\".";
+    // /include/model/symbol.class.php (241)
+$l10n["Untitled"] =
+      "Sans titre";
+    // /profile_wizard.php (64)
+    // /profile_wizard.php (120)
+$l10n["Untitled data source"] =
+      "Source sans titre";
+    // /include/model/connection.class.php (56)
+$l10n["Untitled symbol"] =
+      "Symbole sans titre";
+    // /include/model/symbol.class.php (56)
+$l10n["Url of musmap root dir"] =
+      "Url du dossier racine de MUSMAP";
+    // /include/conf.inc.php (253)
+$l10n["Url to temp images"] =
+      "Url des images temporaires";
+    // /include/conf.inc.php (259)
+$l10n["User account"] =
+      "Compte utilisateur";
+    // /admin/users.php (191)
+$l10n["User account name:"] =
+      "Nom du compte utilisateur :";
+    // /admin/users.php (314)
+$l10n["User account:"] =
+      "Compte utilisateur :";
+    // /change_password.php (60)
+$l10n["User accounts"] =
+      "Comptes utilisateur";
+    // /admin/users.php (187)
+$l10n["User accounts management"] =
+      "Gestion des comptes utilisateur";
+    // /admin/index.php (52)
+    // /admin/users.php (47)
+$l10n["User:"] =
+      "Utilisateur :";
+    // /include/badlog.tmpl.php (115)
+$l10n["Users with access to admin pages"] =
+      "Users ayant accès aux pages d'administration";
+    // /include/conf.inc.php (312)
+$l10n["Values:"] =
+      "Valeurs:";
+    // /presentation_wizard.php (210)
+$l10n["Vector"] =
+      "Vecteur";
+    // /include/model/symbol.class.php (143)
+$l10n["Warning"] =
+      "Avertissement";
+    // /include/framework/framework.class.php (423)
+$l10n["With private profiles:"] =
+      "Pour les profils privés :";
+    // /admin/users.php (266)
+$l10n["With public profiles:"] =
+      "Pour les profils publics :";
+    // /admin/users.php (249)
+$l10n["With selection:"] =
+      "Pour la sélection :";
+    // /admin/users.php (241)
+$l10n["Y"] =
+      "O";
+    // /admin/fw.test.php (41)
+    // /include/library/type.class.php (116)
+$l10n["Yes"] =
+      "Oui";
+    // /admin/fw.test.php (48)
+    // /admin/create_tables.php (64)
+    // /admin/settings.php (355)
+    // /include/library/type.class.php (123)
+$l10n["Yesterday"] =
+      "Hier";
+    // /include/misc.inc.php (333)
+$l10n["You can't change %s (%s)."] =
+      "Vous ne pouvez pas modifier %s (%s).";
+    // /include/model/component.class.php (593)
+    // /include/model/component.class.php (741)
+    // /include/model/component.class.php (833)
+    // /include/model/component.class.php (900)
+$l10n["You can't delete %s (%s)."] =
+      "Vous ne pouvez pas supprimer %s (%s).";
+    // /include/model/component.class.php (610)
+$l10n["You can't delete children of %s (%s)."] =
+      "Vous ne pouvez pas supprimer les enfants de %s (%s).";
+    // /include/model/component.class.php (639)
+$l10n["You don't have access to \"%s\"."] =
+      "Vous n'avez pas accès à \"%s\".";
+    // /include/model/map_reference.class.php (105)
+    // /include/model/symbol.class.php (114)
+$l10n["You don't have sufficient privileges for this area."] =
+      "Vous n'avez pas les droits nécessaires pour cette zone.";
+    // /include/model/user.class.php (212)
+$l10n["You have logged out."] =
+      "Vous vous êtes déconnecté.";
+    // /include/model/user.class.php (204)
+$l10n["You need special privileges to enter in this area."] =
+      "Vous ne benéficiez pas des privilèges nécessaires pour accéder à cette zone.";
+    // /include/model/user.class.php (180)
+$l10n["Your browser seems to be to old, please download a modern browser."] =
+      "Votre navigateur semble trop ancien, veuillez en télécharger un récent.";
+    // /index.php (90)
+$l10n["Your new password is empty!"] =
+      "Votre nouveau mot de passe est vide !";
+    // /include/model/user.class.php (223)
+$l10n["Your new password should be repeated exactly!"] =
+      "Votre nouveau mot de passe doit être répeté exactement !";
+    // /include/model/user.class.php (225)
+$l10n["Your session has expired."] =
+      "Votre session est arrivée à expiration.";
+    // /include/model/user.class.php (208)
+$l10n["Your user name or password is invalid."] =
+      "Votre nom d'utilisateur ou votre mot de passe est invalide.";
+    // /include/model/user.class.php (192)
+$l10n["Zoom factor"] =
+      "Facteur de zoom";
+    // /tools.php (72)
+$l10n["Zoom in (+)"] =
+      "Zoom + (+)";
+    // /tools.php (66)
+$l10n["Zoom init"] =
+      "Zoom initial";
+    // /tools.php (60)
+$l10n["Zoom out (-)"] =
+      "Zoom - (-)";
+    // /tools.php (69)
+$l10n["Zoom to layer"] =
+      "Zoomer sur la couche";
+    // /include/map.class.php (326)
+$l10n["[Empty]"] =
+      "[Vide]";
+    // /include/model/data_source.class.php (287)
+$l10n["[NULL]"] =
+      "[NUL]";
+    // /include/model/data_source.class.php (289)
+$l10n["_date"] =
+      "j/n/Y H:i:s";
+    // /include/misc.inc.php (339)
+    // /include/model/session.class.php (46)
+$l10n["_locale"] =
+      "fr_FR at euro;fr_FR;fr;C";
+    // /include/conf.inc.php (177)
+    // /include/conf.inc.php (178)
+$l10n["_time"] =
+      "H:i:s";
+    // /include/misc.inc.php (330)
+    // /include/misc.inc.php (333)
+    // /include/misc.inc.php (336)
+$l10n["automatic"] =
+      "automatique";
+    // /include/model/label.class.php (214)
+$l10n["center center"] =
+      "centre centre";
+    // /include/model/label.class.php (219)
+$l10n["center left"] =
+      "centre gauche";
+    // /include/model/label.class.php (218)
+$l10n["center right"] =
+      "centre droite";
+    // /include/model/label.class.php (220)
+$l10n["here"] =
+      "ici";
+    // /include/model/component.inc.php (124)
+$l10n["in %s %s"] =
+      "dans %s %s";
+    // /include/misc.inc.php (321)
+    // /include/misc.inc.php (327)
+$l10n["lower center"] =
+      "bas centre";
+    // /include/model/label.class.php (222)
+$l10n["lower left"] =
+      "bas gauche";
+    // /include/model/label.class.php (221)
+$l10n["lower right"] =
+      "bas droite";
+    // /include/model/label.class.php (223)
+$l10n["minutes"] =
+      "minutes";
+    // /include/misc.inc.php (324)
+    // /include/misc.inc.php (327)
+$l10n["msDBFGetItemIndex()"] =
+      "Lecture d'un champ DBF";
+    // /include/map.class.php (629)
+$l10n["msDrawMap()"] =
+      "Dessin de la carte";
+    // /include/map.class.php (627)
+$l10n["msSHPOpenFile()"] =
+      "Ouverture du fichier shape";
+    // /include/map.class.php (628)
+$l10n["seconds"] =
+      "secondes";
+    // /include/misc.inc.php (318)
+    // /include/misc.inc.php (321)
+$l10n["upper center"] =
+      "haut centre";
+    // /include/model/label.class.php (216)
+$l10n["upper left"] =
+      "haut gauche";
+    // /include/model/label.class.php (215)
+$l10n["upper right"] =
+      "haut droite";
+    // /include/model/label.class.php (217)
+$l10n["used technologies"] =
+      "technologies utilisées";
+    // /about.php (46)
+    // /include/badlog.tmpl.php (126)
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/data/lang/fr/model.lang.php
===================================================================
--- packages/musmap/branches/upstream/current/data/lang/fr/model.lang.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/data/lang/fr/model.lang.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,281 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * fr: model
+   * @package lang
+   * @subpackage fr
+   */
+
+$model_l10n["class"]="thème de légende";
+$model_l10n["a_class"]="un thème de légende";
+$model_l10n["id_class"]="thème de légende";
+$model_l10n["class_name"]="nom";
+$model_l10n["class_expression"]="expression";
+$model_l10n["class_index"]="position";
+
+$model_l10n["connection"]="connection";
+$model_l10n["a_connection"]="une connection";
+$model_l10n["id_connection"]="connection";
+$model_l10n["connection_name"]="nom";
+$model_l10n["connection_driver"]="pilote";
+$model_l10n["connection_params"]="paramètres";
+$model_l10n["connection_owner_id"]="propriétaire";
+$model_l10n["connection_reader_group_id"]="groupe lecture";
+$model_l10n["connection_writer_group_id"]="groupe écriture";
+$model_l10n["connection_privileges"]="privilèges";
+$model_l10n["connection_modification_time"]="date de modification";
+
+$model_l10n["data_column"]="colonne";
+$model_l10n["a_data_column"]="une colonne";
+$model_l10n["id_data_column"]="colonne";
+$model_l10n["column_code"]="nom de la colonne";
+$model_l10n["column_short_label"]="intitulé court";
+$model_l10n["column_long_label"]="intitulé long";
+$model_l10n["column_visible"]="visible";
+$model_l10n["column_index"]="position";
+$model_l10n["column_is_decodification"]="décodifie";
+$model_l10n["column_type"]="type";
+$model_l10n["column_expression"]="expression";
+
+$model_l10n["extent"]="étendue";
+$model_l10n["a_extent"]="une étendue";
+$model_l10n["id_extent"]="étendue";
+$model_l10n["extent_name"]="nom de l'étendue";
+$model_l10n["extent_minx"]="X min";
+$model_l10n["extent_miny"]="Y min";
+$model_l10n["extent_maxx"]="X max";
+$model_l10n["extent_maxy"]="Y max";
+$model_l10n["extent_owner_id"]="propriétaire";
+$model_l10n["extent_reader_group_id"]="groupe lecture";
+$model_l10n["extent_writer_group_id"]="groupe écriture";
+$model_l10n["extent_privileges"]="privilèges";
+$model_l10n["extent_modification_time"]="date de modification";
+
+$model_l10n["group"]="groupe";
+$model_l10n["a_group"]="un groupe";
+$model_l10n["id_group"]="groupe";
+$model_l10n["group_name"]="nom du groupe";
+
+$model_l10n["label"]="étiquette";
+$model_l10n["a_label"]="une étiquette";
+$model_l10n["id_label"]="étiquette";
+$model_l10n["label_column"]="colonne affichée";
+$model_l10n["label_encoding"]="encodage des caractères";
+$model_l10n["label_font"]="police";
+$model_l10n["label_color"]="couleur du texte";
+$model_l10n["label_minscale"]="échelle minimale d'affichage";
+$model_l10n["label_maxscale"]="échelle maximale d'affichage";
+$model_l10n["label_force_visibility"]="permettre la superposition des annotations";
+$model_l10n["label_default_size"]="taille par défaut";
+$model_l10n["label_size"]="colonne de la taille";
+$model_l10n["label_default_angle"]="angle par défaut";
+$model_l10n["label_angle"]="colonne de l'angle";
+$model_l10n["label_position"]="position";
+$model_l10n["label_rect_color"]="couleur du rectangle";
+$model_l10n["label_rect_shadow_color"]="couleur du de l'ombre rectangle";
+$model_l10n["label_rect_shadow_size"]="taille de l'ombre du rectangle";
+$model_l10n["label_buffer"]="marge";
+$model_l10n["label_outline_color"]="couleur du contour";
+$model_l10n["label_partials"]="dessiner en bordure d'image";
+$model_l10n["label_shadow_color"]="couleur du de l'ombre";
+$model_l10n["label_shadow_size"]="taille de l'ombre";
+
+$model_l10n["map_reference"]="mini-carte";
+$model_l10n["a_map_reference"]="une mini-carte";
+$model_l10n["id_map_reference"]="mini-carte";
+$model_l10n["reference_name"]="nom de la mini-carte";
+$model_l10n["reference_path"]="chemin de l'image";
+$model_l10n["reference_owner_id"]="propriétaire";
+$model_l10n["reference_reader_group_id"]="groupe lecture";
+$model_l10n["reference_writer_group_id"]="groupe écriture";
+$model_l10n["reference_privileges"]="privilèges";
+$model_l10n["reference_modification_time"]="date de modification";
+
+$model_l10n["profile_extent"]="étendue du profil";
+$model_l10n["a_profile_extent"]="une étendue du profil";
+
+$model_l10n["profile"]="profil";
+$model_l10n["a_profile"]="un profil";
+$model_l10n["id_profile"]="profil";
+$model_l10n["profile_name"]="nom du profil";
+$model_l10n["profile_is_public"]="profil public";
+$model_l10n["profile_owner_id"]="propriétaire";
+$model_l10n["profile_reader_group_id"]="groupe lecture";
+$model_l10n["profile_writer_group_id"]="groupe écriture";
+$model_l10n["profile_privileges"]="privilèges";
+$model_l10n["profile_modification_time"]="date de modification";
+
+$model_l10n["profile_column"]="colonne du profil";
+$model_l10n["a_profile_column"]="une colonne du profil";
+$model_l10n["id_profile_column"]="colonne du profil";
+$model_l10n["profile_column_index"]="position";
+$model_l10n["profile_column_visible"]="visibilité";
+
+$model_l10n["profile_data"]="donnée du profil";
+$model_l10n["a_profile_data"]="une donnée du profil";
+$model_l10n["id_profile_data"]="donnée du profil";
+$model_l10n["profile_data_title"]="nom de la donnée du profil";
+$model_l10n["profile_data_index"]="position";
+$model_l10n["profile_data_visible"]="visible";
+$model_l10n["profile_data_owner_id"]="propriétaire";
+$model_l10n["profile_data_reader_group_id"]="groupe lecture";
+$model_l10n["profile_data_writer_group_id"]="groupe écriture";
+$model_l10n["profile_data_privileges"]="privilèges";
+$model_l10n["profile_data_modification_time"]="date de modification";
+$model_l10n["layer_minscale"]="échelle minimale d'affichage";
+$model_l10n["layer_maxscale"]="échelle maximale d'affichage";
+$model_l10n["layer_group"]="groupe";
+$model_l10n["layer_symbols_scale"]="échelle de réference des symboles";
+$model_l10n["layer_classitem"]="colonne d'étude par défaut";
+$model_l10n["layer_opacity"]="opacité";
+$model_l10n["layer_type"]="type de shape";
+$model_l10n["raster_offsite"]="couleur de transparence (offsite)";
+
+$model_l10n["projection"]="projection";
+$model_l10n["a_projection"]="une projection";
+$model_l10n["id_projection"]="projection";
+$model_l10n["projection_name"]="nom de la projection";
+$model_l10n["projection_params"]="paramètres de la projection";
+$model_l10n["projection_owner_id"]="propriétaire";
+$model_l10n["projection_reader_group_id"]="groupe lecture";
+$model_l10n["projection_writer_group_id"]="groupe écriture";
+$model_l10n["projection_privileges"]="privilèges";
+$model_l10n["projection_modification_time"]="date de modification";
+
+$model_l10n["query_form"]="formulaire";
+$model_l10n["a_query_form"]="un formulaire";
+$model_l10n["id_query_form"]="formulaire";
+$model_l10n["query_form_menu_title"]="titre dans le menu";
+$model_l10n["query_form_title"]="titre de la fenêtre";
+$model_l10n["query_form_header"]="en-tête HTML";
+$model_l10n["query_form_form"]="formulaire HTML";
+$model_l10n["query_form_params"]="paramètres";
+$model_l10n["query_form_owner_id"]="propriétaire";
+$model_l10n["query_form_reader_group_id"]="groupe lecture";
+$model_l10n["query_form_writer_group_id"]="groupe écriture";
+$model_l10n["query_form_privileges"]="privilèges";
+$model_l10n["query_form_modification_time"]="date de modification";
+
+$model_l10n["query_result"]="résultat de requête";
+$model_l10n["a_query_result"]="un résultat de requête";
+$model_l10n["id_query_result"]="résultat de requête";
+$model_l10n["query_result_name"]="nom";
+$model_l10n["query_result_data"]="donnée du résultat";
+$model_l10n["query_result_owner_id"]="propriétaire";
+$model_l10n["query_result_reader_group_id"]="groupe lecture";
+$model_l10n["query_result_writer_group_id"]="groupe écriture";
+$model_l10n["query_result_privileges"]="privilèges";
+$model_l10n["query_result_modification_time"]="date de modification";
+
+$model_l10n["relation"]="relation";
+$model_l10n["a_relation"]="une relation";
+$model_l10n["id_relation"]="relation";
+$model_l10n["dat_id_data_column"]="colonne cible (clé primaire)";
+$model_l10n["relation_label_fk_pk"]="intitulé FK->PK";
+$model_l10n["relation_min_cardinality_fk_pk"]="cardinalité mini FK->PK";
+$model_l10n["relation_label_pk_fk"]="intitulé PK->FK";
+$model_l10n["relation_min_cardinality_pk_fk"]="cardinalité mini PK->FK";
+$model_l10n["relation_max_cardinality_pk_fk"]="cardinalité mini PK->FK";
+
+$model_l10n["session"]="session";
+$model_l10n["a_session"]="une session";
+$model_l10n["session_id"]="session";
+$model_l10n["session_creation_time"]="date de création";
+$model_l10n["session_modification_time"]="date de modification";
+
+$model_l10n["style"]="style";
+$model_l10n["a_style"]="un style";
+$model_l10n["id_style"]="style";
+$model_l10n["style_name"]="nom du style";
+$model_l10n["style_background_color"]="couleur du fond";
+$model_l10n["style_color"]="couleur du style";
+$model_l10n["style_outline_color"]="couleur du contour";
+$model_l10n["style_size"]="taille du symbole du style";
+$model_l10n["style_symbol_maxsize"]="taille maximale";
+$model_l10n["style_symbol_minsize"]="taille minimale";
+$model_l10n["style_index"]="position";
+
+$model_l10n["symbol"]="symbole";
+$model_l10n["a_symbol"]="un symbole";
+$model_l10n["id_symbol"]="symbole";
+$model_l10n["symbol_family"]="famille du symbole";
+$model_l10n["symbol_name"]="nom du symbole";
+$model_l10n["symbol_type"]="type de symbole";
+$model_l10n["symbol_filled"]="symbole plein";
+$model_l10n["symbol_font"]="police du symbole";
+$model_l10n["symbol_image_path"]="chemin de l'image du symbole";
+$model_l10n["symbol_points"]="points du symbole";
+$model_l10n["symbol_style"]="style de pointillé du symbole";
+$model_l10n["symbol_owner_id"]="propriétaire";
+$model_l10n["symbol_reader_group_id"]="groupe lecture";
+$model_l10n["symbol_writer_group_id"]="groupe écriture";
+$model_l10n["symbol_privileges"]="privilèges";
+$model_l10n["symbol_modification_time"]="date de modification";
+
+$model_l10n["data_source"]="source de données";
+$model_l10n["a_data_source"]="une source de données";
+$model_l10n["id_data_source"]="source de données";
+$model_l10n["data_source_catalog"]="catalogue";
+$model_l10n["data_source_schema"]="schéma";
+$model_l10n["data_source_name"]="nom";
+$model_l10n["data_source_label"]="intitulé";
+$model_l10n["data_source_params"]="paramètres";
+$model_l10n["data_source_type"]="type";
+$model_l10n["data_source_doc"]="documentation";
+$model_l10n["data_source_owner_id"]="propriétaire";
+$model_l10n["data_source_reader_group_id"]="groupe lecture";
+$model_l10n["data_source_writer_group_id"]="groupe écriture";
+$model_l10n["data_source_privileges"]="privilèges";
+$model_l10n["data_source_modification_time"]="date de modification";
+            
+$model_l10n["tool_setting"]="configuration";
+$model_l10n["a_tool_setting"]="un paramètre";
+$model_l10n["setting_code"]="paramètre";
+$model_l10n["setting_value"]="valeur";
+
+$model_l10n["user"]="utilisateur";
+$model_l10n["a_user"]="un utilisateur";
+$model_l10n["id_user"]="utilisateur";
+$model_l10n["user_name"]="nom d'utilisateur";
+$model_l10n["user_password"]="mot de passe";
+
+$model_l10n["users_group"]="groupe d'utilisateurs";
+$model_l10n["a_users_group"]="un groupe d'utilisateurs";
+
+// Virtual tables
+$model_l10n["connections_list"]="connections";
+$model_l10n["extents_list"]="étendues";
+$model_l10n["map_references_list"]="mini-cartes";
+$model_l10n["profiles_list"]="profils";
+$model_l10n["projections_list"]="projections";
+$model_l10n["query_forms_list"]="formulaires";
+$model_l10n["query_results_list"]="résultats";
+$model_l10n["symbols_list"]="symbols";
+?>

Added: packages/musmap/branches/upstream/current/doc.php
===================================================================
--- packages/musmap/branches/upstream/current/doc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/doc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,115 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Data documentation
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  $user=new t_user();
+  
+  if(!isset($_GET['rel_path'])) {
+    $rel_path='';
+  } else {
+    $rel_path=str_replace('\\','/',$_GET['rel_path']);
+  }
+  //security check:
+  $rel_path=preg_replace('/([\/]?[^\/]*[\/]?[\.]{2,})/', '', $rel_path);
+  $oConnections= & LibComponent::Load('connections');
+  $oTable = &$oConnections->GetSubItemByClassNameAndAttribute('data_source', 'id_data_source',
+     $_GET['id_data_source']);
+  if($oTable) {
+    if(substr($oTable->Attributes->Value('data_source_doc'),0,7) == 'http://') {
+      Header('location: '.$oTable->Attributes->Value('data_source_doc'));
+      exit;
+    } else {
+      $doc_path= $oTable->Attributes->Value('data_source_doc').$rel_path;
+      if(is_file($doc_path)) {
+        $conf['debug_level']=Conf::get('debug_level') & ! E_MUSMAP_PERFORMANCE;
+        switch(substr($doc_path,-4)) {
+          case '.doc':
+            $mime_type='application/msword';
+            break;
+          default:
+            $mime_type='application/octet-stream';
+        }
+        header('Content-type: '.$mime_type);
+        header('Content-Disposition: attachment; filename="'.basename($doc_path).'"');
+        readfile($doc_path);
+        exit;
+      }
+    }
+  } 
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Documentation');?></title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <script type="text/javascript" language="JavaScript">
+    <!--
+      top.rootDir='.';
+    //-->
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/l10n.php"></script>
+</head>
+
+<body>
+<?php
+if(!$oTable) {
+  add_error(l10n('Unable to load documentation.'));
+} else {
+  if(file_exists($doc_path)) {
+    $d=dir($doc_path);
+    while (false !== ($entry = $d->read())) {
+      if($entry=='.' || $entry=='..') {
+        continue;
+      }
+      echo '<a href="doc.php?id_data_source='.
+        $_GET['id_data_source'].
+        '&amp;rel_path='.($_GET['rel_path'].'/'.$entry).'">';
+      echo $entry;
+      echo '</a><br>'."\n";
+    }
+    $d->close();
+  } else {
+    add_error(l10n('Unable to load documentation.').' '.
+        l10n('File not found.'));
+  }
+}
+?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/get_tables_wizard.php
===================================================================
--- packages/musmap/branches/upstream/current/get_tables_wizard.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/get_tables_wizard.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,131 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Presentation wizard
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre_admin.inc.php');
+  $oConnections= & LibComponent::Load('connections');
+  if(isset($_REQUEST['id_connection'])) {
+    $oConnection= & $oConnections->GetItemByClassNameAndAttribute(
+      'connection', 'id_connection', $_REQUEST['id_connection']);
+  }
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Get data sources wizard');?></title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript">
+    <!--
+      top.rootDir='.';
+    //-->
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xbgeo.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/explorer.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/l10n.php"></script>
+</head>
+
+<body class="wizard">
+<h1><?php echo html_l10n('Getting data sources');?></h1>
+<?php
+if($oConnectionDb= & $oConnection->GetDb(DB_SUPPORTS_GetInformationSchema)) {
+  $aInformationSchema= $oConnectionDb->GetInformationSchema();
+  if(!is_array($aInformationSchema)) {
+    add_error(sprintf(l10n('Drivers for "%s" do not support GetInformationSchema.'),
+      $oConnection->Attributes->Value('connection_driver')));
+  } else {
+    $bHasDataSource= false;
+    foreach($aInformationSchema AS $aSchema) {
+      foreach($aSchema['TABLES'] AS $aTable) {
+        $bHasDataSource= true;
+        $oTable= & $oConnection->add_child('data_source',
+          Array(
+            'data_source_catalog'=>$aTable['TABLE_CATALOG'],
+            'data_source_schema'=>$aTable['TABLE_SCHEMA'],
+            'data_source_name'=>$aTable['TABLE_NAME'],
+            'data_source_label'=>isset($aTable['MUSMAP_TABLE_LABEL']) 
+              ? $aTable['MUSMAP_TABLE_LABEL'] 
+              : $aTable['TABLE_NAME'],
+            'data_source_params'=>isset($aTable['MUSMAP_TABLE_PARAMS']) 
+              ? $aTable['MUSMAP_TABLE_PARAMS'] 
+              : '',
+            'data_source_type'=>isset($aTable['MUSMAP_TABLE_TYPE']) 
+              ? $aTable['MUSMAP_TABLE_TYPE'] 
+              : 'T',
+            'data_source_doc'=>isset($aTable['MUSMAP_TABLE_DOC']) 
+              ? $aTable['MUSMAP_TABLE_DOC'] 
+              : ''
+          ));
+        foreach($aTable['COLUMNS'] AS $aColumn) {
+          $aMusmapType= $oConnectionDb->MusmapTypeFromSQLType(
+            Array('type'=>$aColumn['DATA_TYPE']));
+          $oTable->add_child('data_column',
+            Array(
+              'column_code'=>$aColumn['COLUMN_NAME'],
+              'column_short_label'=>isset($aTable['MUSMAP_COLUMN_SHORT_LABEL']) 
+                ? $aTable['MUSMAP_COLUMN_SHORT_LABEL'] 
+                : $aColumn['COLUMN_NAME'],
+              'column_long_label'=>isset($aTable['MUSMAP_COLUMN_LONG_LABEL']) 
+                ? $aTable['MUSMAP_COLUMN_LONG_LABEL'] 
+                : $aColumn['COLUMN_NAME'],
+              'column_visible'=>1,
+              'column_index'=>$aColumn['ORDINAL_POSITION'],
+              'column_is_decodification'=>0,
+              'column_type'=>$aMusmapType['type'],
+              'column_expression'=>''
+            ));
+        }
+      }
+    }
+  }
+  if(!$bHasDataSource) {
+    add_error(l10n('No data source found.'));
+  } else {
+    add_error(l10n('Done'));
+  }
+  unset($bHasDataSource);
+} else {
+  add_error(sprintf(l10n('Drivers for "%s" do not support GetInformationSchema.'),
+    $oConnection->Attributes->Value('connection_driver')));
+}
+?>
+<p>
+<a href="javascript:self.close();"><?php echo html_l10n('Close');?></a>
+</p>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/images/arrow_down.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/arrow_down.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/arrow_up.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/arrow_up.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/bg.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/bg.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/cursors/zoomin.cur
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/cursors/zoomin.cur
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/cursors/zoomout.cur
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/cursors/zoomout.cur
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/eye.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/eye.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/eye_hidden.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/eye_hidden.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/help.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/help.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/moins.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/moins.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/palette.jpeg
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/palette.jpeg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/paletteBW.jpeg
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/paletteBW.jpeg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/plus.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/plus.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/logout.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/logout.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/measure.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/measure.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/pan.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/pan.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/print.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/print.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/querypoint.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/querypoint.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/queryrect.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/queryrect.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/refresh.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/refresh.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/zoomin.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/zoomin.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/zoominit.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/zoominit.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/tool/zoomout.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/tool/zoomout.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/images/white_pixel.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/images/white_pixel.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/import_mapfile.php
===================================================================
--- packages/musmap/branches/upstream/current/import_mapfile.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/import_mapfile.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,196 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Mapfile importation
+ * @package admin
+ */
+
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  $user=new t_user();
+  $profiles= & LibComponent::Load('profiles');
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Mapfile importation');?></title>
+</head>
+<body>
+<?php
+if(!isset($_POST['step'])) {
+  $_POST['step'] = '1';
+}
+
+switch($_POST['step']) {
+  case '2':
+    while(true) {
+      $tmp_name = Conf::get('tmp_dir').'tmp'.
+        sprintf('%4x',rand(0,0xFFFF)).'.map';
+      if(!file_exists($tmp_name)) {
+        break;
+      }
+    }
+    if(    isset($_FILES['mapfile'])
+        && !empty($_FILES['mapfile']['tmp_name'])
+        && rename($_FILES['mapfile']['tmp_name'],$tmp_name)
+        && ($imported_map = new TMap($tmp_name))
+        && $imported_map->ms_map
+    ) {
+      //Profile
+      $profile = $user->add_child('profile',
+        Array(
+          'id_map_reference'=>0,
+          'profile_name'=>$imported_map->ms_map->name.' '.rand(0,999),
+          'profile_is_public'=>0));
+      if($profile) {
+        $oConnections= & LibComponent::Load('connections');
+        $oSymbols= & LibComponent::Load('symbols');
+        //Layers
+        for($layer_i=0; $layer_i<$imported_map->ms_map->numlayers; $layer_i++) {
+            $ms_layer = $imported_map->ms_map->getLayer($layer_i);
+            $id_data_source = 0;
+            $layer = $profile->add_child('profile_data',
+              Array(
+              'id_data_source'=>$id_data_source,
+              ));
+            if($layer_name = $ms_layer->getMetaData('profile_data_title')) {
+            } elseif($layer_name = $ms_layer->getMetaData('title')) {
+            } else {
+              $layer_name = $ms_layer->name;
+            }
+            $layer->change(
+              Array(
+              'profile_data_title'=>$layer_name,
+              'profile_data_index'=>$layer_i,
+              'profile_data_visible'=>$ms_layer->status!=MS_OFF,
+              'layer_minscale'=>$ms_layer->minscale,
+              'layer_maxscale'=>$ms_layer->maxscale,
+              'layer_group'=>$ms_layer->group,
+              'layer_symbols_scale'=>$ms_layer->symbolscale,
+              'layer_classitem'=>$ms_layer->classitem,
+              'layer_opacity'=>$ms_layer->transparency,
+              'layer_type'=>t_profile_data::getLayerType($ms_layer),
+              'raster_offsite'=>LibVisual::getColor($ms_layer->offsite)
+              ));
+            //Classes
+            for($class_i=0; $class_i<$ms_layer->numclasses; $class_i++) {
+              $ms_class = $ms_layer->getClass($class_i);
+              $class = $layer->add_child('class',
+                Array(
+                  'class_name'=>$ms_class->name,
+                  'class_expression'=>$ms_class->getExpression()
+                ));
+              //Label
+              if($ms_class->label->font) {
+                $label = $class->add_child('label',
+                  Array(
+                    'label_column'=>$ms_layer->labelitem,
+                    'label_encoding'=>$ms_class->label->encoding,
+                    'label_font'=>$ms_class->label->font,
+                    'label_color'=>LibVisual::getColor($ms_class->label->color),
+                    'label_minscale'=>$ms_layer->labelminscale,
+                    'label_maxscale'=>$ms_layer->labelmaxscale,
+                    'label_force_visibility'=>$ms_class->label->force,
+                    'label_default_size'=>$ms_class->label->size,
+                    'label_size'=>$ms_class->label->labelsizeitem,
+                    'label_default_angle'=>$ms_class->label->angle,
+                    'label_angle'=>$ms_class->label->labelangleitem,
+                    'label_position'=>LibVisual::getPosition($ms_class->label),// -----
+                    'label_rect_color'=>LibVisual::getColor($ms_class->label->backgroundcolor),
+                    'label_rect_shadow_color'=>LibVisual::getColor($ms_class->label->backgroundshadowcolor),
+                    'label_rect_shadow_size'=>$ms_class->label->backgroundshadowsizex,
+                    'label_buffer'=>$ms_class->label->buffer,
+                    'label_outline_color'=>LibVisual::getColor($ms_class->label->outlinecolor),
+                    'label_partials'=>$ms_class->label->partials,
+                    'label_shadow_color'=>LibVisual::getColor($ms_class->label->shadowcolor),
+                    'label_shadow_size'=>$ms_class->label->shadowsizex
+                  ));
+              }
+              //Styles
+              for($style_i=0; $style_i<$ms_class->numstyles; $style_i++) {
+                $ms_style = $ms_class->getStyle($style_i);
+                if(preg_match('/^(.*?)\_\_(.*)$/',$ms_style->symbolname,$matches)) {
+                  $oAttrFilterSymbolFamily->Right= $matches[1];
+                  $oAttrFilterSymbolName->Right= $matches[2];
+                  $oAttrFilterSymbolCode= & new TAttributeFilter($oAttrFilterSymbolFamily,'AND',$oAttrFilterSymbolName,'TAttributeFilter');
+                  $oAttrFilterSymbol= & new TAttributeFilter($oAttrFilterIsSymbol,'AND',$oAttrFilterSymbolCode,'TAttributeFilter');
+                  $symbol = &$oSymbols->Items->GetWithAttributeFilterRecursive($oAttrFilterSymbol);
+                  if($symbol) {
+                    $id_symbol = $symbol->Attributes->Value('id_symbol');
+                  } else {
+                    $id_symbol = 0;
+                  }
+                  unset($symbol);
+                } else {
+                  $id_symbol = 0;
+                }
+                $style = $class->add_child('style',
+                  Array(
+                    'id_symbol'=>$id_symbol,
+                    'style_name'=>$ms_class->name.' '.($style_i+1),
+                    'style_background_color'=>LibVisual::getColor($ms_style->backgroundcolor),
+                    'style_color'=>LibVisual::getColor($ms_style->color),
+                    'style_outline_color'=>LibVisual::getColor($ms_style->outlinecolor),
+                    'style_size'=>$ms_style->size,
+                    'style_symbol_maxsize'=>$ms_style->maxsize,
+                    'style_symbol_minsize'=>$ms_style->minsize,
+                    'style_index'=>$style_i
+                  ));
+              }
+            }
+          }
+        } else {
+          add_error(l10n('Unable to create profile.').' '.
+            l10n('Check for duplicate names.'));
+        }
+    } else {
+      add_error(l10n('Unable to open the mapfile.'));
+    }
+    //@unlink($tmp_name);
+    break;
+  case '1':
+  default:
+    echo '<p>'."\n";
+    echo '  '.html_l10n('This tool permit to import Mapserver mapfiles.')."\n";
+    echo '</p>'."\n";
+    echo '<form action="import_mapfile.php" method="POST" '.
+      'enctype="multipart/form-data">'."\n";
+    echo '  <input type="hidden" name="MAX_FILE_SIZE" value="200000">';
+    echo '  <input name="mapfile" type="file"><br>'."\n";
+    echo '  <input name="step" type="hidden" value="2">'."\n";
+    echo '  <input value="'.html_l10n('Send').'" type="submit">'."\n";
+    echo '</form>';
+}
+?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/include/.htaccess
===================================================================
--- packages/musmap/branches/upstream/current/include/.htaccess	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/.htaccess	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from All

Added: packages/musmap/branches/upstream/current/include/auth/auth.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/auth/auth.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/auth/auth.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,74 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Basic authentification constants
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage authentification
+ * @since 2005-11
+ */
+ 
+ /**
+  * User name or password is invalid
+  */
+ define('MUSMAP_AUTH_USER_INVALID', 1);
+ 
+ /**
+  * No data entered
+  */
+ define('MUSMAP_AUTH_USER_NO_DATA', 2);
+ 
+ /**
+  * User name and password is OK
+  */
+ define('MUSMAP_AUTH_USER_OK', 3);
+ 
+ /**
+  * Can't check user name and password
+  */
+ define('MUSMAP_AUTH_UNAVAILABLE', 4); 
+
+ /**
+  * User is logging out
+  */
+ define('MUSMAP_AUTH_LOGOUT', 5); 
+ 
+ /**
+  * User have insufficient privileges
+  */
+ define('MUSMAP_AUTH_INSUFFICIENT_PRIVILEGES', 6); 
+ 
+ /**
+  * User or session has expirated
+  */
+ define('MUSMAP_AUTH_USER_EXPIRED', 7); 
+?>

Added: packages/musmap/branches/upstream/current/include/auth/basic.auth.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/auth/basic.auth.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/auth/basic.auth.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,106 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Basic database authentification
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage authentification
+ * @since 2005-11
+ */
+  
+ require_once('cookies.auth.class.php');
+ require_once('db.auth.class.php');
+ 
+  /**
+   * Basic authentification class
+   */
+  class TAuthBasic {
+    var $_AuthCookies;
+    var $_Auth;
+    /**
+     * Authentificate
+     * @param t_user $oUser Variable to create the user into
+     * @param t_session|NULL $oSession Variable to create the session into
+     */
+    function Authenticate(&$oUser, &$oSession){
+      global $db;
+      $this->_AuthCookies= & new TAuthCookies();
+      // Logout
+      if(isset($_POST["logout"]) || isset($_GET["logout"])) {
+        $this->_AuthCookies->DeleteUser($oUser, $oSession);
+        $oUser->Attributes->SetTo(Array());
+        return MUSMAP_AUTH_LOGOUT;
+      }
+      $iCookiesAuth= $this->_AuthCookies->Authenticate($oUser, $oSession);
+      switch($iCookiesAuth) {
+        case MUSMAP_AUTH_USER_INVALID:
+          $this->_AuthCookies->ClearAuthCookies();
+          $oUser->Attributes->SetTo(Array());
+          return $iCookiesAuth;
+        case MUSMAP_AUTH_USER_OK:
+          $rSessionQuery= $db->Query(
+            "SELECT * FROM users ".
+            "WHERE id_user=".$db->Quote($oSession->Attributes->Value('id_user'),'int'));
+          if(!$rSessionQuery)
+            return MUSMAP_AUTH_UNAVAILABLE;
+          $aSessionAttributes= $db->FetchAssoc($rSessionQuery);
+          unset($aSessionAttributes['user_password']);
+          $db->FreeResult($rSessionQuery);
+          $oUser->Attributes->SetTo($aSessionAttributes);
+          return $iCookiesAuth;
+        case MUSMAP_AUTH_USER_EXPIRED:
+        case MUSMAP_AUTH_UNAVAILABLE:
+          return $iCookiesAuth;
+        case MUSMAP_AUTH_USER_NO_DATA:
+          //continue to next step
+          break;
+        default:
+      }
+      $this->_Auth= & new TAuthDatabase();
+      $iDatabaseAuth = $this->_Auth->Authenticate($oUser, $oSession);
+      switch($iDatabaseAuth) {
+        case MUSMAP_AUTH_USER_OK:
+          TAuthCookies::CreateUser($oUser, $oSession);
+          return $iDatabaseAuth;
+        case MUSMAP_AUTH_USER_INVALID:
+          $oUser->Attributes->SetTo(Array());
+          return $iDatabaseAuth;
+        case MUSMAP_AUTH_UNAVAILABLE:
+        case MUSMAP_AUTH_USER_NO_DATA:
+          return $iDatabaseAuth;
+          break;
+        default:
+      }
+    }
+  }
+  
+?>

Added: packages/musmap/branches/upstream/current/include/auth/basic.ldap.auth.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/auth/basic.ldap.auth.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/auth/basic.ldap.auth.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,117 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Basic database authentification
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage authentification
+ * @since 2005-11
+ */
+  
+ require_once('cookies.auth.class.php');
+ require_once('db.auth.class.php');
+ require_once('ldap.auth.class.php');
+ 
+  /**
+   * Basic authentification class
+   */
+  class TAuthBasicLDAP {
+    var $_AuthCookies;
+    var $_Auth;
+    /**
+     * Authentificate
+     * @param t_user $oUser Variable to create the user into
+     * @param t_session|NULL $oSession Variable to create the session into
+     */
+    function Authenticate(&$oUser, &$oSession){
+      global $db;
+      $this->_AuthCookies= & new TAuthCookies();
+      // Logout
+      if(isset($_POST["logout"]) || isset($_GET["logout"])) {
+        $this->_AuthCookies->DeleteUser($oUser, $oSession);
+        $oUser->Attributes->SetTo(Array());
+        return MUSMAP_AUTH_LOGOUT;
+      }
+      $iCookiesAuth= $this->_AuthCookies->Authenticate($oUser, $oSession);
+      switch($iCookiesAuth) {
+        case MUSMAP_AUTH_USER_INVALID:
+          $this->_AuthCookies->ClearAuthCookies();
+          $oUser->Attributes->SetTo(Array());
+          return $iCookiesAuth;
+        case MUSMAP_AUTH_USER_OK:
+          $rSessionQuery= $db->Query(
+            "SELECT * FROM users ".
+            "WHERE id_user=".$db->Quote($oSession->Attributes->Value('id_user'),'int'));
+          if(!$rSessionQuery)
+            return MUSMAP_AUTH_UNAVAILABLE;
+          $aSessionAttributes= $db->FetchAssoc($rSessionQuery);
+          $db->FreeResult($rSessionQuery);
+          unset($aSessionAttributes['user_password']);
+          $oUser->Attributes->SetTo($aSessionAttributes);
+          return $iCookiesAuth;
+        case MUSMAP_AUTH_USER_EXPIRED:
+        case MUSMAP_AUTH_UNAVAILABLE:
+          return $iCookiesAuth;
+        case MUSMAP_AUTH_USER_NO_DATA:
+          //continue to next step
+          break;
+        default:
+      }
+      $this->_Auth= & new TAuthLDAP();
+      $iLDAPAuth = $this->_Auth->Authenticate($oUser, $oSession);
+      switch($iLDAPAuth) {
+        case MUSMAP_AUTH_USER_OK:
+          $rUserQuery= $db->Query(
+            "SELECT * FROM users ".
+            "WHERE user_name=".$db->Quote($oUser->Attributes->Value('user_name')));
+          $aUserAttributes= $db->FetchAssoc($rUserQuery);
+          $db->FreeResult($rUserQuery);
+          if(!$aUserAttributes) {
+            TAuthDatabase::CreateUser($oUser, $oSession);
+          } else {
+            $oUser->Attributes->SetTo($aUserAttributes);
+          }
+          TAuthCookies::CreateUser($oUser, $oSession);
+          return $iLDAPAuth;
+        case MUSMAP_AUTH_USER_INVALID:
+          $oUser->Attributes->SetTo(Array());
+          return $iLDAPAuth;
+        case MUSMAP_AUTH_UNAVAILABLE:
+        case MUSMAP_AUTH_USER_NO_DATA:
+          return $iLDAPAuth;
+          break;
+        default:
+      }
+    }
+  }
+  
+?>

Added: packages/musmap/branches/upstream/current/include/auth/cookies.auth.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/auth/cookies.auth.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/auth/cookies.auth.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,157 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Cookies authentification
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage authentification
+ * @since 2005-11
+ */
+ 
+ require_once('auth.inc.php');
+  
+  /**
+   * Cookies authentification class
+   */
+  class TAuthCookies {
+    /**
+     * Authentificate
+     * @param t_user $oUser User to check
+     * @param t_session|NULL $oSession Variable to create the session into
+     */
+    function Authenticate(&$oUser, &$oSession){
+      global $db;
+      //Expiration of the session
+      $expiration= time() + Conf::Get('session_lifetime');
+      // A session is opened: check
+      if(!empty($_COOKIE["MusmapSession"])
+          && !empty($_COOKIE["MusmapSessionSecurity"])) {
+        //check session
+        $rSessionQuery= $db->Query(
+          "SELECT * \n".
+          'FROM sessions '."\n".
+          'WHERE session_id='.$db->Quote($_COOKIE["MusmapSession"])." ".
+            "AND session_security_id=".$db->Quote($_COOKIE["MusmapSessionSecurity"]));
+        if(!$rSessionQuery) //can't connect to server
+          return MUSMAP_AUTH_UNAVAILABLE;
+        $aSessionAttributes= $db->FetchAssoc($rSessionQuery);
+        $db->FreeResult($rSessionQuery);
+        if($aSessionAttributes) {//session is ok
+          if($aSessionAttributes['session_modification_time']>$expiration) {
+            TAuthCookies::DeleteUser($oUser, $oSession);
+            return MUSMAP_AUTH_USER_EXPIRED;
+          }
+          $temp= & new t_session($aSessionAttributes);
+          $oSession= $temp;
+          $oSession->SetParent($oUser);
+          unset($temp);
+          $db->StartTransaction();
+          $db->Query("UPDATE sessions ".
+            "SET session_modification_time=".$db->Quote(time())." ".
+            "WHERE session_id=".$db->Quote($_COOKIE["MusmapSession"]));
+          $db->Commit();
+          return MUSMAP_AUTH_USER_OK;
+        } else {
+          return MUSMAP_AUTH_USER_INVALID;
+        }
+      }
+      return MUSMAP_AUTH_USER_NO_DATA;
+    }
+    
+    /**
+     * Unset authentification cookies
+     * MusmapSession & MusmapSessionSecurity
+     */
+    function ClearAuthCookies() {
+      setcookie("MusmapSession", "", time(), Conf::get('musmap_root_url'));
+      unset($_COOKIE["MusmapSession"]);
+      setcookie("MusmapSessionSecurity", "", time(), Conf::get('musmap_root_url'));
+      unset($_COOKIE["MusmapSessionSecurity"]);
+    }
+    
+    /**
+     * Create user (here, session)
+     * @param string $sUserName
+     * @param string $sPassword
+     * @param t_session $oSession variable to create the session from
+     *                  it should contain at least attributes id_user 
+     *                  and id_profile
+     */
+    /* static */ function CreateUser(&$oUser, &$oSession) {
+      global $db;
+      $expiration= time() + Conf::Get('session_lifetime');
+      $_COOKIE["MusmapSession"]= round(rand(1,100) * time());
+      $_COOKIE["MusmapSessionSecurity"]= round(rand(1,100) * time());
+      setcookie("MusmapSession", $_COOKIE["MusmapSession"],
+        $expiration,Conf::get('musmap_root_url'));
+      setcookie("MusmapSessionSecurity", $_COOKIE["MusmapSessionSecurity"],
+        $expiration,Conf::get('musmap_root_url'));
+      $db->StartTransaction();
+      $session_query=$db->Query(
+        "INSERT INTO sessions ".
+            "(session_id,session_security_id,id_user,id_profile,".
+              "session_creation_time,session_modification_time)\n".
+          "VALUES(".
+            $db->Quote($_COOKIE["MusmapSession"]).", ".
+            $db->Quote($_COOKIE["MusmapSessionSecurity"]).", ".
+            $db->Quote($oUser->Attributes->Value('id_user')).", ".
+            $db->Quote($oUser->Attributes->Value('id_profile')).", ".
+            $db->Quote(time()).", ".
+            $db->Quote(time()).") "
+          );
+      $db->Commit();
+      TAuthCookies::Authenticate($oUser, $oSession);
+    }
+    
+    /**
+     * Delete user
+     * @param string $sUserName
+     * @param string $sPassword
+     * @param t_session $oSession variable to delete the session from
+     */
+    /* static */ function DeleteUser(&$oUser, &$oSession) {
+      global $db;
+      $_COOKIE["MusmapSession"]= 
+        isset($_COOKIE["MusmapSession"]) ? $_COOKIE["MusmapSession"] : '';
+      $_COOKIE["MusmapSessionSecurity"]= 
+        isset($_COOKIE["MusmapSessionSecurity"]) ? $_COOKIE["MusmapSessionSecurity"] : '';
+      $db->StartTransaction();
+      $db->Query("DELETE FROM sessions ".
+        "WHERE session_id=".$db->Quote($_COOKIE["MusmapSession"])." ".
+          "AND session_security_id=".$db->Quote($_COOKIE["MusmapSessionSecurity"]));
+      $db->Commit();
+      TAuthCookies::ClearAuthCookies();
+    }
+    
+  }
+  
+?>

Added: packages/musmap/branches/upstream/current/include/auth/db.auth.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/auth/db.auth.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/auth/db.auth.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,95 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Basic database authentification
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage authentification
+ * @since 2005-11
+ */
+  
+ require_once('auth.inc.php');
+
+  /**
+   * Basic database authentification class
+   */
+  class TAuthDatabase {
+    /**
+     * Authentificate
+     * @param t_user|NULL $oUser Variable to create the user into
+     * @param t_session|NULL $oSession Variable to create the session into
+     */
+    function Authenticate(&$oUser, &$oSession){
+      global $db;
+      if(!is_a($oUser, 't_user') || ($oUser->Attributes->IsEmpty('user_name') 
+          && $oUser->Attributes->IsEmpty('user_password')))
+        return MUSMAP_AUTH_USER_NO_DATA;
+      //Testing password
+      $rSessionQuery=$db->Query(
+        "SELECT * FROM users ".
+        "WHERE user_name=".$db->Quote($oUser->Attributes->ValueWithDefault('user_name',''))." ".
+          "AND user_password=".$db->Quote(password($oUser->Attributes->ValueWithDefault('user_password',''))));
+      if(!$rSessionQuery)
+        return MUSMAP_AUTH_UNAVAILABLE;
+      $aSessionAttributes= $db->FetchAssoc($rSessionQuery);
+      unset($aSessionAttributes['user_password']);
+      $oUser->Attributes->SetTo($aSessionAttributes);
+      $r= $aSessionAttributes ? MUSMAP_AUTH_USER_OK : MUSMAP_AUTH_USER_INVALID;
+      $db->FreeResult($rSessionQuery);
+      return $r;
+    }
+    
+    /**
+     * Create user
+     * @param t_user|NULL $oUser Variable to create the user into
+     * @param t_session|NULL $oSession Variable to create the session into
+     */
+    /* static */ function CreateUser(&$oUser, &$oSession) {
+      global $db;
+      $id_profile= 0;
+      $db->StartTransaction();
+      $insert_q= $db->Query("INSERT INTO users ".
+        "(user_name,user_password,id_profile) ".
+        "VALUES (".
+          $db->Quote($oUser->Attributes->Value('user_name')).", ".
+          $db->Quote(NULL).", ".
+          $db->Quote($id_profile).")");
+      $id_user= $db->get_last_insert_row_id($insert_q, 'users',
+        'id_user');
+      echo mysql_error();
+      $db->Commit();
+      $oUser->Attributes->Set('id_user', $id_user);
+      $oUser->Attributes->Set('id_profile', $id_profile);
+    }
+  }
+  
+?>

Added: packages/musmap/branches/upstream/current/include/auth/ldap.auth.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/auth/ldap.auth.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/auth/ldap.auth.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,139 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Basic LDAP authentification
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage authentification
+ * @since 2005-12
+ */
+  
+if(function_exists('ldap_connect')) {
+ require_once('auth.inc.php');
+
+  /**
+   * Basic database authentification class
+   */
+  class TAuthLDAP {
+    /**
+     * LDAP connection
+     */
+    var $_ds= NULL;
+    
+    /**
+     * Authentificate
+     * @param t_user|NULL $oUser Variable to create the user into
+     * @param t_session|NULL $oSession Variable to create the session into
+     */
+    function Authenticate(&$oUser, &$oSession){
+      global $db;
+      if(!is_a($oUser, 't_user') || $oUser->Attributes->IsEmpty('user_name') 
+          || $oUser->Attributes->IsEmpty('user_password'))
+        return MUSMAP_AUTH_USER_NO_DATA;
+      $connection= $this->_Connect();
+      if($connection!==true)
+        return $connection;
+      //Searching user
+      $search= ldap_search($this->_ds, Conf::Get('auth_ldap_basedn'),
+        Conf::Get('auth_ldap_uid').'='.$oUser->Attributes->ValueWithDefault('user_name',''));
+      if(!$search)
+        return MUSMAP_AUTH_UNAVAILABLE;
+      $entryID= ldap_first_entry($this->_ds, $search);
+      if(!$entryID) {
+        return MUSMAP_AUTH_USER_INVALID;
+      }
+      $dn= ldap_get_dn($this->_ds,$entryID);
+      //Testing password
+      $bind= @ldap_bind($this->_ds, $dn,
+        $oUser->Attributes->Value('user_password'));
+      if($bind) {
+        $aAttr= Array();
+        foreach(Conf::Get('auth_ldap_attributes') as $ldap_attr=>$musmap_attr) {
+          $values= ldap_get_values($this->_ds, $entryID,$ldap_attr);
+          if(isset($values[0]))
+            $aAttr[$musmap_attr]= $values[0];
+        }
+        $oUser->Attributes->SetTo($aAttr);
+        return MUSMAP_AUTH_USER_OK;
+      }else{
+        return MUSMAP_AUTH_USER_INVALID;
+      }
+    }
+    
+    /**
+     * Connect to LDAP server and binds as the guest user or as the optional dn.
+     * @access private
+     * @return boolean  Connection success
+     */
+    /* private */ function _Connect(){
+      // Connect to the LDAP server
+      $this->_ds = @ldap_connect(Conf::Get('auth_ldap_server'));
+      if(!$this->_ds) {
+        return MUSMAP_AUTH_UNAVAILABLE;
+      }
+      if(!Conf::IsEmpty('auth_ldap_version')) {
+        if(!ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION,
+            Conf::Get('auth_ldap_version'))) {
+          Information(
+            sprintf('Unable to set LDAP protocol version to %d: [%d] %s',
+              Conf::Get('auth_ldap_version'),
+              ldap_errno($conn),
+              ldap_error($conn)));
+        }
+      }
+      if(Conf::IsDefined('auth_ldap_binddn')) {
+        $bind = @ldap_bind($this->_ds, Conf::Get('auth_ldap_binddn'),
+          Conf::Get('auth_ldap_bindpassword'));
+      }else{
+        $bind = @ldap_bind($this->_ds);
+      }
+      if(!$bind) {
+          return MUSMAP_AUTH_UNAVAILABLE;
+      }
+      return true;
+    }
+
+    
+    
+  }
+  
+  Conf::Register('auth.ldap', 'auth_ldap_server', 'string', '127.0.0.1', 'LDAP server');
+  Conf::Register('auth.ldap', 'auth_ldap_basedn', 'string', NULL, 'LDAP base dn');
+  Conf::Register('auth.ldap', 'auth_ldap_binddn', 'string', NULL, 'LDAP bind dn');
+  Conf::Register('auth.ldap', 'auth_ldap_bindpassword', 'paswword', NULL, 'LDAP bind dn password');
+  Conf::Register('auth.ldap', 'auth_ldap_uid', 'string', 'uid', 'LDAP uid');
+  Conf::Register('auth.ldap', 'auth_ldap_version', 'integer', 3, 'LDAP version');
+  Conf::Register('auth.ldap', 'auth_ldap_attributes', 'string[s]', 
+    Array('userpassword'=>'user_password','cn'=>'user_name'),
+    'LDAP attributes to keep');
+}
+?>

Added: packages/musmap/branches/upstream/current/include/badlog.tmpl.php
===================================================================
--- packages/musmap/branches/upstream/current/include/badlog.tmpl.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/badlog.tmpl.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,136 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Page HTML d'ouverture de session
+   * (Utilisateur,Mot de passe)
+   * @package interface
+   */
+
+
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title>Musmap - login</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <meta http-equiv="Author" content="Mathieu Parent">
+  <style type="text/css">
+  <!--
+  BODY {
+    font-family:sans-serif;
+  }
+  
+  div.message {
+    position:absolute;
+    top:10%;
+    left:5%;
+    width:90%;
+    vertical-align:middle;
+    text-align:center;
+    padding:4px;
+    background-color:#EEEEEE;
+  }
+  
+  div.message * {
+    text-align:left;
+  }
+  
+  div#error {
+    border:solid red 2px;
+  }
+  div#login {
+    border:solid green 2px;
+  }
+  #user-p {
+    width: 50%;
+    text-align:right;
+  }
+  
+  #ok-button-p {
+    width: 50%;
+    text-align:right;
+  }
+  -->
+  </style>
+  <script type="text/javascript" language="JavaScript">
+  <!--
+  function loadMe() {
+    //being in a frame, reload top frame
+    if(top!=self) {
+      top.location.reload();
+      return;
+    } else {
+      document.forms[0].user_name.focus();
+    }
+  }
+  //-->
+  </script>
+  <noscript></noscript>
+</head>
+<body onload="loadMe();">
+<div id="<?php echo $message_id;?>" class="message">
+<div style="background-color:white;text-align:left;">
+<?php echo Conf::get('login_message');?>
+</div>
+<p>
+</p>
+<form method="POST" action="<?php 
+ //remove logout
+  echo isset($_SERVER['REQUEST_URI']) ? htmlentities(
+    preg_replace('/([?&])logout[^&]*(\&|$)/','\\1',$_SERVER['REQUEST_URI'])) : ''; ?>"> 
+<fieldset>
+<legend><?php echo html_l10n('Login');?></legend>
+<p id="message-p">
+  <?php echo $message;?>
+</p>
+<p id="user-p">
+<label for="user-name"><?php echo html_l10n('User:');?></label>
+<input name="user_name" value="" id="user-name"><br>
+<label for="user-password"><?php echo html_l10n('Password:');?></label>
+<input type="password" name="user_password" id="user-password" value="">
+</p>
+<p id="ok-button-p">
+<input type="submit" value="<?php echo html_l10n('OK');?>">
+</p>
+</fieldset>
+<p style="text-align:left;">
+  <?php echo sprintf(l10n('For more informations about Musmap, please look at %s.'),
+    "<a href='./about.php'>".l10n('used technologies')."</a>");?>
+</p>
+<?php
+// Pass POST vars
+unset($_GET['logout']);
+LibMisc::ArrayToInputs($_GET);
+?>
+</form>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/colors.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/colors.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/colors.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,256 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Colors
+ *
+ * Conversion HSL<->RGB
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-07, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+  
+  /**
+   * Library for color manipulation
+   * @package include
+   */
+  class LibColor {
+    /**
+     * RGB -> HSL
+     *
+     * @param int $r
+     * @param int $g
+     * @param int $b
+     * @return int[] Array(0=>H,1=>S,2=>L)
+     */
+     
+    function RGB2HSL ($r, $g, $b)
+    {
+      $red =   round ($r);
+      $green = round ($g);
+      $blue =  round ($b);
+      $minval = min ($red, min ($green, $blue));
+      $maxval = max ($red, max ($green, $blue));
+      $mdiff = $maxval - $minval + 0.0;
+      $msum =  $maxval + $minval + 0.0;
+      $luminance = $msum / 510.0;
+      if ($maxval == $minval)
+      {
+        $saturation = 0.0;
+        $hue = 0.0;
+      }
+      else
+      {
+        $rnorm = ($maxval - $red)   / $mdiff;
+        $gnorm = ($maxval - $green) / $mdiff;
+        $bnorm = ($maxval - $blue)  / $mdiff;
+        $saturation = ($luminance <= 0.5) ? ($mdiff / $msum) : ($mdiff / (510.0 - $msum));
+        if ($red == $maxval)
+          $hue = 60.0 * (6.0 + $bnorm - $gnorm);
+        if ($green == $maxval)
+          $hue = 60.0 * (2.0 + $rnorm - $bnorm);
+        if ($blue == $maxval)
+          $hue = 60.0 * (4.0 + $gnorm - $rnorm);
+        if ($hue > 360.0)
+          $hue -= 360.0;
+      }
+      return Array (round ($hue * 255.0 / 360.0), round ($saturation * 255.0), round ($luminance * 255.0));
+    }
+  
+    /**
+     * Magic
+     *
+     * @param int $rm1
+     * @param int $rm2
+     * @param int $rh
+     * @return int
+     */
+    function Magic ($rm1, $rm2, $rh)
+    {
+      $retval = $rm1;
+      if ($rh > 360.0)
+        $rh -= 360.0;
+      if ($rh < 0.0)
+        $rh += 360.0;
+      if ($rh < 60.0)
+        $retval = $rm1 + ($rm2 - $rm1) * $rh / 60.0;
+      else if ($rh < 180.0)
+        $retval = $rm2;
+      else if ($rh < 240.0)
+        $retval = $rm1 + ($rm2 - $rm1) * (240.0 - $rh) / 60.0;
+      return round ($retval * 255);
+    }
+  
+    /**
+     * HSL -> RGB
+     *
+     * @param int $h
+     * @param int $s
+     * @param int $l
+     * @return int[] Array(0=>R,1=>G,2=>B)
+     */
+    function HSL2RGB ($h, $s, $l)
+    {
+      $hue = $h * 360.0 / 255.0;
+      $saturation = $s / 255.0;
+      $luminance = $l / 255.0;
+      if ($saturation == 0.0)
+      {
+        $red =   round($luminance * 255.0);
+        $green = round($luminance * 255.0);
+        $blue =  round($luminance * 255.0);
+      }
+      else
+      {
+        if ($luminance <= 0.5)
+          $rm2 = $luminance + $luminance * $saturation;
+        else
+          $rm2 = $luminance + $saturation - $luminance * $saturation;
+        $rm1 = 2.0 * $luminance - $rm2;
+        $red =   LibColor::Magic($rm1, $rm2, $hue + 120.0);
+        $green = LibColor::Magic($rm1, $rm2, $hue);
+        $blue =  LibColor::Magic($rm1, $rm2, $hue - 120.0);
+      }
+      return Array ($red, $green, $blue);
+    }
+    
+    /**
+     * HSL -> RGB
+     *
+     * @param int $h
+     * @param int $s
+     * @param int $l
+     * @return string
+     */
+    function HSL2RGB_string($h,$s,$l)
+    {
+      $rgb=LibColor::HSL2RGB($h,$s,$l);
+      return sprintf("#%02X%02X%02X",$rgb[0],$rgb[1],$rgb[2]) ;
+    }
+  
+    /**
+     * Random color
+     *
+     * Return a random hex value
+     *
+     * @return string
+     */
+     
+    function random_color() {
+      return LibColor::HSL2RGB_string(rand(0,255),rand(0,255),rand(0,255)) ;
+    }
+    
+    /**
+     * Gradient
+     * @param string $sStartColor
+     * @param string $sEndColor
+     * @param integer $iColorsCount
+     */
+    function Gradient($sStartColor, $sEndColor, $iColorsCount) {
+      $iR=hexdec(substr($sStartColor,1,2));
+      $iG=hexdec(substr($sStartColor,3,2));
+      $iB=hexdec(substr($sStartColor,5,2));
+      $iR2=hexdec(substr($sEndColor,1,2));
+      $iG2=hexdec(substr($sEndColor,3,2));
+      $iB2=hexdec(substr($sEndColor,5,2));
+      $r=Array();
+      for($i= 0; $i<$iColorsCount; $i++) {
+        $r[]= sprintf("#%02X%02X%02X",
+          $iR+($iR2-$iR)*$i/($iColorsCount-1),
+          $iG+($iG2-$iG)*$i/($iColorsCount-1),
+          $iB+($iB2-$iB)*$i/($iColorsCount-1));
+      }
+      return $r;
+    }
+    
+    /**
+     * MultiGradient
+     * @param integer $iColorsCount
+     * @param string $sStartColor
+     * @param string $sNextColor
+     * @param float $iColorPlace between 0 and 1
+     * @param string $sNextColor
+     * @param float $iColorPlace between 0 and 1
+     */
+    function MultiGradient($iColorsCount) {
+      $aParams= func_get_args();
+      array_shift($aParams);
+      $sOriginColor= array_shift($aParams);
+      $fOriginColorPlace= 0.0;
+      if(!($sNextColor= (string) array_shift($aParams))) {
+        $sNextColor=$sOriginColor;
+      }
+      if(!($fNextColorPlace= (float) array_shift($aParams))) {
+        $fNextColorPlace= 1.0;
+      }
+      $r= Array();
+      for($i=0; $i<$iColorsCount; $i++) {
+        if($i/($iColorsCount-1)>$fNextColorPlace) {
+          $sOriginColor= $sNextColor;
+          $fOriginColorPlace= $fNextColorPlace;
+          if(!($sNextColor= (string) array_shift($aParams))) {
+            $sNextColor=$sOriginColor;
+          }
+          if(!($fNextColorPlace= (float) array_shift($aParams))) {
+            $fNextColorPlace= 1.0;
+          }
+        }
+        $iR=hexdec(substr($sOriginColor,1,2));
+        $iG=hexdec(substr($sOriginColor,3,2));
+        $iB=hexdec(substr($sOriginColor,5,2));
+        $iR2=hexdec(substr($sNextColor,1,2));
+        $iG2=hexdec(substr($sNextColor,3,2));
+        $iB2=hexdec(substr($sNextColor,5,2));
+        $r[]= sprintf("#%02X%02X%02X",
+          $iR+($iR2-$iR)*($i/($iColorsCount-1)-$fOriginColorPlace)/($fNextColorPlace-$fOriginColorPlace),
+          $iG+($iG2-$iG)*($i/($iColorsCount-1)-$fOriginColorPlace)/($fNextColorPlace-$fOriginColorPlace),
+          $iB+($iB2-$iB)*($i/($iColorsCount-1)-$fOriginColorPlace)/($fNextColorPlace-$fOriginColorPlace));
+      }
+      return $r;
+    }
+
+    /**
+     * Print colors
+     */
+    function PrintColors($aColors) {
+      foreach($aColors AS $sColor) {
+        LibColor::PrintColor($sColor);
+      }
+    }
+    
+    /**
+     * Print color
+     */
+    function PrintColor($sColor) {
+      echo '<span style="background:'.$sColor.'">&nbsp;</span>';
+    }
+  }
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/conf/blank.map
===================================================================
--- packages/musmap/branches/upstream/current/include/conf/blank.map	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/conf/blank.map	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,88 @@
+MAP
+  NAME "Map"
+  STATUS ON
+  SIZE 500 500
+  EXTENT 0 0 1 1
+  UNITS METERS
+  #SHAPEPATH ""
+  IMAGECOLOR 255 255 255
+    #Map background is white
+  #FONTSET "fonts.list"
+  
+  IMAGETYPE PNG
+  
+  # =============================================
+  # SYMBOLS
+  # Created by Musmap (except circle)
+  SYMBOL
+    NAME "circle"
+    TYPE ELLIPSE
+    FILLED TRUE
+    POINTS
+      1 1
+    END
+  END  
+
+  # =============================================
+  # OUTPUTFORMATS
+  # Automaticaly set by MapServer
+
+  # =============================================
+  # QUERYMAP
+  # Not used by Musmap
+  
+  # =============================================
+  # Overview map
+  #
+  REFERENCE
+    IMAGE ""
+    EXTENT 0 0 1 1
+    SIZE 100 100
+    STATUS ON
+    COLOR -1 -1 -1
+      # transparent
+    OUTLINECOLOR 255 0 0
+      # red
+  END
+  
+  
+  # ===========================================================================
+  # Legend
+  #
+  LEGEND
+    KEYSIZE 18 12
+      # class symbol size
+    STATUS ON
+    IMAGECOLOR 255 255 255 
+      # white
+  END
+  
+  # ===========================================================================
+  # Scalebar
+  #
+  SCALEBAR
+    IMAGECOLOR 255 255 255
+      # white
+    LABEL
+      COLOR 0 0 0
+        # Text: black
+      TYPE BITMAP
+      SIZE tiny
+    END
+    STYLE 0
+      # 0/1
+    SIZE 150 2
+      # size w/o label
+    BACKGROUNDCOLOR 200 200 200
+      # light gray
+    COLOR 0 0 0
+      # black
+    UNITS METERS
+    INTERVALS 5
+      # intervals count
+    TRANSPARENT OFF
+    STATUS TRUE
+  END
+    
+  #LAYERs created by Musmap
+END

Added: packages/musmap/branches/upstream/current/include/conf/config.php
===================================================================
--- packages/musmap/branches/upstream/current/include/conf/config.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/conf/config.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,56 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Configuration file
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package config
+ * @since 2004-06
+ * @filesource
+ */
+
+
+/**
+ * Database configuration
+ */
+ require('db_config.php');
+
+/**
+ * Modules loading
+ */
+ require('modules.conf.php');
+  
+/**
+ * DON'T EDIT THIS FILE !
+ * Use db_config.php, modules.conf.php and
+ * Db configuration instead
+ */
+?>

Added: packages/musmap/branches/upstream/current/include/conf/db_config.php
===================================================================
--- packages/musmap/branches/upstream/current/include/conf/db_config.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/conf/db_config.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,81 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 10/2005                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Database configuration file
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-10, Mathieu PARENT
+ * @package config
+ * @since 2005-10
+ * @filesource
+ */
+
+
+/**
+ * Database engine
+ *
+ * Uncomment your choice and fill specific informations
+ */
+  Conf::Set('db_engine', 'mysql');
+  //Conf::Set('db_engine', 'postgresql');
+  //Conf::Set('db_engine', 'sqlite');
+  //Conf::Set('db_engine', 'firebird'); //Experimental
+
+  $db_params['mysql']=Array(//mysql
+    'user'=>'musmap',
+    'password'=>'musmap',
+    'host'=>'',
+    'dbname'=>'musmap');
+  
+  $db_params['postgresql']=Array(//postgresql
+    'user'=>'musmap',
+    'password'=>'musmap',
+    'host'=>'localhost',
+    'port'=>'5432',
+    'dbname'=>'musmap');
+  
+  $db_params['sqlite']=Array(//sqlite
+    'filename'=>'/path/to/musmap.sqlite');
+    
+  $db_params['firebird']=Array(//Firebird/Interbase
+    'database'=> 'localhost:/path/to/musmap.fdb',
+    'username'=> 'SYSDBA',
+    'password'=> 'masterkey',
+    'dialect'=>3);
+
+
+/**
+ * Model database params
+ */
+ Conf::Set('db_params', $db_params[$conf['db_engine']]);
+ 
+ unset($db_params);
+
+?>

Added: packages/musmap/branches/upstream/current/include/conf/fonts.list
===================================================================
--- packages/musmap/branches/upstream/current/include/conf/fonts.list	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/conf/fonts.list	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,11 @@
+vera                            ../../../fonts/ming-fonts-1.00/ttf/Vera.ttf
+vera-bold                       ../../../fonts/ming-fonts-1.00/ttf/VeraBd.ttf
+vera-italic                     ../../../fonts/ming-fonts-1.00/ttf/VeraIt.ttf
+vera-bold-italic                ../../../fonts/ming-fonts-1.00/ttf/VeraBI.ttf
+vera-mono                       ../../../fonts/ming-fonts-1.00/ttf/VeraMo.ttf
+vera-mono-bold                  ../../../fonts/ming-fonts-1.00/ttf/VeraMoBd.ttf
+vera-mono-italic                ../../../fonts/ming-fonts-1.00/ttf/VeraMoIt.ttf
+vera-mono-bold-italic           ../../../fonts/ming-fonts-1.00/ttf/VeraMoBI.ttf
+vera-serif                      ../../../fonts/ming-fonts-1.00/ttf/VeraSe.ttf
+vera-serif-bold                 ../../../fonts/ming-fonts-1.00/ttf/VeraSeBd.ttf
+vera-fdb                        ../../../fonts/ming-fonts-1.00/fdb/Bitstream Vera Serif.fdb
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/conf/modules.conf.php
===================================================================
--- packages/musmap/branches/upstream/current/include/conf/modules.conf.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/conf/modules.conf.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,42 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 10/2005                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Module selection
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-12, Mathieu PARENT
+ * @package config
+ * @since 2005-12
+ * @filesource
+ */
+
+  //require_once('auth/basic.ldap.auth.class.php');
+
+?>

Added: packages/musmap/branches/upstream/current/include/conf/scales.txt
===================================================================
--- packages/musmap/branches/upstream/current/include/conf/scales.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/conf/scales.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,10 @@
+200
+500
+1000
+1500
+2000
+5000
+10000
+50000
+100000
+200000
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/conf.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/conf.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/conf.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,324 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * Fichier de configuration partie fonctions
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage conf
+ * @since 2004-06
+ */
+ 
+/**
+ * Settings list (used in /admin/settings.php)
+ *
+ * @global array $conf_array
+ */
+ 
+
+  /**
+   * Conf library
+   * @package include
+   * @subpackage conf
+   */
+  class Conf {
+    /**
+     * Obtain a configuration parameter
+     * Use this instead of $conf[$param]
+     * @param string $param
+     * @return mixed 
+     */
+    function Get($param) {
+      return $GLOBALS['conf'][$param];
+    }
+        
+    function GetMusmapInputFormats() {
+      global $g_oDbEngines;
+      $r= Array();
+      foreach($g_oDbEngines AS $input_type=>$engines) {
+        $r2="$input_type (";
+        foreach($engines as $engine) {
+          $r2.=TDbEngine::CapabilitiesAsString($engine[1]).' using '.$engine[0].'; ';
+        }
+        $r[]= substr($r2,0,-2).")";
+      }
+      return $r;
+    }
+    
+    /**
+     * Obtain a configuration parameter existence
+     * Use this instead of isset($conf[$param])
+     * @param string $param
+     * @return boolean 
+     */
+    function IsDefined($param) {
+      global $conf;
+      return isset($conf[$param]);
+    }
+    
+    
+    /**
+     * Obtain a configuration parameter emptyness
+     * Use this instead of empty($conf[$param])
+     * @param string $param
+     * @return boolean 
+     */
+    function IsEmpty($param) {
+      global $conf;
+      return empty($conf[$param]);
+    }
+    
+    
+    /**
+     * Surcharge de la configuration à l'aide de la base de données
+     *
+     * @return void 
+     */
+    function Override() {
+      global $conf,$conf_array,$db;
+      if($db->TableExists(NULL, NULL,'tool_settings', NULL)===false) {
+        $settings_r= NULL;
+      } else {
+        $settings_r= $db->Query('SELECT '.
+          $db->QuoteIdentifier('setting_code').' AS '.$db->QuoteIdentifier('cd').', '.
+          $db->QuoteIdentifier('setting_value').' AS '.$db->QuoteIdentifier('v').' '.
+          'FROM '.$db->QuoteIdentifier('tool_settings'));
+      }
+      if(!$settings_r) {
+        define('MUSMAP_NO_DB', 1);
+        if(!defined('MUSMAP_FILE_CREATE_TABLES')) {
+          Warning(l10n('Database not installed.'));
+          if((substr($_SERVER['PHP_SELF'],-6,5)==='admin')
+              || (substr(dirname($_SERVER['PHP_SELF']),-5)==='admin')){
+            $sRelDir= '';
+          } else {
+            $sRelDir= 'admin/';
+          }
+          echo '<p><a href="'.$sRelDir.'create_tables.php">'.
+            html_l10n('Install database!').'</a></p>';
+          exit;
+        }
+      } else {
+        while($setting=$db->FetchAssoc($settings_r)) {
+          if(!isset($conf_array[$setting['cd']]))
+            continue;//setting not declared is ignored
+          $conf_array[$setting['cd']]['changed']=1;
+          if(isset($conf_array[$setting['cd']])) {
+            switch($conf_array[$setting['cd']]['type']) {
+              case 'string[s]':
+                $conf[$setting['cd']]= unserialize($setting['v']);
+                break;
+              case 'string[i]':
+                $conf[$setting['cd']]= unserialize($setting['v']);
+                break;
+              default :
+                $conf[$setting['cd']]= $setting['v'];
+            }
+          } else {
+            $conf[$setting['cd']]=$setting['v'];
+          }
+        }
+        $db->FreeResult($settings_r);
+      }
+      
+      //Always display INFORMATION and WARNING
+      $conf['debug_level']= $conf['debug_level'] | 
+        E_MUSMAP_INFORMATION | E_MUSMAP_WARNING;
+      
+      //Language
+      global $l10n,$model_l10n;
+      if(isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
+        $http_langs=explode(',',$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
+      } else {
+        $http_langs=Array();
+      }
+      $conf['client_lang']=Conf::Get('default_lang');
+      foreach($http_langs AS $http_lang) {
+        $lang=explode(';',$http_lang);
+        $lang=$lang[0];
+        if(($lang=='en') || (file_exists(Conf::Get('musmap_root_dir').'/data/lang/'.$lang))) {
+          $conf['client_lang']=$lang;
+          break;
+        }
+      }
+      $l10n=Array();
+      if(file_exists(Conf::Get('musmap_root_dir').'/data/lang/'.Conf::Get('client_lang').'/main.lang.php')) {
+        include(Conf::Get('musmap_root_dir').'/data/lang/'.Conf::Get('client_lang').'/main.lang.php');
+        if(l10n('_locale')) {
+          $aLocales= explode(';', l10n('_locale'));
+          setlocale(LC_COLLATE, $aLocales);
+          setlocale(LC_CTYPE, $aLocales);
+          setlocale(LC_MONETARY, $aLocales);
+          setlocale(LC_TIME, $aLocales);
+          // Be carefull with this option, 
+	  // it replaces . by , when echo'ing numbers in some languages (french)
+          // @setlocale(LC_NUMERIC, $asLocales);
+          unset($aLocales);
+        }
+	//*/
+      }
+      $model_l10n=Array();
+      if(file_exists(Conf::Get('musmap_root_dir').'/data/lang/'.Conf::Get('client_lang').'/model.lang.php')) {
+        include(Conf::Get('musmap_root_dir').'/data/lang/'.Conf::Get('client_lang').'/model.lang.php');
+      }
+    }
+    
+    /**
+     * Register a configuration parameter
+     * Use this instead of $conf[$param]
+     * @param string $param Param name
+     * @param string $type Param type
+     * @param mixed $default_value Default param value
+     * @param string $description
+     * @param boolean $read_only
+     * @return void
+     */
+    function Register($section, $param, $type, $default_value, $description, $read_only= false, $hidden= false) {
+      global $conf, $conf_array;
+      $conf_array[$param]=Array('type'=>$type,
+        'label'=>$description,
+        'read_only'=>$read_only,
+        'default_value'=>$default_value,
+        'hidden'=>$hidden);
+      if(!isset($conf[$param])) {
+        $conf[$param]= $default_value;
+      }
+    }
+    
+    /**
+     * Set a configuration parameter
+     * Use this instead of $conf[$param]=...
+     * @param string $param
+     * @param mixed $value
+     * @return void
+     */
+    function Set($param, $value) {
+      global $conf;
+      $conf[$param]= $value;
+    }
+    
+    /**
+     * Set a configuration parameter to its default value
+     * @param string $param
+     * @return void
+     */
+    function SetToDefault($param) {
+      global $conf, $conf_array;
+      if(isset($conf_array[$param]['default_value']))
+        $conf[$param]= $conf_array[$param]['default_value'];
+      else
+        $conf[$param]= NULL;
+    }
+  }
+  
+  //l10n('Default lang')
+  Conf::Register('musmap.core', 'default_lang', 'lang',
+    'en', 'Default lang');
+  //l10n('Login message')
+  Conf::Register('musmap.core', 'login_message', 'string',
+    'Welcome in <b>Musmap</b>', 'Login message');
+  //l10n('Root dir of musmap')
+  Conf::Register('musmap.core', 'musmap_root_dir', 'dir',
+    MUSMAP_ROOT_DIR, 'Root dir of musmap', true);
+  //l10n('Url of musmap root dir')
+  Conf::Register('musmap.core.advanced', 'musmap_root_url', 'url',
+    '/musmap', 'Url of musmap root dir');
+  //l10n('Path to temp images')
+  Conf::Register('musmap.core.advanced', 'image_path', 'dir',
+    MUSMAP_ROOT_DIR.'/webtmp/', 'Path to temp images');
+  //l10n('Url to temp images')
+  Conf::Register('musmap.core.advanced', 'image_url', 'url',
+    Conf::Get('musmap_root_url').'/webtmp/', 'Url to temp images');
+  //l10n('Path to log directory')
+  Conf::Register('musmap.core.advanced', 'log_dir', 'dir',
+    MUSMAP_ROOT_DIR.'/log/', 'Path to log directory');
+  //l10n('Path to temporary directory')
+  Conf::Register('musmap.core.advanced', 'tmp_dir', 'dir',
+    MUSMAP_ROOT_DIR.'/srvtmp/', 'Path to temporary directory');
+  //l10n('Path to the map template')
+  Conf::Register('musmap.core.advanced', 'blank_map_path', 'file',
+    MUSMAP_ROOT_DIR.'/include/conf/blank.map', 'Path to the map template');
+  //l10n('Path to the file listing font files')
+  Conf::Register('musmap.core.advanced', 'font_list_path', 'file',
+    MUSMAP_ROOT_DIR.'/include/conf/fonts.list', 'Path to the file listing font files');
+  //l10n('Minimum time before deleting temp files (sec)')
+  Conf::Register('musmap.core.advanced', 'temp_files_expiration', 'int',
+    300, 'Minimum time before deleting temp files (sec)');
+  //l10n('Contextual help url')
+  Conf::Register('musmap.core.advanced', 'help_url', 'url',
+    'http://musmap.sourceforge.net/mediawiki/index.php?title=[module]:[page]#[paragraph]', 'Contextual help url');
+  //l10n('Params for connections (database user and password, ...)')
+  Conf::Register('musmap.core', 'connect_params', 'string[s]',
+    Array(), 'Params for connections (database user and password, ...)');
+  //l10n('Tables to backup')
+  Conf::Register('musmap.core.advanced', 'tables_to_backup', 'string[i]',
+    Array(
+      'classes',
+      'connections',
+      'data_columns',
+      'data_sources',
+      'extents',
+      'groups',
+      'labels',
+      'map_references',
+      'profile_extents',
+      'profiles',
+      'profiles_columns',
+      'profiles_data',
+      'projections',
+      'query_forms',
+      'query_results',
+      'relations',
+      //'sessions', //usualy not backed up
+      'styles',
+      'symbols',
+      'tool_settings',
+      'users',
+      'users_groups'
+      ), 'Tables to backup', false, true);
+  //l10n('Debug level')
+  Conf::Register('musmap.core.advanced', 'debug_level', 'debug_level',
+    E_MUSMAP_INFORMATION | E_MUSMAP_WARNING, 'Debug level');
+  //l10n('Users with access to admin pages')
+  Conf::Register('musmap.core', 'admin_users', 'string[i]',
+    Array(), 'Users with access to admin pages');
+  //l10n('Database engine')
+  Conf::Register('musmap.core.advanced', 'db_engine', 'string',
+    'mysql', 'Database engine', true);
+  //l10n('Database params')
+  Conf::Register('musmap.core.advanced', 'db_params', 'string[s]',
+    Array(), 'Database params', true);
+  //l10n('Session life time (seconds)')
+  Conf::Register('musmap.core.advanced', 'session_lifetime', 'int',
+    3600, 'Session life time (seconds)', false, true);
+  
+?>

Added: packages/musmap/branches/upstream/current/include/contrib/metadata/esri_meta.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/contrib/metadata/esri_meta.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/contrib/metadata/esri_meta.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,127 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * ESRI XML metadata parser
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-08
+ */
+if(extension_loaded('DOM')) {
+  /**
+   * REturn table structure using ESRI XML metatdata
+   * @param string $aInformationSchema Base information schema
+   * @param string $sXML XML string to parse
+   * @return array {@link TDbEngine::getTableInfos()}
+   */
+  function AddESRIXMLMetadata($aTableInformationSchema, $sXML) {
+    $oDOMDoc= DOMDocument::loadXML($sXML);
+    $oDOMRoot= $oDOMDoc->firstChild;
+    $r=$aTableInformationSchema;
+    while($oDOMRoot) {
+      if(is_a($oDOMRoot,'DOMElement')
+          && ($oDOMRoot->tagName=='metadata')) {
+        $oDOMNode1= $oDOMRoot->firstChild;
+        while($oDOMNode1) {
+          if(is_a($oDOMNode1,'DOMElement')
+              && ($oDOMNode1->tagName=='eainfo')) {
+            $oDOMNode2= $oDOMNode1->firstChild;
+            while($oDOMNode2) {
+              if(is_a($oDOMNode2,'DOMElement')
+                  && ($oDOMNode2->tagName=='detailed')) {
+                $r['TABLE_NAME']= $oDOMNode2->getAttribute('Name');
+                $oDOMNode3= $oDOMNode2->firstChild;
+                while($oDOMNode3) {
+                  if(is_a($oDOMNode3,'DOMElement')
+                      && ($oDOMNode3->tagName=='enttyp')) {
+                    $oDOMNode4= $oDOMNode3->firstChild;
+                    while($oDOMNode4) {
+                      if(is_a($oDOMNode4,'DOMElement')) {
+                        switch($oDOMNode4->tagName) {
+                          case 'enttypl':
+                            $r['MUSMAP_TABLE_LABEL']=$oDOMNode4->textContent;
+                            break;
+                        }
+                        $r['ESRI_'.$oDOMNode4->tagName]=$oDOMNode4->textContent;
+                      }
+                      $oDOMNode4= $oDOMNode4->nextSibling;
+                    }
+                  } elseif(is_a($oDOMNode3,'DOMElement')
+                      && ($oDOMNode3->tagName=='attr')) {
+                    $fieldName='';
+                    $oDOMNodeList= $oDOMNode3->getElementsByTagName('attrlabl');
+                    if($oDOMNodeList->length) {
+                      $oDOMNode4= $oDOMNodeList->item(0);
+                      $mColumnIndex=NULL;
+                      $fieldName= $oDOMNode4->textContent;
+                      //search the column
+                      foreach($r['COLUMNS'] AS $mLoopColumnIndex=>$aLoopColumnInfos) {
+                        if($aLoopColumnInfos['COLUMN_NAME']===$fieldName) {
+                          $mColumnIndex= $mLoopColumnIndex;
+                          break;
+                        }
+                      }
+                      if($mColumnIndex===NULL) {
+                        $mColumnIndex= array_push($r['COLUMNS'], Array());
+                      }
+                      $r['COLUMNS'][$mColumnIndex]['COLUMN_NAME']= $oDOMNode4->textContent;
+                      $oDOMNode4= $oDOMNode3->firstChild;
+                      while($oDOMNode4) {
+                        if(is_a($oDOMNode4,'DOMElement')) {
+                          switch($oDOMNode4->tagName) {
+                            case 'attrlabl':
+                              break;
+                            case 'attalias':
+                              $r['COLUMNS'][$mColumnIndex]['MUSMAP_COLUMN_LONG_LABEL']= $oDOMNode4->textContent;
+                              $r['COLUMNS'][$mColumnIndex]['MUSMAP_COLUMN_SHORT_LABEL']= $oDOMNode4->textContent;
+                              break;
+                          }
+                          $r['COLUMNS'][$mColumnIndex]['ESRI_'.$oDOMNode4->tagName]= $oDOMNode4->textContent;
+                        }
+                        $oDOMNode4= $oDOMNode4->nextSibling;
+                      }
+                    }
+                  }
+                  $oDOMNode3= $oDOMNode3->nextSibling;
+                }
+              }
+              $oDOMNode2= $oDOMNode2->nextSibling;
+            }
+          }
+          $oDOMNode1= $oDOMNode1->nextSibling;
+        }
+      }
+      $oDOMRoot= $oDOMRoot->nextSibling;
+    }
+    return $r;
+  }
+}
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/data_sources.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/data_sources.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/data_sources.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,125 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * Data sources
+ *
+ * Admin data_sources
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-07
+ */
+
+  /**
+   * Data sources
+   *
+   * @param  array $data_infos
+   * @return array the cleaned params
+   */
+  function data_source_connection($data_infos) {
+    /*
+      MS_INLINE, MS_SHAPEFILE, MS_TILED_SHAPEFILE,
+      MS_SDE, MS_OGR, 
+      MS_WMS, MS_WFS, 
+      MS_MYGIS, MS_POSTGIS, MS_ORACLESPATIAL,
+      
+      MS_GRATICULE, MS_TILED_OGR
+     */
+    if(empty($data_infos['connection_driver'])) {
+      $data_infos['connection_driver']='local';
+    }
+    $params= $data_infos['connection_params']."\n".$data_infos['data_source_params'];
+    if(!empty($params)) {
+      $connect_params=Conf::get('connect_params');
+      $params=preg_replace("/%(\S*?)%/e",
+           '$connect_params["\\1"]',
+           $params);
+    }
+    preg_match_all('/^\s*("?)(\S+?)\\1\s*=\s*("?)(.*?)\\3\s*$/m', $params,
+      $params_matches, PREG_SET_ORDER);
+    $params = Array(
+      'driver'=>$data_infos['connection_driver'],
+      'tablename'=>$data_infos['data_source_name']);
+    foreach($params_matches AS $param) {
+      $params[$param[2]]=$param[4];
+    }
+    switch($data_infos['connection_driver']) {
+      case 'sde':
+        $params['ms_connectiontype']= MS_SDE;
+        break;
+      case 'wms':
+        $params['ms_connectiontype']= MS_WMS;
+        break;
+      case 'wfs':
+        $params['ms_connectiontype']= MS_WFS;
+        break;
+      case 'ogr':
+      case 'gdal':
+        $params['ms_connectiontype']= MS_OGR;
+        break;
+      case 'oraclespacial':
+        $params['ms_connectiontype']= MS_ORACLESPATIAL;
+        break;
+      case 'postgis':
+        $params['ms_connectiontype']= MS_POSTGIS;
+        break;
+      case 'mygis':
+        $params['ms_connectiontype']= MS_MYGIS;
+        break;
+      case 'shapefile':
+      case 'raster':
+        if(!isset($params['dirname'])) {
+          $params['dirname']= '';
+        }
+        $sPath= LibMisc::PathFromParts(
+          $params['dirname'],
+          $data_infos['data_source_catalog'],
+          $data_infos['data_source_schema'],
+          $data_infos['data_source_name']);
+        if(file_exists($sPath.'.shp')) {
+          $params['driver']='shapefile';
+          $params['data']= $sPath.'.shp';
+          $params['ms_connectiontype']= MS_SHAPEFILE;
+        } elseif(file_exists($sPath.'.dbf')) {
+          $params['driver']='dbase';
+          $params['ms_connectiontype']= -1;
+        } else {
+          $params['ms_connectiontype']= -1;
+        }
+        break;
+      default:
+        $params['ms_connectiontype']=-1;
+        add_error(sprintf(l10n('Unknow connection type: %s.'),$data_infos['connection_driver']));
+    }
+    return $params;
+  }
+?>

Added: packages/musmap/branches/upstream/current/include/database/db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,859 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * DB engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2004-08
+ */
+
+  /**
+   * Class TDbEngine
+   * @package database
+   */
+  class TDbEngine {
+    var $db_params;
+    var $handle;
+    var $LogFileIsWritable= NULL;
+    // Infos
+    var $engine;
+    var $website;
+    
+    /**
+     * Connect to db
+     */
+    function Connect($db_params) {
+      $this->db_params=$db_params;
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      return l10n('Unknown database engine.');
+    }
+    
+    /**
+     * Retrieve the last error (NULL if unknown)
+     * 
+     * @return NULL|string[] 0=>SQLSTATE, 1=>ERROR_CODE, 2=> ERROR_STRING
+     */
+    function ErrorInfo() {
+      return NULL;
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return $s;
+    }
+    
+    /**
+     * Log one statement
+     */
+    function Log($s) {
+      if(Conf::get('debug_level') & E_MUSMAP_SQL_LOG) {
+        $sSQLLog= Conf::get('log_dir').'musmap.sql';
+        if((   (file_exists($sSQLLog) && is_writable($sSQLLog))
+            || (!file_exists($sSQLLog) && is_writable(dirname($sSQLLog))))
+            && ($fp= @fopen($sSQLLog,'a'))) {
+          fwrite($fp,"/* ".Date('Y-m-d H:i:s')." ".$_SERVER['REQUEST_URI']." */\r\n".
+            "$s\r\n\r\n");
+          fclose($fp);
+        } else {
+          if($this->LogFileIsWritable===NULL) {
+            Warning(sprintf(l10n('Musmap is not able to write SQL log "%s".'),
+              $sSQLLog));
+          }
+          $this->LogFileIsWritable= false;
+        }
+      }
+    }
+    
+    
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name deprecated
+     * @param int $e_level
+     * @return mixed
+     */
+    function Query($q) {
+      add_error(l10n('No database engine!'));
+      return false;
+    }
+    
+    /* protected */ function _InternalQuoteIdentifier($s) {
+      // "" is for ANSI SQL
+      return "\"$s\"";
+    }
+    
+    /* protected */ function _InternalQuote($s) {
+          // '' is for ANSI SQL
+      return "'$s'";
+    }
+    
+    /* protected */ function _InternalNull($sType) {
+      return 'NULL';
+    }
+    
+    /**
+     * Escape  and quote string
+     */
+    function Quote($s,$sType='string') {
+      if($sType==NULL) {$sType='string';}
+      elseif($sType=='N') {$sType='float';}
+      elseif($sType=='C') {$sType='string';}
+      elseif($sType=='F') {$sType='float';}
+      elseif($sType=='L') {$sType='string';}
+      elseif($sType=='M') {$sType='string';}
+      if($s === NULL) {
+        return $this->_InternalNull($sType);
+      } else {
+        settype($s, $sType);
+        if($sType=='float' || $sType=='integer') {
+          return $this->Escape($s);
+        } else {
+          return $this->_InternalQuote($this->Escape($s));
+        }
+      }
+    }
+    
+    /**
+     * Escape  and quote identifier
+     */
+    function QuoteIdentifier($s) {
+      return $this->_InternalQuoteIdentifier($this->Escape($s));
+    }
+    
+    
+    /**
+     * Execute a select query and return the result
+     *
+     * @param string $table_name
+     * @param string[][] $where_array Array(Array($field,$operator,$value,$type='string'),...)
+     *                   where $operator is one of '=','<>','<','<=','>=','>','LIKE'
+     * @param string[] $order_by_array array of fields
+     * @param string[] $fields array of fields
+     * @return mixed
+     */
+    function Select($table_catalog, $table_schema, $table_name, $table_params, 
+        $where_array=Array(),$order_by_array=Array(),$fields=Array('*')) {
+      $q='SELECT ';
+      $order_by_array= (array) $order_by_array;
+      foreach($fields AS $field_alias=>$field) {
+        if($field=='*') {
+          $q.=$field.', ';
+        } elseif(is_string($field_alias)) {
+          $q.=$field.' AS '.$this->QuoteIdentifier($field_alias).', ';
+        } else {
+          $q.=$this->QuoteIdentifier($field).', ';
+        }
+      }
+      if(is_array($table_name)) {
+        $q=substr($q,0,-2).' FROM '.implode(',',$table_name).' ';
+      } else {
+        $q=substr($q,0,-2).' FROM '.$this->QuoteIdentifier($table_name).' ';
+      }
+      if(count($where_array)>0) {
+        $q.='WHERE ';
+        foreach($where_array AS $where_item) {
+          $q.=$this->QuoteIdentifier($where_item[0]).' '.
+            ((($where_item[1]=='=') && ($where_item[2]===NULL)) ? 'IS' : $where_item[1]).' '.
+            $this->Quote($where_item[2],isset($where_item[3])?$where_item[3]:NULL).' AND ';
+        }
+        $q=substr($q,0,-4);
+      }
+      if(count($order_by_array)>0) {
+        $q.='ORDER BY ';
+        foreach($order_by_array AS $order_by_field=>$dir) {
+          $q.=$this->QuoteIdentifier($order_by_field);
+          if(($dir=='DESC') || ($dir=='ASC')) {
+            $q.=' '.$dir;
+          }
+          $q.=', ';
+        }
+        $q=substr($q,0,-2);
+      }
+      return $this->query($q);
+    }
+    
+    /**
+     * Resturns if table exists
+     *
+     * * true => yes
+     * * false => no
+     * * NULL => unknown (perform a select query to check)
+     *
+     * @param string $table_catalog
+     * @param string $table_schema
+     * @param string $table_name
+     * @param array  $table_params
+     * @return NULL|true|false
+     */
+    function TableExists($table_catalog, $table_schema, $table_name, $table_params) {
+      return NULL;
+    }
+    
+    /**
+     * Truncate a table
+     *
+     * @param string table_name
+     * @return mixed
+     */
+    function TruncateTable($table_name) {
+      return $this->query('DELETE FROM '.$this->Quote($table_name).';');
+    }
+    
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      return $this->query('START TRANSACTION');
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      return $this->query('COMMIT');
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      return $this->query('ROLLBACK');
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows() {
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed the result
+     */
+    function FreeResult($r) {
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed the result
+     * @return int
+     */
+    function get_num_rows($result) {
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+    }
+    
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+    }
+    
+    /**
+     * insert one row (import_csv)
+     *
+     * @return int
+     */
+    /* private */ function _insert_fields(
+        $table_name,
+        $fields,
+        $headers = NULL
+    ) {
+      $headers_string = '';
+      if(is_array($headers) && !empty($headers)) {
+        foreach($headers AS $header) {
+          $headers_string .= ', '.$this->QuoteIdentifier($header);
+        }
+        $headers_string = substr($headers_string, 2);
+      }
+      $values_string = '';
+      foreach($fields AS $field) {
+        $values_string .= ', '.$this->Quote($field, 'string');
+      }
+      $values_string = substr($values_string, 2);
+      return $this->query('INSERT INTO '.$this->QuoteIdentifier($table_name).' '.
+        (empty($headers_string) ? '' : "($headers_string) ")."\n".
+        "VALUES(".$values_string.")");
+    }
+    /**
+     * Import csv file
+     *
+     * This method should import a file
+     * @see TDbEngine::export_csv()
+     * 
+     * @return bool
+     */
+    function import_csv(
+        $file_path,
+        $table_name,
+        $field_separator=NULL,
+        $line_separator=NULL, 
+        $enclosed_by = NULL,
+        $escaped_by = NULL,
+        $first_line_is_headers = true)
+    {
+      if(empty($field_separator)) $field_separator = ',';
+      if(empty($line_separator) ) $line_separator  = "\r";
+      if(empty($enclosed_by)    ) $enclosed_by     = '"';
+      if(empty($escaped_by)     ) $escaped_by      = '\\';
+      if(!$fp = fopen($file_path, 'r')) {
+        add_error(sprintf(l10n('Unable to open file "%s".'), $file_path));
+        return false;
+      }
+      $this->StartTransaction();
+      $current_field = '';
+      $fields = Array();
+      $line_no = 0;
+      $in_quotes = false;
+      $prev_char = NULL;
+      $headers = NULL;
+      while(true) {
+        $char = fgetc($fp);
+        if($char === false) {
+          if(empty($fields) && (trim($current_field) == '')) {
+            //last line empty
+            break;
+          } else {
+            if($prev_char === $enclosed_by) {
+              $fields[] = substr($current_field,0,-1);
+            } else {
+              $fields[] = trim($current_field);
+            }
+            $line_no ++;
+            if($first_line_is_headers && ($line_no == 1)) {
+              $headers = $fields;
+            } else {
+              if(!$this->_insert_fields($table_name, $fields, $headers)) {
+                return false;
+              }
+            }
+          }
+          break;
+        }
+        if($prev_char === '\\') {
+          switch($char) {
+            case 'n':
+              $current_field.="\n";
+              break;
+            case 'r':
+              $current_field.="\r";
+              break;
+            case '0':
+              $current_field.="\0";
+              break;
+            default:
+              $current_field.=$char;
+          }
+          $char = $prev_char.$char;
+        } else {
+          switch($char) {
+            case $escaped_by:
+              break;
+            case $field_separator:
+              if($in_quotes) {
+                if($prev_char === $enclosed_by) {
+                  $fields[] = substr($current_field,0,-1);
+                  $current_field = '';
+                  $in_quotes = false;
+                } else {
+                  $current_field.=$char;
+                }
+              } else {
+                $fields[] = trim($current_field);
+                $current_field = '';
+              }
+              break;
+            case $line_separator:
+              if($prev_char === $enclosed_by) {
+                $fields[] = substr($current_field,0,-1);
+              } else {
+                $fields[] = trim($current_field);
+              }
+              $line_no ++;
+              if($first_line_is_headers && ($line_no == 1)) {
+                $headers = $fields;
+              } else {
+                if(!$this->_insert_fields($table_name, $fields, $headers)) {
+                  return false;
+                }
+              }
+              $fields = Array();
+              $current_field = '';
+              $in_quotes = false;
+              break;
+            case $enclosed_by:
+              if(!$in_quotes) {
+                if(trim($current_field) == '') {
+                  $current_field = '';
+                  $in_quotes = true;
+                  break;
+                } else {
+                  //...
+                }
+              }
+            default:
+              $current_field.=$char;
+          }
+        }
+        $prev_char = $char;
+      }
+      $this->commit();
+      fclose($fp);
+      return true;
+    }
+    
+    /**
+     * Export to csv file
+     *
+     * @see TDbEngine::import_csv()
+     * @return bool
+     */
+    function export_csv(
+        $table_catalog, $table_schema, $table_name_or_query,
+        $file_path,
+        $field_separator=NULL,
+        $line_separator=NULL, 
+        $enclosed_by = NULL,
+        $escaped_by = NULL,
+        $first_line_is_headers = true)
+    {
+      if(empty($field_separator)) $field_separator = ',';
+      if(empty($line_separator) ) $line_separator  = "\r";
+      if(empty($enclosed_by)    ) $enclosed_by     = '"';
+      if(empty($escaped_by)     ) $escaped_by      = '\\';
+      if(is_string($table_name_or_query)) {
+        $query = $this->select($table_catalog, $table_schema, $table_name_or_query);
+      } else {
+        $query = $table_name_or_query;
+      }
+      if(!$fp = fopen($file_path, 'w+')) {
+        add_error(sprintf(l10n('Unable to open file "%s".'), $file_path));
+        return false;
+      }
+      $row_no = 0;
+      while($row = $this->FetchAssoc($query)) {
+        $row_no ++;
+        $line = '';
+        if($first_line_is_headers && ($row_no == 1)) {
+          foreach($row AS $field=>$value) {
+            $field = str_replace(
+              Array($escaped_by, $field_separator, $enclosed_by, $line_separator),
+              Array($escaped_by.$escaped_by, $escaped_by.$field_separator,
+                $enclosed_by.$enclosed_by, $enclosed_by.$line_separator),
+              $field);
+            $line.= $enclosed_by.$field.$enclosed_by.$field_separator;
+          }
+          $line = substr($line, 0, -strlen($field_separator));
+          fputs($fp, $line.$line_separator);
+          $line = '';
+        }
+        foreach($row AS $field=>$value) {
+          $value = str_replace(
+            Array($escaped_by, $field_separator, $enclosed_by, $line_separator),
+            Array($escaped_by.$escaped_by, $escaped_by.$field_separator,
+              $enclosed_by.$enclosed_by, $enclosed_by.$line_separator),
+            $value);
+          $line.= $enclosed_by.$value.$enclosed_by.$field_separator;
+        }
+        $line = substr($line, 0, -strlen($field_separator));
+        fputs($fp, $line.$line_separator);
+      }
+      fclose($fp);
+      return true;
+    }
+    
+    function hilite($result) {
+    }
+    
+    function print_table($res) {
+      echo '<table class="results">'."\n";
+      while($row=$this->FetchAssoc($res)) {
+        echo '<tr>'."\n";
+        foreach($row AS $item=>$value) {
+        echo '<td title="'.$item.'">';
+        echo $value;
+        echo '</td>'."\n";
+        }
+        echo '</tr>'."\n";
+      }
+      echo '</table>'."\n";
+    }
+    
+    function query_by_shape($table_name,$shape) {
+      add_error(sprintf(l10n('Current database engine can\'t query by shape (%s).'),
+        $this->engine));
+    }
+    
+    
+    /* protected */ function _GetSchemata($sCatalogName= NULL, $sSchemaName= NULL) {
+      $r= Array();
+      $sSchemataWhereClause= '';
+      if($sCatalogName!== NULL) {
+        $sSchemataWhereClause.= 'CATALOG_NAME='.$this->Quote($sCatalogName).' ';
+      }
+      if($sSchemaName!== NULL) {
+        if(!empty($sSchemataWhereClause)) {
+          $sSchemataWhereClause.='AND ';
+        }
+        $sSchemataWhereClause.= 'SCHEMA_NAME='.$this->Quote($sSchemaName).' ';
+      }
+      if(!empty($sSchemataWhereClause)) {
+        $sSchemataWhereClause= 'WHERE '.$sSchemataWhereClause;
+      }
+      $rSchemata= $this->Query('SELECT * FROM INFORMATION_SCHEMA.SCHEMATA '.
+        $sSchemataWhereClause);
+      while($row= $this->FetchAssoc($rSchemata)) {
+        $r[]=Array(
+          'CATALOG_NAME'=>$row['CATALOG_NAME'],
+          'SCHEMA_NAME'=>$row['SCHEMA_NAME'],
+          'DEFAULT_CHARACTER_SET_NAME'=>$row['DEFAULT_CHARACTER_SET_NAME'],
+          'SQL_PATH'=>$row['SQL_PATH']
+          );
+      }
+      $this->FreeResult($rSchemata);
+      return $r;
+    }
+    
+    /* protected */ function _GetTables($sCatalogName, $sSchemaName, $sTableName= NULL) {
+      $r= Array();
+      $sTablesWhereClause= '';
+      if($sCatalogName!== NULL) {
+        $sTablesWhereClause.= 'TABLE_CATALOG='.$this->Quote($sCatalogName).' ';
+      }
+      if($sSchemaName!== NULL) {
+        if(!empty($sTablesWhereClause)) {
+          $sTablesWhereClause.='AND ';
+        }
+        $sTablesWhereClause.= 'TABLE_SCHEMA='.$this->Quote($sSchemaName).' ';
+      }
+      if($sTableName!== NULL) {
+        if(!empty($sTablesWhereClause)) {
+          $sTablesWhereClause.='AND ';
+        }
+        $sTablesWhereClause.= 'TABLE_NAME='.$this->Quote($sTableName).' ';
+      }
+      if(!empty($sTablesWhereClause)) {
+        $sTablesWhereClause= 'WHERE '.$sTablesWhereClause;
+      }
+      $rTables= $this->Query('SELECT * FROM INFORMATION_SCHEMA.TABLES '.
+        $sTablesWhereClause);
+      while($row= $this->FetchAssoc($rTables)) {
+        $r[]=Array(
+          'TABLE_CATALOG'=>$row['TABLE_CATALOG'],
+          'TABLE_SCHEMA'=>$row['TABLE_SCHEMA'],
+          'TABLE_NAME'=>$row['TABLE_NAME'],
+          'TABLE_TYPE'=>$row['TABLE_TYPE']
+          );
+      }
+      $this->FreeResult($rTables);
+      return $r;
+    }
+    
+    /* protected */ function _GetColumns($sCatalogName, $sSchemaName, $sTableName, 
+        $sColumnName= NULL) {
+      $r= Array();
+      $sColumnsWhereClause= '';
+      if($sCatalogName!== NULL) {
+        $sColumnsWhereClause.= 'TABLE_CATALOG='.$this->Quote($sCatalogName).' ';
+      }
+      if($sSchemaName!== NULL) {
+        if(!empty($sColumnsWhereClause)) {
+          $sColumnsWhereClause.='AND ';
+        }
+        $sColumnsWhereClause.= 'TABLE_SCHEMA='.$this->Quote($sSchemaName).' ';
+      }
+      if($sTableName!== NULL) {
+        if(!empty($sColumnsWhereClause)) {
+          $sColumnsWhereClause.='AND ';
+        }
+        $sColumnsWhereClause.= 'TABLE_NAME='.$this->Quote($sTableName).' ';
+      }
+      if($sColumnName!== NULL) {
+        if(!empty($sColumnsWhereClause)) {
+          $sColumnsWhereClause.='AND ';
+        }
+        $sColumnsWhereClause.= 'COLUMN_NAME='.$this->Quote($sColumnName).' ';
+      }
+      if(!empty($sColumnsWhereClause)) {
+        $sColumnsWhereClause= 'WHERE '.$sColumnsWhereClause;
+      }
+      $rColumns= $this->Query('SELECT * FROM INFORMATION_SCHEMA.COLUMNS '.
+          $sColumnsWhereClause);
+      while($row= $this->FetchAssoc($rColumns)) {
+        $r[]=Array(
+          'TABLE_CATALOG'=>$row['TABLE_CATALOG'],
+          'TABLE_SCHEMA'=>$row['TABLE_SCHEMA'],
+          'TABLE_NAME'=>$row['TABLE_NAME'],
+          'COLUMN_NAME'=>$row['COLUMN_NAME'],
+          'ORDINAL_POSITION'=>$row['ORDINAL_POSITION'],
+          'COLUMN_DEFAULT'=>$row['COLUMN_DEFAULT'],
+          'IS_NULLABLE'=>$row['IS_NULLABLE'],
+          'DATA_TYPE'=>$row['DATA_TYPE'],
+          'CHARACTER_MAXIMUM_LENGTH'=>$row['CHARACTER_MAXIMUM_LENGTH'],
+          'CHARACTER_OCTET_LENGTH'=>$row['CHARACTER_OCTET_LENGTH'],
+          'NUMERIC_PRECISION'=>$row['NUMERIC_PRECISION'],
+          'NUMERIC_SCALE'=>$row['NUMERIC_SCALE'],
+          'CHARACTER_SET_NAME'=>$row['CHARACTER_SET_NAME'],
+          'COLLATION_NAME'=>$row['COLLATION_NAME']
+          );
+      }
+      $this->FreeResult($rColumns);
+      return $r;
+    }
+    
+    function GetInformationSchema($sCatalogName= NULL, $sSchemaName= NULL,
+        $sTableName= NULL, $sColumnName= NULL) {
+      $aSchemata= $this->_GetSchemata($sCatalogName, $sSchemaName);
+      foreach($aSchemata AS $kSchemata=>$vSchemata) {
+        $aSchemata[$kSchemata]['TABLES']= $this->_GetTables(
+            $vSchemata['CATALOG_NAME'],$vSchemata['SCHEMA_NAME'], $sTableName);
+        foreach($aSchemata[$kSchemata]['TABLES'] AS $kTable=>$vTable){
+          $aSchemata[$kSchemata]['TABLES'][$kTable]['COLUMNS']=
+            $this->_GetColumns($vSchemata['CATALOG_NAME'],$vSchemata['SCHEMA_NAME'],
+                $vTable['TABLE_NAME'], $sColumnName);
+          if(!empty($vTable['MUSMAP_ESRI_XML_METADATA_FILE'])
+              && function_exists('AddESRIXMLMetadata')) {
+            $aSchemata[$kSchemata]['TABLES'][$kTable]= 
+              AddESRIXMLMetadata($aSchemata[$kSchemata]['TABLES'][$kTable],
+                file_get_contents($vTable['MUSMAP_ESRI_XML_METADATA_FILE']));
+          } elseif(!empty($vTable['MUSMAP_ESRI_XML_METADATA'])
+              && function_exists('AddESRIXMLMetadata')) {
+            $aSchemata[$kSchemata]['TABLES'][$kTable]= 
+              AddESRIXMLMetadata($aSchemata[$kSchemata]['TABLES'][$kTable],
+                $vTable['MUSMAP_ESRI_XML_METADATA']);
+          }
+        }
+      }
+      return $aSchemata;
+    }
+    
+    function MusmapTypeFromSQLType($sql_type_infos) {
+      if(!isset($sql_type_infos['params'][0])) {
+        $sql_type_infos['params'][0]= 0;
+      }
+      if(!isset($sql_type_infos['params'][1])) {
+        $sql_type_infos['params'][1]= 0;
+      }
+      switch(strtolower($sql_type_infos['type'])) {
+        case 'binary':
+        case 'longbinary':
+        case 'bigbinary':
+        case 'blob':
+        case 'longblob':
+        case 'text':
+        case 'longtext':
+        case 'varchar':
+        case 'char':
+        case 'longchar'://odbc
+          $sql_type_infos['type']= 'C';
+          break;
+        case 'bit':
+        case 'counter'://odbc
+        case 'int':
+        case 'integer':
+        case 'tinyint':
+        case 'smallint':
+        case 'bigint':
+        case 'double':
+        case 'double precision':
+        case 'real':
+        case 'float':
+        case 'decimal':
+        case 'numeric':
+        case 'timestamp':
+        case 'guid'://Access
+          $sql_type_infos['type']= 'N';
+          break;
+        case 'date':
+          $sql_type_infos['type']= 'C';
+          $sql_type_infos['params'][0]= 10;
+          break;
+        case 'time':
+          $sql_type_infos['type']= 'C';
+          $sql_type_infos['params'][0]= 8;
+          break;
+        case 'datetime':
+          $sql_type_infos['type']= 'C';
+          $sql_type_infos['params'][0]= 19;
+          break;
+        case 'enum'://MySQL
+        case 'set'://MySQL
+          $sql_type_infos['type']= 'C';
+          $sql_type_infos['params'][0]= NULL;
+          break;
+        default:
+          add_error(sprintf(l10n('Unknown %s type: "%s".'),
+            'SQL', $sql_type_infos['type']));
+          return false;
+      }
+      return $sql_type_infos;
+    }
+    
+    /**
+     * Returns an SQL expression to concatenate
+     *
+     * @param string $s,... SQL expression
+     */
+    function SQLConcat() {
+      $aArgs= func_get_args();
+      return '('.implode(' || ', $aArgs).')';
+    }
+    
+    /**
+     * Returns an SQL expression to get the first non-null value
+     *
+     * @param string $s,... SQL expression
+     */
+    function SQLCoalesce() {
+      $aArgs= func_get_args();
+      return 'COALESCE('.implode(', ', $aArgs).')';
+    }
+    
+    function CapabilitiesAsArray($iCapabilities) {
+      $r= Array();
+      if(($iCapabilities & DB_SUPPORTS_SQL)==DB_SUPPORTS_SQL) {
+        $r[]='SQL';
+      } elseif(($iCapabilities & DB_SUPPORTS_SELECT)==DB_SUPPORTS_SELECT) {
+        $r[]='Select';
+      }
+      if(($iCapabilities & DB_SUPPORTS_GetInformationSchema)==DB_SUPPORTS_GetInformationSchema) {
+        $r[]='GetInformationSchema';
+      }
+      if(($iCapabilities & DB_SUPPORTS_GET_LAST_INSERT_ROW_ID)==DB_SUPPORTS_GET_LAST_INSERT_ROW_ID) {
+        $r[]='GetLastInsertRowId';
+      }
+      if(($iCapabilities & DB_SUPPORTS_DRAWING)==DB_SUPPORTS_DRAWING) {
+        $r[]='Drawing';
+      }
+      return $r;
+    }
+    function CapabilitiesAsString($iCapabilities) {
+      return implode(", ",TDbEngine::CapabilitiesAsArray($iCapabilities));
+    }
+    
+    /**
+     * Create a complete database
+     * Param is a schemata, using the same structure as 
+     * GetInformationSchema return value
+     */
+    function ConstructDatabase($aSchemata) {
+      echo '<pre>';
+      foreach($aSchemata AS $kSchemata=>$vSchemata) {
+        foreach($vSchemata['TABLES'] AS $kTable=>$vTable){
+          $sTableIdentifier= $this->QuoteIdentifier($vTable['TABLE_NAME']);
+          if($vTable['TABLE_SCHEMA']) {
+            $sTableIdentifier= $this->QuoteIdentifier($vTable['TABLE_SCHEMA']).
+              '.'.$sTableIdentifier;
+            if($vTable['TABLE_CATALOG']) {
+              $sTableIdentifier= $this->QuoteIdentifier($vTable['TABLE_CATALOG']).
+                '.'.$sTableIdentifier;
+            }
+          }
+          $aPrimaryKeyFields= Array();
+          $sCreateTable= 'CREATE TABLE '.$sTableIdentifier." (\n";
+          foreach($vTable['COLUMNS'] AS $kColumn=>$vColumn){
+            $aMusmapType= $this->MusmapTypeFromSQLType(Array('type'=>$vColumn['DATA_TYPE']));
+            $sCreateTable.= '  '.$this->QuoteIdentifier($vColumn['COLUMN_NAME']).' '.
+              $vColumn['DATA_TYPE'].
+              ' DEFAULT '.$this->Quote($vColumn['COLUMN_DEFAULT'], $aMusmapType['type']).
+              ($vColumn['IS_NULLABLE'] ? ' NULL' : ' NOT NULL').
+              ','."\n";
+          }
+          if(!empty($aPrimaryKeyFields)) {
+            $sCreateTable.='PRIMARY KEY (';
+            foreach($aPrimaryKeyFields AS $sPrimaryKeyField) {
+              $sCreateTable.=$this->QuoteIdentifier($sPrimaryKeyField).', ';
+            }
+            $sCreateTable=substr($sCreateTable, 0, -2).')'."\n";
+          } else {
+            $sCreateTable= substr($sCreateTable, 0, -2)."\n";
+          }
+          $sCreateTable.= ');'."\n";
+          echo($sCreateTable);
+        }
+      }
+    }
+  }
+  
+  define('DB_SUPPORTS_NONE', 0);
+  define('DB_SUPPORTS_SELECT', 1);
+  define('DB_SUPPORTS_SQL', 2 | DB_SUPPORTS_SELECT);
+  define('DB_SUPPORTS_GetInformationSchema',4);
+  define('DB_SUPPORTS_GET_LAST_INSERT_ROW_ID', 8);
+  define('DB_SUPPORTS_DRAWING', 16);
+
+?>

Added: packages/musmap/branches/upstream/current/include/database/db.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/db.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/db.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,125 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Database functions
+ * 
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+  /**
+   * List all engines
+   */
+  global $g_oDbEngines;
+  $g_oDbEngines=Array();
+  
+  require_once('data_sources.inc.php');
+  
+
+  function cast($str,$type) {
+    switch($type) {
+      case NULL:
+      case '':
+      case 'C':
+      case 'L'://HTML link
+        $type='string';
+        break;
+      case 'F':
+      case 'N':
+        $type='float';
+        break;
+    }
+    settype($str,$type);
+    return $str;
+  }
+
+
+  /**
+   * Database engine independant 
+   * password function
+   */
+  function password($unencoded) {
+    return md5($unencoded);
+  }
+  
+  function sql__concat() {
+    $r='';
+    for($i=0;$i<func_num_args();$i++) {
+      $r.=func_get_arg($i);
+    }
+    return $r;
+  }
+  
+  function sql__substr() {
+    $args=func_get_args();
+    return call_user_func_array('substr',$args);
+  }
+  
+  function sql__cast() {
+    $args=func_get_args();
+    return call_user_func_array('cast',$args);
+  }
+  
+  function RegisterDbEngine($dbClassName, $dbDriver, $capabilities) {
+    global $g_oDbEngines;
+    $g_oDbEngines[$dbDriver][]= Array($dbClassName, $capabilities);
+  }
+  
+  function GetCapabilities($dbClassName, $dbDriver) {
+    global $g_oDbEngines;
+    if(isset($g_oDbEngines[$dbDriver])) {
+      foreach($g_oDbEngines[$dbDriver] AS $dbEngineInfos) {
+        if($dbEngineInfos[0]==$dbClassName) {
+          return $dbEngineInfos[1];
+        }
+      }
+    }
+    return DB_SUPPORTS_NONE;
+  }
+  
+  /**
+   *
+   * @param string $dbDriver
+   * @param integer $capabilities
+   * @return string|false
+   */
+  function GetDbEngine($dbDriver, $capabilities) {
+    global $g_oDbEngines;
+    if(isset($g_oDbEngines[$dbDriver])) {
+      foreach($g_oDbEngines[$dbDriver] as $dbEngineInfos) {
+        if(($dbEngineInfos[1] & $capabilities) == $capabilities) {
+          return $dbEngineInfos[0];
+        }
+      }
+    }
+    return false;
+  }
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/database/dbase.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/dbase.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/dbase.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,78 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Dbase engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2004-08
+ */
+ 
+  /**
+   * Class TODBCEngine
+   */
+  require_once('odbc.db.class.php');
+  
+if(class_exists('TODBCEngine') && substr(PHP_OS,0,3)=='WIN') {
+    /**
+     * Class TdBaseEngine
+     * @package database
+     */
+    class TdBaseEngine extends TODBCEngine {
+      
+      /**
+       * Connect to db
+       */
+      function connect($db_params) {
+        if(empty($db_params['dsn'])) {
+          $db_params['dsn']='DRIVER=Microsoft dBase Driver (*.dbf);'.
+                            'DefaultDir='.$db_params['dirname'].';'.
+                            'DBQ='.$db_params['dirname'];
+        }
+        parent::connect($db_params);
+      }
+      
+  }
+  
+  registerDbEngine('TdBaseEngine', 'dbase',
+       DB_SUPPORTS_SQL
+    | !DB_SUPPORTS_GetInformationSchema
+    | !DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+    
+  registerDbEngine('TdBaseEngine', 'shapefile',
+       DB_SUPPORTS_SQL
+    | !DB_SUPPORTS_GetInformationSchema
+    | !DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+  
+}//class_exists('TODBCEngine') && substr(PHP_OS,0,3)=='WIN'
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/database/dbase_file.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/dbase_file.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/dbase_file.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,275 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * DBase "engine": bad performance
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2004-08
+ */
+  /**
+   * Class TDBaseFileEngine
+   * @package database
+   */
+  class TDBaseFileEngine extends TDbEngine {
+    var $header= Array();
+    /**
+     * File position
+     */
+    var $pos= Array();
+    var $num_rows= Array();
+    var $row_size= Array();
+    /**
+     * Db infos
+     */
+    function TDBaseFileEngine() {
+      $this->engine="dBase";
+      $this->website="";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      return MUSMAP_VERSION;
+    }
+
+  /**
+   * Connect to db
+   */
+    function connect($db_params) {
+      $this->db_params= $db_params;
+      if(isset($this->db_params['path']) && !isset($this->db_params['dirname'])) {
+        $this->db_params['dirname']= dirname($this->db_params['path']);
+      }
+      if(!isset($this->db_params['dirname'])) {
+        $this->db_params['dirname']= '';
+      }
+      if(!file_exists($this->db_params['dirname'])) {
+        add_error(sprintf(l10n('DBase folder not found: "%s".'), $this->db_params['dirname']));
+      }
+    }
+    
+    /**
+     * Load header (columns definition)
+     * @private
+     */
+    /* private */ function LoadHeader($sTableName) {
+      if(!file_exists($this->db_params['dirname'])) {
+        add_error(sprintf(l10n('DBase folder not found: "%s".'), $this->db_params['dirname']));
+        return false;
+      }
+      $sDbfFilePath= $this->db_params['dirname'].DIRECTORY_SEPARATOR.$sTableName.'.dbf';
+      $fdbf = @fopen($sDbfFilePath,'r');
+      if($fdbf===false) {
+        add_error(sprintf(l10n('Dbase file not found: "%s".'), $sDbfFilePath));
+        return false;
+      }
+      $dbfhdrarr = array();
+      $buff32 = '';
+      $i = 1;
+      $goon = true;
+      while ($goon) {
+        if (!feof($fdbf)) {
+          $buff32 = fread($fdbf,32);
+          if ($i > 1) {
+            if (substr($buff32,0,1) == chr(13)) {
+              $goon = false;
+            } else {
+              $pos = strpos(substr($buff32,0,10),chr(0));
+              $pos = ($pos == 0?10:$pos);
+              $fieldname = substr($buff32,0,$pos);
+              $fieldtype = substr($buff32,11,1);
+              $fieldlen = ord(substr($buff32,16,1));
+              $fielddec = ord(substr($buff32,17,1));
+              array_push($dbfhdrarr, array($fieldname,$fieldtype,$fieldlen,$fielddec));
+            }
+          }
+          $i++;
+        } else {
+          $goon = false;
+        }
+      }
+      $this->pos[$sTableName]=ftell($fdbf)-30;
+      fclose($fdbf);
+      $this->header[$sTableName]=$dbfhdrarr;
+      $this->row_size[$sTableName]=1;
+      foreach($this->header[$sTableName] AS $col) {
+        $this->row_size[$sTableName]+=$col[2];
+      }
+      $this->num_rows[$sTableName]= (filesize($sDbfFilePath)-$this->pos[$sTableName])/($this->row_size[$sTableName]);
+    }
+    
+    /* protected */ function _GetSchemata($sCatalogName= NULL, $sSchemaName= NULL) {
+      $r= Array();
+      if($sCatalogName!== NULL) {
+        add_error(l10n('SQL catalogs not supported.'));
+      }
+      if($sSchemaName!== NULL) {
+        add_error(l10n('SQL schema not supported.'));
+      }
+      $r[]=Array(
+        'CATALOG_NAME'=>NULL,
+        'SCHEMA_NAME'=>NULL,
+        'DEFAULT_CHARACTER_SET_NAME'=>NULL,
+        'SQL_PATH'=>NULL
+        );
+      return $r;
+    }
+    
+    /* protected */ function _GetTables($sCatalogName, $sSchemaName, $sTableName= NULL) {
+      if(!file_exists($this->db_params['dirname'])) {
+        add_error(sprintf(l10n('DBase folder not found: "%s".'), $this->db_params['dirname']));
+        return false;
+      }
+      $r= Array();
+      $sTablesWhereClause= '';
+      if($sCatalogName!== NULL) {
+        add_error(l10n('SQL catalogs not supported.'));
+      }
+      if($sSchemaName!== NULL) {
+        add_error(l10n('SQL schema not supported.'));
+      }
+      $dir= dir($this->db_params['dirname']);
+      
+      while(false !== ($entry= $dir->read())) {
+        $aTableInfos= NULL;
+        if(strtolower(substr($entry,-4))=='.dbf') {
+          if(($sTableName===NULL) || ($sTableName==substr($entry,0,-4))) {
+            $aTableInfos= Array(
+              'TABLE_CATALOG'=> NULL,
+              'TABLE_SCHEMA'=>NULL,
+              'TABLE_NAME'=>substr($entry,0,-4),
+              'TABLE_TYPE'=>NULL
+              );
+            if(file_exists($this->db_params['dirname'].DIRECTORY_SEPARATOR.substr($entry,0,-4).'.shp.xml')) {
+              $aTableInfos['MUSMAP_ESRI_XML_METADATA_FILE']=
+                $this->db_params['dirname'].DIRECTORY_SEPARATOR.substr($entry,0,-4).'.shp.xml';
+            } elseif(file_exists($this->db_params['dirname'].DIRECTORY_SEPARATOR.substr($entry,0,-4).'.dbf.xml')) {
+              $aTableInfos['MUSMAP_ESRI_XML_METADATA_FILE']=
+                $this->db_params['dirname'].DIRECTORY_SEPARATOR.substr($entry,0,-4).'.dbf.xml';
+            } elseif(file_exists($this->db_params['dirname'].DIRECTORY_SEPARATOR.substr($entry,0,-4).'.xml')) {
+              $aTableInfos['MUSMAP_ESRI_XML_METADATA_FILE']=
+                $this->db_params['dirname'].DIRECTORY_SEPARATOR.substr($entry,0,-4).'.xml';
+            }
+            if(file_exists($dir->path.DIRECTORY_SEPARATOR.substr($entry,0,-4).'.shp')) {
+              $aTableInfos['MUSMAP_TABLE_TYPE']= TMapserverEngine::getShapeFileType(
+                $dir->path.DIRECTORY_SEPARATOR.substr($entry,0,-4).'.shp');
+            }
+            $r[]= $aTableInfos;
+          }
+        }
+      }
+      $dir->close();
+      return $r;
+    }
+    
+    /* protected */ function _GetColumns($sCatalogName, $sSchemaName, $sTableName, 
+        $sColumnName= NULL) {
+      $r= Array();
+      if($sCatalogName!== NULL) {
+        add_error(l10n('SQL catalogs not supported.'));
+      }
+      if($sSchemaName!== NULL) {
+        add_error(l10n('SQL schema not supported.'));
+      }
+      $this->LoadHeader($sTableName);
+      $iOrdinalPosition= 0;
+      foreach($this->header[$sTableName] AS $col) {
+        $iOrdinalPosition++;
+        if($sColumnName===NULL |$sColumnName==$col[0]) {
+          $sql_infos= TDBaseFileEngine::SQLTypeFromInternalType($col);
+          $r[]=Array(
+            'TABLE_CATALOG'=>NULL,
+            'TABLE_SCHEMA'=>NULL,
+            'TABLE_NAME'=>$sTableName,
+            'COLUMN_NAME'=>$col[0],
+            'ORDINAL_POSITION'=>$iOrdinalPosition,
+            'COLUMN_DEFAULT'=>NULL,
+            'IS_NULLABLE'=>'No',
+            'DATA_TYPE'=>$sql_infos['type'],
+            'CHARACTER_MAXIMUM_LENGTH'=>NULL,
+            'CHARACTER_OCTET_LENGTH'=>NULL,
+            'NUMERIC_PRECISION'=>NULL,
+            'NUMERIC_SCALE'=>NULL,
+            'CHARACTER_SET_NAME'=>NULL,
+            'COLLATION_NAME'=>NULL
+            );
+        }
+      }
+      return $r;
+    }
+    
+    function SQLTypeFromInternalType($internal_type) {
+      $sql_params= Array($internal_type[2], $internal_type[3]);
+      switch($internal_type[1]) {
+        case 'L':
+          $sql_type= 'TINYINT';
+          break;
+        case 'M':
+          $sql_type= 'VARCHAR';
+          break;
+        case 'D':
+          $sql_type= 'DATE';
+          break;
+        case 'N':
+          if($internal_type[3]>0) {
+            $sql_type= 'DOUBLE';
+          } else {
+            $sql_type= 'INT';
+          }
+          break;
+        case 'F':
+          $sql_type= 'DOUBLE';
+          break;
+        case 'C':
+          $sql_type= 'CHAR';
+          break;
+        default:
+          add_error(sprintf(l10n('Unknown %s type: "%s".'),
+            'dBase', $internal_type[1]));
+          return false;
+      }
+      return Array('type'=>$sql_type, 'params'=>$sql_params);
+    }
+  }
+  registerDbEngine('TDBaseFileEngine', 'dbase',
+      !DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    | !DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+  registerDbEngine('TDBaseFileEngine', 'shapefile',
+      !DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    | !DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/database/firebird.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/firebird.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/firebird.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,284 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * Firebird/Interbase engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2005-07
+ */
+if(function_exists('ibase_connect')) {
+  /**
+   * Class TFirebirdEngine
+   * @package database
+   */
+  class TFirebirdEngine extends TDbEngine {
+    /**
+     * Last transaction id
+     */
+    var $transaction= NULL;
+    
+    /**
+     * Db infos
+     */
+    function TFirebirdEngine() {
+      $this->engine="FireBird/Interbase";
+      $this->website="http://firebird.sourceforge.net/";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      return '?';
+    }
+    
+    /**
+     * Connect to db
+     */
+    function connect($db_params) {
+      $this->db_params=$db_params;
+      extract($db_params);
+      $this->handle= ibase_connect(
+        isset($database) ? $database : NULL,
+        isset($username) ? $username : NULL,
+        isset($password) ? $password : NULL,
+        isset($charset) ? $charset : NULL,
+        isset($buffers) ? $buffers : NULL,
+        isset($dialect) ? $dialect : NULL,
+        isset($role) ? $role : NULL);
+        //isset($sync) ? $sync : NULL);
+      if(!$this->handle) {
+        add_error(sprintf(
+            l10n('"%s" does\'nt respond. Check if it is running.'),
+            'Firebird/Interbase'));
+      }
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return str_replace("'","''",$s);
+    }
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name
+     * @param int $e_level
+     * @return mixed
+     */
+    function Query($q) {
+      $this->Log($q);
+      if($this->transaction) {
+        $r= ibase_query($this->transaction, $q);
+      } else {
+        $r= ibase_query($this->handle, $q);
+      }
+      return $r;
+    }
+
+    /**
+     * Escape  and quote identifier
+     */
+    function QuoteIdentifier($s) {
+      // HACK: Identifiers upper cased !
+      return $this->_InternalQuoteIdentifier($this->Escape(strtoupper($s)));
+    }
+    
+    /**
+     * Returns if table exists
+     *
+     * * true => yes
+     * * false => no
+     * * NULL => unknown (perform a select query to check)
+     *
+     * @param string $table_catalog
+     * @param string $table_schema
+     * @param string $table_name
+     * @param array  $table_params
+     * @return NULL|true|false
+     */
+    function TableExists($table_catalog, $table_schema, $table_name, $table_params) {
+      return NULL;
+      //*/
+      $r= $this->Query('SELECT RDB$RELATION_NAME '.
+        'FROM RDB$RELATIONS '.
+        'WHERE ((RDB$SYSTEM_FLAG = 0) OR (RDB$SYSTEM_FLAG IS NULL)) '.
+          'AND (RDB$VIEW_SOURCE IS NULL) '.
+          'AND RDB$RELATION_NAME='.$this->Quote($table_name).' ');
+      $row= $this->FetchAssoc($r);
+      $this->FreeResult($r);
+      return (bool) $row;
+    }
+
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      $this->transaction= ibase_trans();
+      return $this->transaction;
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      $r= ibase_commit($this->transaction);
+      $this->transaction= NULL;
+      return $r;
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      $r= ibase_rollback($this->transaction);
+      $this->transaction= NULL;
+      return $r;
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows($result) {
+      return ibase_affected_rows($this->handle);
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+      //If the query was successful and there were no results, ibase_query returns TRUE.
+      if($result===true) {
+        return false;
+      } else {
+        $r1= ibase_fetch_assoc($result, IBASE_TEXT);
+        if(is_array($r1)) {
+          $r2= Array();
+          foreach($r1 as $k=>$v) {
+            $r2[strtolower($k)]= $v;
+          }
+          return $r2;
+        } else {
+          return $r1;
+        }
+      }
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+      //If the query was successful and there were no results, ibase_query returns TRUE.
+      if($result===true) {
+        return false;
+      } else {
+        return ibase_fetch_row($result, IBASE_TEXT);
+      }
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed the result
+     */
+    function FreeResult($r) {
+      //If the query was successful and there were no results, ibase_query returns TRUE.
+      if($r!==true) {
+        return ibase_FreeResult($r);
+      }
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed the result
+     * @return int
+     */
+    function get_num_rows($result) {
+      return -1;
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+      $q=$this->query("SELECT GEN_ID(".substr($table_name.'_'.$id_name,0,31).",0) ".
+        "FROM rdb\$database;");
+      $row=$this->FetchNum($q);
+      $this->FreeResult($q);
+      return array_pop($row);
+    }
+    
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+      return $this->Query("SET GENERATOR ".
+        substr($table_name.'_'.$id_name,0,31).
+        "TO ".$this->Quote($value));
+    }
+  }
+
+  registerDbEngine('TFirebirdEngine', 'firebird',
+       DB_SUPPORTS_SQL
+    | !DB_SUPPORTS_GetInformationSchema
+    |  DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+  registerDbEngine('TFirebirdEngine', 'interbase',
+       DB_SUPPORTS_SQL
+    | !DB_SUPPORTS_GetInformationSchema
+    |  DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+}//function_exists('ibase_connect')
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/database/mapserver.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/mapserver.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/mapserver.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,470 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Mapserver engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2004-10
+ */
+
+if(function_exists('ms_GetVersion')) {
+  /**
+   * Class TMapserverEngine
+   * @package database
+   */
+  class TMapserverEngine extends TDbEngine {
+    var $current_rows=Array();
+    var $sub_db=NULL;
+    /**
+     * Db infos
+     */
+    function TMapserverEngine() {
+      $this->engine="MapServer";
+      $this->website="http://mapserver.gis.umn.edu/";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      return ms_GetVersion();
+    }
+
+  /**
+   * Connect to db
+   */
+    function connect($db_params) {
+      $this->db_params=$db_params;
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return $s;
+    }
+    
+    /**
+     * Escape  and quote identifier
+     */
+    function QuoteIdentifier($s,$type) {
+      if($type==NULL) {$type='string';}
+      elseif($type=='C') {$type='string';}
+      elseif($type=='L') {$type='string';}
+      elseif($type=='M') {$type='string';}
+      elseif($type=='N') {$type='float';}
+      elseif($type=='F') {$type='float';}
+      if($type=='float' || $type=='int') {
+        return "[".$this->Escape($s)."]";
+      } else {
+        return "'[".$this->Escape($s)."]'";
+      }
+    }
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name deprecated
+     * @param int $e_level
+     * @return mixed
+     */
+    function Query($q) {
+      if(!$this->sub_db) {
+        $db_engine= getDbEngine('dbase', DB_SUPPORTS_SQL);
+        if($db_engine!==false) {
+          $this->sub_db = & new $db_engine();
+          $this->sub_db->connect($this->db_params);
+        } else {
+          add_error(l10n('No database engine!'));
+          return false;
+        }
+      }
+      return Array(NULL,$this->sub_db->query($q));
+    }
+    
+    /**
+     * Execute a select query and return the result
+     *
+     * @param string $table_name
+     * @param string[][] $where_array Array(Array($field,$operator,$value,$type='string'),...)
+     *                   where $operator is one of '=','<>','<','<=','>=','>','LIKE'
+     * @param string[] $order_by_array array of fields
+     * @param string[] $fields array of fields
+     * @return mixed
+     */
+    function select($table_catalog, $table_schema, $table_name, $table_params, $where_array=Array(),$order_by_array=Array(),$fields=Array('*')) {
+      global $map;
+      if(count($order_by_array)>0) {
+        add_error(sprintf(l10n('Current database engine can\'t sort rows (%s).'),
+          $this->engine));
+      }
+      $ms_layer=$map->get_ms_layer_by_name($table_name,false);
+      if($ms_layer) {// ms_layer
+        if(is_array($where_array)) {
+          $qitem=$where_array[0][0];
+          $qstring='';
+          if(count($where_array)>0) {
+            //begin expression
+            $qstring='(';
+            foreach($where_array AS $where_item) {
+              $qstring.=$this->QuoteIdentifier($where_item[0],isset($where_item[3])?$where_item[3]:NULL).$where_item[1].
+                $this->Quote($where_item[2],isset($where_item[3])?$where_item[3]:NULL).' and ';
+            }
+            $qstring=substr($qstring,0,-5).')';
+          }
+        } else {
+          $start_pos=strpos($where_array,'==')+1;
+          $qitem=substr($where_array,0,$start_pos-1);
+          $qstring=substr($where_array,$start_pos+1);
+        }
+        $ms_extent= $ms_layer->getExtent();
+        $map->ms_map->setextent(
+          $ms_extent->minx, $ms_extent->miny,
+          $ms_extent->maxx, $ms_extent->maxy);
+        $r= @$ms_layer->queryByAttributes($qitem,$qstring,MS_MULTIPLE);
+        return Array(
+          $ms_layer,
+          $r);
+      } else {
+        add_error(sprintf(l10n('Layer not found: "%s".'), 
+            $table_name));
+        return false;
+      }
+    }
+    
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      //return $this->query('BEGIN');
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      //return $this->query('COMMIT');
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      //return $this->query('ROLLBACK');
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows($result) {
+      //return mysql_affected_rows($this->handle);
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+      global $map;
+      if($result[0]===NULL) {
+        return $this->sub_db->FetchAssoc($result[1]);
+      } else {
+        if(!is_a($result[0],'ms_layer_obj') && !is_a($result[0],'LayerObj')) {
+          return false;
+        }
+        $result[0]->open();
+        if(!isset($this->current_rows[$result[0]->name])) {
+          $this->current_rows[$result[0]->name]= 0;
+        }
+        $result1=$result[0]->getResult($this->current_rows[$result[0]->name]);
+        if(!$result1) {
+          return false;
+        } else {
+          $this->current_rows[$result[0]->name]++;
+          $this->shape=$result[0]->getShape($result1->tileindex,$result1->shapeindex);
+          return $this->shape->values;
+        }
+      }
+    }
+    
+    function hilite($result) {
+      global $map;
+      if($result[0]!==NULL) {
+        $map->ms_query_layers[$this->shape->type]->addFeature($this->shape);
+        /*
+        $this->shape->draw($map->ms_map,
+          $map->ms_query_layers[$this->shape->type],
+          $map->map_img);
+        //*/
+      }
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed $result the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed $result the result
+     * @return mixed
+     */
+    function FreeResult($result) {
+      if($result[0]===NULL) {
+        return $this->sub_db->FreeResult($result[1]);
+      } else {
+        if(!is_a($result[0],'ms_layer_obj') && !is_a($result[0],'LayerObj')) {
+          return false;
+        }
+        return $result[0]->close();
+      }
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed $result the result
+     * @return int
+     */
+    function get_num_rows($result) {
+      if($result[0]===NULL) {
+        return $this->sub_db->get_num_rows($result[1]);
+      } else {
+        if(is_a($result[0],'ms_layer_obj') || is_a($result[0],'LayerObj')) {
+          return $result[0]->getNumresults();
+        } else {
+          return -1;
+        }
+      }
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+      return mysql_insert_id($this->handle);
+    }
+
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+    }
+
+    /**
+     * Execute a select query and return the result
+     *
+     * @param string $table_name
+     * @param mixed $shape 
+     * @return mixed
+     */
+    function query_by_shape($table_name,$shape) {
+      global $map;
+      if($table_name==='*') {
+        $ms_layer=$map->ms_map;
+      } else {
+        $ms_layer=$map->get_ms_layer_by_name($table_name,false);
+      }
+      if($ms_layer) {
+        if(is_a($shape,'ms_rect_obj')) {
+          $query_result=@$ms_layer->queryByRect($shape);
+        } elseif(is_a($shape,'ms_point_obj')) {
+          $query_result=@$ms_layer->queryBypoint($shape,MS_SINGLE,10);
+        } else {
+          return false;
+        }
+        if(is_a($ms_layer,'ms_layer_obj')) {
+          return Array(
+            $ms_layer,
+            $query_result);
+        } else {
+          add_error(l10n('Unknown query shape object.'));
+          return false;
+        }
+      } else {
+        return false;
+      }
+    }
+    
+    /**
+     * Get the shape file type
+     */
+    function getShapeFileType($shape_path) {
+      $r=false;
+      if(file_exists($shape_path)) {
+        $shape_obj=ms_newShapefileObj($shape_path, -1);
+        switch($shape_obj->type) {
+          case 0 ://Null Shape
+            $r='';
+            break;
+          case MS_SHP_POINT ://1
+          case 11 ://11: point Z
+          case MS_SHP_POINTM ://21
+            $r='P';
+            break;
+          case MS_SHP_ARC ://3
+          case 13 ://11: PolyLineZ
+          case MS_SHP_ARCM ://23
+            $r='L';
+            break;
+          case MS_SHP_POLYGON ://5
+          case 15 ://11: PolygonZ
+          case MS_SHP_POLYGONM ://25
+            $r='S';
+            break;
+          case MS_SHP_MULTIPOINT ://8
+          case 18 ://11: MultiPointZ
+          case MS_SHP_MULTIPOINTM ://28
+            $r='P';
+            break;
+          case 31 ://11: MultiPatch
+          default :
+            add_error(sprintf(l10n('Unknown shape file type "%s" for file "%s" .'),
+              $shape_obj->type,
+              $shape_path));
+        }
+        $shape_obj->free();
+      } else {
+        add_error(sprintf(l10n('File not found "%s".'),$shape_path));
+      }
+      return $r;
+    }
+    
+    /**
+     *
+     */
+    function registerMapserverEngine() {
+      global $mapserver_output_formats;
+      $mapserver_output_formats = Array();
+      foreach(explode(' ',ms_GetVersion()) AS $version_info) {
+        switch($version_info) {
+          case 'INPUT=SHAPEFILE':
+            registerDbEngine('TMapserverEngine', 'shapefile',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            break;
+          case 'INPUT=OGR':
+            registerDbEngine('TMapserverEngine', 'ogr',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            break;
+          case 'INPUT=POSTGIS':
+            registerDbEngine('TMapserverEngine', 'postgis',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            break;
+          case 'INPUT=MYGIS':
+            registerDbEngine('TMapserverEngine', 'mygis',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            break;
+          case 'INPUT=ORACLESPATIAL':
+            registerDbEngine('TMapserverEngine', 'oraclespatial',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            break;
+          case 'SUPPORTS=WMS_CLIENT':
+          //case 'SUPPORTS=WMS_SERVER':
+            registerDbEngine('TMapserverEngine', 'wms',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            break;
+          case 'SUPPORTS=WFS_CLIENT':
+          //case 'SUPPORTS=WFS_SERVER':
+            registerDbEngine('TMapserverEngine', 'wfs',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            break;
+          //== Mixed formats
+          case 'INPUT=SDE':
+            registerDbEngine('TMapserverEngine', 'sde',
+              DB_SUPPORTS_DRAWING | DB_SUPPORTS_SELECT);
+            registerDbEngine('TMapserverEngine', 'raster:sde',
+              DB_SUPPORTS_DRAWING);
+            break;
+          //== Raster formats
+          case 'INPUT=GDAL':
+            registerDbEngine('TMapserverEngine', 'raster:gdal',
+              DB_SUPPORTS_DRAWING);
+            break;
+          case 'INPUT=TIFF':
+            registerDbEngine('TMapserverEngine', 'raster:tiff',
+              DB_SUPPORTS_DRAWING);
+            break;
+          case 'OUTPUT=GIF':
+            registerDbEngine('TMapserverEngine', 'raster:gif',
+              DB_SUPPORTS_DRAWING);
+            break;
+          case 'OUTPUT=PNG':
+            registerDbEngine('TMapserverEngine', 'raster:png',
+              DB_SUPPORTS_DRAWING);
+            break;
+          case 'INPUT=JPEG':
+            registerDbEngine('TMapserverEngine', 'raster:jpeg',
+              DB_SUPPORTS_DRAWING);
+            break;
+          case 'INPUT=EPPL7':
+            registerDbEngine('TMapserverEngine', 'raster:eppl7',
+              DB_SUPPORTS_DRAWING);
+            break;
+          default:
+        }
+        if(preg_match('/^OUTPUT=(\S+)$/', $version_info, $m)) {
+          $mapserver_output_formats[] = $m[1];
+        }
+      }
+      registerDbEngine('TMapserverEngine', 'raster',
+        DB_SUPPORTS_DRAWING);
+    }
+  }
+  TMapserverEngine::registerMapserverEngine();
+} else {
+  if(!defined('MUSMAP_MAPSERVER_NOT_REQUIRED')) {
+    Error(sprintf(l10n('%s is not installed.'),
+      'PHP/MapScript'));
+    exit;//Fatal error: musmap needs PHP/MapScript
+  }
+}
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/database/mysql.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/mysql.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/mysql.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,473 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * MySQL engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2004-08
+ */
+if(function_exists('mysql_connect')) {
+  /**
+   * Class TMySQLEngine
+   * @package database
+   */
+  class TMySQLEngine extends TDbEngine {
+    /**
+     * Db infos
+     */
+    function TMySQLEngine() {
+      $this->engine="MySQL";
+      $this->website="http://www.mysql.com/";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      if(isset($this))  {
+        return "Client (PHP): ".mysql_get_client_info()."\n".
+          "Server: ".mysql_get_server_info($this->handle);
+      } else {
+        return "Client (PHP): ".mysql_get_client_info()."\n".
+          "Server: ?";
+      }
+    }
+
+  /**
+   * Connect to db
+   */
+    function connect($db_params) {
+      $this->db_params=$db_params;
+      extract($db_params);
+      if(empty($host)) $host = NULL;
+      if(empty($user)) $user = NULL;
+      if(empty($password)) $password = NULL;
+      $this->handle=mysql_connect(
+        $host.(!empty($port) ? ":$port":''),
+        $user,
+        $password);
+      if(!$this->handle) {
+        Warning(sprintf(
+            l10n('"%s" does\'nt respond. Check if it is running.'),
+            'MySQL'));
+      }
+      if(!empty($dbname)) {
+        mysql_select_db($dbname,$this->handle);
+      }
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return mysql_escape_string($s);
+    }
+    
+    /**
+     * Escape  and quote identifier
+     */
+    function _InternalQuoteIdentifier($s) {
+      return "`$s`";
+    }
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name deprecated
+     * @param int $e_level
+     * @return mixed
+     */
+    function query($q) {
+      $this->Log($q);
+      $r = mysql_query($q,$this->handle);
+      return $r;
+    }
+    
+    /**
+     * Retrieve the last error (NULL if unknown)
+     * 
+     * @return NULL|string[] 0=>SQLSTATE, 1=>ERROR_CODE, 2=> ERROR_STRING
+     */
+    function errorInfo() {
+      $errno= mysql_errno($this->handle);
+      switch($errno) {
+        case 0:
+          $sqlstate= '00000';
+          break;
+        case 1062://Duplicate entry '%s' for key %d
+          $sqlstate= '23000'; //ER_DUP_ENTRY
+          break;
+        default:
+          $sqlstate= NULL;
+      }
+      return Array($sqlstate, $errno, mysql_error($this->handle));
+    }
+    
+    /**
+     * Truncate a table
+     *
+     * @param string table_name
+     * @return mixed
+     */
+    function TruncateTable($table_name) {
+      return $this->query('TRUNCATE '.$this->QuoteIdentifier($table_name));
+    }
+    
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      return $this->query('BEGIN');
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      return $this->query('COMMIT');
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      return $this->query('ROLLBACK');
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows($result) {
+      return mysql_affected_rows($this->handle);
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+      return mysql_fetch_assoc($result);
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+      return mysql_fetch_row($result);
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed the result
+     */
+    function FreeResult($r) {
+      return mysql_free_result($r);
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed the result
+     * @return int
+     */
+    function get_num_rows($result) {
+      return mysql_num_rows($result);
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+      return mysql_insert_id($this->handle);
+    }
+
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+    }
+
+    /* protected */ function _GetSchemata($sCatalogName= NULL, $sSchemaName= NULL) {
+      if(version_compare(mysql_get_server_info($this->handle),'5.0.2','>=')) {
+        return parent::_GetSchemata($sCatalogName, $sSchemaName);
+      }
+      $r= Array();
+      $sSchemataWhereClause= '';
+      if($sCatalogName!== NULL) {
+        Information(l10n('MySQL doesn\'t support SQL catalogs.'));
+      }
+      if($sSchemaName!== NULL) {
+        $sSchemataWhereClause.= 'LIKE '.$this->Quote($sSchemaName).' ';
+      }
+      $rSchemata= $this->Query('SHOW DATABASES '.$sSchemataWhereClause);
+      while($row= $this->FetchNum($rSchemata)) {
+        $r[]=Array(
+          'CATALOG_NAME'=>NULL,
+          'SCHEMA_NAME'=>$row[0],
+          'DEFAULT_CHARACTER_SET_NAME'=>NULL,
+          'SQL_PATH'=>NULL
+          );
+      }
+      $this->FreeResult($rSchemata);
+      return $r;
+    }
+    
+    /* protected */ function _GetTables($sCatalogName, $sSchemaName, $sTableName= NULL) {
+      if(version_compare(mysql_get_server_info($this->handle),'5.0.2','>=')) {
+        return parent::_GetTables($sCatalogName, $sSchemaName, $sTableName);
+      }
+      $r= Array();
+      $sTablesWhereClause= '';
+      if($sCatalogName!== NULL) {
+        Information(l10n('MySQL doesn\'t support SQL catalogs.'));
+      }
+      if($sSchemaName!== NULL) {
+        $sTablesWhereClause.= 'FROM '.$this->QuoteIdentifier($sSchemaName).' ';
+      }
+      if($sTableName!== NULL) {
+        $sTablesWhereClause.= 'LIKE '.$this->Quote($sTableName).' ';
+      }
+      $rTables= $this->Query('SHOW TABLE STATUS '.
+        $sTablesWhereClause);
+      while($row= $this->FetchAssoc($rTables)) {
+        $r[]=Array(
+          'TABLE_CATALOG'=>Null,
+          'TABLE_SCHEMA'=>$sSchemaName,
+          'TABLE_NAME'=>$row['Name'],
+          'TABLE_TYPE'=>NULL
+          );
+      }
+      $this->FreeResult($rTables);
+      return $r;
+    }
+    
+    /* protected */ function _GetColumns($sCatalogName, $sSchemaName, $sTableName, 
+        $sColumnName= NULL) {
+      if(version_compare(mysql_get_server_info($this->handle),'5.0.2','>=')) {
+        return parent::_GetColumns($sCatalogName, $sSchemaName, $sTableName,
+          $sColumnName);
+      }
+      $r= Array();
+      $sColumnsWhereClause= '';
+      if($sCatalogName!== NULL) {
+        Information(l10n('MySQL doesn\'t support SQL catalogs.'));
+      }
+      if($sTableName!== NULL) {
+        $sColumnsWhereClause.= 'FROM '.$this->QuoteIdentifier($sTableName).' ';
+      }
+      if($sSchemaName!== NULL) {
+        $sColumnsWhereClause.= 'FROM '.$this->QuoteIdentifier($sSchemaName).' ';
+      }
+      if($sColumnName!== NULL) {
+        $sColumnsWhereClause.= 'LIKE '.$this->Quote($sColumnName).' ';
+      }
+      $rColumns= $this->Query('SHOW COLUMNS '.$sColumnsWhereClause);
+      $iOrdinalPosition= 0;
+      while($row= $this->FetchAssoc($rColumns)) {
+        $iOrdinalPosition++;
+        $sql_infos= TMySQLEngine::SQLTypeFromInternalType(
+          $row['Type']);
+        $musmap_infos= TMySQLEngine::MusmapTypeFromSQLType($sql_infos);
+        $r[]=Array(
+          'TABLE_CATALOG'=>NULL,
+          'TABLE_SCHEMA'=>$sSchemaName,
+          'TABLE_NAME'=>$sTableName,
+          'COLUMN_NAME'=>$row['Field'],
+          'ORDINAL_POSITION'=>$iOrdinalPosition,
+          'COLUMN_DEFAULT'=>$row['Default'],
+          'IS_NULLABLE'=>$row['Null'],
+          'DATA_TYPE'=>$sql_infos['type'],
+          'CHARACTER_MAXIMUM_LENGTH'=>NULL,
+          'CHARACTER_OCTET_LENGTH'=>NULL,
+          'NUMERIC_PRECISION'=>NULL,
+          'NUMERIC_SCALE'=>NULL,
+          'CHARACTER_SET_NAME'=>NULL,
+          'COLLATION_NAME'=>NULL
+          );
+      }
+      $this->FreeResult($rColumns);
+      return $r;
+    }
+    
+    function SQLTypeFromInternalType($internal_type) {
+      preg_match('/^(\S+?)(\((.+?)(,\s*.+?)*\))?((\s+\S+)*)$/',
+              $internal_type, $matches);
+      $r = Array(
+        strtolower($matches[1]),
+        empty($matches[2]) ? NULL : explode(',',substr($matches[2],1,-1)),
+        empty($matches[5]) ? NULL : explode(' ',trim($matches[5])));
+      switch($r[0]) {
+        //chars
+        case 'char':
+        case 'varchar':
+          $sql_type = $r[0];
+          $sql_params = Array($r[1][0]);
+          break;
+        //int
+        case 'tinyint':
+        case 'mediumint':
+        case 'bigint'://caution!
+        case 'int':
+          $sql_type = 'int';
+          if(isset($r[1][0])) {
+            $sql_params = Array($r[1][0]);
+          } else {
+            $sql_params = Array();
+          }
+          break;
+        case 'smallint':
+          $sql_type = 'smallint';
+          if(isset($r[1][0])) {
+            $sql_params = Array($r[1][0]);
+          } else {
+            $sql_params = Array();
+          }
+          break;
+        //real
+        case 'double':
+          $sql_type = 'double precision';
+          $sql_params = Array();
+          break;
+        case 'float':
+          $sql_type = 'real';
+          if(isset($r[1][0])) {
+            $sql_params = Array($r[1][0]);
+          } else {
+            $sql_params = Array();
+          }
+          break;
+        //decimal
+        case 'decimal':
+          $sql_type = 'decimal';
+          $sql_params = Array($r[1][0],$r[1][1]);
+          break;
+        //timestamp
+        case 'timestamp':
+          $sql_type = 'timestamp';
+          $sql_params = Array();
+          break;
+        case 'date':
+          $sql_type = 'date';
+          $sql_params = Array();
+          break;
+        case 'time':
+          $sql_type = 'time';
+          $sql_params = Array();
+          break;
+        case 'enum'://=>varchar
+          $sql_type = 'varchar';
+          $sql_params = Array(0);
+          foreach($r[1] AS $enum_value) {
+            $sql_params[0]= max($sql_params[0],
+              strlen($enum_value)-2);
+          }
+          break;
+        case 'set'://=>varchar
+          $sql_type = 'varchar';
+          $sql_params = Array(0);
+          foreach($r[1] AS $enum_value) {
+            $sql_params[0]+=strlen($enum_value)-1;
+          }
+          $sql_params[0]=max($sql_params[0]-1,0);
+          break;
+        case 'year':
+          $sql_type = 'char';
+          $sql_params = Array(4);
+          break;
+        case 'datetime'://0000-00-00 00:00:00
+          $sql_type = 'char';
+          $sql_params = Array(19);
+          break;
+        case 'tinyblob':
+        case 'tinytext':
+        case 'blob':
+        case 'text':
+        case 'mediumblob':
+        case 'mediumtext':
+        case 'longblob':
+        case 'longtext':
+          $sql_type = 'varchar';
+          $sql_params = Array();
+          break;
+        default:
+          Warning(sprintf(l10n('Unknown %s type: "%s".'),
+            'MySQL', $r[0]));
+          return false;
+      }
+      return Array(
+        'type'=>$sql_type,
+        'params'=>$sql_params);
+    }
+    
+    /**
+     * Returns an SQL expression to concatenate
+     *
+     * @param string $s,... SQL expression
+     */
+    function SQLConcat() {
+      $aArgs= func_get_args();
+      return 'CONCAT('.implode(', ', $aArgs).')';
+    }
+  }
+  registerDbEngine('TMySQLEngine', 'mysql',
+       DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    |  DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+  
+  registerDbEngine('TMySQLEngine', 'mygis',
+       DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    |  DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+}//function_exists('mysql_connect')
+?>

Added: packages/musmap/branches/upstream/current/include/database/odbc.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/odbc.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/odbc.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,312 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * ODBC engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2004-08
+ */
+if(function_exists('odbc_connect')) {
+  /**
+   * Class TODBCEngine
+   * @package database
+   */
+  class TODBCEngine extends TDbEngine {
+    /**
+     * Db infos
+     */
+    function TODBCEngine() {
+      $this->engine="ODBC";
+      $this->website="";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      return '?';
+    }
+    
+    /**
+     * Connect to db
+     */
+    function connect($db_params) {
+      $this->db_params=$db_params;
+      $this->handle=@odbc_connect(
+        $this->db_params['dsn'],
+        isset($this->db_params['user']) ? $this->db_params['user'] : '',
+        isset($this->db_params['password']) ? $this->db_params['password'] : '');
+      if(!$this->handle) {
+        add_error(sprintf(
+            l10n('"%s" does\'nt respond. Check if it is running.'),
+            'ODBC'));
+      }
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return  addslashes($s);
+    }
+    
+    /**
+     * Escape  and quote identifier
+     */
+    function _InternalQuoteIdentifier($s) {
+      return "[$s]";
+    }
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name
+     * @param int $e_level
+     * @return mixed
+     */
+    function query($q) {
+      $this->Log($q);
+      $r = odbc_exec ($this->handle,$q);
+      return $r;
+    }
+    
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      return odbc_autocommit($this->handle,FALSE);
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      return odbc_commit($this->handle);
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      return odbc_rollback($this->handle);
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows($result) {
+      return -1;
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+      return odbc_fetch_array($result);
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+      if(odbc_fetch_row($result)) {
+        for($i=0;$i<odbc_num_fields($result);$i++) {
+          $values[$i]=odbc_result($result,$i);
+        }
+      } else {
+        $values=-1;
+      }
+      return $values;
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed the result
+     */
+    function FreeResult($r) {
+      return odbc_FreeResult($r);
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed the result
+     * @return int
+     */
+    function get_num_rows($result) {
+      return odbc_num_rows($result);
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+      return -1;
+    }
+    
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+      return -1;
+    }
+    
+    /* protected */ function _GetSchemata($sCatalogName= NULL, $sSchemaName= NULL) {
+      $r= Array();
+      $c=Array();
+      if($sCatalogName===NULL) {
+        $sCatalogName= '%';
+      }
+      if($sSchemaName===NULL) {
+        $sSchemaName= '%';
+      }
+      if($this->handle) {
+        $rTables= odbc_tables($this->handle, $sCatalogName);
+        if($rTables) {
+          while($aTable= $this->FetchAssoc($rTables)) {
+            if(!isset($c['c:'.$aTable['TABLE_CAT']]) && 
+                !isset($c['c:'.$aTable['TABLE_CAT']]['s:'.$aTable['TABLE_SCHEM']])) {
+              $r[]=Array(
+                'CATALOG_NAME'=>$aTable['TABLE_CAT'],
+                'SCHEMA_NAME'=>$aTable['TABLE_SCHEM'],
+                'DEFAULT_CHARACTER_SET_NAME'=>NULL,
+                'SQL_PATH'=>NULL
+                );
+              $c['c:'.$aTable['TABLE_CAT']]['s:'.$aTable['TABLE_SCHEM']]=1;
+            }
+          }
+          $this->FreeResult($rTables);
+        } else {
+          //
+        }
+      }
+      return $r;
+    }
+    
+    /* protected */ function _GetTables($sCatalogName, $sSchemaName, $sTableName= NULL) {
+      if($sTableName===NULL) {
+        $sTableName= '%';
+      }
+      $r= Array();
+      if($this->handle) {
+        $rTables= odbc_tables($this->handle, $sCatalogName, $sSchemaName, $sTableName, "'TABLE','VIEW'");
+        if($rTables) {
+          while($aTable= $this->FetchAssoc($rTables)) {
+            $r[]=Array(
+              'TABLE_CATALOG'=>$aTable['TABLE_CAT'],
+              'TABLE_SCHEMA'=>$aTable['TABLE_SCHEM'],
+              'TABLE_NAME'=>$aTable['TABLE_NAME'],
+              'TABLE_TYPE'=>$aTable['TABLE_TYPE']
+              );
+          }
+          $this->FreeResult($rTables);
+        } else {
+          //
+        }
+      }
+      return $r;
+    }
+    
+    /* protected */ function _GetColumns($sCatalogName, $sSchemaName, $sTableName, 
+        $sColumnName= NULL) {
+      $r= Array();
+      /*
+      if($sCatalogName===NULL) {
+        $sColumnName= '';
+      }
+      if($sSchemaName===NULL) {
+        $sSchemaName= '%';
+      }
+      if($sTableName===NULL) {
+        $sTableName= '';
+      }
+      //*/
+      if($this->handle) {
+        if($sColumnName===NULL) {
+          $rColumns= odbc_columns($this->handle,$sCatalogName, $sSchemaName, $sTableName);
+        } else {
+          $rColumns= odbc_columns($this->handle,$sCatalogName, $sSchemaName, $sTableName,
+            $sColumnName);
+        }
+        if($rColumns) {
+          while($aColumn= $this->FetchAssoc($rColumns)) {
+            $r[]=Array(
+              'TABLE_CATALOG'=>$aColumn['TABLE_CAT'],
+              'TABLE_SCHEMA'=>$aColumn['TABLE_SCHEM'],
+              'TABLE_NAME'=>$aColumn['TABLE_NAME'],
+              'COLUMN_NAME'=>$aColumn['COLUMN_NAME'],
+              'ORDINAL_POSITION'=>$aColumn['ORDINAL_POSITION'],
+              'COLUMN_DEFAULT'=>$aColumn['COLUMN_DEF'],
+              'IS_NULLABLE'=>$aColumn['IS_NULLABLE'],
+              'DATA_TYPE'=>$aColumn['TYPE_NAME'],
+              'CHARACTER_MAXIMUM_LENGTH'=>NULL,
+              'CHARACTER_OCTET_LENGTH'=>$aColumn['CHAR_OCTET_LENGTH'],
+              'NUMERIC_PRECISION'=>NULL,
+              'NUMERIC_SCALE'=>NULL,
+              'CHARACTER_SET_NAME'=>NULL,
+              'COLLATION_NAME'=>NULL
+              );
+          }
+          $this->FreeResult($rColumns);
+        }
+      }
+      return $r;
+    }
+  }
+  registerDbEngine('TODBCEngine', 'odbc',
+       DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    | !DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+}//function_exists('odbc_connect')
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/database/ogr.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/ogr.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/ogr.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,428 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | (c) 05/2005                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * OGR engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-05, Mathieu PARENT
+ * @package database
+ * @since 2005-05
+ */
+if(function_exists('ogrgetdrivercount')) {
+  /**
+   * Class TOGREngine
+   * @package database
+   */
+  class TOGREngine extends TDbEngine {
+    /**
+     * Db infos
+     */
+    function TOGREngine() {
+      $this->engine="OGR";
+      $this->website="http://ogr.maptools.org";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      return '?';
+    }
+    
+    /**
+     * Connect to db
+     */
+    function connect($db_params) {
+      $this->db_params=$db_params;
+      if(!empty($db_params['connection'])) {
+        $this->handle= ogropen($db_params['connection'], '');
+        if(!$this->handle) {
+          add_error(sprintf(
+              l10n('"%s" does\'nt respond. Check if it is running.'), 'OGR'));
+        }
+      } else {
+       add_error(sprintf(
+            l10n('Missing parameter: %s for %s connection.'), 'connection', 'OGR'));
+      }
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return  addslashes($s);
+    }
+    
+    /**
+     * Escape  and quote identifier
+     */
+    function _InternalQuoteIdentifier($s) {
+      return "[$s]";
+    }
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name
+     * @param int $e_level
+     * @return mixed
+     */
+    function query($q) {
+      $this->Log($q);
+      $r= OGR_DS_ExecuteSQL($this->handle,$q, NULL, NULL);
+      if($r===false) {
+        //how to get error ?
+      }
+      return $r;
+    }
+    
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      //return odbc_autocommit($this->handle,FALSE);
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      //return odbc_commit($this->handle);
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      //return odbc_rollback($this->handle);
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows($result) {
+      //return -1;
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+      $oFeature= OGR_L_GetNextFeature($result);
+      if($oFeature) {
+        $r= Array();
+        $iFieldCount= OGR_F_GetFieldCount($oFeature);
+        for($i=0;$i<$iFieldCount; $i++ ) {
+          $pFieldDefn= OGR_F_GetFieldDefnRef($oFeature,$i);
+          switch(OGR_FLD_GetType($pFieldDefn)) {
+            case OFTInteger:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsInteger($oFeature, $i);
+              break;
+            case OFTIntegerList:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsIntegerList($oFeature, $i);
+              break;
+            case OFTReal:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsDouble($oFeature, $i);
+              break;
+            case OFTRealList:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsDoubleList($oFeature, $i);
+              break;
+            case OFTString:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            case OFTStringList:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsStringList($oFeature, $i);
+              break;
+            case OFTWideString:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            case OFTWideStringList:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            case OFTWideStringList:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsStringList($oFeature, $i);
+              break;
+            case OFTBinary:
+              $r[OGR_FLD_GetNameRef($pFieldDefn)]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            default:
+              add_error(sprintf(l10n('Unknown %s type: "%s".'), 'OGR', OGR_FLD_GetType($pFieldDefn)));
+          }
+        }
+        OGR_F_Destroy($oFeature);
+        return $r;
+      } else {
+        return NULL;
+      }
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+      $oFeature= OGR_L_GetNextFeature($result);
+      if($oFeature) {
+        $r= Array();
+        $iFieldCount= OGR_F_GetFieldCount($oFeature);
+        for($i=0;$i<$iFieldCount; $i++ ) {
+          $pFieldDefn= OGR_F_GetFieldDefnRef($oFeature,$i);
+          switch(OGR_FLD_GetType($pFieldDefn)) {
+            case OFTInteger:
+              $r[$i]= OGR_F_GetFieldAsInteger($oFeature, $i);
+              break;
+            case OFTIntegerList:
+              $r[$i]= OGR_F_GetFieldAsIntegerList($oFeature, $i);
+              break;
+            case OFTReal:
+              $r[$i]= OGR_F_GetFieldAsDouble($oFeature, $i);
+              break;
+            case OFTRealList:
+              $r[$i]= OGR_F_GetFieldAsDoubleList($oFeature, $i);
+              break;
+            case OFTString:
+              $r[$i]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            case OFTStringList:
+              $r[$i]= OGR_F_GetFieldAsStringList($oFeature, $i);
+              break;
+            case OFTWideString:
+              $r[$i]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            case OFTWideStringList:
+              $r[$i]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            case OFTWideStringList:
+              $r[$i]= OGR_F_GetFieldAsStringList($oFeature, $i);
+              break;
+            case OFTBinary:
+              $r[$i]= OGR_F_GetFieldAsString($oFeature, $i);
+              break;
+            default:
+              add_error(sprintf(l10n('Unknown %s type: "%s".'), 'OGR', OGR_FLD_GetType($pFieldDefn)));
+          }
+        }
+        OGR_F_Destroy($oFeature);
+        return $r;
+      } else {
+        return NULL;
+      }
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed the result
+     */
+    function FreeResult($r) {
+      return ogr_ds_releaseresultset($this->handle, $r);
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed the result
+     * @return int
+     */
+    function get_num_rows($result) {
+      return odbc_num_rows($result);
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+      return -1;
+    }
+    
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+      return -1;
+    }
+    
+    /* protected */ function _GetSchemata($sCatalogName= NULL, $sSchemaName= NULL) {
+      $r= Array();
+      if($sCatalogName!== NULL) {
+        add_error(sprintf(l10n('%s doesn\'t support SQL catalogs.'), 'OGR'));
+      }
+      if($sSchemaName!== NULL) {
+        add_error(sprintf(l10n('%s doesn\'t support SQL schemas.'), 'OGR'));
+      }
+      $r[]=Array(
+        'CATALOG_NAME'=>NULL,
+        'SCHEMA_NAME'=>NULL,
+        'DEFAULT_CHARACTER_SET_NAME'=>NULL,
+        'SQL_PATH'=>NULL
+        );
+      return $r;
+    }
+    
+    /* protected */ function _GetTables($sCatalogName, $sSchemaName, $sTableName= NULL) {
+      $r= Array();
+      $sTablesWhereClause= '';
+      if($sCatalogName!== NULL) {
+        add_error(sprintf(l10n('%s doesn\'t support SQL catalogs.'), 'OGR'));
+      }
+      if($sSchemaName!== NULL) {
+        add_error(sprintf(l10n('%s doesn\'t support SQL schemas.'), 'OGR'));
+      }
+      for($j=0;$j<ogr_ds_getlayercount($this->handle); $j++) {
+        $pLayer= ogr_ds_getlayer($this->handle, $j);
+        if($pLayer) {
+          $pLayerDef=ogr_l_getlayerdefn($pLayer);
+          if($pLayerDef) {
+            if(($sTableName===NULL) || (ogr_fd_getname($pLayerDef)===$sTableName)) {
+              $r[]=Array(
+                'TABLE_CATALOG'=>Null,
+                'TABLE_SCHEMA'=>NULL,
+                'TABLE_NAME'=>ogr_fd_getname($pLayerDef),
+                'TABLE_TYPE'=>NULL,
+                'MUSMAP_TABLE_TYPE'=>$this->getMusmapTableType(ogr_fd_getgeomtype($pLayerDef))
+                );
+            }
+          } else {
+            add_error(sprintf(l10n('Unable to find %s table definition for table "%s".'),
+              'OGR', $j));
+          }
+        } else {
+          add_error(sprintf(l10n('Unable to find %s table "%s".'),
+            'OGR', $j));
+        }
+      }
+      return $r;
+    }
+    
+    /* protected */ function _GetColumns($sCatalogName, $sSchemaName, $sTableName, 
+        $sColumnName= NULL) {
+      $r= Array();
+      $sColumnsWhereClause= '';
+      if($sCatalogName!== NULL) {
+        add_error(sprintf(l10n('%s doesn\'t support SQL catalogs.'), 'OGR'));
+      }
+      if($sSchemaName!== NULL) {
+        add_error(sprintf(l10n('%s doesn\'t support SQL schemas.'), 'OGR'));
+      }
+      for($j=0;$j<ogr_ds_getlayercount($this->handle); $j++) {
+        $pLayer= ogr_ds_getlayer($this->handle, $j);
+        if($pLayer) {
+          $pLayerDef=ogr_l_getlayerdefn($pLayer);
+          if($pLayerDef) {
+            if(($sTableName===NULL) || (ogr_fd_getname($pLayerDef)===$sTableName)) {
+              for($k=0;$k<ogr_fd_getfieldcount($pLayerDef);$k++) {
+                $pFieldDef= ogr_fd_getfielddefn($pLayerDef, $k);
+                if($pFieldDef) {
+                  $r[]=Array(
+                    'TABLE_CATALOG'=>NULL,
+                    'TABLE_SCHEMA'=>NULL,
+                    'TABLE_NAME'=>ogr_fd_getname($pLayerDef),
+                    'COLUMN_NAME'=>ogr_fld_getnameref($pFieldDef),
+                    'ORDINAL_POSITION'=>$k+1,
+                    'COLUMN_DEFAULT'=>NULL,
+                    'IS_NULLABLE'=>NULL,
+                    'DATA_TYPE'=>ogr_getfieldtypename(ogr_fld_gettype($pFieldDef)),
+                    'CHARACTER_MAXIMUM_LENGTH'=>NULL,
+                    'CHARACTER_OCTET_LENGTH'=>NULL,
+                    'NUMERIC_PRECISION'=>NULL,
+                    'NUMERIC_SCALE'=>NULL,
+                    'CHARACTER_SET_NAME'=>NULL,
+                    'COLLATION_NAME'=>NULL
+                    );
+                } else {
+                  add_error(sprintf(l10n('Unable to find %s field definition for field "%s" in table "%s".'),
+                    'OGR', $k,ogr_fd_getname($pLayerDef)));
+                }
+              }
+            }
+          } else {
+            add_error(sprintf(l10n('Unable to find %s table definition for table "%s".'),
+              'OGR', $j));
+          }
+        } else {
+          add_error(sprintf(l10n('Unable to find %s table "%s".'),
+            'OGR', $j));
+        }
+      }
+      return $r;
+    }
+    
+    function getMusmapTableType($iOGRType) {
+      switch($iOGRType) {
+        case wkbUnknown: return NULL;
+        case wkbPoint: return 'P';
+        case wkbLineString: return 'S';
+        case wkbPolygon: return 'S';
+        case wkbMultiPoint: return 'S';
+        case wkbMultiLineString: return 'S';
+        case wkbMultiPolygon: return 'S';
+        case wkbGeometryCollection: return 'S';
+        case wkbNone: return 'S';
+        case wkbLinearRing: return 'S';
+        case wkbPoint25D: return NULL;
+        case wkbLineString25D: return NULL;
+        case wkbPolygon25D: return NULL;
+        case wkbMultiPoint25D: return NULL;
+        case wkbMultiLineString25D: return NULL;
+        case wkbMultiPolygon25D: return NULL;
+        case wkbGeometryCollection25D: return NULL;
+        default:
+          add_error(sprintf(l10n('Unknown %s type "%s".'),
+            'OGR', $iOGRType));
+          return NULL;
+      }
+    }
+  }
+  ogrregisterall();
+  registerDbEngine('TOGREngine', 'ogr',
+       DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    | !DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+}//function_exists('ogrgetdrivercount')
+?>

Added: packages/musmap/branches/upstream/current/include/database/postgresql.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/postgresql.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/postgresql.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,242 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * PosgreSQL engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package database
+ * @since 2004-08
+ */
+if(function_exists('pg_connect')) {
+  /**
+   * Class TPostgreSQLEngine
+   * @package database
+   */
+  class TPostgreSQLEngine extends TDbEngine {
+    /**
+     * Db infos
+     */
+    function TPostgreSQLEngine() {
+      $this->engine="PostgreSQL";
+      $this->website="http://www.postgresql.org/";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      $version_query=$this->query("SELECT VERSION() AS version");
+      $version=$this->FetchAssoc($version_query);
+      $this->FreeResult($version_query);
+      $version=$version['version'];
+      $version = explode(' ', $version);
+      
+      return $version[0].': '.$version[1];
+    }
+    
+    /**
+     * Connect to db
+     */
+    function connect($db_params) {
+      $this->db_params=$db_params;
+      extract($db_params);
+      $this->handle=pg_connect("user=$user password=$password dbname=$dbname host=$host port=$port");
+      if(!$this->handle) {
+        add_error(sprintf(
+            l10n('"%s" does\'nt respond. Check if it is running.'),
+            'PostgreSQL'));
+      }
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return pg_escape_string($s);
+    }
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name
+     * @param int $e_level
+     * @return mixed
+     */
+    function Query($q) {
+      $this->Log($q);
+      return pg_query($this->handle,$q);
+    }
+    
+    /**
+     * Retrieve the last error (NULL if unknown)
+     * 
+     * @return NULL|string[] 0=>SQLSTATE, 1=>ERROR_CODE, 2=> ERROR_STRING
+     */
+    /*
+    function errorInfo() {
+      $err= pg_last_error($this->handle);
+      switch($err) {
+        case '':
+          $sqlstate= '00000';
+          break;
+        case 1062://Duplicate entry '%s' for key %d
+          $sqlstate= '23000'; //ER_DUP_ENTRY
+          break;
+        default:
+          $sqlstate= NULL;
+      }
+      return Array($sqlstate, NULL, $err);
+    }
+    //*/
+    
+    /**
+     * Truncate a table
+     *
+     * @param string table_name
+     * @return mixed
+     */
+    function TruncateTable($table_name) {
+      return $this->query('TRUNCATE '.$this->Quote($table_name));
+    }
+    
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      return $this->query('BEGIN');
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      return $this->query('COMMIT');
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      return $this->query('ROLLBACK');
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows($result) {
+      return pg_affected_rows($result);
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+      return pg_fetch_assoc($result);
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+      return pg_fetch_row($result);
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed the result
+     */
+    function FreeResult($r) {
+      return pg_FreeResult($r);
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed the result
+     * @return int
+     */
+    function get_num_rows($result) {
+      return pg_num_rows($result);
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+      $q=$this->query("SELECT currval('".$this->QuoteIdentifier($table_name.'_'.$id_name.'_seq')."');");
+      $row=$this->FetchNum($q);
+      $this->FreeResult($q);
+      return array_pop($row);
+    }
+    
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+      return $this->query("SELECT setval('".
+        $this->QuoteIdentifier($table_name.'_'.$id_name.'_seq').
+        "', ".$this->Quote($value).", false);");
+    }
+  }
+
+  registerDbEngine('TPostgreSQLEngine', 'postgresql',
+       DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    |  DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+  registerDbEngine('TPostgreSQLEngine', 'postgis',
+       DB_SUPPORTS_SQL
+    |  DB_SUPPORTS_GetInformationSchema
+    |  DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+}//function_exists('pg_connect')
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/database/sqlite.db.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/database/sqlite.db.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/database/sqlite.db.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,238 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+ * SQLite engine
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-09, Mathieu Parent
+ * @package database
+ * @since 2004-09
+ */
+if(function_exists('sqlite_open')) {
+  /**
+   * Class TSQLiteEngine
+   * @package database
+   */
+  class TSQLiteEngine extends TDbEngine {
+    /**
+     * Db infos
+     */
+    function TSQLiteEngine() {
+      $this->engine="SQLite";
+      $this->website="http://www.sqlite.org/";
+    }
+    
+    /**
+     * versions of the engine
+     */
+    function EngineVersion() {
+      return "Library: ".sqlite_libversion();
+    }
+    
+    /**
+     * Connect to db
+     */
+    function connect($db_params) {
+      $this->db_params=$db_params;
+      extract($db_params);
+      $this->handle=sqlite_open($filename,0666,$sqliteerror);
+      if(!$this->handle) {
+        add_error('SQLite error: '.$sqliteerror);
+      }
+    }
+    
+    /**
+     * Escape string for security reasons
+     */
+    function Escape($s) {
+      return sqlite_escape_string($s);
+    }
+    
+    /**
+     * Escape  and quote identifier
+     */
+    function _InternalQuoteIdentifier($s) {
+      return "[$s]";
+    }
+    
+    /**
+     * Execute the query and return the result
+     *
+     * @param string $q 
+     * @param string $db_name
+     * @param int $e_level
+     * @return mixed
+     */
+    function Query($q) {
+      if(preg_match_all("/^\s*INSERT\s+INTO\s+(\S.*)\s+\(\s*\)\s*VALUES\s*\(\)/",
+               $q, $table_name_array)) {
+        //Hack for all values to default
+        //assume first column is INTEGER NOT NULL PRIMARY KEY
+        //(AUTO_INCREMENT)
+        $table_q=$this->query('SELECT * FROM '.$table_name_array[1][0].' LIMIT 1;');
+        $field_name=sqlite_field_name($table_q,0);
+        $this->FreeResult($table_q);
+        $q="INSERT INTO ".$table_name_array[1][0]." (".$field_name.") VALUES (NULL);";
+      }
+      $this->Log($q);
+      $r = sqlite_query($this->handle,$q);
+      /*
+      $e = sqlite_last_error($this->handle);
+      if($e) {
+        Error(sqlite_error_string($e)."\n{".$q.'}');
+      }
+      //*/
+      return $r;
+    }
+    
+    /**
+     * Retrieve the last error (NULL if unknown)
+     * 
+     * @return NULL|string[] 0=>SQLSTATE, 1=>ERROR_CODE, 2=> ERROR_STRING
+     */
+    function errorInfo() {
+      $errno= sqlite_last_error($this->handle);
+      switch($errno) {
+        case 0:
+          $sqlstate= '00000';
+          break;
+        case 19://SQLITE_CONSTRAINT
+          $sqlstate= '23000'; //ER_DUP_ENTRY
+          break;
+        default:
+          $sqlstate= NULL;
+      }
+      return Array($sqlstate, $errno, sqlite_error_string($errno));
+    }
+    
+    /**
+     * Start a transaction
+     *
+     * @return int
+     */
+    function StartTransaction() {
+      return $this->query('BEGIN');
+    }
+
+    /**
+     * Commit a transaction
+     *
+     * @return int
+     */
+    function commit() {
+      return $this->query('COMMIT');
+    }
+    
+    /**
+     * Rollback a transaction
+     *
+     * @return int
+     */
+    function rollback() {
+      return $this->query('ROLLBACK');
+    }
+    
+    /**
+     * Returns affected rows from the last query
+     *
+     * @return int
+     */
+    function affected_rows($result) {
+      return sqlite_changes($result);
+    }
+    
+    /**
+     * Returns next row in an associative array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchAssoc($result) {
+      return sqlite_fetch_array($result,SQLITE_ASSOC);
+    }
+    
+    /**
+     * Returns next row in an indexed array
+     *
+     * @param mixed the result
+     * @return mixed[]
+     */
+    function FetchNum($result) {
+      return sqlite_fetch_array($result,SQLITE_NUM);
+    }
+    
+    /**
+     * Free the reult
+     *
+     * @param mixed the result
+     */
+    function FreeResult($r) {
+      //return sqlite_FreeResult($r);
+    }
+    
+    /**
+     * Returns the number of rows from the last query
+     *
+     * @param mixed the result
+     * @return int
+     */
+    function get_num_rows($result) {
+      return sqlite_num_rows($result);
+    }
+    
+    /**
+     * Returns id of the last insert id
+     *
+     * @return int
+     */
+    function get_last_insert_row_id($result,$table_name,$id_name) {
+      $q=$this->query("SELECT last_insert_rowid();");
+      $row=$this->FetchNum($q);
+      $this->FreeResult($q);
+      return($row[0]);
+    }
+    
+    /**
+     * Set id of the next insert id
+     *
+     * @return int
+     */
+    function set_next_insert_row_id($table_name,$id_name,$value) {
+      //
+    }
+  }
+  registerDbEngine('TSQLiteEngine', 'sqlite',
+       DB_SUPPORTS_SQL
+    | !DB_SUPPORTS_GetInformationSchema
+    |  DB_SUPPORTS_GET_LAST_INSERT_ROW_ID
+    | !DB_SUPPORTS_DRAWING);
+}//function_exists('sqlite_open')
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/error.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/error.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/error.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,180 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Gestion centralisée des erreurs
+ *
+ * Pour l'instant cela ne fait pas grand chose
+ * Mais le code est ainsi plus structuré
+ * (possibilité de créer des logs ?)
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+
+if(!defined("E_MUSMAP_MIN")) {
+  if(!defined("E_STRICT")) {
+    define("E_STRICT",2048);
+  }
+  /**
+   * Valeur de l'erreur minimale
+   *
+   * Pour éviter les conflits de numéro d'erreur 
+   * avec PHP.
+   * (NB : E_USER_NOTICE=1024)
+   */
+  define("E_MUSMAP_MIN",E_USER_NOTICE*16);
+  
+  /**
+   * Information message
+   */
+  define('E_MUSMAP_INFORMATION', E_USER_NOTICE);
+
+  /**
+   * Warning message
+   */
+  define('E_MUSMAP_WARNING', E_USER_WARNING);
+
+  /**
+   * Error message
+   */
+  define('E_MUSMAP_ERROR', E_USER_ERROR);
+
+  /**
+   * Debug mode
+   */
+  define('E_MUSMAP_DEBUG', E_MUSMAP_MIN*16);
+  
+ /**
+   * Show performance infos 
+   */
+  define('E_MUSMAP_PERFORMANCE', E_MUSMAP_MIN*128);
+
+  /**
+   * Make an SQL log 
+   */
+  define('E_MUSMAP_SQL_LOG', E_MUSMAP_MIN*256);
+
+  /**
+   * All musmap options
+   */
+  define('E_MUSMAP_ALL',
+      E_MUSMAP_INFORMATION | E_MUSMAP_WARNING | E_MUSMAP_ERROR
+    | E_MUSMAP_DEBUG | E_MUSMAP_PERFORMANCE | E_MUSMAP_SQL_LOG);
+}
+
+/**
+ * Add a message
+ * Use Message(), Warning() and Error() instead !
+ *
+ * @deprecated
+ * @param string $s message
+ */
+function add_error($s) {
+  Information($s);
+}
+
+/**
+ * Add an error
+ *
+ * @param int
+ * @param string
+ * @param string
+ * @param int
+ * @param mixed
+ */
+  function error_handler($iErrNumber, $sErrMessage, $sErrFile, $iErrline,$aErrContext){
+    if(
+            ((strstr($sErrMessage, '[MapServer Error]: msQueryByPoint(): No matching record(s) found')===false)
+          && (strstr($sErrMessage, '[MapServer Error]: msQueryByRect(): No matching record(s) found')===false)
+          && (strstr($sErrMessage, '[MapServer Error]: msQueryByAttributes(): No matching record(s) found')===false)
+          && (substr($sErrMessage,0,27) !== 'getLayerByName failed for :'))
+        && ((Conf::IsEmpty('debug_level') && $iErrNumber & E_ALL)
+          ||(!Conf::IsEmpty('debug_level') && ($iErrNumber & Conf::Get('debug_level'))))) {
+      switch($iErrNumber) {
+        case E_NOTICE :
+          Information($sErrMessage."\n ($sErrFile [$iErrline])", 'E_NOTICE');
+          break;
+        case E_WARNING :
+          Warning($sErrMessage."\n ($sErrFile [$iErrline])", 'E_WARNING');
+          break;
+        case E_ERROR :
+          Error($sErrMessage."\n ($sErrFile [$iErrline])", 'E_ERROR');
+          break;
+        default :
+          Warning($sErrMessage."\n ($sErrFile [$iErrline])", $iErrNumber);
+      }
+      if((Conf::get('debug_level') & E_MUSMAP_DEBUG) 
+          && !($iErrNumber & (E_STRICT|E_NOTICE))
+          && !defined('MUSMAP_HAS_FRAME')) {
+        echo '<pre>';
+        var_dump(debug_backtrace());
+        echo '</pre>';
+      }
+    }
+  }
+  
+
+/**
+ * The shutdown function
+ */
+function shutdown_function() {
+  LibMisc::TimePoint("end");
+  $t0=$GLOBALS['times'][0][1];
+  $tn=$GLOBALS['times'][sizeof($GLOBALS['times'])-1][1]-$t0;
+  if(Conf::get('debug_level') & E_MUSMAP_PERFORMANCE) {
+    $t_1=$t0;
+    // "/*" is for Javascript
+    echo "/*\n";
+    echo 'Memory usage: '.LibMisc::GetMemUsage()."<br>\n";
+    echo '<table border="1">'.
+      '<tr>'.
+        '<th>&nbsp;</th>'.
+        '<th>Step time</th>'.
+        '<th>Total time</th>'.
+        '<th>%</th>'.
+      '</tr>'."\n";
+    foreach($GLOBALS['times'] AS $t) {
+      echo "  <tr><td>$t[0]</td>".
+        "<td>".round($t[1]-$t_1,3)."</td>".
+        "<td>".round($t[1]-$t0,3)."</td>".
+        "<td>".round(100*($t[1]-$t_1)/$tn,1)."%</td>".
+        "</tr>";
+      $t_1=$t[1];
+    }
+    echo "</table>\n";
+    echo "*/\n";
+  } 
+}
+
+set_error_handler('error_handler');
+register_shutdown_function('shutdown_function');
+?>

Added: packages/musmap/branches/upstream/current/include/framework/framework.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/framework/framework.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/framework/framework.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,436 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 05/2005                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Base FrameWork
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package framework
+ * @since 2005-05
+ */
+
+  /**
+   * Base FrameWork
+   *
+   * @package framework
+   */
+  class TFrameWork extends TCollection {
+    /**
+     *
+     */
+    var $name='';
+
+    /**
+     *
+     */
+    var $scripts;
+
+    /**
+     *
+     */
+    var $type;
+
+    /**
+     *
+     */
+    var $value= NULL;
+
+    /**
+     * Base FrameWork constructor
+     */
+    function TFrameWork($sType='root') {
+      parent::TCollection();
+      $this->type= $sType;
+      $this->scripts= & new TCollectionItems($this, 'scripts');
+    }
+    
+    /**
+     * Create an element and append it to the
+     * layout
+     *
+     * @param string $sName name of the element
+     * @param string $sType type of element
+     * @return TFwElement element added
+     */
+    /* final */ function & AddElement($sName, $sType) {
+      $oEl= & $this->CreateElement($sName, $sType);
+      $this->Append($oEl);
+      return $oEl;
+    }
+    
+    /**
+     * Show the specified type using basic elements
+     * @param TType $oType
+     */
+    function AddElementFromType($oType) {
+      $v= & $oType->Attribute->Value;
+      switch($oType->Type) {
+        case 'bool':
+          $oChkBox= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+            'checkbox');
+          $oChkBox->Attributes->Set('checked', $v);
+          foreach(Array('readonly','nullable') as $sAttr) {
+            if(!$oType->Attributes->IsEmpty($sAttr)) 
+              $oChkBox->Attributes->Set($sAttr, $oType->Attributes->Value($sAttr));
+          }
+          unset($oChkBox);
+          break;
+        case 'color':
+          $oColor= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+            'color');
+          $oColor->Attributes->Set('value', $v);
+          foreach(Array('readonly','nullable') as $sAttr) {
+            if(!$oType->Attributes->IsEmpty($sAttr)) 
+              $oColor->Attributes->Set($sAttr, $oType->Attributes->Value($sAttr));
+          }
+          unset($oColor);
+          break;
+        case 'date':
+          break;
+        case 'fromarray':
+        case 'fromtable':
+        case 'enum':
+          $mSource= $oType->Attributes->ValueWithDefault('source', NULL);
+          if($mSource===NULL) {
+            
+          } elseif(gettype($mSource)=='array') {
+            $oComboBox= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+              'combobox');
+            if($oType->Attributes->ValueWithDefault('nullable', false)) {
+              $oItem= &$oComboBox->AddElement('', 'item');
+              $oItem->Attributes->Set('value',l10n('None'));
+            }
+            foreach($mSource as $k2=>$v2) {
+              $oItem= & $oComboBox->AddElement($k2, 'item');
+              $oItem->Attributes->Set('value',$v2);
+              if($v==$k2)
+                $oItem->Attributes->Set('selected',true);
+              unset($oItem);
+            }
+            unset($oComboBox);
+          } elseif(is_a($mSource,'TCollection')) {
+            $oComboBox= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+              'combobox');
+            if($oType->Attributes->ValueWithDefault('nullable', false)) {
+              $oItem= &$oComboBox->AddElement('', 'item');
+              $oItem->Attributes->Set('value',l10n('None'));
+            }
+            $sCodeField= $oType->Attributes->Value('codefield');
+            $sLabelField= $oType->Attributes->Value('labelfield');
+            $oEnum= &$mSource->Items->NewEnum();
+            $oEnum->Reset();
+            while($oSourceItem= & $oEnum->Each()) {
+              $k2= $oSourceItem->Attributes->Value($sCodeField);
+              $v2= $oSourceItem->Attributes->Value($sLabelField);
+              $oItem= &$oComboBox->AddElement($k2, 'item');
+              $oItem->Attributes->Set('value',$v2);
+              if($v==$k2)
+                $oItem->Attributes->Set('selected',true);
+              unset($oItem);
+            }
+            unset($oEnum);
+            unset($oComboBox);
+          
+          } else {
+            
+          }
+                  
+          break;
+        case 'file':
+          break;
+        case 'float':
+          $oText= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+            'float');
+          $oText->Attributes->Set('value', $v);
+          foreach(Array('readonly','nullable','min','max') as $sAttr) {
+            if(!$oType->Attributes->IsEmpty($sAttr)) 
+              $oText->Attributes->Set($sAttr, $oType->Attributes->Value($sAttr));
+          }
+          unset($oText);
+          break;
+        case 'index':
+          $oText= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+            'integer');
+          $oText->Attributes->Set('value', $v);
+          $oText->Attributes->Set('constraint', 'integer');
+          foreach(Array('readonly','nullable','min','max') as $sAttr) {
+            if(!$oType->Attributes->IsEmpty($sAttr)) 
+              $oText->Attributes->Set($sAttr, $oType->Attributes->Value($sAttr));
+          }
+          unset($oText);
+          break;
+        case 'integer':
+          $oText= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+            'integer');
+          $oText->Attributes->Set('value', $v);
+          $oText->Attributes->Set('constraint', 'integer');
+          foreach(Array('readonly','nullable','min','max') as $sAttr) {
+            if(!$oType->Attributes->IsEmpty($sAttr)) 
+              $oText->Attributes->Set($sAttr, $oType->Attributes->Value($sAttr));
+          }
+          unset($oText);
+          break;
+        case 'regex':
+          $oText= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+            'textedit');
+          $oText->Attributes->Set('value', $v);
+          foreach(Array('readonly','nullable') as $sAttr) {
+            if(!$oType->Attributes->IsEmpty($sAttr)) 
+              $oText->Attributes->Set($sAttr, $oType->Attributes->Value($sAttr));
+          }
+          unset($oText);
+          break;
+        case 'set':
+          break;
+        case 'text':
+          $oText= & $this->AddElement($oType->Prefix.$oType->Attribute->Name.$oType->Suffix,
+            'textedit');
+          $oText->Attributes->Set('value', $v);
+          foreach(Array('readonly','nullable','maxlength','rows','cols') as $sAttr) {
+            if(!$oType->Attributes->IsEmpty($sAttr)) 
+              $oText->Attributes->Set($sAttr, $oType->Attributes->Value($sAttr));
+          }
+          unset($oText);
+          break;
+        case 'time':
+          break;
+        default:
+          $r= '<font color=red>unknown type: "'.$oType->Type.'".</font>';
+      }
+    }
+    
+    /**
+     * Add text
+     *
+     * @param string $sText text to show
+     * @return TObject element added
+     */
+    /* final */ function & AddText($sText) {
+      $oText= & $this->AddElement('', 'text');
+      $oText->Attributes->Set('caption', $sText);
+      return $oText;
+    }
+    
+    /**
+     * Add a script if not added
+     *
+     * @param string $sSrc source file
+     * @return TObject element added
+     */
+    /* final */ function & AddScriptOnce($sSrc) {
+      $oEl= $this->scripts->GetByAttribute('src', $sSrc);
+      if(!$oEl) {
+        $oEl= & new TScript($sSrc);
+        $this->scripts->Append($oEl);
+      }
+      return $oEl;
+    }
+    
+    /**
+     * Append an element to the layout
+     *
+     * @param TFwElement $oEl element to append
+     * @return void
+     */
+    function & Append(& $oEl) {
+      $this->Items->Append($oEl);
+    }
+    
+    /**
+     * Return the URL corresponding to module, page & paragraph
+     */
+    /* final */ function ContextualHelpUrl($module, $page, $paragraph) {
+      return str_replace(Array('[module]','[page]','[paragraph]'),
+        Array($module, $page, $paragraph),Conf::get('help_url'));
+    }
+    
+    /**
+     * Print the link corresponding to module, page & paragraph
+     */
+    function ContextualHelpButton($module, $page, $paragraph) {
+      $this->Information(sprintf(l10n('The current framework does\'nt support  "%s".'), 'ContextualHelpButton'));
+    }
+    
+    /**
+     * Create an element
+     *
+     * @param string $sName name of the element
+     * @param string $sType type of element
+     * @return TFwElement element created
+     */
+    function & CreateElement($sName, $sType) {
+      $oEl= & new TFrameWork($sType);
+      $oEl->name= $sName;
+      return $oEl;
+    }
+    
+    /**
+     * Error, no confirmation
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     */
+    /* final */ function Error(
+      $sMessage,
+      $sTitle='',
+      $sHelpModule= NULL,
+      $sHelpPage= NULL,
+      $sHelpParagraph=NULL
+    ) {
+      global $log;
+      if(!empty($sMessage)) {
+        $log->Add($sMessage, $sTitle, 2);
+      }
+      //l10n('Error')
+      $this->_Message('error', $sMessage, $sTitle,
+        $sHelpModule, $sHelpPage, $sHelpParagraph);
+    }
+    
+    /**
+     * Information, no confirmation
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     */
+    /* final */ function Information(
+      $sMessage,
+      $sTitle='',
+      $sHelpModule= NULL,
+      $sHelpPage= NULL,
+      $sHelpParagraph=NULL
+    ) {
+      //l10n('Information')
+      $this->_Message('information', $sMessage, $sTitle,
+        $sHelpModule, $sHelpPage, $sHelpParagraph);
+    }
+    
+    /**
+     * Message, no confirmation
+     * @param 'message'|'warning'|'error'
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     */
+    /* protected */ function _Message(
+      $sType,
+      $sMessage,
+      $sTitle='',
+      $sHelpModule= NULL,
+      $sHelpPage= NULL,
+      $sHelpParagraph=NULL
+    ) {
+      if(empty($sMessage)) {
+        return;
+      }
+      if(empty($sTitle)) {
+        $sTitle= l10n(ucfirst($sType));
+      }
+      echo '['.$sTitle.']'.str_repeat('=',max(0,80-strlen($STitle)-2));
+      echo ' '.$this->ContextualHelpUrl($sHelpModule, $sHelpPage, $sHelpParagraph);
+      echo "\n";
+      echo $sMessage."\n";
+    }
+    
+    /**
+     *
+     */
+    /* final */ function Render() {
+      $this->_RenderBefore();
+      $this->_RenderElements();
+      $this->_RenderAfter();
+    }
+    
+    /* protected */ function _RenderAfter() {
+    }
+    
+    /* protected */ function _RenderBefore() {
+      switch(strtolower($this->type)) {
+        case 'root':
+        case 'frame':
+        case 'bool': 
+        case 'color':
+        case 'fromarray':
+        case 'fromtable':
+        case 'index':
+        case 'float':
+        case 'integer':
+        case 'text':
+        case 'textedit':
+        case 'time':
+          $this->Information(sprintf(l10n('The current framework does\'nt render element of type  "%s".'),$this->type));
+          break;
+        default:
+          $this->Information(sprintf(l10n('Unknown framework element type: "%s".'),$this->type));
+      }
+    }
+    
+    /* protected */ function _RenderElements() {
+      $oEnum= $this->Items->NewEnum();
+      while($oEl= & $oEnum->Each()) {
+        $oEl->Render();
+      }
+      unset($oEnum);
+    }
+    
+    /**
+     * Warning, no confirmation
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     */
+    /* final */ function Warning(
+      $sMessage,
+      $sTitle='',
+      $sHelpModule= NULL,
+      $sHelpPage= NULL,
+      $sHelpParagraph=NULL
+    ) {
+      //l10n('Warning')
+      $this->_Message('warning', $sMessage, $sTitle,
+        $sHelpModule, $sHelpPage, $sHelpParagraph);
+    }
+    
+  }
+  
+  class TScript extends TCollectionItem {
+    function TScript($sSrc) {
+      parent::TCollectionItem();
+      $this->Attributes->Set('src', $sSrc);
+    }
+  }
+?>

Added: packages/musmap/branches/upstream/current/include/framework/framework.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/framework/framework.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/framework/framework.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,98 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 05/2005                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Base FrameWork functions
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package framework
+ * @since 2005-05
+ */
+
+  /**
+   * Error, no confirmation
+   * @param string
+   * @param string
+   * @param string
+   * @param string
+   * @param string
+   */
+  function Error(
+    $sMessage,
+    $sTitle='',
+    $sHelpModule= NULL,
+    $sHelpPage= NULL,
+    $sHelpParagraph=NULL
+  ) {
+    global $fw;
+    $fw->Error($sMessage, $sTitle,
+      $sHelpModule, $sHelpPage, $sHelpParagraph);
+  }
+  
+  /**
+   * Information, no confirmation
+   * @param string
+   * @param string
+   * @param string
+   * @param string
+   * @param string
+   */
+  function Information(
+    $sMessage,
+    $sTitle='',
+    $sHelpModule= NULL,
+    $sHelpPage= NULL,
+    $sHelpParagraph=NULL
+  ) {
+    global $fw;
+    $fw->Information($sMessage, $sTitle,
+      $sHelpModule, $sHelpPage, $sHelpParagraph);
+  }
+  
+  /**
+   * Warning, no confirmation
+   * @param string
+   * @param string
+   * @param string
+   * @param string
+   * @param string
+   */
+  function Warning(
+    $sMessage,
+    $sTitle='',
+    $sHelpModule= NULL,
+    $sHelpPage= NULL,
+    $sHelpParagraph=NULL
+  ) {
+    global $fw;
+    $fw->Warning($sMessage, $sTitle,
+      $sHelpModule, $sHelpPage, $sHelpParagraph);
+  }
+?>

Added: packages/musmap/branches/upstream/current/include/framework/html/htmlframework.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/framework/html/htmlframework.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/framework/html/htmlframework.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,409 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 05/2005                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Base FrameWork
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package framework
+ * @subpackage html
+ * @since 2005-05
+ */
+
+  /**
+   * HTML FrameWork
+   *
+   * @package framework
+   * @subpackage html
+   */
+  class THTMLFrameWork extends TFrameWork {
+    /**
+     * Print the link corresponding to module, page & paragraph
+     */
+    function ContextualHelpButton($module, $page, $paragraph) {
+      if(($module!==NULL) && ($page!==NULL)) {
+        echo '<a href="'.$this->ContextualHelpUrl($module, $page, $paragraph).'" '.
+          'target="_blank">'.
+          '<img src="'.Conf::get('musmap_root_url').'/images/help.png" alt="[?]">'.
+          '</a>';
+      }
+    }
+    
+    /**
+     * Create an element
+     *
+     * @param string $sName name of the element
+     * @param string $sType type of element
+     * @return TFwElement element created
+     */
+    function & CreateElement($sName, $sType) {
+      $oEl= & new THTMLFrameWork($sType);
+      $oEl->name= $sName;
+      return $oEl;
+    }
+    
+    /**
+     * Message, no confirmation
+     * @param 'message'|'warning'|'error'
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     * @param string
+     */
+    /* protected */ function _Message(
+      $sType,
+      $sMessage,
+      $sTitle='',
+      $sHelpModule= NULL,
+      $sHelpPage= NULL,
+      $sHelpParagraph=NULL
+    ) {
+      if(empty($sMessage)) {
+        return;
+      }
+      if(defined('MUSMAP_HAS_FRAME') || defined('MUSMAP_IS_HIDDEN')) {
+        echo '<script type="text/javascript">'."\n";
+        echo '<!--'."\n";
+        echo "  alert('".LibMisc::EscapeJS($sTitle.": ".$sMessage)."');\n";
+        echo '//-->'."\n";
+        echo '</script>'."\n";
+      } else {
+        echo '<fieldset class="'.$sType.' message">';
+        if(empty($sTitle)) {
+          $sTitle= html_l10n(ucfirst($sType));
+        }
+        echo '<legend>';
+        echo $sTitle.' ';
+        $this->ContextualHelpButton($sHelpModule, $sHelpPage, $sHelpParagraph);
+        echo '</legend>';
+        echo nl2br(htmlentities($sMessage));
+        echo '</fieldset>'."\n";
+      }
+    }
+    
+    /* protected */ function _RenderAfter() {
+      switch(strtolower($this->type)) {
+        case 'root':
+          echo "</body>\n";
+          echo "</html>\n";
+          break;
+        case 'cell':
+          //echo "</td>";
+          break;
+        case 'combobox':
+          echo "</select>\n";
+          break;
+        case 'frame':
+          echo "</form>\n";
+          break;
+        case 'listbox':
+          echo "</select>\n";
+          break;
+        case 'row':
+          //echo "</tr>";
+          echo "\n";
+          break;
+        case 'table':
+          echo "</table>\n";
+          break;
+        default:
+          parent::_RenderAfter();
+      }
+    }
+    
+    /* protected */ function _RenderBefore() {
+      global $db;
+      $r='';
+      $v= & $this->value;
+      switch(strtolower($this->type)) {
+        case 'root':
+          echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">'."\n";
+          echo "<html lang=\"".Conf::get('client_lang')."\">\n";
+          echo "<head>\n";
+          echo "  <title>".$this->Attributes->Value('title')."</title>\n";
+          echo '  <link rel="stylesheet" type="text/css" href="'.Conf::get('musmap_root_url').'/map.css">'."\n";
+          echo '  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">'."\n";
+          echo '  <meta http-equiv="Content-Script-Type" content="text/javascript">'."\n";
+          echo '  <script type="text/javascript" language="JavaScript">'."\n";
+          echo '    <!--'."\n";
+          echo '      top.rootDir="'.Conf::get('musmap_root_url').'";'."\n";
+          echo '    //-->'."\n";
+          echo '  </script>'."\n";
+          $oEnum= $this->scripts->NewEnum();
+          while($oScript= & $oEnum->Each()) {
+            echo '  <script type="text/javascript" language="JavaScript" src="'.Conf::get('musmap_root_url').'/js/'.$oScript->Attributes->Value('src').'.js">'."\n";
+            echo '  </script>'."\n";
+          }
+          unset($oEnum);
+          echo "</head>\n";
+          echo "<body>\n";
+          break;
+        case 'checkbox';
+          echo '<label><input type="checkbox" name="'.$this->name.'"'.
+            ($this->Attributes->ValueWithDefault('checked', false) ? ' checked' : '').
+            '>'.$this->Attributes->ValueWithDefault('label', '').
+            '</label>';
+          break;
+        case 'color':
+          $color_id = str_replace(Array('[',']'),'-', $this->name);
+          $v= $this->Attributes->Value('value');
+          echo '<input type="text" '.
+            'name="'.$this->name.'" '.
+              'value="'.$v.'" size="7" '.
+              'id="color-'.$color_id.'" maxlength="7">'.
+            '<span style="background:url(\''.Conf::get('musmap_root_url').'/images/bg.gif\');">'.
+              '<span onmouseover="changeColor(document.getElementById('.
+                '\'color-'.$color_id.'\'),this);" '.
+              'id="color-span-'.$color_id.'" '.
+              'onclick="colorPicker(this,document.getElementById('.
+                '\'color-'.$color_id.'\'));" '.
+              'style="background-color: '.(empty($v) ? 'transparent' : $v).';" '.
+              'class="color-span" title="'.html_l10n('Pick a color').'">'.
+                '&nbsp;&nbsp;&nbsp;&nbsp;'.
+            '</span>'.
+          '</span>'.
+          '&nbsp;'.
+          '<a title="'.html_l10n('No color').'" href="javascript:void(0);" '.
+            'onclick="changeColor('.
+              '\'color-'.$color_id.'\','.
+              '\'color-span-'.$color_id.'\','.
+              '\'\'); return false;" '.
+            'style="color:red;">X</a>';
+          break;
+        case 'frame':
+          echo "<form>\n";
+          break;
+        case 'fromarray':
+          $a= $this->Attributes->Value('array');
+          switch($this->Attributes->Value('showas')) {
+            case 'label':
+              if(isset($a[$v])) {
+                $r.= $a[$v];
+              } else {
+                $r.= '<i>'.html_l10n('None').'</i>';
+              }
+              break;
+            case 'list':
+              $r.= '<input type="text" name="'.
+                $this->name.'" '.
+                'value="'.$v.'">';
+              $r.= '  <select onchange="this.form[\''.
+                  $this->name.'\']'.
+                  '.value=this.value;">'."\n";
+              if($this->Attributes->Value('nullable')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              foreach($a AS $d_k=>$d_v) {
+                $r.= '    <option value="'.$d_k.'" '.
+                  (($v==$d_k) ? ' selected' : '').'>'.
+                    $d_v.'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+              break;
+            case 'combo':
+            default:
+              $r.= '  <select name="'.
+                  $this->name.'">'."\n";
+              if($this->Attributes->Value('nullable')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              foreach($a AS $d_k=>$d_v) {
+                $r.= '    <option value="'.$d_k.'" '.
+                  (($v==$d_k) ? ' selected' : '').'>'.
+                    $d_v.'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+          }
+          break;
+       case 'fromtable':
+          $sCodeFieldName= $this->Attributes->Value('codefield');
+          $sLabelFieldName= $this->Attributes->Value('labelfield');
+          switch($this->Attributes->Value('showas')) {
+            case 'label':
+              $oQuery= $db->Select(
+                $this->Attributes->Value('tablecatalog'),
+                $this->Attributes->Value('tableschema'),
+                $this->Attributes->Value('tablename'),
+                $this->Attributes->Value('tableparams'),
+                Array(Array(
+                  $sCodeFieldName,'=',$v,
+                    $this->Attributes->Value('fieldtype')
+                  )),
+                $this->Attributes->Value('orderby'));
+              if($aRow= $db->FetchAssoc($oQuery)) {
+                $r.= $aRow[$sLabelFieldName];
+              } else {
+                $r.= '<i>'.html_l10n('None').'</i>';
+              }
+              break;
+            case 'list':
+              $r.= 'TODO list';
+              break;
+            case 'combo':
+            default:
+              $oQuery= $db->Select(
+                $this->Attributes->Value('tablecatalog'),
+                $this->Attributes->Value('tableschema'),
+                $this->Attributes->Value('tablename'),
+                $this->Attributes->Value('tableparams'),
+                Array(),
+                $this->Attributes->Value('orderby'),
+                Array('code'=>$sCodeFieldName,'label'=>$sLabelFieldName));
+              $r.= '  <select name="'.
+                  $this->name.'">'."\n";
+              if($this->Attributes->Value('nullable')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              while($aRow= $db->FetchAssoc($oQuery)) {
+                $r.= '    <option value="'.$aRow['code'].'" '.
+                  (($v==$aRow['code']) ? ' selected' : '').'>'.
+                    $aRow['label'].'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+              $db->FreeResult($oQuery);
+          }
+          break;
+        case 'combobox':
+          echo '<select '.
+            'name="'.$this->name.'" >';
+          break;
+        case 'index':
+          echo '<input type="text" '.
+            'name="'.$this->name.'" '.
+            'value="'.$v.'" size="2">';
+          $col=$this->Attributes->Value('column');
+          if($this->Attributes->Value('compact')) {
+            echo '<a href="javascript:void(0);" '.
+              'onclick="return moveRow(this.parentNode.parentNode, '.
+                '\'u\', \''.$col.'\')" class="arrow-up">'.
+              '<img alt="^" '.
+                'src="'.Conf::get('musmap_root_url').'/images/arrow_up.gif">'.
+              '</a>';
+            echo '<a href="javascript:void(0);" '.
+              'onclick="return moveRow(this.parentNode.parentNode, '.
+                '\'d\', \''.$col.'\')" class="arrow-down">'.
+              '<img alt="v" '.
+                'src="'.Conf::get('musmap_root_url').'/images/arrow_down.gif">'.
+              '</a>';
+          }
+          break;
+        case 'item':
+          $v= $this->Attributes->Value('value');
+          $selected= $this->Attributes->ValueWithDefault('selected', false);
+          echo '<option '.
+            'name="'.htmlentities($this->name).'"'.
+            ($selected ? ' selected' : '').'>'.
+            htmlentities($this->Attributes->Value('value'));
+          break;
+        case 'integer':
+        case 'float':
+          $v= $this->Attributes->Value('value');
+          $min= $this->Attributes->ValueWithDefault('min', NULL);
+          $max= $this->Attributes->ValueWithDefault('max', NULL);
+          $r.= '<input type="text" name="'.$this->name.'" '.
+            ($max||$min ? 'size="'.max(strlen($min),strlen($max)).'" ' : '').
+            'value="'.$v.'">';
+          break;
+        case 'textedit':
+          $v= $this->Attributes->Value('value');
+          if($this->Attributes->ValueWithDefault('maxlength',0)>128) {
+            $r.='<textarea name="'.$this->name.'" '.
+              'cols="'.$this->Attributes->ValueWithDefault('cols',50).'" '.
+              'rows="'.$this->Attributes->ValueWithDefault('rows',3).'">'.$v.'</textarea>';
+
+          } else {
+            $max_length= $this->Attributes->ValueWithDefault('maxlength', NULL);
+            $r.= '<input type="text" name="'.$this->name.'" '.
+              ($max_length ? 'maxlength="'.$max_length.'" ' : '').
+              'value="'.$v.'">';
+          }
+          break;
+        case 'listbox':
+          echo '<select '.
+            'name="'.$this->name.'" >';
+          break;
+        case 'text':
+          $r.= htmlentities($this->Attributes->ValueWithDefault('caption',''));
+          break;
+        case 'table':
+          echo "<table>\n";
+          break;
+        case 'row':
+          echo "<tr>";
+          break;
+        case 'cell':
+          echo "<td>";
+          break;
+        case 'time':
+        if($v) {
+          $r.= htmlentities(LibMisc::RelativeDate($v));
+        } else {
+          $r.= '<i>'.html_l10n('None').'</i>';
+        }
+          break;
+        default:
+          parent::_RenderBefore();
+      }
+      echo $r;
+    }
+    
+    /**
+     * Handle event
+     *
+     * @param TEvent $oEvent
+     * @return void
+     */
+    function HandleEvent(&$oEvent) {
+      parent::HandleEvent($oEvent);
+      switch(strtolower(get_class($oEvent))) {
+        case 'tmutationevent':
+          if(($oEvent->Type()=='AttrModified') &&
+              ($oEvent->AttrChange() & (ADDITION|MODIFICATION))) {
+            $oTarget=& $oEvent->Target();
+            if($oTarget->type=='color') {
+              $oTop= & $this->GetTopParent();
+              $oTop->AddScriptOnce('explorer');
+              $oTop->AddScriptOnce('contrib/xb');
+              unset($oTop);
+            }
+            unset($oTarget);
+          }
+        default:
+      }
+    }
+  }
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/attributefilter.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/attributefilter.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/attributefilter.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,199 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Attribute filter class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+  
+  /**
+   * Attributes filter
+   * @package library
+   */
+  class TAttributeFilter {
+    /**
+     * Left type
+     * @var string|TType
+     */
+    var $_LeftType;
+    
+    /**
+     * Right type
+     * @var string|TType
+     */
+    var $_RightType;
+    
+    /**
+     * Left 
+     * @var mixed|TAttributeFilter
+     */
+    var $Left;
+    
+    /**
+     * Operator =, <, >, <=, >=, LIKE, AND, OR, NOT
+     * @var string
+     */
+    var $Operator;
+    
+    /**
+     * Right 
+     * @var mixed|TAttributeFilter
+     */
+    var $Right;
+    
+    /**
+     * Constructor
+     *
+     * @param string $sName attribute name
+     * @param mixed $mValue attribute value
+     * @param TAttributes $oAttributes attributes
+     */
+    function TAttributeFilter($mLeft, $sOperator, $mRight, 
+        $mLeftType=NULL, $mRightType=NULL) {
+      $this->_LeftType= $mLeftType;
+      $this->_RightType= $mRightType;
+      $this->Left= $mLeft;
+      $this->Operator= $sOperator;
+      $this->Right= $mRight;
+    }
+    
+    /**
+     * Build SQL query
+     * @param TDbEngine $oDb
+     * @return string
+     */
+    function BuildSQLQuery($oDb) {
+      switch($this->GetLeftType()) {
+        case 'TAttributeFilter':
+        case 'tattributefilter':
+          $left= '('.$this->Left->BuildSQLQuery($oDb).')';
+          break;
+        case 'Attribute':
+          $left= $oDb->QuoteIdentifier($this->Left);
+          break;
+        default;
+          $left= $oDb->Quote($this->Left);
+      }
+      switch($this->GetRightType()) {
+        case 'TAttributeFilter':
+        case 'tattributefilter':
+          $right= '('.$this->Right->BuildSQLQuery($oDb).')';
+          break;
+        case 'Attribute':
+          $right= $oDb->QuoteIdentifier($this->Right);
+          break;
+        default;
+          $right= $oDb->Quote($this->Right);
+      }
+      return $left.' '.$this->Operator.' '.$right;
+    }
+    
+    /**
+     * Check expression
+     * @return bool
+     */
+    function Check(& $oObject) {
+      if(!in_array($this->Operator ,Array('IS A','NOT'))) {
+        switch($this->GetLeftType()) {
+          case 'TAttributeFilter':
+          case 'tattributefilter':
+            $left= $this->Left->Check($oObject);
+            break;
+          case 'Attribute':
+            $left= $oObject->Attributes->Value($this->Left);
+            break;
+          default;
+            $left= $this->Left;
+        }
+      }
+      switch($this->GetRightType()) {
+        case 'TAttributeFilter':
+        case 'tattributefilter':
+          $right= $this->Right->Check($oObject);
+          break;
+        case 'Attribute':
+          $right= $oObject->Attributes->Value($this->Right);
+          break;
+        default;
+          $right= $this->Right;
+      }
+      switch($this->Operator) {
+        case '=':    return $left==$right;
+        case '<>':    return $left<>$right;
+        case '<':    return $left<$right;
+        case '>':    return $left>$right;
+        case '<=':   return $left<=$right;
+        case '>=':   return $left>=$right;
+        case 'NOT':   return !$right;
+        case 'LIKE':
+          return (bool) preg_match(
+            str_replace(Array('%','_'),Array('.*','.'),
+              '/^'.preg_quote($right,'/').'$/'), $left);
+        case 'AND':  return $left && $right;
+        case 'OR':   return $left || $right;
+        case 'IS A': return is_a($oObject, $right);
+        default:return FALSE;
+      }
+    }
+    
+    /**
+     * Left type 
+     * @return string|TType
+     */
+    function GetLeftType() {
+      if(!empty($this->_LeftType)) {
+        return $this->_LeftType;
+      } elseif(is_object($this->Left)) {
+        return get_class($this->Left);
+      } else {
+        return 'Attribute';
+      }
+    }
+    
+    /**
+     * Right type 
+     * @return string|TType
+     */
+    function GetRightType() {
+      if(!empty($this->_RightType)) {
+        return $this->_RightType;
+      } elseif(is_object($this->Right)) {
+        return get_class($this->Right);
+      } else {
+        return gettype($this->Right);
+      }
+    }
+    
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/attributes.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/attributes.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/attributes.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,317 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Attributes class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+
+  /**
+   * Events
+   */
+  require_once('mutation.evt.class.php');
+  
+  /**
+   * Attribute
+   * @package library
+   */
+  class TAttribute {
+    /**
+     * Parent object
+     * @var TObject
+     */
+    var $Attributes;
+    
+    /**
+     * Attribute name
+     * @var string
+     */
+    var $Name;
+    
+    /**
+     * Attribute value
+     * @var mixed
+     */
+    var $Value;
+    
+    /**
+     * Constructor
+     *
+     * @param string $sName attribute name
+     * @param mixed $mValue attribute value
+     * @param TAttributes $oAttributes attributes
+     */
+    function TAttribute($sName, $mValue, &$oAttributes) {
+      $this->Name= $sName;
+      $this->Value= $mValue;
+      $this->Attributes= & $oAttributes;
+    }
+  }
+  
+  /**
+   * Attributes container
+   * @package library
+   */
+  class TAttributes {
+    /**
+     * Private array containing the attributes
+     * 
+     * @var array string=>mixed
+     * @access private
+     */
+    var $_Attributes;
+     
+    /**
+     * Name in Parent object
+     * 
+     * @var string
+     */
+    var $NameInObject;
+    
+    /**
+     * Parent object
+     * 
+     * @var TObject
+     */
+    var $Object;
+    
+    /**
+     * Constructor
+     *
+     * @param TObject|null $oObject the parent object
+     */
+    function TAttributes(&$oObject, $sNameInObject='Attributes') {
+      $this->_Attributes= Array();
+      $this->NameInObject= $sNameInObject;
+      $this->Object= &$oObject;
+    }
+    
+    /**
+     * Unset all properties
+     *
+     * @return void
+     */
+    function Destruct() {
+      unset($this->_Attributes);
+      unset($this->NameInObject);
+      unset($this->Object);
+    }
+    
+    /**
+     * Clear attributes
+     *
+     * @return void
+     */
+    function Clear() {
+      $NIL= NULL;
+      $oEvent= & new TMutationEvent();
+      $oEvent->InitMutationEvent('AllAttrModified', true, true,
+        $this, $NIL, $this->_Attributes, NULL, REMOVAL);
+      if(!$this->RaiseEvent($oEvent)) {
+        $this->_Attributes= Array();
+        unset($oEvent);
+        return true;
+      } else {
+        unset($oEvent);
+        return false;
+      }
+    }
+    
+    /**
+     * Each
+     *
+     * @return TAttribute
+     */
+    function & Each() {
+      if(list($sN, $mV)= each($this->_Attributes)) {
+        $r= & new TAttribute($sN, $mV, $this);
+        return $r;
+      } else {
+        $F= FALSE;
+        return $F;
+      }
+    }
+    
+    /**
+     * Attribute exists
+     *
+     * @param string
+     * @return bool
+     */
+    function Exists($sName) {
+      return array_key_exists($sName, $this->_Attributes);
+    }
+    
+    /**
+     * Attribute getter
+     *
+     * @param string
+     * @return mixed
+     */
+    function & Value($sName) {
+      if(array_key_exists($sName,$this->_Attributes)) {
+        return $this->_Attributes[$sName];
+      } else {
+        return NULL;
+      }
+    }
+    
+    /**
+     * Attribute getter with default value
+     *
+     * @param string
+     * @param mixed
+     * @return mixed
+     */
+    function & ValueWithDefault($sName, $mDefault) {
+      if($this->Exists($sName)) {
+        return $this->Value($sName);
+      } else {
+        return $mDefault;
+      }
+    }
+    
+    /**
+     * Attribute getter
+     *
+     * @param string
+     * @return TAttribute
+     */
+    function & GetAttribute($sName) {
+      $r= & new TAttribute($sName, $this->_Attributes[$sName], $this);
+      return $r;
+    }
+    
+    /**
+     * Attribute is empty
+     *
+     * @param string
+     * @return bool
+     */
+    function IsEmpty($sName) {
+      return empty($this->_Attributes[$sName]);
+    }
+    
+    /**
+     * Attribute remover
+     *
+     * @param string
+     * @return bool has it been removed
+     */
+    function Remove($sName) {
+      $oEvent= & new TMutationEvent();
+      if(array_key_exists($sName, $this->_Attributes)) {
+        $NIL= NULL;
+        $oEvent->InitMutationEvent('AttrModified', true, true,
+          $this, $this->Value($sName), $NIL, $sName, REMOVAL);
+        if(!$this->RaiseEvent($oEvent)) {
+          LibMisc::ArrayRemoveKey($this->_Attributes, $sName);
+        }
+      } else {
+        return false;
+      }
+    }
+    
+    /**
+     * Reset
+     *
+     * @return void
+     */
+    function Reset() {
+      reset($this->_Attributes);
+    }
+    
+    /**
+     * Attribute setter
+     *
+     * @param string
+     * @param mixed
+     * @return bool
+     */
+    function Set($sName, $mValue) {
+      $oEvent= & new TMutationEvent();
+      if(array_key_exists($sName, $this->_Attributes)) {
+        $oEvent->InitMutationEvent('AttrModified', true, true,
+          $this, $this->Value($sName), $mValue, $sName, MODIFICATION);
+      } else {
+        $NIL= NULL;
+        $oEvent->InitMutationEvent('AttrModified', true, true,
+          $this, $NIL, $mValue, $sName, ADDITION);
+      }
+      if(!$this->RaiseEvent($oEvent)) {
+        $this->_Attributes[$sName]= $mValue;
+        unset($oEvent);
+        return true;
+      } else {
+        unset($oEvent);
+        return false;
+      }
+    }
+    
+    /**
+     * Attributes setter
+     *
+     * @param array
+     * @return bool has it been done?
+     */
+    function SetTo($aAttributes) {
+      $oEvent= & new TMutationEvent();
+      $oEvent->InitMutationEvent('AllAttrModified', true, true,
+        $this, $aAttributes, $this->_Attributes, NULL, MODIFICATION);
+      if(!$this->RaiseEvent($oEvent)) {
+        $this->_Attributes= $aAttributes;
+        unset($oEvent);
+        return true;
+      } else {
+        unset($oEvent);
+        return false;
+      }
+    }
+    
+    /* ========================================== */
+    /*                    EVENTS                  */
+    /* ========================================== */
+    /**
+     * Raise an event
+     *
+     * @return bool prevent default ?
+     */
+    /* final */ function RaiseEvent(&$oEvent) {
+      if(is_a($this->Object,"TObject")) {
+        return $this->Object->DispatchEvent($oEvent);
+      } else {
+        return false;
+      }
+    }
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/collection.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/collection.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/collection.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,84 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Collection class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+  
+  /**
+   * Parent class
+   */
+  require_once('collectionitem.class.php');
+  
+  /**
+   * Items container
+   */
+  require_once('collectionitems.class.php');
+  
+  /**
+   * Types (for field types)
+   */
+  require_once('type.class.php');
+  
+  /**
+   * Collection (with Items)
+   * @package library
+   */
+  class TCollection extends TCollectionItem {
+    /**
+     * Items
+     * @var TCollectionItems
+     */
+    var $Items;
+    
+    /**
+     * Constructor
+     */
+    function TCollection() {
+      parent::TObject();
+      $this->Items= & new TCollectionItems($this);
+    }
+    
+    /**
+     * Unset all properties
+     *
+     * @return void
+     */
+    function Destruct() {
+      $this->Items->Destruct();
+      parent::Destruct();
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/collectionitem.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/collectionitem.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/collectionitem.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,115 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * CollectionItem class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+  
+  /**
+   * Object with attributes
+   */
+  require_once('object.class.php');
+  
+  /**
+   * Item of a collection
+   * @package library
+   */
+  class TCollectionItem extends TObject {
+    /**
+     * Parent
+     * @access private
+     * @var TCollection
+     */
+    var $_Parent= NULL;
+    
+    /**
+     * Parents
+     * @access private
+     * @var TCollection[]
+     */
+    var $_Parents= Array();
+    
+    /**
+     * Unset all properties
+     *
+     * @return void
+     */
+    function Destruct() {
+      unset($this->_Parent);
+      unset($this->_Parents);
+      parent::Destruct();
+    }
+    
+    /**
+     * Get the parent collection
+     * @param NULL|string
+     * @return TCollection
+     */
+    function & GetParent($sRole= NULL) {
+      if($sRole===NULL) {
+        return $this->_Parent;
+      } else {
+        return $this->_Parents[$sRole];
+      }
+    }
+    
+    /**
+     * Set the parent collection
+     * @param NULL|string
+     * @return TCollection
+     */
+    function SetParent(& $oCollection, $sRole= NULL) {
+      if($sRole===NULL) {
+        unset($this->_Parent);
+        $this->_Parent= & $oCollection;
+      } else {
+        unset($this->_Parents[$sRole]);
+        $this->_Parents[$sRole]= & $oCollection;
+      }
+    }
+    
+    /**
+     * Get the top parent collection
+     * @return TCollection
+     */
+    function & GetTopParent() {
+      if(is_a($this->_Parent,"TCollection")) {
+        return $this->_Parent->GetTopParent();
+      } else {
+        return $this;
+      }
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/collectionitems.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/collectionitems.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/collectionitems.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,308 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * CollectionItems class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+  
+  /**
+   * Attribute filter
+   */
+  require_once('attributefilter.class.php');
+  
+  /**
+   * Enum
+   */
+  require_once('enum.class.php');
+  
+  /**
+   * Items of a collection
+   * @package library
+   */
+  class TCollectionItems {
+    /**
+     * Collection
+     * @var TCollection
+     */
+    var $Collection;
+    
+    /**
+     * Items
+     * @access private
+     * @var array $_Items integer=>TCollectionItem
+     */
+    var $_Items;
+    
+    /**
+     * Constructor
+     *
+     * @param TCollection|null $oCollection the parent object
+     */
+    function TCollectionItems(&$oCollection) {
+      $this->Collection= &$oCollection;
+      $this->_Items= Array();
+    }
+    
+    /**
+     * Unset all properties
+     *
+     * @return void
+     */
+    function Destruct() {
+      unset($this->Collection);
+      unset($this->_Items);
+    }
+    
+    /**
+     * Append an item
+     * @param TCollectionItem $oCollectionItem Item to append
+     * @param false|NULL|string $mSetParent false means don't set parent, NULL means set default parent, string means set a parent with a role
+     * @return bool done
+     */
+    function Append(&$oCollectionItem, $mSetParent= NULL) {
+      $NIL= NULL;
+      $oEvent= & new TMutationEvent();
+      $oEvent->InitMutationEvent('NodeInserted', true, true,
+        $this, $NIL, $oCollectionItem, NULL, ADDITION);
+      if(!$this->RaiseEvent($oEvent)) {
+        $this->_Items[]= &$oCollectionItem;
+        if($mSetParent!==false) {
+          $oCollectionItem->SetParent($this->Collection, $mSetParent);
+        }
+        unset($oEvent);
+        return true;
+      } else {
+        unset($oEvent);
+        return false;
+      }
+    }
+    
+    /**
+     * Items Count
+     * @return integer
+     */
+    function Count() {
+      return count($this->_Items);
+    }
+    
+    /**
+     * Each
+     *
+     * @return TCollectionItem
+     */
+    function & Each() {
+      if(list($k, )= each($this->_Items)) {
+        return $this->_Items[$k];
+      } else {
+        return FALSE;
+      }
+    }
+    
+    /**
+     * Get each item with attribute filter
+     *
+     * @param TAttributeFilter
+     * @return TCollectionItem
+     */
+    function & EachWithAttributeFilter($oAttrFilter) {
+      while($oItem= & $this->Each()) {
+        if($oAttrFilter->check($oItem)) {
+          return $oItem;
+        }
+      }
+      return FALSE;
+    }
+    
+    /**
+     * Get item by attribute
+     *
+     * @param string
+     * @param mixed
+     * @return TCollectionItem
+     */
+    function & GetByAttribute($sName, $mValue) {
+      $oItemsEnum= & $this->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        if($oItem->Attributes->Value($sName)==$mValue) {
+          unset($oItemsEnum);
+          return $oItem;
+        }
+      }
+      unset($oItemsEnum);
+      return FALSE;
+    }
+    
+    /**
+     * Get item with attribute filter
+     *
+     * @param TAttributeFilter
+     * @return TCollectionItem
+     */
+    function & GetWithAttributeFilter($oAttrFilter) {
+      $oItemsEnum= & $this->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        if($oAttrFilter->Check($oItem)) {
+          unset($oItemsEnum);
+          return $oItem;
+        }
+      }
+      unset($oItemsEnum);
+      return FALSE;
+    }
+    
+    /**
+     * Get item by attribute filter recursively
+     *
+     * @param TAttributeFilter
+     * @return TCollectionItem
+     */
+    function & GetWithAttributeFilterRecursive($oAttrFilter) {
+      $oItemsEnum= & $this->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        if($oAttrFilter->Check($oItem)) {
+          return $oItem;
+        } elseif(is_a($oItem, 'TCollection')) {
+          $r= & $oItem->Items->GetWithAttributeFilterRecursive($oAttrFilter);
+          if($r) {
+            unset($oItemsEnum);
+            return $r;
+          }
+        }
+      }
+      unset($oItemsEnum);
+      $F= FALSE;
+      return $F;
+    }
+    
+    /**
+     * Get item by attribute recursively
+     *
+     * @param string
+     * @param mixed
+     * @return TCollectionItem
+     */
+    function & GetByAttributeRecursive($sName, $mValue) {
+      $oItemsEnum= & $this->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        if($oItem->Attributes->Value($sName)==$mValue) {
+          return $oItem;
+        } elseif(is_a($oItem, 'TCollection')) {
+          $r= & $oItem->Collection->GetByAttributeRecursive($sName, $mValue);
+          if($r) {
+            unset($oItemsEnum);
+            return $r;
+          }
+        }
+      }
+      unset($oItemsEnum);
+      return FALSE;
+    }
+    
+    /**
+     * Has items
+     * @return bool
+     */
+    function HasItems() {
+      return !empty($this->_Items);
+    }
+    
+    /**
+     * Get Item
+     * @param integer
+     * @return TCollectionItem
+     */
+    function &Item($iIndex) {
+      return $this->_Items[$iIndex];
+    }
+    
+    /**
+     * Create a new enum
+     * @return TEnum
+     */
+    function & NewEnum() {
+      $r= & new TEnum($this->_Items);
+      return $r;
+    }
+    
+    /**
+     * Attribute remover
+     *
+     * @param string
+     * @return void
+     */
+    function Remove($iIndex) {
+      $oEvent= & new TMutationEvent();
+      if(array_key_exists($sName, $this->_Attributes)) {
+        $NIL= NULL;
+        $oEvent->InitMutationEvent('NodeRemoved', true, true,
+          $this, $this->Item($iIndex), $NIL, $iIndex, REMOVAL);
+        if(!$this->RaiseEvent($oEvent)) {
+          LibMisc::ArrayRemoveKey($this->_Items, $iIndex); 
+        }
+      } else {
+        return false;
+      }
+    }
+    
+    /**
+     * Reset
+     *
+     * @return void
+     */
+    function Reset() {
+      reset($this->_Items);
+    }
+    
+    /* ========================================== */
+    /*                    EVENTS                  */
+    /* ========================================== */
+    /**
+     * Raise an event
+     *
+     * @return bool prevent default ?
+     */
+    /* final */ function RaiseEvent(&$oEvent) {
+      if(is_a($this->Collection,"TObject")) {
+        return $this->Collection->DispatchEvent($oEvent);
+      } else {
+        return false;
+      }
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/enum.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/enum.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/enum.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,98 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Enum class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+  
+  
+  /**
+   * Enum
+   * @package library
+   */
+  class TEnum {
+    /**
+     * Array to enum
+     * @var mixed[]
+     */
+    var $_Array;
+    
+    /**
+     * Keys of the array (containing the cursor)
+     * @var string[]|integer[]
+     */
+    var $_Keys;
+    
+    /**
+     * Constructor
+     */
+    function TEnum(& $aArray) {
+      $this->_Array= & $aArray;
+      $this->_Keys= array_keys($aArray);
+    }
+    
+    /**
+     * Each
+     *
+     * @return mixed
+     */
+    function & Each() {
+      if(list($k,$v)= each($this->_Keys)) {
+        return $this->_Array[$v];
+      } else {
+        $F= FALSE;
+        return $F;
+      }
+    }
+    
+    /**
+     * Has items
+     * @return bool
+     */
+    function HasItems() {
+      return !empty($this->_Keys);
+    }
+    
+    /**
+     * Reset
+     *
+     * @return void
+     */
+    function Reset() {
+      reset($this->_Keys);
+    }
+    
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/event.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/event.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/event.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,115 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Base Event class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-06, Mathieu PARENT
+ * @package library
+ * @since 2005-06
+ */
+  
+  
+  /**
+   * Event
+   * @package library
+   */
+  class TEvent {
+    /**
+     * Can event bubble (not supported)
+     * @var bool
+     */
+    var $_bubbles= true;
+    
+    /**
+     * Is event cancelable
+     * @var bool
+     */
+    var $_cancelable= true;
+    
+    /**
+     * Is event default prevented
+     * @var bool
+     */
+    var $_isDefaultPrevented= false;
+    
+    /**
+     * event target
+     * @var TObject
+     */
+    var $_target= NULL;
+    
+    /**
+     * event type (as for DOM events)
+     * @var string
+     */
+    var $_type;
+    
+    /**
+     * Constructor
+     */
+    function TEvent() {
+    }
+    
+    function Cancelable() {
+      return $this->_cancelable;
+    }
+    
+    /**
+     * initialize the value of the event
+     * @param string $eventTypeArg event type
+     * @param bool $canBubbleArg can bubble (not supported)
+     * @param bool $cancelableArg cancelable
+     */
+    function InitEvent($eventTypeArg,$canBubbleArg,$cancelableArg) {
+      $this->_type= $eventTypeArg;
+      $this->_bubbles= $canBubbleArg;
+      $this->_cancelable= $cancelableArg;
+    }
+    
+    function IsDefaultPrevented() {
+      return $this->_isDefaultPrevented;
+    }
+    
+    function PreventDefault() {
+      if($this->_cancelable) {
+        $this->_isDefaultPrevented= true;
+      }
+    }
+    
+    function Target() {
+      return $this->_target;
+    }
+    function Type() {
+      return $this->_type;
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/mutation.evt.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/mutation.evt.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/mutation.evt.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,124 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Mutation Event class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-06, Mathieu PARENT
+ * @package library
+ * @since 2005-06
+ */
+  
+  /**
+   * Events
+   */
+  require_once('event.class.php');
+
+define('ADDITION',1);
+define('MODIFICATION',2);
+define('REMOVAL',3);
+
+  /**
+   * Mutation Event
+   * @package library
+   */
+  class TMutationEvent extends TEvent {
+    /**
+     * Type of change
+     * @var ADDITION|MODIFICATION|REMOVAL
+     */
+    var $_attrChange= MODIFICATION;
+    
+    /**
+     * name of the changed Attr node
+     * @var string
+     */
+    var $_attrName= '';
+    
+    /**
+     * New value
+     * @var mixed
+     */
+    var $_newValue= NULL;
+    
+    /**
+     * Prev value
+     * @var mixed
+     */
+    var $_prevValue= NULL;
+    
+    /**
+     * related node
+     * @var TObject
+     */
+    var $_relatedNode= NULL;
+    
+    /**
+     * Constructor
+     */
+    function TMutationEvent() {
+    }
+    
+    /**
+     * initialize the value of the event
+     * @param string $eventTypeArg event type
+     * @param bool $canBubbleArg can bubble (not supported)
+     * @param bool $cancelableArg cancelable
+     */
+    function initMutationEvent($typeArg,$canBubbleArg,$cancelableArg,
+        &$relatedNodeArg, &$prevValueArg, &$newValueArg,
+        $attrNameArg, $attrChangeArg) {
+      parent::initEvent($typeArg,$canBubbleArg,$cancelableArg);
+      $this->_relatedNode= $relatedNodeArg;
+      $this->_prevValue= $prevValueArg;
+      $this->_newValue= $newValueArg;
+      $this->_attrName= $attrNameArg;
+      $this->_attrChange= $attrChangeArg;
+    }
+    
+    function AttrChange() {
+      return $this->_attrChange;
+    }
+    function AttrName() {
+      return $this->_attrName;
+    }
+    function NewValue() {
+      return $this->_newValue;
+    }
+    function PrevValue() {
+      return $this->_prevValue;
+    }
+    function RelatedNode() {
+      return $this->_relatedNode;
+    }
+    
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/object.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/object.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/object.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,99 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Object class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+  
+  /**
+   * Attributes
+   */
+  require_once('attributes.class.php');
+  
+  /**
+   * Object with attributes
+   * @package library
+   */
+  class TObject {
+    /**
+     * Attributes
+     * @var TAttributes
+     */
+    var $Attributes;
+    
+    /**
+     * Constructor
+     */
+    function TObject() {
+      $this->Attributes= & new TAttributes($this);
+    }
+    
+    /**
+     * Unset all properties
+     *
+     * @return void
+     */
+    function Destruct() {
+      $this->Attributes->Destruct();
+      unset($this->Attributes);
+    }
+    
+    /* ========================================== */
+    /*                  EVENTS                    */
+    /* ========================================== */
+    /**
+     * Dispatch event
+     * Currently, it is not dispatched but just raised
+     *
+     * @param TEvent $oEvent
+     * @return bool should default behavior be prevented ?
+     */
+    function DispatchEvent(&$oEvent) {
+      $oEvent->_target= & $this;
+      $this->HandleEvent($oEvent);
+      return $oEvent->IsDefaultPrevented();
+    }
+    
+    /**
+     * Handle event
+     *
+     * @param TEvent $oEvent
+     * @return void
+     */
+    function HandleEvent(&$oEvent) {
+      //LibMisc::IntelligentVarDump($oEvent);
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/library/type.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/library/type.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/library/type.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,302 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Type class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package library
+ * @since 2005-03
+ */
+  
+  /**
+   * Type
+   * @package library
+   */
+  class TType extends TObject {
+    /**
+     * Attribute
+     * @var TAttribute
+     */
+    var $Attribute;
+    
+    /**
+     * No physical representation (database or file)
+     * @var boolean
+     */
+    var $Virtual= false;
+    
+    /**
+     * Control name suffix/prefix
+     * @var string
+     */
+    var $Prefix='';
+    var $Suffix='';
+    
+    /**
+     * Type: 
+     * * bool
+     * * color
+     * * float
+     * * fromarray
+     * * fromtable
+     * * groupid
+     * * index
+     * * integer
+     * * text
+     * * time
+     * * userid
+     * * unknow
+     *
+     * Attributes are: visible, ignore, and:
+     * * bool: nullable, compact
+     * * color: nullable
+     * * float: nullable, min, max, minsize, maxsize
+     * * fromarray: nullable, array (code=>v), showas (combo, list, label)
+     * * fromtable: nullable, tablename, codefield, labelfield, 
+     *   showas (combo, list, label), fieldtype
+     * * integer: nullable, min, max, minsize, maxsize
+     * * text: size, minsize, maxsize, compact
+     * * 
+     * @var string
+     */
+    var $Type;
+    
+    /**
+     * Constructor
+     * @param string
+     * @param TAttribute
+     */
+    function TType($sType, & $oAttribute) {
+      parent::TObject();
+      $this->Attribute= $oAttribute;
+      $this->Type= $sType;
+    }
+    
+    /**
+     * Get HTML from this type
+     * @return string
+     */
+    function HTML() {
+      global $db;
+      $r='';
+      $v= & $this->Attribute->Value;
+      switch(strtolower($this->Type)) {
+        case 'bool': 
+          if($this->Attributes->Value('compact')) {
+            $r.= '<input type="radio" '.
+              'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="1"'.($v=='1' ? ' checked' : '').'>'.html_l10n('Y');
+            $r.= '<input type="radio" '.
+              'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="0"'.($v!='1' ? ' checked' : '').'>'.html_l10n('N');
+          } else {
+            $r.= '<input type="radio" name="'.
+              $this->Prefix.$this->Attribute->Name.$this->Suffix.'" value="1"'.
+              ($v=='1' ? ' checked' : '').'>'.html_l10n('Yes').' ';
+            $r.= '<input type="radio" name="'.
+              $this->Prefix.$this->Attribute->Name.$this->Suffix.'" value="0"'.
+              ($v!='1' ? ' checked' : '').'>'.html_l10n('No');
+          }
+          break;
+        case 'color':
+          $color_id = str_replace(Array('[',']'),Array('-','-'),
+            $this->Prefix.$this->Attribute->Name.$this->Suffix);
+          echo '<input type="text" '.
+            'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="'.$v.'" size="7" '.
+              'id="color-'.$color_id.'" maxlength="7">'.
+            '<span style="background:url(\'images/bg.gif\');">'.
+              '<span onmouseover="changeColor(document.getElementById('.
+                '\'color-'.$color_id.'\'),this);" '.
+              'id="color-span-'.$color_id.'" '.
+              'onclick="colorPicker(this,document.getElementById('.
+                '\'color-'.$color_id.'\'));" '.
+              'style="background-color: '.(empty($v) ? 'transparent' : $v).';" '.
+              'class="color-span" title="'.html_l10n('Pick a color').'">'.
+                '&nbsp;&nbsp;&nbsp;&nbsp;'.
+            '</span>'.
+          '</span>'.
+          '&nbsp;'.
+          '<a title="'.html_l10n('No color').'" href="javascript:void(0);" '.
+            'onclick="changeColor('.
+              '\'color-'.$color_id.'\','.
+              '\'color-span-'.$color_id.'\','.
+              '\'\'); return false;" '.
+            'style="color:red;">X</a>';
+          break;
+        case 'fromarray':
+          $a= $this->Attributes->Value('array');
+          switch($this->Attributes->Value('showas')) {
+            case 'label':
+              if(isset($a[$v])) {
+                $r.= $a[$v];
+              } else {
+                $r.= '<i>'.html_l10n('None').'</i>';
+              }
+              break;
+            case 'list':
+              $r.= '<input type="text" name="'.
+                $this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+                'value="'.$v.'">';
+              $r.= '  <select onchange="this.form[\''.
+                  $this->Prefix.$this->Attribute->Name.$this->Suffix.'\']'.
+                  '.value=this.value;">'."\n";
+              if($this->Attributes->Value('nullable')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              foreach($a AS $d_k=>$d_v) {
+                $r.= '    <option value="'.$d_k.'" '.
+                  (($v==$d_k) ? ' selected' : '').'>'.
+                    $d_v.'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+              break;
+            case 'combo':
+            default:
+              $r.= '  <select name="'.
+                  $this->Prefix.$this->Attribute->Name.$this->Suffix.'">'."\n";
+              if($this->Attributes->Value('nullable')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              foreach($a AS $d_k=>$d_v) {
+                $r.= '    <option value="'.$d_k.'" '.
+                  (($v==$d_k) ? ' selected' : '').'>'.
+                    $d_v.'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+          }
+          break;
+       case 'fromtable':
+          $sCodeFieldName= $this->Attributes->Value('codefield');
+          $sLabelFieldName= $this->Attributes->Value('labelfield');
+          switch($this->Attributes->Value('showas')) {
+            case 'label':
+              $oQuery= $db->Select(
+                $this->Attributes->Value('tablecatalog'),
+                $this->Attributes->Value('tableschema'),
+                $this->Attributes->Value('tablename'),
+                $this->Attributes->Value('tableparams'),
+                Array(Array(
+                  $sCodeFieldName,'=',$v,
+                    $this->Attributes->Value('fieldtype')
+                  )),
+                $this->Attributes->Value('orderby'));
+              if($aRow= $db->FetchAssoc($oQuery)) {
+                $r.= $aRow[$sLabelFieldName];
+              } else {
+                $r.= '<i>'.html_l10n('None').'</i>';
+              }
+              break;
+            case 'list':
+              $r.= 'TODO list';
+              break;
+            case 'combo':
+            default:
+              $oQuery= $db->Select(
+                $this->Attributes->Value('tablecatalog'),
+                $this->Attributes->Value('tableschema'),
+                $this->Attributes->Value('tablename'),
+                $this->Attributes->Value('tableparams'),
+                Array(),
+                $this->Attributes->Value('orderby'),
+                Array('code'=>$sCodeFieldName,'label'=>$sLabelFieldName));
+              $r.= '  <select name="'.
+                  $this->Prefix.$this->Attribute->Name.$this->Suffix.'">'."\n";
+              if($this->Attributes->Value('nullable')) {
+                $r.= '    <option value="0" style="font-style:italic;">'.
+                  html_l10n('None').'</option>'."\n";
+                $r.= '    <option value="" disabled>-</option>'."\n";
+              }
+              while($aRow= $db->FetchAssoc($oQuery)) {
+                $r.= '    <option value="'.$aRow['code'].'" '.
+                  (($v==$aRow['code']) ? ' selected' : '').'>'.
+                    $aRow['label'].'</option>'."\n";
+              }
+              $r.= '  </select>'."\n";
+              $db->FreeResult($oQuery);
+          }
+          break;
+        case 'index':
+          echo '<input type="text" '.
+            'name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+            'value="'.$v.'" size="2">';
+          $col=$this->Attributes->Value('column');
+          if($this->Attributes->Value('compact')) {
+            echo '<a href="javascript:void(0);" '.
+              'onclick="return moveRow(this.parentNode.parentNode, '.
+                '\'u\', \''.$col.'\')" class="arrow-up">'.
+              '<img alt="^" '.
+                'src="'.Conf::get('musmap_root_url').'/images/arrow_up.gif">'.
+              '</a>';
+            echo '<a href="javascript:void(0);" '.
+              'onclick="return moveRow(this.parentNode.parentNode, '.
+                '\'d\', \''.$col.'\')" class="arrow-down">'.
+              '<img alt="v" '.
+                'src="'.Conf::get('musmap_root_url').'/images/arrow_down.gif">'.
+              '</a>';
+          }
+          break;
+        case 'float':
+          //break;
+        case 'integer':
+          //break;
+        case 'text':
+          if($this->Attributes->Value('memo') 
+              && !$this->Attributes->Value('compact')) {
+            $r.='<textarea name="'.$this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'cols="'.$this->Attributes->ValueWithDefault('cols',50).'" '.
+              'rows="'.$this->Attributes->ValueWithDefault('rows',3).'">'.$v.'</textarea>';
+
+          } else {
+            $r.= '<input type="text" name="'.
+              $this->Prefix.$this->Attribute->Name.$this->Suffix.'" '.
+              'value="'.$v.'">';
+          }
+          break;
+        case 'time':
+        if($v) {
+          $r.= htmlentities(LibMisc::RelativeDate($v));
+        } else {
+          $r.= '<i>'.html_l10n('None').'</i>';
+        }
+          break;
+        default:
+          $r= '<font color=red>unknown type: "'.$this->Type.'".</font>';
+      }
+      return $r;
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/localization.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/localization.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/localization.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,70 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Localization
+   *
+   * @author Mathieu Parent
+   * @copyright 2004-09, Mathieu PARENT
+   * @package include
+   * @since 2004-06
+   */
+  
+  /**
+   * localize a string
+   */
+  function l10n($message) {
+    global $l10n,$log;
+    if(isset($l10n[$message])) {
+      return $l10n[$message];
+    } else {
+      return $message;
+    }
+  }
+  
+  /**
+   * & => &amp; ...
+   */
+  function html_l10n($message) {
+    return(htmlentities(l10n($message)));
+  }
+
+  /**
+   * Get model column labels
+   */
+  function translate($message) {
+    global $model_l10n,$log;
+    if(isset($model_l10n[$message])) {
+      return $model_l10n[$message];
+    } else {
+      return $message;
+    }
+  }
+  
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/log.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/log.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/log.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,148 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Logging class
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-09
+ */
+
+  /**
+   * Class TLog
+   * @package include
+   */
+  class TLog {
+    var $has_error;
+    var $errors;
+    var $fp;
+    
+    /**
+     * Constructor
+     */
+    function TLog() {
+      $this->has_error=false;
+    }
+    
+    /**
+     * Add a log 
+     */
+    function Add($str,$sTitle='', $i=0) {
+      $this->has_error = true;
+      $trace=debug_backtrace();
+      if(isset($trace[$i+1])) {
+        $filename   = $trace[$i+1]['file'];
+        $linenumber = $trace[$i+1]['line'];
+      } else {
+        $filename   = '';
+        $linenumber = 0;
+      }
+      $this->fp= fopen(Conf::get('log_dir').'musmap.log','a');
+      if($this->fp) {
+        fwrite($this->fp,
+          '"'.$this->Escape($sTitle).'";'.
+          '"'.$this->Escape($str).'";'.
+          '"'.$this->Escape($filename).'";'.
+          '"'.$this->Escape($linenumber).'";'.
+          '"'.$this->Escape(time()).'";'.
+          '"'.$this->Escape(serialize($trace)).'";""'.
+          "\n"
+          );
+        fclose($this->fp);
+      }
+    }
+    
+    function Escape($str) {
+      return str_replace(Array(';','"'),Array("\t",'\\"'),
+        addcslashes($str, "\0..\37!@\@\177..\377"));
+    }
+    
+    function UnEscape($str) {
+      return stripcslashes(str_replace(Array("\t",'\\"'),Array(';','"'),
+        $str));
+    }
+    
+    function clear(){
+      if(!file_exists(Conf::get('log_dir').'musmap.log')) {
+        return;
+      } else {
+        unlink(Conf::get('log_dir').'musmap.log');
+      }
+    }
+    
+    function show($headers=true){
+      if(!file_exists(Conf::get('log_dir').'musmap.log')) {
+        return;
+      }
+      $this->fp=fopen(Conf::get('log_dir').'musmap.log','r');
+      echo '<table class="log-table">';
+      if($headers) {
+        echo '<tr>';
+          echo '<th>&nbsp;</th>';
+          echo '<th>Text</th>';
+          echo '<th>File</th>';
+          echo '<th>Trace</th>';
+          echo '<th>More</th>';
+        echo "</tr>\n";
+      }
+      $line_number=0;
+      while (($items = fgetcsv($this->fp, 1000, ";",'"')) !== FALSE) {
+        if(!isset($items[6])) {
+          $items[6]= '';
+        }
+        echo '<tr>';
+        echo '<td>'.
+          '<a href="#'.($line_number+1).'" name="'.$line_number.'">'.
+            'V'.
+          '</a></td>';
+        echo '<td>'.nl2br($this->UnEscape($items[0])."<br>\n".
+            $this->UnEscape($items[1])).'</td>';//error
+        echo '<td>';
+          echo $this->UnEscape($items[2]).'<br>';//file
+          echo 'Line='.$this->UnEscape($items[3]).'<br>';//line
+          echo 'Date='.date("j/n/Y H:i:s",$this->UnEscape($items[4]));
+        echo  '</td>';
+        echo '<td><textarea cols="75" rows="10">';
+          ob_start();
+          var_dump(unserialize($this->UnEscape($items[5])));
+          $r= ob_get_contents();
+          ob_end_flush();
+          echo htmlentities($r);
+        echo '</textarea></td>';
+        echo '<td>'.$this->UnEscape($items[6]).'</td>';
+        echo "</tr>\n";
+        $line_number++;
+      }
+      echo '</table>';
+      fclose($this->fp);
+    }
+  }
+?>

Added: packages/musmap/branches/upstream/current/include/map.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/map.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/map.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,936 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Classe Map : Carte
+   *
+   * Les fonctions mapscript sont regroupées dans
+   * cet objet, ainsi que les diverses ajouts
+   * (légende, vérification des données utilisateur)
+   *
+   * @author Mathieu Parent
+   * @copyright 2004-06, Mathieu PARENT
+   * @package include
+   * @since 2004-06
+   */
+   
+   /**
+    * Functions
+    */ 
+  require_once('map.inc.php');
+  
+  /**
+   * Classe regroupant les fonctions de carte
+   */
+  class TMap {
+    //File
+    var $map_path;
+    //Mapscript map
+    var $ms_map;
+    //
+    var $current_extent; // De type RectObj
+    var $user_rect;
+    var $user_point;
+    var $user_point2;
+    //Images
+    var $map_img;
+    var $ref_img;
+    var $scalebar_img;
+    var $imagemap_img;
+    //urls
+    var $map_url;
+    var $ref_url;
+    var $scalebar_url;
+    var $imagemap_url;
+    //
+    var $query_results;
+    var $drawn=false;
+    
+    var $query_extent;
+    var $extent_margin=1;
+    
+    /**
+     * Constructor
+     */
+    function TMap($map_file_name) {
+      $this->map_path=$map_file_name;
+      $this->ms_map = ms_newMapObj($this->map_path);
+      if(!$this->ms_map) {
+        $this->print_errors();
+        return;
+      }
+      if(Conf::get('image_path')) {
+        $this->ms_map->web->set('imagepath',Conf::get('image_path'));
+      }
+      if(Conf::get('image_url')) {
+        $this->ms_map->web->set('imageurl',Conf::get('image_url'));
+      }
+      $this->query_results=Array();
+    }
+  
+    /**
+     * Activate layers according to scale
+     */
+    function activate_layers($scale=NULL) {
+      global $INPUT;
+      if($scale===NULL) {
+        $scale=$this->ms_map->scale;
+      }
+      for($i=0;$i<$this->ms_map->numlayers;$i++) {
+        $layer=$this->ms_map->getLayer($i);
+        if(isset($INPUT['layers'])) {
+          if(isset($INPUT['layers'][$layer->name])
+            && ($INPUT['layers'][$layer->name]=='on')) {
+            $layer->set('status',MS_ON);
+          } else {
+            $layer->set('status',MS_OFF);
+          }
+        }
+        if(($layer->status==MS_ON)
+            && (($layer->minscale<=$scale) || ($layer->minscale<=0))
+            && (($layer->maxscale>=$scale) || ($layer->maxscale<=0))) {
+          $layer->set('status',MS_ON);
+        } else {
+          $layer->set('status',MS_OFF);
+        }
+      }
+    }
+    
+    /**
+     * Affichage de la légende
+     */
+    function print_legend($mode='screen') {
+      LibMap::print_legend($this->ms_map,$mode=='screen');
+    }
+    
+    
+    
+    /**
+     * Vérification du paramètre extent
+     */
+    function check_extent_input() {
+      global $INPUT;
+      /* =================================
+       * Rectangle de la partie actuellement affichée
+       */
+        $extent_invalid=!isset($INPUT['extent'])
+          || !is_numeric($INPUT['extent']['minx'])
+          || !is_numeric($INPUT['extent']['miny'])
+          || !is_numeric($INPUT['extent']['maxx'])
+          || !is_numeric($INPUT['extent']['maxy'])
+          || ((float) $INPUT['extent']['minx']==(float) $INPUT['extent']['maxx'])
+          || ((float) $INPUT['extent']['miny']==(float) $INPUT['extent']['maxy']);
+        if($extent_invalid) {
+          $this->current_extent=$this->ms_map->extent;
+        } else {
+          $geoRect=$INPUT['extent'];
+          $this->current_extent=ms_newRectObj();
+          $this->current_extent->setextent(
+            (float) $geoRect['minx'],(float) $geoRect['miny'],
+            (float) $geoRect['maxx'],(float) $geoRect['maxy']);
+          unset($geoRect);
+        }
+    }
+    
+    /**
+     * Vérification des données utilisateur
+     */
+    function check_input() {
+      global $INPUT;
+      /* =================================
+       * Action (zoom, ...)
+       */
+        if(!isset($INPUT['command'])){
+          $INPUT['command']='';//par défaut
+        }
+      
+      $this->check_extent_input();
+      /* =================================
+       * Facteur de zoom
+       */
+        if(!isset($INPUT['zoom_factor']) || ((int) $INPUT['zoom_factor']==0)){
+          $INPUT['zoom_factor']=1;//Recentrage
+        }
+        
+      /* =================================
+       * Taille de la carte (sur l'écran client)
+       */
+        $no_imagesize=empty($INPUT['image_width']) || empty($INPUT['image_height']);
+        if(!$no_imagesize) {
+          $this->ms_map->set('width',$INPUT['image_width']);
+          $this->ms_map->set('height',$INPUT['image_height']);
+        }
+      
+      /* =================================
+       * Sélections à la souris
+       */
+        $mouse_rect_point_min_invalid=
+          !isset($INPUT['mouse_rect'])
+          || (gettype($INPUT['mouse_rect'])!='array')
+          || !isset($INPUT['mouse_rect']['minx'])
+          || !isset($INPUT['mouse_rect']['miny']) 
+          || ($INPUT['mouse_rect']['minx']=='NaN')
+          || ($INPUT['mouse_rect']['miny']=='NaN')
+          || ($INPUT['mouse_rect']['minx']=='')
+          || ($INPUT['mouse_rect']['miny']=='');
+        $mouse_rect_point_max_invalid=
+          !isset($INPUT['mouse_rect'])
+          || (gettype($INPUT['mouse_rect'])!='array')
+          || !isset($INPUT['mouse_rect']['maxx'])
+          || !isset($INPUT['mouse_rect']['maxy']) 
+          || ($INPUT['mouse_rect']['maxx']=='NaN')
+          || ($INPUT['mouse_rect']['maxy']=='NaN')
+          || ($INPUT['mouse_rect']['maxx']=='')
+          || ($INPUT['mouse_rect']['maxy']=='');
+        if($INPUT['command']==='zoom_ref') {
+          if($mouse_rect_point_min_invalid) {
+            $INPUT['mouse_rect']['minx']=0;
+            $INPUT['mouse_rect']['miny']=0;
+          }
+          if($mouse_rect_point_max_invalid) {
+            $INPUT['mouse_rect']['maxx']=0;
+            $INPUT['mouse_rect']['maxy']=0;
+          }
+        } elseif(in_array($INPUT['command']
+            ,Array('zoom_in','zoom_out','zoom_ref','query_point','zoom_scale'))) {
+          if($mouse_rect_point_min_invalid) {
+            $INPUT['mouse_rect']=Array('minx'=>0,'miny'=>0);
+          } else {
+            unset($INPUT['mouse_rect']['maxx']);
+            unset($INPUT['mouse_rect']['maxy']);
+          }
+        } else {
+          if($mouse_rect_point_min_invalid || $mouse_rect_point_max_invalid ) {
+            $INPUT['mouse_rect']=Array('minx'=>0,'miny'=>0,
+              'maxx'=>$this->ms_map->width,'maxy'=>$this->ms_map->height);
+          }
+        }
+        //Création de l'objet point/rectangle
+        if($INPUT['command']==='zoom_ref') {
+          $this->user_point=ms_newPointObj();
+          $this->user_point->setXY(
+            $INPUT['mouse_rect']['minx'],$INPUT['mouse_rect']['miny']);
+          $this->user_point2=ms_newPointObj();
+          $this->user_point2->setXY(
+            $INPUT['mouse_rect']['maxx'],$INPUT['mouse_rect']['maxy']);
+        } elseif(isset($INPUT['mouse_rect']['maxx'])) {
+          $this->user_rect=ms_newRectObj();
+          $this->user_rect->setExtent(
+            (float) $INPUT['mouse_rect']['minx'],
+            (float) $INPUT['mouse_rect']['miny'],
+            (float) $INPUT['mouse_rect']['maxx'],
+            (float) $INPUT['mouse_rect']['maxy']);
+        } else {
+          $this->user_point=ms_newPointObj();
+          $this->user_point->setXY(
+            $INPUT['mouse_rect']['minx'],$INPUT['mouse_rect']['miny']);
+        }
+        
+    }
+    
+    /**
+     * Get layer by name
+     */
+    function get_ms_layer_by_name($layer_name,$show_error=true) {
+      if($layer_name==-1) {
+        $layer=$this->ms_map;
+      } elseif(is_numeric($layer_name)) {
+        $layer=$this->ms_map->getLayer($layer_name);
+      } elseif (!$layer=@$this->ms_map->getLayerByName($layer_name)) {
+        $layer_len=strlen($layer_name);
+        for($layer_index=0;$layer_index<$this->ms_map->numlayers;$layer_index++) {
+          $layer=$this->ms_map->getLayer($layer_index);
+          if($layer->getMetaData('data_source_name')==$layer_name) {
+            break;
+          }
+          $layer=NULL;
+        }
+      }
+      if($layer===NULL) {
+        if($show_error) {
+          add_error(
+            sprintf(
+              l10n('Layer not found: "%s".'),
+              $layer_name));
+        }
+        return false;
+      } else {
+        return $layer;
+      }
+    }
+    
+    /**
+     * Get layer by id_profile_data
+     */
+    function get_ms_layer_by_id_profile_data($id_profile_data) {
+      for($layer_index=0;$layer_index<$this->ms_map->numlayers;$layer_index++) {
+        $ms_layer=$this->ms_map->getLayer($layer_index);
+        if($ms_layer->getMetaData('id_profile_data')==$id_profile_data) {
+          break;
+        }
+        $layer=NULL;
+      }
+      return $ms_layer;
+    }
+    
+    /**
+     * Do the command Zoom/Query/...
+     */
+    function do_command() {
+      global $INPUT, $db, $user;
+      switch($INPUT['command']) {
+        // ================== ZOOM ==================================
+        case 'zoom_extent' :
+          $this->ms_map->setextent(
+            $this->current_extent->minx, $this->current_extent->miny,
+            $this->current_extent->maxx, $this->current_extent->maxy);
+          break;
+        case 'zoom_layer' :
+          if(isset($INPUT['layer_select'])) {
+	    $INPUT['id_profile_data']= substr($INPUT['layer_select'],
+              strstr($INPUT['layer_select'],'id_profile_data=')+16);
+            $INPUT['id_profile_data']= (integer) $INPUT['id_profile_data'];
+            $ms_layer=  $this->get_ms_layer_by_name('profile_data_'.$INPUT['id_profile_data'],false);
+            if($ms_layer!==NULL) {
+              $ms_extent= $ms_layer->getExtent();
+              $this->ms_map->setextent(
+                $ms_extent->minx, $ms_extent->miny,
+                $ms_extent->maxx, $ms_extent->maxy);
+            } else {
+              add_error(sprintf(l10n('Operation "%s" failed:'), l10n('Zoom to layer')).' '.
+                sprintf(l10n('Layer "%s" not found.'),
+                'id='.$INPUT['id_profile_data']));
+            }
+	  }
+          break;
+        case 'zoom_box' :
+          $this->ms_map->zoomrectangle(
+            $this->user_rect,
+            $this->ms_map->width, $this->ms_map->height, 
+            $this->current_extent);
+          break;
+        case 'zoom_out' :
+          $INPUT['zoom_factor']=-$INPUT['zoom_factor'];
+          //continue
+        case 'zoom_in' :
+          $this->ms_map->zoompoint($INPUT['zoom_factor'], $this->user_point,
+            $this->ms_map->width, $this->ms_map->height,$this->current_extent);
+          break;
+        case 'zoom_scale' :
+          $this->ms_map->zoomscale($INPUT['scale'], $this->user_point,
+            $INPUT['image_width'], $INPUT['image_height'],$this->current_extent);
+          break;
+        case 'zoom_ref' :
+          //we need this to calculate reference size
+          $oRefImg = $this->ms_map->drawReferenceMap();
+          $this->ms_map->reference->set('width', $oRefImg->width);
+          $this->ms_map->reference->set('height', $oRefImg->height);
+          $oRefImg->free();
+          unset($oRefImg);
+          $this->ms_map->zoomscale($INPUT['scale'], $this->user_point,
+            $this->user_point2->x, $this->user_point2->y,$this->ms_map->reference->extent);
+          break;
+        case 'zoom_init' :
+          break;
+        // ================== GRAPHICAL QUERIES =====================
+        case 'query_result':
+          $this->ms_map->setExtent(
+            $this->current_extent->minx, $this->current_extent->miny,
+            $this->current_extent->maxx, $this->current_extent->maxy);
+          $oQueryResults= & LibComponent::Load('query_results');
+          if($oQueryResult = $oQueryResults->GetItemByClassNameAndAttribute(
+              'query_result', 'id_query_result', $_GET['id_query_result'])) {
+            $r = $oQueryResult->show();
+            if($r) {
+              $this->query_results[]=$r;
+            }
+          } else {
+            add_error(sprintf(l10n('%s not found: "%s".'),
+                translate('query_result'),
+                'id:'.$_GET['id_query_result']));
+          }
+          break;
+        case 'query_point':
+        case 'query_rect':
+          $this->ms_map->setExtent(
+            $this->current_extent->minx,
+            $this->current_extent->miny,
+            $this->current_extent->maxx,
+            $this->current_extent->maxy);
+          $oConnections= & LibComponent::Load('connections');
+          $oDataSource= & $oConnections->GetSubItemByClassNameAndAttribute(
+            'data_source','id_data_source',$INPUT['id_data_source']);
+          if($oDataSource) {
+            $oConnection= & $oDataSource->GetParent();
+            if($oConnection) {
+              if($INPUT['command']==='query_point') {
+                $oShape=ms_newPointObj();
+                $oShape->setXY($INPUT['x'],$INPUT['y']);
+              } else {
+                $oShape=ms_newRectObj();
+                $oShape->setExtent($INPUT['minx'],$INPUT['miny'],
+                  $INPUT['maxx'],$INPUT['maxy']);
+              }
+              $oDb= & $oConnection->GetDb(DB_SUPPORTS_DRAWING);
+              if($oDb) {
+                $r= $oDb->query_by_shape('profile_data_'.$INPUT['id_profile_data'],$oShape);
+                if($r!==false) {
+                  $this->query_results[]=Array($oDataSource, $oDb, $r);
+                } else {
+                  add_error(sprintf(l10n('Layer not found: "%s".'),
+                      'id:'.$INPUT['id_profile_data']));
+                }
+              } else {
+                add_error(l10n('Connection does not support QueryByShape.'));
+              }
+              $oShape->free();
+            } else {
+              add_error(l10n('Connection not found.'));
+            }
+          } else {
+            add_error(sprintf(l10n('Data source not found: "%s".'),
+                'id:'.$INPUT['id_data_source']));
+          }
+          break;
+        // ================== FORM QUERIES ==========================
+        case 'query_form':
+          $oQueryForms= & LibComponent::Load('query_forms');
+          $oQueryForm = $oQueryForms->GetItemByClassNameAndAttribute('query_form',
+              'id_query_form', $INPUT['form']);
+          $oConnections= & LibComponent::Load('connections');
+          if($oQueryForm) {
+            preg_match_all('/^\s*("?)(\S+?)\\1\s*=\s*("?)(.*?)\\3\s*$/m',
+              $oQueryForm->Attributes->Value('query_form_params'),
+              $params_matches, PREG_SET_ORDER);
+            $params = Array();
+            foreach($params_matches AS $param) {
+              $params[$param[2]]=$param[4];
+            }
+            if(empty($params['query.type'])) {
+              add_error(sprintf(l10n('Missing query form parameter "%s", using "%s".'),
+                'query.type', 'attributes'));
+              $params['query.type']= 'attributes';
+            }
+            switch($params['query.type']) {
+              case 'sql' :
+                LibMisc::TimePoint("sql query start");
+                if(!empty($params['query.text'])) {
+                  if(!empty($params['id'])) {
+                    $id= $params['id'];
+                    $oDataSource= $oConnections->GetSubItemByClassNameAndAttribute('data_source',
+                      'id_data_source', $oQueryForm->Attributes->Value('id_data_source'));
+                    if($oDataSource) {
+                      $oConnection= & $oDataSource->GetParent();
+                      if($oConnection) {
+                        $oSQLDb= & $oConnection->GetDb(DB_SUPPORTS_SQL);
+                        if($oSQLDb) {
+                          $id_type='N';
+                          $sql=preg_replace("/(\{)(.*?)(:\S*?)?(\})/e",
+                               "\$oSQLDb->Quote(\$db->Escape(\$INPUT['query']['\\2']),substr('\\3',1))",
+                               $params['query.text']);
+                          $q= $oSQLDb->query($sql);
+                          if($q) {
+                            $oDrawingDb= & $oConnection->GetDb(DB_SUPPORTS_DRAWING);
+                            if($oDrawingDb) {
+                              $qstring='';
+                              while($aRow=$oSQLDb->FetchAssoc($q)) {
+                                $qstring.=cast($aRow[$id], $id_type).',';
+                              }
+                              if(!empty($qstring)) {
+                                $qstring="([".$id."] IN '".substr($qstring,0,-1)."')";
+                                $this->query_results[]= Array(&$oDataSource, &$oDrawingDb, 
+                                  $oDrawingDb->Select(NULL, NULL, $oDataSource->Attributes->Value('data_source_name'), NULL,
+                                    $id.'=='.$qstring));
+                                if($oDataSource->IsRaster() || $oDataSource->IsShape()) {
+                                  $this->calculate_query_extent();
+                                }
+                              }
+                            } else {
+                              $this->query_results[]=Array(& $oDataSource, & $oSQLDb, & $q);
+                            }
+                          } else {//Alpha Query error
+                            add_error(sprintf(l10n('Error performing query: "%s" on data source "%s".'), 
+                                $sql,
+                                'id='.$oQueryForm->Attributes->Value('id_data_source')));
+                          }
+                        } else {
+                          add_error(l10n('Connection does not support SQL.'));
+                        }
+                      } else {
+                        add_error(sprintf(l10n('%s not found.'),
+                            ucfirst(translate('connection'))));
+                      }
+                    } else {
+                      add_error(sprintf(l10n('%s not found: "%s".'),
+                          ucfirst(translate('data_source')),
+                          'id:'.$oQueryForm->Attributes->Value('id_data_source')));
+                    }
+                  } else {
+                    add_error(sprintf(l10n('Missing query form parameter "%s", exiting.'),
+                      'id'));
+                  }
+                } else {
+                  add_error(sprintf(l10n('Missing query form parameter "%s", exiting.'),
+                    'query.text'));
+                }
+                break;
+              case 'attributes' : 
+                LibMisc::TimePoint("TMap::do_command() query_form attributes start");
+                if(!empty($params['query.string'])) {
+                  if(!empty($params['query.item'])) {
+                    $aMissingParameters= Array();
+                    $query_where=preg_replace("/(\{)(.*?)(:\S*?)?(\})/e",
+                         "cast(\$db->Escape(isset(\$INPUT['query']['\\2']) ? \$INPUT['query']['\\2'] : (\$aMissingParameters[]='\\2')),substr('\\3',1))",
+                         $params['query.string']);
+                    foreach($aMissingParameters as $sMissingParameter) {
+                      add_error(sprintf(l10n('Missing query form parameter "%s", using "%s".'),
+                        $sMissingParameter, ''));
+                    }
+                    unset($sMissingParameter);
+                    unset($aMissingParameters);
+                    $oDataSource= $oConnections->GetSubItemByClassNameAndAttribute('data_source',
+                      'id_data_source', $oQueryForm->Attributes->Value('id_data_source'));
+                    if($oDataSource) {
+                      $oConnection= & $oDataSource->GetParent();
+                      if($oConnection) {
+                        $oDrawingDb= & $oConnection->GetDb(DB_SUPPORTS_DRAWING);
+                        if($oDrawingDb) {
+                          $this->query_results[]=Array(
+                            $oDataSource,
+                            $oDrawingDb,
+                            $oDrawingDb->Select(
+                              $oDataSource->Attributes->Value('data_source_catalog'),
+                              $oDataSource->Attributes->Value('data_source_schema'),
+                              $oDataSource->Attributes->Value('data_source_name'), 
+                              $oDataSource->Attributes->Value('data_source_params'),
+                              $params['query.item'].'=='.$query_where));
+                          if($oDataSource->IsRaster() || $oDataSource->IsShape()) {
+                            $this->calculate_query_extent();
+                          }
+                          unset($oDrawingDb);
+                        } else {
+                          $oSelectDb= & $oConnection->GetDb(DB_SUPPORTS_SELECT);
+                          if($oSelectDb) {
+                            $this->query_results[]=Array(
+                            $oDataSource,
+                            $oDrawingDb,
+                              $oDrawingDb->Select(
+                                $oDataSource->Attributes->Value('data_source_catalog'),
+                                $oDataSource->Attributes->Value('data_source_schema'),
+                                $oDataSource->Attributes->Value('data_source_name'), 
+                                $this->Attributes->Value('data_source_params'),
+                                Array($params['query.item'],'=',$query_where)));
+                            unset($oSelectDb);
+                          } else {
+                            add_error(l10n('Connection does not support Select.'));
+                          }
+                        }
+                      } else {
+                        add_error(sprintf(l10n('%s not found: "%s".'),
+                            ucfirst(translate('conncetion')),
+                            'id:'.$oDataSource->Attributes->Value('id_connection')));
+                      }
+                    } else {
+                      add_error(sprintf(l10n('%s not found: "%s".'),
+                          ucfirst(translate('data_source')),
+                          'id:'.$oQueryForm->Attributes->Value('id_data_source')));
+                    }
+                  } else {
+                    add_error(sprintf(l10n('Missing query form parameter "%s", exiting.'),
+                      'query.item'));
+                  }
+                } else {
+                  add_error(sprintf(l10n('Missing query form parameter "%s", exiting.'),
+                    'query.string'));
+                }
+                LibMisc::TimePoint("TMap::do_command() query_form attributes end");
+                break;
+              default :
+                add_error(sprintf(
+                    l10n('Type of form query unknown: "%s".'),
+                    $params['query.type']));
+            }
+          } else {
+            add_error(sprintf(
+              l10n('Query form not found: "%s".'), $INPUT['form']));
+          }
+          break;
+        // ================== ATTRIBUTES QUERIES ====================
+        case 'query_attributes':
+          $oConnections= & LibComponent::Load('connections');
+          $oDataSource = &$oConnections->GetSubItemByClassNameAndAttribute('data_source','id_data_source',$INPUT['id_data_source']);
+          if($oDataSource) {
+            if(    !empty($_GET['order_by_item'])
+                && !empty($_GET['order_by_id_data_source'])
+                && ($_GET['order_by_id_data_source'] == $oDataSource->Attributes->Value('id_data_source'))) {
+              $r=$oDataSource->select(Array(Array($INPUT['item'],'=',$INPUT['string'],$INPUT['type'])),
+                Array($_GET['order_by_item']=>''));
+            } else {
+              $r= $oDataSource->select(Array(Array($INPUT['item'],'=',$INPUT['string'],$INPUT['type'])));
+            }
+            $this->query_results[]= $r;
+            if($oDataSource->IsRaster() || $oDataSource->IsShape()) {
+              $this->calculate_query_extent();
+            }
+          } else {
+            add_error(sprintf(l10n('Data source not found: "%s".'),
+                'id:'.$INPUT['id_data_source']));
+          }
+          break;
+        Default :
+          Warning(sprintf(l10n('Invalid command: "%s".'),$INPUT['command']));
+      }
+    }
+    
+    /**
+     * Debug save
+     */
+    function save($file_path = NULL) {
+      if($file_path === NULL) {
+        $this->ms_map->save(Conf::get('blank_map_path').".map");
+      } else {
+        $this->ms_map->save($file_path);
+      }
+    }
+    
+    /**
+     *
+     */
+    function print_errors()
+    {
+      //l10n('msDrawMap()')
+      //l10n('msSHPOpenFile()')
+      //l10n('msDBFGetItemIndex()')
+      $error = ms_GetErrorObj();
+      while($error && $error->code != MS_NOERR)
+      {
+        if($error->code==MS_IMGERR)
+        {
+          sscanf($error->message,
+              "Failed to draw layer named '%s'.",$layer_name);
+          add_error(
+              sprintf(l10n('Error %s:'),$error->code).' '.
+              l10n($error->routine).': '.
+              sprintf(l10n("Failed to draw layer named '%s'."),$layer_name));
+        }
+        elseif($error->code==MS_DBFERR)
+        {
+          sscanf($error->message,
+              "Item '%s' not found.",$item);
+          add_error(
+              sprintf(l10n('Error %s:'),$error->code).' '.
+              l10n($error->routine).': '.
+              sprintf(l10n("Item '%s' not found."),$item));
+        }
+        elseif ($error->code==MS_NOTFOUND)
+        {
+          //Is this really an error ?
+        }
+        elseif($error->code==MS_IOERR)
+        {
+          //Error 1: msAddImageSymbol(): Error opening image file %s.
+        }
+        else
+        {
+          add_error(
+              sprintf(l10n('Error %s:'),$error->code).' '.
+              l10n($error->routine).': '.
+              l10n($error->message));
+        }
+        $error = $error->next();
+      }
+      ms_ResetErrorList();
+    }
+    
+    /**
+     * Création des images
+     */
+    function create_images($free_img=true, $map_only = false) {
+      LibMisc::TimePoint("TMap::create_images() start");
+      if(!$this->drawn) {
+        //$this->save();
+        // Map
+          $this->map_img = @$this->ms_map->draw();
+          $this->print_errors();
+          if($this->map_img)
+          {
+              if($free_img) {
+                $this->map_url = $this->map_img->saveWebImage();
+                $this->map_img->free();
+              }
+              if($map_only) {
+                return;
+              }
+            // Reference
+              if(!empty($this->ms_map->reference->image)) {
+                $this->ref_img = $this->ms_map->drawReferenceMap();
+                $this->ref_url = $this->ref_img->saveWebImage();
+                $this->ms_map->reference->set('width', $this->ref_img->width);
+                $this->ms_map->reference->set('height', $this->ref_img->height);
+                $this->ref_img->free();
+              } else {
+                $this->ref_url= NULL;
+              }
+            // Scalebar
+              $this->scalebar_img = $this->ms_map->drawScaleBar();
+              $this->scalebar_url = $this->scalebar_img->saveWebImage();
+              $this->scalebar_img->free();
+            // Image-Map
+              if(false) {
+                $this->ms_map->selectOutputformat('imagemap');
+                $this->imagemap_img = $this->ms_map->draw();
+                $this->imagemap_url = $this->imagemap_img->saveWebImage();
+                $this->imagemap_img->free();
+              }
+            $this->drawn=true;
+          }
+          else // error when drawing map
+          {
+            add_error(l10n('Unable to load map. Check if data sources exists.'));
+          }
+          $this->print_errors();
+      }
+      LibMisc::TimePoint("TMap::create_images() end");
+    }
+    
+    function create_selection_layers() {
+      foreach(Array(
+          MS_SHAPE_POINT=>MS_LAYER_POINT,
+          MS_SHAPE_LINE=>MS_LAYER_LINE,
+          MS_SHAPE_POLYGON=>MS_LAYER_POLYGON,
+          MS_SHAPE_NULL=>MS_LAYER_POINT) AS $shape_type=>$layer_type) {
+        $this->ms_query_layers[$shape_type]= ms_newLayerObj($this->ms_map);
+        $this->ms_query_layers[$shape_type]->set('name','_sel_'.$layer_type);
+        $this->ms_query_layers[$shape_type]->set('type',$layer_type);
+        $this->ms_query_layers[$shape_type]->set('status',MS_ON);
+        $this->ms_query_layers[$shape_type]->set('transparency',50);
+        $ms_class=ms_newClassObj($this->ms_query_layers[$shape_type]);
+        if($layer_type==MS_LAYER_POINT) {
+          $ms_style=ms_newStyleObj($ms_class);
+          $ms_style->color->setRGB(255,0,0);
+          $ms_style->set('symbolname','circle');
+          $ms_style->set('size',10);
+          $ms_style->outlinecolor->setRGB(0,255,0);
+        } elseif($layer_type==MS_LAYER_POLYGON) {
+          $ms_style=ms_newStyleObj($ms_class);
+          $ms_style->color->setRGB(255,0,0);
+          $ms_style=ms_newStyleObj($ms_class);
+          $ms_style->outlinecolor->setRGB(0,255,0);
+          $ms_style->set('symbolname','circle');
+          $ms_style->set('size',2);
+        } elseif ($layer_type==MS_LAYER_LINE) {
+          $ms_style=ms_newStyleObj($ms_class);
+          $ms_style->outlinecolor->setRGB(0,255,0);
+          $ms_style->set('symbolname','circle');
+          $ms_style->set('size',7);
+          $ms_style=ms_newStyleObj($ms_class);
+          $ms_style->color->setRGB(255,0,0);
+          $ms_style->set('symbolname','circle');
+          $ms_style->set('size',3);
+        }
+      }
+    }
+    
+    function hilite_features() {
+      if($this->map_img) {
+        foreach($this->ms_query_layers AS $shape_type=>$ms_layer) {
+          $ms_layer->draw($this->map_img);
+        }
+      }
+    }
+    
+    function calculate_query_extent() {
+      global $INPUT;
+      LibMisc::TimePoint("TMap::calculate_query_extent() start");
+      $result_count=0;
+      for($layer_index=0;$layer_index<$this->ms_map->numlayers;$layer_index++) {
+        $layer=$this->ms_map->getLayer($layer_index);
+        if($layer->type!=MS_LAYER_RASTER) {
+          $layer->open();
+          for($j=0;$j<$layer->getNumResults();$j++) {
+            $result=$layer->getResult($j);
+            $shape=$layer->getShape($result->tileindex,$result->shapeindex);
+            $this->add_to_query_extent($shape->bounds);
+            $result_count++;
+          }
+          $layer->close();
+        }
+      }
+      if($result_count==0) {
+        $this->add_to_query_extent($this->ms_map->extent);
+        //don't need to draw it
+        $this->drawn=true;
+      }
+      $this->ms_map->setExtent(
+        $this->query_extent->minx,
+        $this->query_extent->miny,
+        $this->query_extent->maxx,
+        $this->query_extent->maxy);
+      $INPUT['minx']=$this->query_extent->minx;
+      $INPUT['miny']=$this->query_extent->miny;
+      $INPUT['maxx']=$this->query_extent->maxx;
+      $INPUT['maxy']=$this->query_extent->maxy;
+      LibMisc::TimePoint("TMap::calculate_query_extent() end");
+      if(isset($INPUT['min_scale']) || isset($INPUT['max_scale'])) {
+        $this->ms_map->preparequery();
+        $ms_point=ms_newPointObj();
+        $ms_point->setXY(500,500);
+        if(isset($INPUT['min_scale']) && $this->ms_map->scale<$INPUT['min_scale']) {
+          $this->ms_map->zoomscale($INPUT['min_scale'], $ms_point,
+            1000, 1000,$this->query_extent);
+        } elseif(isset($INPUT['max_scale']) && $this->ms_map->scale>$INPUT['max_scale']) {
+          $this->ms_map->zoomscale($INPUT['max_scale'], $ms_point,
+            1000, 1000,$this->query_extent);
+        }
+        $ms_point->free();
+        //*/
+      }
+    }
+    
+    function add_to_query_extent($new_extent) {
+      if(!isset($this->query_extent)) {
+        $this->query_extent=ms_newRectObj() ;
+        $this->query_extent->setExtent(
+          $new_extent->minx-$this->extent_margin,
+          $new_extent->miny-$this->extent_margin,
+          $new_extent->maxx+$this->extent_margin,
+          $new_extent->maxy+$this->extent_margin);
+      } else {            
+        $this->query_extent->setExtent(
+          min($new_extent->minx-$this->extent_margin,$this->query_extent->minx),
+          min($new_extent->miny-$this->extent_margin,$this->query_extent->miny),
+          max($new_extent->maxx+$this->extent_margin,$this->query_extent->maxx),
+          max($new_extent->maxy+$this->extent_margin,$this->query_extent->maxy));
+      }
+    }
+    
+    
+    function print_attribute_tables() {
+      $this->create_selection_layers();
+      LibMisc::TimePoint("TMap::print_attribute_tables() start");
+      $this->drawn=true;
+      echo '<table class="query-results">'."\n";
+      echo '  <tr class="results-toc">'."\n";
+      echo '    <td colspan="3">'."\n";
+      foreach($this->query_results AS $query_result) {
+        echo '      <a href="#'.
+              $query_result[0]->Attributes->Value('data_source_catalog').'.'.
+              $query_result[0]->Attributes->Value('data_source_schema').'.'.
+              $query_result[0]->Attributes->Value('data_source_name').'">'.
+            $query_result[0]->Attributes->Value('data_source_label').
+          '</a><br>'."\n";
+      }
+      echo "    </td>\n";
+      echo "  </tr>\n";
+      foreach($this->query_results AS $query_result) {
+        if($query_result[0]->IsRaster()
+            || $query_result[0]->IsShape()) {
+          $this->drawn=false;
+        }
+        echo "  <tr>\n";
+        echo "    <td colspan=\"3\">\n";
+        echo '      <a name="'.
+              $query_result[0]->Attributes->Value('data_source_catalog').'.'.
+              $query_result[0]->Attributes->Value('data_source_schema').'.'.
+              $query_result[0]->Attributes->Value('data_source_name').'">'.
+            $query_result[0]->Attributes->Value('data_source_label').
+          '</a>';
+        $num_results=$query_result[1]->get_num_rows($query_result[2]);
+        if($num_results>=0) {
+          echo ' ('.$num_results.')';
+        }
+        echo "\n";
+        echo "    </td>\n";
+        echo "  </tr>\n";
+        echo '<tr><td colspan="3">';
+        if($num_results==0) {
+          add_error(l10n('No result.'));
+        }
+        $row_no = 0;
+        $this->save_query($query_result[0]->Attributes->Value('id_data_source'),
+            $query_result[0]->Attributes->Value('id_profile_data'),
+            $query_result[0]->Attributes->Value('data_source_label'));
+        echo '<table class="attributes-table">'."\n";
+        while($row=$query_result[0]->rec_FetchAssoc($query_result)) {
+          $row_no++;
+          $query_result[1]->hilite($query_result[2]);
+          $query_result[0]->print_row($row, $row_no);
+        }
+        echo '</table>'."\n";
+        echo '</td></tr>';
+        $query_result[0]->FreeResult($query_result);
+      }
+      $this->hilite_features();
+      echo "</table>\n";
+      LibMisc::TimePoint("TMap::print_attribute_tables() end");
+    }
+    
+    function save_query($id_data_source, $id_profile_data, $query_name = NULL) {
+      global $db, $user;
+      if($query_name === NULL) {
+        $query_name = l10n('Latest');
+      }
+      if($user) {
+        $oQueryResults= & LibComponent::Load('query_results');
+        
+        $tmp_name = tempnam(Conf::get('tmp_dir'),'q_');
+        $this->ms_map->savequery($tmp_name);
+        
+        $oAttrFilter1= & new TAttributeFilter('','IS A','t_query_result');
+        $oAttrFilter2= & new TAttributeFilter('id_query_result', '=', $user->Attributes->Value('id_query_result'));
+        $oAttrFilter12= & new TAttributeFilter($oAttrFilter1,'AND',$oAttrFilter2,'TAttributeFilter');
+        
+        if($query_result = $oQueryResults->Items->GetWithAttributeFilterRecursive($oAttrFilter12)) {
+          $query_result->change(
+            Array(
+              'id_data_source'=>$id_data_source,
+              'id_profile_data'=>$id_profile_data,
+              'query_result_name'=>$query_name,
+              'query_result_data'=>base64_encode(file_get_contents($tmp_name))));
+        } else {
+          $query_result= & $oQueryResults->add_child('query_result',
+            Array(
+              'id_data_source'=>$id_data_source,
+              'id_profile_data'=>$id_profile_data,
+              'query_result_name'=>$query_name,
+              'query_result_data'=>base64_encode(file_get_contents($tmp_name))));
+          if($query_result) {
+            $oAttrFilter1= & new TAttributeFilter('','IS A','t_session');
+            $oAttrFilter2= & new TAttributeFilter('session_id', '=', $user->Attributes->Value('session_id'));
+            $oAttrFilter12= & new TAttributeFilter($oAttrFilter1,'AND',$oAttrFilter2,'TAttributeFilter');
+            if($session= $user->Items->GetWithAttributeFilterRecursive($oAttrFilter12)) {
+              $session->change(Array('id_query_result'=>$query_result->Attributes->Value('id_query_result')));
+            }
+          }
+        }
+        unlink($tmp_name);
+      }
+    }
+  }
+?>

Added: packages/musmap/branches/upstream/current/include/map.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/map.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/map.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,239 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Map functions
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+
+  /**
+   * Map functions
+   * @package include
+   */
+  class LibMap {
+  /**
+   * Returns short text with minscale/maxscale
+   *
+   * @param layerObj
+   * @return string
+   */
+   function layer_scales($layer) {
+    if($layer->minscale>0 && $layer->maxscale) {
+      return sprintf(html_l10n('Shown from 1/%d toward 1/%d'),$layer->maxscale,$layer->minscale);
+    } elseif($layer->minscale>0) {
+      return sprintf(html_l10n('Shown toward 1/%d'),$layer->minscale);
+    } elseif($layer->maxscale>0) {
+      return sprintf(html_l10n('Shown from 1/%d'),$layer->maxscale);
+    } else {
+      return html_l10n('Shown always');
+    }
+   }
+   
+  /* private */ function select_button($obj) {
+    if(is_string($obj)) {
+      echo '<input type="checkbox" '.
+          //'id="group-checkbox--1" '.
+          'onclick="javascript:top.selectLayergroup(-1,this);" disabled>';
+    } else {
+     echo '<input type="checkbox" id="layer-'.$obj->index.'-0" '.
+        'name="layers['.$obj->name.']"'.($obj->status!=0 ? ' checked' : '').'>';
+    }
+  }
+  
+  /* private */ function query_select_button($obj) {
+    if($obj==NULL) {
+      $layer_index='';
+    } else {
+      $layer_index='id_profile_data='.$obj->getMetaData('id_profile_data').
+        '&amp;'.'id_data_source='.$obj->getMetaData('id_data_source').
+        '&amp;'.'id_connection='.$obj->getMetaData('id_connection');
+    }
+    echo '<input type="radio" name="layer_select" '.
+        'value="'.$layer_index.'" '.
+          'onclick="javascript:top.selectLayer(\''.$layer_index.'\')">';
+  }
+  
+  /* private */ function eye_button($obj) {
+    if($obj) {
+      $layer_index= $obj->getMetaData('id_profile_data');
+      echo '<img title="'.LibMap::layer_scales($obj).'" alt="(-)" src="images/eye.png" '.
+           'id="eye-'.$layer_index.'"> ',
+           '<input type="hidden" name="scales-'.$layer_index.'" '.
+           'value="'.$obj->minscale.','.$obj->maxscale.'">';
+    } else {
+      echo '<img title="" alt="(-)" src="images/eye.png">';
+    }
+  }
+  
+  /* private */ function collapse_button($type='layer',$deep=0) {
+    echo '<img src="images/moins.gif" onclick="javascript:top.collapse(this,'."'$type',$deep".');" alt="-">';
+  }
+  
+  /* private */ function doc_button($layer) {
+    if(($layer->getMetaData('data_doc'))) {
+      echo '<a href="doc.php?id_data_source='.$layer->getMetaData('id_data_source').
+        '" target="_blank">&gt;</a>';
+    } else {
+      echo '&nbsp;';
+    }
+  }
+  
+  /* private */ function print_row($show_buttons,$TableName,$obj,$has_child,$deep,$layer_obj=NULL) {
+    echo "    <tr>\n";
+    if($show_buttons) {
+      echo "      <td>";
+      if($TableName=='layer' || 
+         $TableName=='group') {
+        LibMap::select_button($obj);
+      } elseif ($TableName=='class' && $layer_obj) {
+        LibMap::select_button($layer_obj);
+      } else {
+        echo "&nbsp;";
+      }
+      echo "</td>\n";
+      echo "      <td>";
+      if($TableName=='layer') {
+        LibMap::eye_button($obj);
+      } elseif($TableName=='class' && $layer_obj) {
+        LibMap::eye_button($layer_obj);
+      } else {
+        echo '&nbsp;';
+      }
+      echo "</td>\n";
+    }
+    for($i=0;$i<$deep;$i++) {
+      echo '      <td class="t">&nbsp;</td>'."\n";
+    }
+    echo '      <td colspan="'.(3-$deep).'">';
+    if($has_child && $show_buttons) {
+      if($TableName=='layer' || $TableName=='group') {
+        LibMap::collapse_button($TableName,$deep);
+      } else {
+        echo 'c';
+      }
+    }
+    echo ' ';
+    switch($TableName) {
+    case 'group':
+      echo $obj;
+      break;
+    case 'layer':
+      echo $obj->getMetaData('profile_data_title');
+      break;
+    case 'class':
+      $layer_legend_image=$obj->createLegendIcon(20,10);
+      $url=$layer_legend_image->saveWebImage();
+      echo '<img width="20" height="10" src="'.$url.'" alt="[]"> ';
+      if(!empty($obj->name)) {
+        echo $obj->name;
+      } elseif ($layer_obj!=NULL) {
+      echo $layer_obj->getMetaData('profile_data_title');
+      }
+      $layer_legend_image->free();
+      break;
+    default:
+      echo '???';
+    }
+    echo '</td>'."\n";
+    if($show_buttons) {
+      echo '      <td>';
+      if($TableName=='layer') {
+        LibMap::doc_button($obj);
+      } elseif($TableName=='class' && $layer_obj) {
+        LibMap::doc_button($layer_obj);
+      } else {
+        echo '&nbsp;';
+      }
+      echo '</td>'."\n";
+      echo '      <td>';
+      if($TableName=='layer') {
+        LibMap::query_select_button($obj);
+      } elseif ($TableName=='class' && $layer_obj) {
+        LibMap::query_select_button($layer_obj);
+      } else {
+        echo "&nbsp;";
+      }
+      echo '</td>'."\n";
+    }
+      echo '    </tr>'."\n";
+  }
+  
+  function print_legend($ms_map,$show_buttons=true) {
+  echo '     <table class="all" style="cursor:default;">'."\n";
+  if($show_buttons) {
+  ?>
+  <tr>
+    <td><?php echo '&nbsp;'; ?></td>
+    <td style="width:12px;"><?php echo '&nbsp;'; ?></td>
+    <td colspan="3">
+      <b><?php echo html_l10n('All layers');?></b></td>
+    <td>&nbsp;</td>
+    <td>&nbsp;<?php //query_select_button(NULL); ?></td>
+  </tr>
+  <?php
+  }
+  $groups=$ms_map->getAllGroupNames();
+  $group_count=sizeof($groups);
+  for($group_index=$group_count-1;$group_index>=0;$group_index--) {
+    $group_name=$groups[$group_index];
+    $layers=$ms_map->getLayersIndexByGroup($group_name);
+    if(!$layers) {
+      $layers=Array();
+    }
+    $layers= array_reverse($layers);
+    $layers_count=count($layers);
+    if($layers_count>1) {
+      LibMap::print_row($show_buttons,'group',$group_name,true,0);
+    }
+    foreach($layers AS $layer_index) {
+      $layer=$ms_map->getLayer($layer_index);
+      if($show_buttons || $layer->status==MS_ON) {
+        if($layer->numclasses==0) {
+          LibMap::print_row($show_buttons,'layer',$layer,false,($layers_count>1)? 1 : 0);
+        } elseif($layer->numclasses==1) {
+          LibMap::print_row($show_buttons,'class',$layer->getClass(0),false,($layers_count>1)? 1 : 0,
+              $layer);
+        } else {
+          LibMap::print_row($show_buttons,'layer',$layer,true,($layers_count>1)? 1 : 0);
+          for($class_no=0;$class_no<$layer->numclasses;$class_no++) {
+            $layer_class=$layer->getClass($class_no);
+            LibMap::print_row($show_buttons,'class',$layer_class,false,($layers_count>1)? 2 : 1);
+          }
+        }
+      }
+    }
+  }
+  echo '     </table>'."\n";
+  }
+}
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/misc.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/misc.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/misc.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,397 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Misc utilities
+   * @package include
+   */
+
+  /**
+   * Misc utilities
+   * @package include
+   */
+  class LibMisc {
+    
+    /**
+     * Remove a key from the array, preserving references
+     * ! this returns nothing but affect the parameter
+     * @param array $aArray array affected
+     * @param string|integer $mKey key to remove
+     */
+    function ArrayRemoveKey(& $aArray, $mKey)
+    {
+      $temp= $aArray;
+      $aArray= Array();
+      foreach($temp AS $k=>$v) {
+        if($k != $mKey) {
+          $aArray[]= & $temp[$k];
+        }
+      }
+      $aArray= & $r;
+    }
+    
+    /**
+     * Remove a key from the array, preserving references and associativity
+     * ! this returns nothing but affect the parameter
+     * @param array $aArray array affected
+     * @param string|integer $mKey key to remove
+     */
+    function ArrayRemoveKeyAssoc(& $aArray, $mKey)
+    {
+      $temp= $aArray;
+      $aArray= Array();
+      foreach($temp AS $k=>$v) {
+        if($k != $mKey) {
+          $aArray[$k]= & $temp[$k];
+        }
+      }
+      $aArray= & $r;
+    }
+    
+    /**
+     * Output a var with hidden html inputs
+     * Used to keep POST or GET data
+     */
+    function ArrayToInputs($arr, $prefix='')
+    {
+      foreach($arr AS $var=>$value) {
+        switch(gettype($value)) {
+          case 'resource':
+          case 'object':
+            break;
+          case 'array':
+            LibMisc::ArrayToInputs($value,
+              !empty($prefix) ? ($prefix.'['.$var.']') : $var);
+            break;
+          case 'string':
+          case 'double':
+          case 'integer':
+          case 'integer':
+          default:
+            echo '<input type="hidden" '.
+              'name="'.(!empty($prefix) ? ($prefix.'['.$var.']') : $var).'" '.
+              'value="'.$value.'">'."\n";
+        }
+      }
+    }
+    
+    /**
+     * Delete temporary files in the Conf::get('image_path') dir
+     * @param bool $output
+     */
+    function DeleteTemporaryFiles($output=false)
+    {
+      if(!file_exists(Conf::get('image_path'))) {
+        return;
+      }
+      if($output) {
+        echo html_l10n('Green: QUEUED.')."<br>\n";
+        echo html_l10n('Blue: PROTECTED.')."<br>\n";
+        echo html_l10n('Red: DELETED.')."<br>\n";
+        echo '<table border="1">'."\n";
+      }
+      $prefix='';
+      $temp_dir=dir(Conf::get('image_path'));
+      while (false !== ($entry = $temp_dir->read())) {
+        $date=filectime(Conf::get('image_path').$entry);
+        if((($entry!='.') && ($entry!='..'))
+          && (
+               (substr($entry,-4)=='.gif')
+            || (substr($entry,-5)=='.jpeg')
+            || (substr($entry,-4)=='.jpg')
+            || (substr($entry,-4)=='.pdf')
+            || (substr($entry,-4)=='.png')
+            || (substr($entry,-4)=='.svg')
+            || (substr($entry,-4)=='.swf')
+            || (substr($entry,-4)=='.wbmp'))
+          && (substr($entry,0,strlen($prefix))==$prefix)) {
+          if($date<(time()-Conf::get('temp_files_expiration'))) {
+            @unlink(Conf::get('image_path').$entry);
+            if($output) 
+              LibMisc::_PrintTemporaryFile($entry,"red",$date);
+          } else {
+            if($output) 
+              LibMisc::_PrintTemporaryFile($entry,"green",$date);
+          }
+        } else {
+            if($output) 
+              LibMisc::_PrintTemporaryFile($entry,"blue",$date);
+        }
+      }
+      if($output) {
+        echo '</table>'."\n";
+      }
+    }
+    
+    /**
+     * Escape string for javascript
+     * Escaping "'","\n","\r"
+     * @param string $str input
+     * @return string
+     */
+    function EscapeJS($str)
+    {
+      return str_replace(Array("'","\r","\n"),Array("\\'",'',''),$str);
+    }
+    
+    /**
+     * Return memory usage
+     * @return string 
+     */
+    function GetMemUsage()
+    {
+      if(function_exists('memory_get_usage')) {
+         return round(memory_get_usage()/1024,2).' ko';
+      } elseif(substr(PHP_OS,0,3)=='WIN') {// Windows workaround
+         $output = Array();
+         exec('tasklist /FI "PID eq '.getmypid().'" /FO LIST', $output);
+         if(!isset($output[5])) {
+          $output[5]='';
+         }
+         return substr($output[5], strpos($output[5], ':') + 1);
+      } else {
+         return '?';
+      }
+    }
+    
+    /**
+     * returns current time in seconds+microseconds/1000
+     * @return float
+     */
+    function GetMicroTime()
+    {
+       list($usec, $sec)= explode(" ",microtime());
+       return ((float)$usec + (float)$sec);
+    }
+    
+    /**
+     * show the temp file name
+     * @private
+     * @param string $file
+     * @param string $color
+     * @param integer $date
+     */
+    /* private */ function _PrintTemporaryFile($file,$color,$date)
+    {
+      echo '<tr style="color:'.$color.';">'.
+        '<td><font color="'.$color.'">'.$file.'</font></td>'.
+        '<td>'.(time()-$date)."</td></tr>\n";
+    }
+    
+    /**
+     * Intelligent var dump
+     * @param mixed $var
+     */
+    function IntelligentVarDump(&$var, $level= 0) {
+      $s= str_repeat('  ', $level);
+      switch(gettype($var)) {
+        case 'object':
+          echo 'object:'.get_class($var).'('.count($var).'){'."\n";
+          foreach($var as $k=>$v) {
+            if(in_array($k,Array('Object','_Parent', '_Parents','Collection')))
+              continue;
+            echo $s.'  '.$k."=>";
+            LibMisc::IntelligentVarDump($v, $level+1);
+          }
+          echo $s.'}'."\n";
+          break;
+          break;
+        case 'array':
+          echo 'array('.count($var).'){'."\n";
+          foreach($var as $k=>$v) {
+            echo $s.'  '.$k."=>";
+            LibMisc::IntelligentVarDump($v, $level+1);
+          }
+          echo $s.'}'."\n";
+          break;
+        default:
+          var_dump($var);
+      }
+    }
+    
+    /**
+     * Merge two arrays recursively
+     * @param array $array1 
+     * @param array $array2
+     * @return array
+     */
+    function MultiMerge($array1, $array2)
+    {
+      if(is_array($array1) && is_array($array2)) {
+        foreach($array2 as $k => $v) {
+          if(isset($array1[$k])) {
+            $array1[$k] = LibMisc::MultiMerge($array1[$k], $v);
+          } else {
+            $array1[$k] = $v;
+          }
+        }
+      } else {
+        $array1 = $array2;
+      }
+      return $array1;
+    }
+    
+    /**
+     * Build a file path from parts
+     * @param string... 
+     * @return string
+     */
+    function PathFromParts() {
+      $aArgs= func_get_args();
+      $r= '';
+      foreach($aArgs AS $sArg) {
+	if($sArg)
+	  $r.= DIRECTORY_SEPARATOR.$sArg;
+      }
+      return substr($r,1);
+    }
+    
+    /**
+     * Build a random password using common characters
+     *
+     */
+    function RandomPassword($iMinLength=6, $iMaxLength=8) {
+      $sCommonChars= 'abcdefghijklmnopqrstuvwxyz'.
+                     'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
+                     '1234567890'.
+                     '_';
+      $iCharsCount= strlen($sCommonChars);
+      $r= '';
+      $iLength= mt_rand($iMinLength, $iMaxLength);
+      for($i=0;$i<$iLength;$i++) {
+        $r.= $sCommonChars{mt_rand(0, $iCharsCount-1)};
+      }
+      return $r;
+    }
+    
+    /**
+     * Display a relative date
+     * @param integer $time_stamp 
+     * @param integer $t base time
+     * @return string
+     */
+    function RelativeDate($iTimeStamp, $iRefTimeStamp = NULL)
+    {
+      if($iRefTimeStamp === NULL) {
+        $iRefTimeStamp = time();
+      }
+      $gmt= true;
+      if(isset($_COOKIE['TIME_ZONE'])) {
+        $iRefTimeStamp-= $_COOKIE['TIME_ZONE']*60;
+        $iTimeStamp-= $_COOKIE['TIME_ZONE']*60;
+        $gmt= false;
+      }
+      //Y-n-j H:i:s
+      $sRefTime= gmdate('Y-n-j H:i:s', $iRefTimeStamp);
+      $sTime= gmdate('Y-n-j H:i:s', $iTimeStamp);
+      if(gmdate('Y-n-j H:i:s', $iRefTimeStamp)== gmdate('Y-n-j H:i:s', $iTimeStamp)) {
+        //same second
+        return l10n('Now');
+      } elseif(($iTimeStamp<$iRefTimeStamp) && ($iTimeStamp+120>$iRefTimeStamp)) {
+        //less than 120 sec before
+        return sprintf(l10n('%s %s ago'),$iRefTimeStamp-$iTimeStamp, l10n('seconds'));
+      } elseif(($iTimeStamp>$iRefTimeStamp) && ($iTimeStamp-120<$iRefTimeStamp)) {
+        //less than 120 sec after
+        return sprintf(l10n('in %s %s'),$iTimeStamp-$iRefTimeStamp, l10n('seconds'));
+      } elseif(($iTimeStamp<$iRefTimeStamp) && ($iTimeStamp+120*60>$iRefTimeStamp)) {
+        //less than 120 minutes before
+        return sprintf(l10n('%s %s ago'),(integer) (($iRefTimeStamp-$iTimeStamp) / 60), l10n('minutes'));
+      } elseif(($iTimeStamp>$iRefTimeStamp) && ($iTimeStamp-120*60<$iRefTimeStamp)) {
+        //less than 120 minutes after
+        return sprintf(l10n('in %s %s'),(integer) (($iTimeStamp-$iRefTimeStamp) / 60), l10n('minutes'));
+      } elseif(gmdate('Y-n-j', $iTimeStamp)==gmdate('Y-n-j', $iRefTimeStamp)) {
+        //same day
+        return gmdate(l10n('_time'), $iTimeStamp).($gmt ? ' GMT' : '');
+      } elseif(gmdate('Y-n-j', $iTimeStamp)==gmdate('Y-n-j', $iRefTimeStamp-3600*24)) {
+        //day before
+        return l10n('Yesterday').' '.gmdate(l10n('_time'), $iTimeStamp).($gmt ? ' GMT' : '');
+      } elseif(gmdate('Y-n-j', $iTimeStamp)==gmdate('Y-n-j', $iRefTimeStamp+3600*24)) {
+        //day after
+        return l10n('Tomorrow').' '.gmdate(l10n('_time'), $iTimeStamp).($gmt ? ' GMT' : '');
+      } else {
+        //other day
+        return gmdate(l10n('_date'), $iTimeStamp).($gmt ? ' GMT' : '');
+      }
+    }
+    
+    /**
+     * Get an array from the string
+     * the string is like in a ini file:<br>
+     * key1 = value1<br>
+     * key2= "this is another value"
+     * "key 3"   =   "third value"
+     * @param string $s
+     * @return array
+     */
+    function StringToArray($s) {
+      preg_match_all('/^\s*("?)(\S+?)\\1\s*=\s*("?)(.*?)\\3\s*$/m', $s,
+        $aMatches, PREG_SET_ORDER);
+      $r = Array();
+      foreach($aMatches AS $aMatch) {
+        $aMatch[$aMatch[2]]=$aMatch[4];
+      }
+      return $r;
+    }
+    
+    /**
+     * Add a time point
+     */
+    function TimePoint($what) {
+      $GLOBALS['times'][]=Array($what, LibMisc::GetMicroTime());
+      //echo "$what<br>";
+    }
+
+    /**
+     * PHP variable to javascript variable.
+     * doesn't supports object and resource
+     * @param mixed $mVar
+     * @return string
+     */
+    function ToJSVar($mVar) {
+      switch(gettype($mVar)) {
+        case 'boolean': return $mVar ? 'true' : 'false';
+        case 'integer': return $mVar;
+        case 'double': return $mVar;
+        case 'string': return '"'.LibMisc::EscapeJS($mVar).'"';
+        case 'array':
+          $r= '{';
+          foreach($mVar AS $k=>$v) {
+            $r.= LibMisc::ToJSVar($k).':'.LibMisc::ToJSVar($v).',';
+          }
+          $r= substr($r,0,-1).'}';
+          return $r;
+        case 'object':
+          return 'new object()';
+        case 'resource':
+          return 'new resource()';
+        case 'NULL': return 'NULL';
+      }
+    }
+  }
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/class.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/class.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/class.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,129 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Classes 'classe",annotation et style
+ *
+ * Données profil, Couches, ...
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+ 
+  require_once('visual.inc.php');
+  require_once('symbol.class.php');
+  require_once('label.class.php');
+  require_once('style.class.php');
+  
+  //USER -> PROFILES -> PROFILE_DATA @ LAYER -> CLASS
+  class t_class extends t_component {
+    var $ChildObjectTypes=Array('style','label');
+    var $main_infos = Array('class_expression'=>Array(),
+        'class_index'=>Array());
+    /**
+     * Internal mapserver class object
+     *
+     * @var ms_class_obj
+     */
+    var $ms_class;
+    
+    var $OrderBy='class_index';
+    
+    function BuildMe() {
+      global $map;
+      $parent_node = & $this->GetParent();
+      if(!$parent_node || !$parent_node->ms_layer) {
+        return false;
+      }
+      if(!is_resource($parent_node->ms_layer->_map_handle_)) {
+        echo add_error('Pb'.$this->Attributes->Value('class_name'));
+        return false;
+      }
+      $this->ms_class=  ms_newClassObj($parent_node->ms_layer);
+      $this->ms_class->set('name',$this->Attributes->Value('class_name'));
+      $this->ms_class->set('title',$this->Attributes->Value('class_name'));
+      $this->ms_class->setexpression($this->Attributes->Value('class_expression'));
+      if($parent_node->IsShape()) {
+        $this->ms_class->set("template", 'accept_selection');
+      }
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_class':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_profile_data':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles_data');
+          $r->Attributes->set('codefield', 'id_profile_data');
+          $r->Attributes->set('labelfield', 'profile_data_title');
+          $r->Attributes->set('orderby', Array('profile_data_title'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'class_name':
+          $r->Type= 'text';
+          break;
+        case 'class_expression':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          $r->Attributes->set('maxlength', 1024);
+          break;
+        case 'class_index':
+          $r->Type= 'index';
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('class_name');
+    }
+    
+    function PrintObject() {
+      if(!$this->ms_class) {
+        $this->BuildMe();
+      }
+      $class_img= $this->ms_class->createLegendIcon(25,12);
+      echo '<img src="'.$class_img->saveWebImage().'" border="0" alt="">';
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/component.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/component.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/component.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,982 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Classe composant
+ *
+ * Définit le comportement des objets des profils
+ * Voir les descendances de cette classe
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+  
+  /**
+   * Parent class
+   */
+  require_once('dbrecordexplorer.class.php');
+  
+  /**
+   * Users
+   */
+  require_once('user.inc.php');
+  
+  /**
+   * Component functions
+   */
+  require_once('component.inc.php');
+  
+  /**
+   * Component class
+   *
+   * Introduce node methods and general binding
+   * to database
+   *
+   * Caution! Lot of methods are override in descendants
+  * classes
+   * @package include
+   */
+  class t_component extends TDbRecordExplorer {
+    var $main_infos= Array();
+    /**
+     * Display form to browse the component
+     *
+     * This is a magic method which implements
+     * everything needed by explorers
+     * 
+     * $INPUT['go'] tells where whe are in
+     * the tree. 
+     *
+     * Then: {@link t_component::explore()}
+     * is called in the target
+     * 
+     * Then: Changes are made (change, delete, clone, ...)
+     *
+     * Then: inputs and buttons are displayed
+     * 
+     * @param t_component $oRedirectFrom root of the tree (used to build the tree)
+     * @return void
+     */
+    function Explore($oRedirectFrom = NULL) {
+      global $INPUT, $db, $map, $user, $fw;
+      // ====================
+      // Redirect to selected node
+      if(!$oRedirectFrom && isset($INPUT['go'])) {
+        $sTableName = key($INPUT['go']);
+        if($sTableName !== NULL) {
+          $sId = key($INPUT['go'][$sTableName]);
+          if($sId !== NULL) {
+            $sIdValue = key($INPUT['go'][$sTableName][$sId]);
+            if($sIdValue !== NULL) {
+              $oNode= & $this->GetSubItemByClassNameAndAttribute($sTableName,$sId,$sIdValue);
+              if($oNode) {
+                $oNode->Explore($this);
+                return;
+              }
+            }
+          }
+        }
+      }
+      if(!isset($_GET['explore'])) $_GET['explore']='';
+      echo '<hr class="hidden">';  
+      //Get the parent node just once (reference)
+      $oParentNode = & $this->GetParent();
+      //prefix is in every html inputs : 'profile_data[...]'
+      $sPrefix= $this->ClassName();
+      // ====================
+      //Execute actions (add child, change, delete, ...)
+      if($this->_ExplorerActions($oRedirectFrom)) {
+        return;
+      }
+      // ====================
+      // Path to where we are
+      echo '<p>'."\n";
+        echo is_object($oParentNode) ? $oParentNode->NodePath().'/' : "/";
+        echo ' '.htmlentities(ucfirst(translate($this->ClassName())));
+        if(($ShortInfo=$this->ShortInfo())!=='') {
+          echo ' "'.$ShortInfo.'"';
+        }
+        echo ' : '."\n";
+        $this->PrintObject();
+      echo '</p>'."\n";
+      // ====================
+      // Current node
+      echo '<div id="explorer-core">'."\n";
+      echo '<div id="explorer-infos">'."\n";
+      echo '<form method="POST" name="explorer" onsubmit="explorerSubmit();" '."\n".
+        '  action="'.htmlentities($_SERVER['PHP_SELF']).'?explore='.$_GET['explore'].
+          (isset($_GET['id_profile']) ? '&amp;id_profile='.((integer) $_GET['id_profile']) : '').'">'."\n";
+      $this->PrintId();
+      $bInTable = false;
+      //for each info
+      $this->Attributes->Reset();
+      while($oAttribute= & $this->Attributes->Each()) {
+        $oType= & $this->GetFieldType($oAttribute->Name);
+        $oType->Prefix= $sPrefix.'[';
+        $oType->Suffix= ']';
+        
+        //Infos to ignore (passwords or calculated values)
+        if($oType->Attributes->ValueWithDefault('ignore', false)===true) {
+          continue;
+        }
+        //infos to hide (<input type=hidden ...), usualy id
+        if($oType->Attributes->ValueWithDefault('visible', true)===false) {
+          echo '  <input type="hidden" name="'.$sPrefix.'['.$oAttribute->Name.']" '.
+            'value="'.$oAttribute->Value.'">'."\n";
+        } else {
+          if(!$bInTable) {
+            echo '<table style="margin-left:15px;">'."\n";
+            $bInTable = true;
+          }
+          
+          echo '  <tr><td title="'.$oAttribute->Name.'">';
+          if($oParentNode 
+              && ($oParentNode->Id()==$oAttribute->Name)
+              && ($oParentNode->IdVAlue()==$oAttribute->Value)) {
+            echo sprintf(nl2br(html_l10n("Parent \n(%s)")),translate($oAttribute->Name));
+          } else {
+            echo ucfirst(translate($oAttribute->Name));
+          }
+          echo '</td>'."\n";
+          echo '<td>';
+          $fw->ContextualHelpButton('model', $this->ClassName(), $oAttribute->Name);
+          echo '</td>'."\n";
+          
+          echo '    <td>';
+          echo $oType->HTML();
+          echo '</td></tr>'."\n";
+        }
+      } //while($oAttribute= & $this->Attributes->Each()) {
+
+      if($bInTable) {
+        echo '</table>'."\n";
+      }
+      //buttons
+      if(!$this->IsVirtual) {
+        echo '<p>'."\n";
+        if($this->CanWrite()) {
+          echo '  <input type="submit" name="update" '.
+            'value="'.html_l10n('Change').'">&nbsp;'."\n";
+        } else {
+          echo '  <input type="button" name="update" '.
+            'value="'.html_l10n('Change').'" disabled>&nbsp;'."\n";
+        }
+        if($this->CanDelete()) {
+          echo '  <input type="submit" name="delete'.
+              '['.$this->ClassName().']'.
+              '['.$this->id().']'.
+              '['.$this->IdValue().']" '.
+            'value="'.html_l10n('Delete').'" '.
+            'onclick="return(confirm(l10n('.
+              '\'Are you sure you want to delete this object?\')));">&nbsp;'."\n";
+        } else {
+          echo '  <input type="button" name="delete" '.
+            'value="'.html_l10n('Delete').'" disabled>&nbsp;'."\n";
+        }
+        if($this->CanDuplicate()) {
+          echo '  <input type="submit" name="clone'.
+              '['.$this->ClassName().']'.
+              '['.$this->id().']'.
+              '['.$this->IdValue().']" '.
+            'value="'.html_l10n('Duplicate').'" '.
+            'onclick="return(confirm(l10n('.
+              '\'Are you sure you want to duplicate this object?\')));">&nbsp;'."\n";
+        } else {
+          echo '  <input type="button" name="clone" '.
+            'value="'.html_l10n('Duplicate').'" disabled>&nbsp;'."\n";
+        }
+      }
+      // Special controls
+      $this->PrintSpecialButtons();
+      if(!$this->IsVirtual) {
+        //Privileges control
+        if($this->HasPrivilegeInfos) {
+          if($this->IsOwner($user)) {
+          echo '  <input type="button" name="privileges" '.
+            'value="'.html_l10n('Privileges...').'" '.
+            'onclick="return(changePrivileges('.
+              "'".$this->ClassName()."',".
+              "'".$this->id()."',".
+              "'".$this->IdValue()."',".
+              "'".($_GET['explore'] ? $_GET['explore'] : '')."'".
+            '));">&nbsp;'."\n";
+          } else {
+            echo '  <input type="button" name="privileges" '.
+              'value="'.html_l10n('Privileges...').'" '.
+              'disabled>&nbsp;'."\n";
+          }
+        }
+        echo '</p>'."\n";
+      }
+      echo '</form>'."\n";
+      //Map file
+      if(isset($INPUT['view_mapfile']) 
+          && $this->ClassName() == 'profile') {
+        echo '<h4>'.html_l10n('Map file').':</h4>'."\n";
+        echo '<pre class="map-file">';
+        $tmp_name =
+          tempnam(Conf::get('tmp_dir'),'m_');
+        $map->save($tmp_name);
+        readfile($tmp_name);
+        unlink($tmp_name);
+        echo '</pre>'."\n";
+        echo '  </td>'."\n";
+        echo '</tr>'."\n";
+        echo '</table>'."\n";
+        return;//doesn't show child nodes
+      }
+      // ====================
+      // Child nodes
+      echo '<form method="POST" name="explorer-child-nodes" '."\n".
+        '  action="'.htmlentities($_SERVER['PHP_SELF']).'?explore='.$_GET['explore'].'">'."\n";
+      $this->PrintId();
+      echo '<h4>'.html_l10n('Children').': ';
+      if($this->CanWrite() && $this->Items->HasItems()) {
+        echo '<input type="submit" name="update_child_nodes" '.
+          'value="'.html_l10n('Change').'">';
+        echo '<input type="submit" name="delete_sel_child_nodes" '.
+          'value="'.html_l10n('Delete selected').'" '.
+          'onclick="return(confirm('.
+            'l10n(\'Are you sure you want to delete the selected objects ?\')));">';
+      } else {
+        echo '<input type="submit" name="update_child_nodes" '.
+          'value="'.html_l10n('Change').'" disabled>';
+        echo '<input type="button" name="delete_sel_child_nodes" '.
+          'value="'.html_l10n('Delete selected').'" disabled>';
+      }
+      
+      echo '</h4>'."\n";
+      $this->PrintChildLinks();
+      echo "<br>\n";
+      $CanWrite=$this->CanWrite();
+      echo '</form>'."\n";
+      echo '<form method="POST" name="explorer-add-child-node" '."\n".
+        '  action="'.htmlentities($_SERVER['PHP_SELF']).'?explore='.$_GET['explore'].'">'."\n";
+      $this->PrintId();
+      foreach($this->ChildObjectTypes AS $child_nodes_type) {
+        echo '<input type="submit" '.
+          'name="add['.$child_nodes_type.'][submit]" '.
+          'value="'.sprintf(
+            html_l10n('Add %s'),
+            htmlentities(translate('a_'.$child_nodes_type))).'"'.
+          ($CanWrite ? '' : ' disabled').
+          '>'."\n";
+        if($CanWrite && ($child_nodes_type=='profile_data')) {
+          $this->print_html_select('data_sources', 'id_data_source',
+            $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote(''))), -1,
+            'add_params[profile_data][id_data_source]', NULL);
+        } elseif ($CanWrite && ($child_nodes_type=='profile_column')) {
+          $this->print_html_select('data_columns','id_data_column',
+            'column_long_label', NULL,
+            'add_params[profile_column][id_data_column]', NULL,
+            "id_data_source=".$db->Quote(
+              $this->Attributes->Value('id_data_source'), 'integer'));
+        } elseif ($CanWrite && ($child_nodes_type=='profile_extent') 
+            && ($this->ClassName()=='profile')) {
+          $this->print_html_select('extents','id_extent','extent_name',
+            NULL,'add_params[profile_extent][id_extent]',
+            NULL,NULL);
+        } elseif ($CanWrite && ($child_nodes_type=='map_reference')) {
+          $this->print_html_select('extents','id_extent','extent_name',
+            NULL,'add_params[map_reference][id_extent]',
+            NULL,NULL);
+        } elseif ($CanWrite && ($child_nodes_type=='query_result')) {
+          $this->print_html_select('data_sources', 'id_data_source',
+            $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote(''))), -1,
+            'add_params[query_result][id_data_source]', NULL);
+        } 
+        echo "<br>\n";
+      }
+      echo '</form>'."\n";
+      echo '</div>'."\n";
+      
+      // tree
+      echo '<div id="explorer-tree">'."\n";
+      echo '<br>';
+      echo '<hr class="hidden">';
+      if(is_object($oRedirectFrom)) {
+        $oRedirectFrom->PrintTree();
+      } else {
+        $this->PrintTree();
+      }
+      echo '</div>'."\n";
+      echo '</div>'."\n";
+    }
+    
+    /**
+     * Apply user submission
+     *
+     * @return bool true=>Exit, false=>Don't exit
+     */
+    function _ExplorerActions($oRedirectFrom) {
+      global $INPUT, $db;
+      //Get the parent node just once (reference)
+      $oParentNode = & $this->GetParent();
+      //add a child node if requested
+      if(!empty($INPUT['add'])) {
+        if(!isset($INPUT['add_params']) || !isset($INPUT['add_params'][key($INPUT['add'])])) {
+          $add_child_params= Array();
+        } else {
+          $add_child_params= $INPUT['add_params'][key($INPUT['add'])];
+        }
+        $oChildNode = & $this->add_child(key($INPUT['add']),$add_child_params);
+        if(is_object($oChildNode)) {
+          unset($INPUT['add']);
+          $oChildNode->Explore($oRedirectFrom);
+          return true;
+        }
+      }
+      //delete this node if requested
+      if(!empty($INPUT['delete'])) {
+        if($this->Delete() && $oParentNode) {
+          $oParentNode->Touch();
+          unset($INPUT['delete']);
+          $oParentNode->Explore($oRedirectFrom);
+          return true;
+        }
+      }
+      //clone this node if requested
+      if(!empty($INPUT['clone'])) {
+        if($oParentNode) {
+          $db->StartTransaction();
+          $oNewNode= & $this->CloneNode($oParentNode);
+          if($oNewNode) {
+            $db->Commit();
+            unset($INPUT['clone']);
+            $oNewNode->Explore($oRedirectFrom);
+            return true;
+          } else {
+            Warning(l10n('Database error: rolling back.'));
+            $db->Rollback();
+            Warning(sprintf(
+              l10n('Unable to clone %s: %s.'),
+              ucfirst(translate($this->ClassName())),
+              $this->Id().':'.$this->IdValue()));
+          }
+        } else {
+          Warning(sprintf(
+            l10n('Parent node not found for %s: %s.'),
+            ucfirst(translate($this->ClassName())),
+            $this->Id().':'.$this->IdValue()));
+        }
+      }
+      //change this node if requested
+      if(!empty($INPUT['update']) && isset($INPUT[$this->ClassName()])) {
+        $this->Change($INPUT[$this->ClassName()]);
+      }
+      //change child nodes if requested
+      if(!empty($INPUT['update_child_nodes'])) {
+        echo '<form method="POST" name="explorer-actions" '."\n".
+          '  action="'.htmlentities($_SERVER['PHP_SELF']).'?explore='.$_GET['explore'].'">'."\n";
+        if(!empty($INPUT['child_node']) && is_array($INPUT['child_node'])) {
+	  foreach($INPUT['child_node'] AS $sChildObjectType=>$aChildObjectType) {
+            foreach($aChildObjectType AS $sId=>$aChildInfos) {
+              foreach($aChildInfos AS $sIdValue=>$aUpdateParams) {
+                $oItem= & $this->GetItemByClassNameAndAttribute(
+                    $sChildObjectType, $sId, $sIdValue);
+                if($oItem) {
+                  $oItem->Change($aUpdateParams);
+                }
+              }
+            }
+          }
+          $this->PrintId();
+          echo '</form>'."\n";
+        }
+      }
+      //delete child nodes if requested
+      if(!empty($INPUT['delete_sel_child_nodes'])) {
+        if(is_array($INPUT['child_node'])) {
+          foreach($INPUT['child_node'] AS $child_node_type=>$child_nodes_by_type) {
+            foreach($child_nodes_by_type AS $sId=>$child_node_infos) {
+              foreach($child_node_infos AS $sIdValue=>$update_params) {
+                if(isset($update_params['_sel'])
+                    &&  ($update_params['_sel']=='on')) {
+                  $oNode= & $this->GetItemByClassNameAndAttribute(
+                    $child_node_type,$sId,$sIdValue);
+                  if($oNode) {
+                    $oNode->Delete();
+                  } else {
+                    Warning(sprintf(l10n('%s not found: "%s".'),
+                        ucfirst(translate($child_node_type)),
+                        "$sId:$sIdValue"));
+                  }
+                }
+              }
+            }
+          }
+          return false;
+        }
+      }
+      return false;
+    }
+    
+    /**
+     * Make a table with links to child nodes
+     *
+     * Call
+     * {@link t_component::PrintLink()}
+     * 
+     * @return void
+     */
+    function PrintChildLinks()
+    {
+      $sPrevClassName = '';
+      $oItemsEnum= & $this->Items->NewEnum();
+      $oItemsEnum->Reset();
+      $child_node_no= 0;
+      while($oItem= & $oItemsEnum->Each()) {
+        if($oItem->State & MUSMAP_STATE_DELETED) {
+          continue;
+        }
+        $child_node_no++;
+        if($sPrevClassName != $oItem->ClassName()) {
+          if($sPrevClassName != '') {
+            echo '</table>'."\n";
+          }
+          echo '<table class="child-nodes">'."\n";
+          echo '  <tr>';
+          echo '<th>'.'</th>';
+          echo '<th class="child-nodes-class-header">'.
+            '<input type="checkbox" '.
+            'onclick="selectChildNodesOfClass(\''.$oItem->ClassName().'\', this);">'.
+              htmlentities(ucfirst(translate($oItem->ClassName()))).
+            '</th>';
+          foreach($oItem->main_infos AS $main_info => $params) {
+            echo '<th>';
+            echo htmlentities(ucfirst(translate($main_info)));
+            echo '</th>';
+          }
+          echo '</tr>'."\n";
+        }
+        echo '  <tr>'.
+          '<td>'.$child_node_no.'</td>'.
+          '<td class="child-link">';
+        echo '<input type="checkbox" '.
+          'name="child_node['.$oItem->ClassName().']'.
+              '['.$oItem->Id().']'.
+              '['.$oItem->IdValue().'][_sel]"'.
+          '>';
+        $oItem->PrintLink();
+        echo '</td>';
+        $col = 2;
+        foreach($oItem->main_infos AS $main_info => $params) {
+          $col++;
+          $oType= & $oItem->GetFieldType($main_info);
+          $oType->Attributes->Set('compact', true);
+          $oType->Attributes->Set('column', $col);
+          $oType->Prefix= 
+            'child_node['.$oItem->ClassName().']'.
+            '['.$oItem->Id().']'.
+            '['.$oItem->IdValue().'][';
+          $oType->Suffix= ']';
+          echo '<td nowrap>';
+          echo $oType->HTML();
+          echo '</td>';
+        }
+        echo '</tr>'."\n";
+        $sPrevClassName = $oItem->ClassName();
+      }
+      unset($oItemsEnum);
+      if($sPrevClassName != '') {
+        echo '</table>'."\n";
+      }
+      if(!$child_node_no) {
+        echo '<p>'.l10n('No children')."</p>\n";
+      }
+    }
+  
+    
+    
+    
+    /**
+     * Modifie les attributs
+     *
+     * Modification directement dans la base.
+     *
+     * La page sera ensuite rechargée pour
+     * tenir compte des modifications
+     * see {@link t_component::change_privileges}
+     * to change privileges
+     * 
+     * @param array $params string=>string an array of the changing values
+     * @return void
+     */
+    function Change($params, $bVerbose= true) {
+      global $db;
+      if($this->CanWrite()) {
+        if($bVerbose) {
+          printf(
+              html_l10n('Changing %s (%s)'),
+              $this->ShortInfo(),
+              translate($this->ClassName()));
+          echo "<br>\n";
+        }
+        $update_q='';
+        foreach($params AS $param_k=>$param_v) {
+          if(    (       $param_k     !='id_'.$this->ClassName())
+	      && (       $param_k{0}  !='_') //Calculated fields
+              && (       $param_k     !='user_name')
+              && (       $param_k     !='user_password')
+              && (substr($param_k,-9) !='_owner_id')
+              && (substr($param_k,-9) !='_group_id')
+              && (substr($param_k,-18)!='_modification_time')
+              && (substr($param_k,-11)!='_privileges')) {
+            $oType= $this->GetFieldType($param_k);
+            if(!$oType->Virtual) {
+              if(in_array($oType->Type, Array('float', 'integer'))) {
+                $update_q.=$db->QuoteIdentifier($param_k).
+                  "=".$db->Quote($param_v, $oType->Type).", ";
+              } else {
+                $update_q.=$db->QuoteIdentifier($param_k).
+                  "=".$db->Quote($param_v).", ";
+              }
+            }
+            unset($oType);
+            $this->Attributes->Set($param_k, $param_v);
+          }
+        }
+        if(!empty($update_q)) {
+          $db->StartTransaction();
+          $update_q="UPDATE ".$db->QuoteIdentifier($this->TableName()).
+            " SET ".substr($update_q,0,-2).
+            " WHERE ".
+            $db->QuoteIdentifier($this->id()).
+              "=".$db->Quote($this->IdValue())." ";
+          $update_r= $db->Query($update_q);
+          if(!$update_r) {
+            Warning(sprintf(l10n('Unable to change %s (%s)'),
+              $this->ShortInfo(),
+              translate($this->ClassName())));
+          } else {
+            $db->Commit();
+          }
+        }
+        $this->Touch();
+      } else {
+        Information(
+          sprintf(
+            l10n("You can't change %s (%s)."),
+              $this->ShortInfo(),
+              translate($this->ClassName())));
+      }
+    }
+    
+    /**
+     * Delete me and my chil nodes
+     * @return void
+     */
+    function Delete() {
+      if($this->CanDelete()) {
+        return $this->DeleteChildren()
+          && $this->DeleteMe();
+      } else {
+        Warning(
+          sprintf(
+            l10n("You can't delete %s (%s)."),
+              $this->ShortInfo(),
+              translate($this->ClassName())));
+        return false;
+      }
+    }
+    
+    /**
+     * Delete my chil nodes
+     * 
+     * @return void
+     */
+    function DeleteChildren() {
+      $iNbDeletedItems= 0;
+      $oItemsEnum= & $this->Items->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        if($oItem->CanDelete()) {
+          if(! $oItem->Delete()) {
+            return false;
+          }
+        } else {
+          $iNbDeletedItems++;
+	}
+      }
+      unset($oItemsEnum);
+      if($iNbDeletedItems) {
+        Warning(
+          sprintf(
+            l10n("You can't delete children of %s (%s)."),
+              $this->ShortInfo(),
+              translate($this->ClassName())));
+									    
+        return false;
+      } else {
+        return true;
+      }
+    }
+    
+    /**
+     * Delete me
+     *
+     * @return void
+     */
+    function DeleteMe() {
+      global $db;
+      if($this->IsVirtual) {
+        return;
+      }
+      printf(html_l10n('Deleting %s (%s)'),
+          $this->ShortInfo(), translate($this->ClassName()));
+      echo "<br>\n";
+      $db->query('DELETE FROM '.$db->QuoteIdentifier($this->TableName()).' '.
+        'WHERE '.
+          $db->QuoteIdentifier($this->Id())."=".$db->Quote($this->IdValue()));
+      $this->State|= MUSMAP_STATE_DELETED;
+      return true;
+    }
+    
+    /**
+     * Add a child
+     * 
+     * @param string $child_type one of profile, profile_data, ...
+     * @param string[] $params values
+     */
+    function & add_child($child_type,$params=Array()) {
+      global $db, $user;
+      if($this->CanWrite()) {
+        $child_type='t_'.$child_type;
+        $child = & new $child_type(NULL);
+        if($child->HasPrivilegeInfos) {
+          if(!isset($params[$child->FieldPrefix().'_owner_id'])
+              && isset($user)) {
+            $params[$child->FieldPrefix().'_owner_id'] = $user->Attributes->Value('id_user');
+          }
+          if(!isset($params[$child->FieldPrefix().'_reader_group_id']))
+            $params[$child->FieldPrefix().'_reader_group_id']= $this->ReaderGroupId();
+          if(!isset($params[$child->FieldPrefix().'_writer_group_id']))
+            $params[$child->FieldPrefix().'_writer_group_id']= $this->WriterGroupId();
+        }
+        if(!$this->IsVirtual) {
+          $params[$this->id()] = $this->IdValue();
+        }
+        $query_columns='';
+        $query_values='';
+        foreach($params AS $column=>$value) {
+          $query_columns.=$db->QuoteIdentifier($column).", ";
+          $query_values.= $db->Quote($value).", ";
+        }
+        $db->StartTransaction();
+        $insert_q=$db->query(
+          "INSERT INTO ".$db->QuoteIdentifier($child->TableName())." ".
+          "(".substr($query_columns,0,-2).") \n".
+          "VALUES ".
+          "(".substr($query_values ,0,-2).") ");
+        if(!$insert_q) {
+          $errorInfo= $db->errorInfo();
+          if(($errorInfo !== NULL) && ($errorInfo[0] == '23000')) {
+            add_error(l10n('Duplicate entry. Rolling back.'));
+          } else {
+            add_error(l10n('Database error: rolling back.'));
+          }
+          $db->Rollback();
+          return false;
+        }
+        $last_id=$db->get_last_insert_row_id($insert_q,$child->TableName(),
+            $child->Id());
+        if($last_id) {
+          $qChildNodes=$db->Query(
+            'SELECT * '.
+            'FROM '.$db->QuoteIdentifier($child->TableName())." \n".
+            ('WHERE '.$db->QuoteIdentifier($child->Id()).'='.$db->Quote($last_id).' '));
+          $params= $db->FetchAssoc($qChildNodes);
+          $db->FreeResult($qChildNodes);
+          unset($qChildNodes);
+        } else {
+          //$params= $params;
+        }
+        $db->Commit();
+        $child->Attributes->SetTo($params);
+        $this->Items->Append($child);
+        $child->Touch();
+        printf(
+            html_l10n('Adding "%s" (%s).'),
+            $child->ShortInfo(),
+            translate($child->ClassName()));
+        echo "<br>\n";
+        return $child;
+      } else {
+        Information(
+            sprintf(
+                l10n("You can't change %s (%s)."),
+                    $this->ShortInfo(),
+                    translate($this->ClassName())));
+        return false;
+      }
+    }
+    
+    /**
+     * Clone me (and my child nodes)
+     * 
+     * @param t_component $new_parent_id
+     * @return bool 
+     */
+    function & CloneNode(& $oDestinationParentNode) {
+      global $db, $user;
+      $F= false;
+      $oParentNode = & $this->GetParent();
+      if($oDestinationParentNode && $oDestinationParentNode->CanWrite()) {
+        printf(
+            html_l10n('Duplicating %s (%s)'),
+            $this->ShortInfo(),
+            translate($this->ClassName()));
+        echo "<br>\n";
+        $update_q='';
+        $update_q_v='';
+        $this->Attributes->Reset();
+        while($oAttribute= & $this->Attributes->Each()) {
+          $param_k=$oAttribute->Name;
+          $param_v=$oAttribute->Value;
+          if(!$this->AttributeExists($param_k)) {
+            continue;
+          }
+          if(substr($param_k,-9)=='_owner_id') {
+            $param_v = $user->Attributes->Value('id_user');
+          }
+          if(    substr($param_k,0,3)!='id_' 
+              || ($param_k=='id_symbol' && $this->ClassName()!='symbol')
+              || ($param_k=='id_data_source' && $this->ClassName()=='profile_data')
+              || ($param_k=='id_extent' && $this->ClassName()=='profile_extent')
+              || ($param_k=='id_map_reference' && $this->ClassName()=='profile')
+          ) {
+            if($param_k=='profile_name' || $param_k=='user_name' 
+                || $param_k=='column_code'|| $param_k=='symbol_name') {
+              $param_v=$param_v.' #'.(time() % 1000);
+            }
+            if($param_k=='profile_is_public') {
+              $param_v=0;
+            }
+            $update_q   .= $db->QuoteIdentifier($param_k).', ';
+            $update_q_v .=  $db->Quote($param_v).', ';
+          }
+        }
+        if(!$oDestinationParentNode->IsVirtual 
+            && ($oDestinationParentNode->ClassName()!='user')) {
+          $update_q  .=$db->QuoteIdentifier($oDestinationParentNode->Id()).', ';
+          $update_q_v.=$db->Quote($oDestinationParentNode->IdValue()).", ";
+        }
+        $update_q='INSERT INTO '.$db->QuoteIdentifier($this->TableName()).' '.
+          '('.substr($update_q,0,-2).") \n".
+          "VALUES (".substr($update_q_v,0,-2).')';
+        $update_r= $db->Query($update_q);
+        if(!$update_r) {
+          return $F;
+        }
+        $new_id=$db->get_last_insert_row_id($update_r,
+          $this->TableName(),$this->Id());
+        
+        $qChildNodes= $db->Query(
+          'SELECT * '.
+          'FROM '.$db->QuoteIdentifier($this->TableName())." \n".
+          ('WHERE '.$db->QuoteIdentifier($this->Id()).'='.$db->Quote($new_id).' '));
+        $aCloneRecord= $db->FetchAssoc($qChildNodes);
+        $db->FreeResult($qChildNodes);
+        unset($qChildNodes);
+        $sChildType= 't_'.$this->ClassName();
+        $oClone = & new $sChildType($aCloneRecord);
+        $oDestinationParentNode->Items->Append($oClone);
+        
+        $oItemsEnum= & $this->Items->NewEnum();
+        $oItemsEnum->Reset();
+        while($oItem=$oItemsEnum->Each()) {
+          $oClonedChild= & $oItem->CloneNode($oClone);
+          if(!$oClonedChild) {
+            return $F;
+          }
+          $oClonedChild= NULL;
+        }
+        unset($oItemsEnum);
+        return $oClone;
+      } else {
+        Information(
+            sprintf(
+                l10n("You can't change %s (%s)."),
+                    $oParentNode->ShortInfo(),
+                    translate($oParentNode->ClassName())));
+      }
+    }
+    
+    /**
+     * Parent profile
+     * 
+     * @deprecated  the rights management is more complex
+     * now {@link t_component::privilege_parent}
+     */
+    function & Profile() {
+      $oParent = & $this->GetParent();
+      if($oParent) {
+        $oProfile= & $oParent->Profile();
+        return $oProfile;
+      } else {
+        $NIL= NULL;
+        return $NIL;
+      }
+    }
+    
+    
+    
+    /**
+     * Change my privileges
+     * 
+     * @param integer|NULL $owner_id NULL to keep old value (0=no owner)
+     * @param integer|NULL $reader_group_id NULL to keep old value (0=no group)
+     * @param integer|NULL $writer_group_id NULL to keep old value (0=no group)
+     * @return bool
+     */
+    function change_privileges(
+        $owner_id = NULL,
+        $reader_group_id = NULL,
+        $writer_group_id = NULL)
+    {
+      global $db, $user;
+      if($this->IsOwner($user)) {
+        $update_q = '';
+        if($owner_id!==NULL) {
+          $update_q .= $db->QuoteIdentifier($this->FieldPrefix().'_owner_id').
+            '='.$db->Quote($owner_id).', ';
+          $this->Attributes->Set($this->FieldPrefix().'_owner_id', $owner_id);
+        }
+        if($reader_group_id!==NULL) {
+          $update_q .= $db->QuoteIdentifier($this->FieldPrefix().'_reader_group_id').
+            '='.$db->Quote($reader_group_id).', ';
+          $this->Attributes->Set($this->FieldPrefix().'_reader_group_id',$reader_group_id);
+        }
+        if($writer_group_id!==NULL) {
+          $update_q .= $db->QuoteIdentifier($this->FieldPrefix().'_writer_group_id').
+            '='.$db->Quote($writer_group_id).', ';
+          $this->Attributes->Set($this->FieldPrefix().'_writer_group_id',$writer_group_id);
+        }
+        if(!empty($update_q)) {
+          $r=$db->query('UPDATE '.$db->QuoteIdentifier($this->TableName()).' '.
+            'SET '.substr($update_q, 0, -2));
+          add_error(l10n('Changing privileges ...'));
+          $this->Touch();
+          return (bool) $r;
+        }
+        return true;
+      } else {
+        add_error(
+            sprintf(
+              l10n("You can't change %s (%s)."),
+                  $this->ShortInfo(),
+                  translate($this->ClassName()))."\n".
+            l10n('Only the owner can change privileges.'));
+        return false;
+      }
+    }
+    
+    /**
+     * Touch (update modification time)
+     * 
+     * @return void
+     */
+    function Touch() {
+      global $db;
+      if($this->IsVirtual) {
+        return;
+      }
+      if($this->HasPrivilegeInfos) {
+        $db->StartTransaction();
+        $db->query('UPDATE '.$db->QuoteIdentifier($this->TableName()).' '.
+            'SET '.
+              $db->QuoteIdentifier($this->FieldPrefix().'_modification_time').
+              '='.time().' '.
+            'WHERE '.$db->QuoteIdentifier($this->Id()).'='.
+              $db->Quote($this->IdValue(),'int'));
+        $db->commit();
+      } else {
+        $oParentNode = & $this->GetParent();
+        if($oParentNode) {
+          $oParentNode->Touch();
+        }
+      }
+    }
+    
+    
+    /**
+     * Print an HTML list
+     * 
+     * @param string $table_name
+     * @param string $id
+     * @param string $field_to_show
+     * @param string $id_selected
+     * @param string $input_name
+     * @param string $order_by
+     * @param string $where
+     * @param bool $has_none
+     * @param string $select_attributes attributes of the html select
+     * @return void
+     */
+    function print_html_select($table_name,$id,$field_to_show,
+        $id_selected=NULL, $input_name=NULL,$order_by='',
+        $where=NULL,$has_none=false,$select_attributes='') {
+      global $db;
+      if($input_name===NULL) {
+        $input_name='add_params['.substr($id,3).']['.$id.']';
+      }
+      if($order_by === NULL) {
+        $order_by = $field_to_show;
+      }
+      $ds_r=$db->query("SELECT ".
+          $db->QuoteIdentifier($id)." AS id, ".
+          $field_to_show." AS label \n".
+        "FROM ".$db->QuoteIdentifier($table_name)." \n".
+        (empty($where)? '': ('WHERE '.$where." \n")).
+        (!empty($order_by) ? "ORDER BY $order_by" : ""));
+      echo '  <select name="'.$input_name.'" '.$select_attributes.'>'."\n";
+      if($has_none) {
+        echo '    <option value="0" style="font-style:italic;">'.
+          html_l10n('None').'</option>'."\n";
+        echo '    <option value="" disabled>-</option>'."\n";
+      }
+      while($ds=$db->FetchAssoc($ds_r)) {
+        echo '    <option value="'.$ds['id'].'" '.
+          (($id_selected==$ds['id']) ? ' selected' : '').'>'.
+            $ds['label'].'</option>'."\n";
+      }
+      echo '  </select>'."\n";
+      $db->FreeResult($ds_r);
+    }
+    
+  }
+  ?>

Added: packages/musmap/branches/upstream/current/include/model/component.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/component.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/component.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,152 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Component functions
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+  /**
+   * Objects bootstraps
+   * @global array $g_aModelRoots
+   */
+  global $g_aModelRoots;
+  $g_aModelRoots= Array(
+      'connections'=>NULL,
+      'extents'=>NULL,
+      'groups'=>NULL,
+      'map_references'=>NULL,
+      'profiles'=>NULL,
+      'projections'=>NULL,
+      'query_forms'=>NULL,
+      'query_results'=>NULL,
+      'symbols'=>NULL,
+      'users'=>NULL
+    );
+  
+  /**
+   * Component functions
+   * @package include
+   */
+  class LibComponent {
+    /**
+     * Load the specified tree acording to user rights.
+     * Family is loaded only once
+     * 
+     * @param string $sWhat family see {@link $g_aModelRoots}
+     *                      for the list of families
+     * @return t_list|NULL the requested family
+     */
+    function & Load($sWhat, $mExtraParam= '*') {
+      if(array_key_exists($sWhat, $GLOBALS['g_aModelRoots'])) {
+        if($GLOBALS['g_aModelRoots'][$sWhat]===NULL) {
+          $sWhatClass= 't_'.$sWhat.'_list';
+          if($sWhat=='profiles') {
+            $GLOBALS['g_aModelRoots'][$sWhat]= & new $sWhatClass($mExtraParam);
+          } else {
+            $GLOBALS['g_aModelRoots'][$sWhat]= & new $sWhatClass();
+          }
+        }
+        return $GLOBALS['g_aModelRoots'][$sWhat];
+      } else {
+        add_error(sprintf(l10n('Requesting for an unexisting root: "%s".'),
+          $sWhat));
+        return NULL;
+      }
+    }
+    
+    /**
+     * Plural of the {@link TDbRecordBinding::ClassName()}
+     * (used by {@link TDbRecordBinding::TableName()})
+     *
+     * @param string $sClassName class name
+     * @return string table name
+     */
+    function Plural($sClassName) {
+      switch($sClassName) {
+        case 'class':
+          return 'classes';
+        case 'profile_column':
+          return 'profiles_columns';
+        case 'profile_data':
+          return 'profiles_data';
+        default:
+          return $sClassName.'s';
+      }
+    }
+    
+    /**
+     * Reload the document, submiting the form
+     *
+     * @see profiles_explorer.php
+     * @return void
+     */
+    function ReloadDocument() {
+      if(!(Conf::get('debug_level') & E_MUSMAP_DEBUG)) {
+        echo '<script type="text/javascript" language="JavaScript">'."\n";
+        echo '  <!--'."\n";
+        echo '  top.reload=true;'."\n";
+        echo '  //-->'."\n";
+        echo '</script>'."\n";
+      }
+      echo '<p>';
+      printf(
+        html_l10n('Click %s  if this page is not automaticaly reloaded.'),
+        sprintf('<input type="submit" value="%s">',html_l10n('here')));
+      echo '</p>'."\n";
+    }
+    
+    /**
+     * Singular of the {@link TDbRecordBinding::TableName()}
+     * (see {@link LibComponent::Plural()})
+     *
+     * @param string $sClassName class name
+     * @return string table name
+     */
+    function Singular($text) {
+      switch($text) {
+        case 'classes':
+          return 'class';
+        case 'profiles_columns':
+          return 'profile_column';
+        case 'profiles_data':
+          return 'profile_data';
+        default:
+          if(substr($text,-1)=='s') {
+            return substr($text,0,-1);
+          } else {
+            return $text;
+          }
+      }
+    }
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/connection.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/connection.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/connection.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,146 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: connections
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  /**
+   */
+  require_once('data_source.class.php');
+  
+  class t_connection extends t_component {
+    var $ChildObjectTypes=Array('data_source');
+    var $Engines= Array();
+    var $HasPrivilegeInfos=true;
+    var $OrderBy='connection_name';
+    
+    
+    function & add_child($child_type,$params=Array())
+    {
+      global $db;
+      if(($child_type=='data_source') && empty($params['data_source_label']))
+      {
+        $params['data_source_label'] = l10n('Untitled data source');
+      }
+      return parent::add_child($child_type, $params);
+    }
+    
+    function & GetDb($iCapabilities)
+    {
+      foreach($this->Engines as $iEngineCapabilities=>$oEngineDb) {
+        if(($iEngineCapabilities & $iCapabilities) == $iCapabilities) {
+          return $this->Engines[$iEngineCapabilities];
+        }
+      }
+      $sEngineClassName= GetDbEngine($this->Attributes->Value('connection_driver'),$iCapabilities);
+      if($sEngineClassName) {
+        $oEngine= & new $sEngineClassName();
+        $this->Engines[GetCapabilities($sEngineClassName,
+          $this->Attributes->Value('connection_driver'))]= & $oEngine;
+        preg_match_all('/^\s*("?)(\S+?)\\1\s*=\s*("?)(.*?)\\3\s*$/m',
+          $this->Attributes->Value('connection_params'),
+          $params_matches, PREG_SET_ORDER);
+        $params = Array(
+          'connection_driver'=>$this->Attributes->Value('connection_driver'));
+        foreach($params_matches AS $param) {
+          $params[$param[2]]=$param[4];
+        }
+        $this->Engines[GetCapabilities($sEngineClassName,
+          $this->Attributes->Value('connection_driver'))]->Connect($params);
+        unset($oEngine);
+        return $this->Engines[GetCapabilities($sEngineClassName,
+          $this->Attributes->Value('connection_driver'))];
+      } else {
+        return false;
+      }
+    }
+    
+
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_connection':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'connection_name':
+          $r->Type= 'text';
+          break;
+        case 'connection_driver':
+          global $g_oDbEngines;
+          $r->Type= 'fromarray';
+          $drivers= Array();
+          foreach($g_oDbEngines AS $db_engine=>$db_class) {
+            $drivers[$db_engine]=$db_engine;
+          }
+          $r->Attributes->set('showas', 'list');
+          $r->Attributes->set('array', $drivers);
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'connection_params':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    
+    /**
+     * Print special button (change password,
+     * view mapfile, wizards, ...)
+     */
+    function PrintSpecialButtons() {
+      echo '  <input type="button" '.
+        'value="'.html_l10n('Get data sources').'" '.
+        'onclick="return(getTablesWizard());">&nbsp;'."\n";
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('connection_name');
+    }
+  }
+  
+  class t_connections_list extends t_list {
+    var $ChildObjectTypes=Array('connection');
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/data_column.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/data_column.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/data_column.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,325 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Data column
+   * @package include
+   * @subpackage model
+   */
+  class t_data_column extends t_component {
+    var $ChildObjectTypes=Array('relation');
+    var $OrderBy='column_index';
+    
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      global $db;
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_data_column':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_data_source':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'data_sources');
+          $r->Attributes->set('codefield', 'id_data_source');
+          $r->Attributes->set('labelfield', $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote(''))));
+          $r->Attributes->set('orderby', Array('data_source_catalog'=>'','data_source_schema'=>'','data_source_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'column_code':
+        case 'column_short_label':
+        case 'column_long_label':
+          $r->Type= 'text';
+          break;
+        case 'column_visible':
+          $r->Type= 'bool';
+          break;
+        case 'column_index':
+          $r->Type= 'index';
+          break;
+        case 'column_is_decodification':
+          $r->Type= 'bool';
+          break;
+        case 'column_type':
+          $r->Type= 'fromarray';
+          $r->Attributes->set('array', Array(
+            'N'=>html_l10n('Number'),
+            'C'=>html_l10n('String'),
+            'F'=>html_l10n('Float'),
+            'L'=>html_l10n('Link'),
+            'I'=>html_l10n('Image'),
+            'M'=>html_l10n('Memo')));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'column_expression':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    
+    function ShortInfo()
+    {
+      return $this->Attributes->Value('column_code').
+        ' ('.$this->Attributes->Value('column_short_label').')';
+    }
+    
+    function expression($expr,$row)
+    {
+      $expr=preg_replace("/(\[)(.*?)(:\S*?)?(\])/",
+                   "cast(\$row['\\2']['value'],substr('\\3',1))",
+                   $expr);
+      $tk=token_get_all('<?php $ret='.$expr.'; ?>');
+      $expr='';
+      foreach($tk AS $token) {
+        if (is_string($token)) {
+         $expr.=$token;
+        } else {
+          list($id, $text) = $token;
+          if($id==T_STRING) {
+            $expr.='sql__'.$text;
+          } else {
+            $expr.=$text;
+          }
+        }
+      }
+      eval(substr($expr,6,-2));
+      return $ret;
+      //*/
+      return preg_replace("/(\[)(.*?)(:\S*?)?(\])/e",
+                   "cast(\$row['\\2']['value'],substr('\\3',1))",
+                   $expr);
+    }
+    
+    /**
+     *
+     * @todo profile column
+     */
+    function complete_row($data_code,$row,$deep=0)
+    {
+      $oConnections= & LibComponent::Load('connections');
+      $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_code']=
+        $this->Attributes->Value('column_code');
+      if(!$this->Attributes->IsEmpty('column_expression')) {
+        $row[$data_code.'.'.$this->Attributes->Value('column_code')]['value']=
+          $this->expression($this->Attributes->Value('column_expression'),$row);
+      }
+      $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_short_label']=
+        $this->Attributes->Value('column_short_label');
+      if($deep==0) {
+        $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_visible']=
+          $this->Attributes->Value('column_visible');
+      } else {
+        $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_visible']=
+          $this->Attributes->Value('column_is_decodification');
+      }
+      $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_index']=
+        $this->Attributes->Value('column_index');
+      $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_is_decodification']=
+        $this->Attributes->Value('column_is_decodification');
+      $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_type']=
+        $this->Attributes->Value('column_type');
+      //profile column
+      if($deep==0) {
+        /*
+        $prof_dc=LibComponent::get_component_by_attribute('profile_column','id_data_column',
+          $this->Attributes->Value('id_data_column'));
+        //*/
+        $prof_dc= NULL;
+        if($prof_dc) {
+          $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_visible']=
+            $prof_dc->Attributes->Value('profile_column_visible');
+          $row[$data_code.'.'.$this->Attributes->Value('column_code')]['column_index']=
+            $prof_dc->Attributes->Value('profile_column_index');
+        }
+      }
+      $oItemsEnum= & $this->Items->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        //destination data column
+        $dest_dc=$oItem->destination_data_column();
+        if(!$dest_dc) {
+          continue;
+        }
+        //destination data source
+        $oDestDataSource= $dest_dc->GetParent();
+        if(!$oDestDataSource) {
+          continue;
+        }
+        $row[$oDestDataSource->Attributes->Value('data_source_catalog').'.'.
+            $oDestDataSource->Attributes->Value('data_source_schema').'.'.
+            $oDestDataSource->Attributes->Value('data_source_name')]=Array(
+              'destination_id_data_source'=>$oDestDataSource->Attributes->Value('id_data_source'),
+              'destination_data_source_catalog'=>$oDestDataSource->Attributes->Value('data_source_catalog'),
+              'destination_data_source_schema'=>$oDestDataSource->Attributes->Value('data_source_schema'),
+              'destination_data_source_name'=>$oDestDataSource->Attributes->Value('data_source_name'),
+              'destination_data_source_label'=>$oDestDataSource->Attributes->Value('data_source_label'),
+              'destination_id_data_column' =>$dest_dc->Attributes->Value('id_data_column'),
+              'destination_column_code'    =>$dest_dc->Attributes->Value('column_code'),
+              'destination_column_type'    =>$dest_dc->Attributes->Value('column_type'),
+              'destination_value'          =>cast($row[$data_code.'.'.$this->Attributes->Value('column_code')]['value'],$dest_dc->Attributes->Value('column_type')),
+              'relation_label_fk_pk'       =>$oItem->Attributes->Value('relation_label_fk_pk'),
+              );
+        $dest_res= $oDestDataSource->select(Array(Array($dest_dc->Attributes->Value('column_code'),'=',
+          $row[$data_code.'.'.$this->Attributes->Value('column_code')]['value'],
+            $dest_dc->Attributes->Value('column_type'))));
+        if($dest_res) {
+          if($rel_row=$oDestDataSource->rec_FetchAssoc($dest_res,$deep+1)) {
+           $row=array_merge($rel_row,$row);
+          }
+        } else {
+          add_error(sprintf(l10n('Unable to join column "%s" to "%s".'),
+            $data_code.'.'.$this->Attributes->Value('column_code'),
+            $oDestDataSource->Attributes->Value('data_source_catalog').'.'.
+            $oDestDataSource->Attributes->Value('data_source_schema').'.'.
+            $oDestDataSource->Attributes->Value('data_source_name').'.'.
+            $dest_dc->Attributes->Value('column_code')));
+        }
+      }
+      unset($oItemsEnum);
+      if($deep==0) {
+        $relation= $oConnections->GetSubItemByClassNameAndAttribute('relation','dat_id_data_column',
+            $this->Attributes->Value('id_data_column'));
+        if($relation){
+        //foreach($relations AS $relation) {
+          $origin_dc=$relation->GetParent();
+          $oOriginDataSource= $origin_dc->GetParent();
+        $row[$oOriginDataSource->Attributes->Value('data_source_catalog').'.'.
+            $oOriginDataSource->Attributes->Value('data_source_schema').'.'.
+            $oOriginDataSource->Attributes->Value('data_source_name')]=Array(
+                'origin_id_data_source'=>$oOriginDataSource->Attributes->Value('id_data_source'),
+                'origin_data_source_catalog'=>$oOriginDataSource->Attributes->Value('data_source_catalog'),
+                'origin_data_source_schema'=>$oOriginDataSource->Attributes->Value('data_source_schema'),
+                'origin_data_source_name'=>$oOriginDataSource->Attributes->Value('data_source_name'),
+                'origin_data_source_label'=>$oOriginDataSource->Attributes->Value('data_source_label'),
+                'origin_column_code'    =>$origin_dc->Attributes->Value('column_code'),
+                'origin_column_type'    =>$origin_dc->Attributes->Value('column_type'),
+                'value'                 =>cast($row[$data_code.'.'.$this->Attributes->Value('column_code')]['value'],$origin_dc->Attributes->Value('column_type')),
+                'relation_label_pk_fk'  =>$relation->Attributes->Value('relation_label_pk_fk'),
+                );
+        }
+      }
+      return $row;
+    }
+  }
+
+  /**
+   * Relation between data_columns
+   * @package include
+   */
+  class t_relation extends t_component {
+    var $destination_data_column= -1;
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      global $db;
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_relation':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_data_column':
+        case 'dat_id_data_column':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', Array('data_columns LEFT JOIN data_sources '.
+            'ON data_columns.id_data_source=data_sources.id_data_source'));
+          $r->Attributes->set('codefield', 'id_data_column');
+          $r->Attributes->set('labelfield', $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote('')),$db->Quote('.'),
+              'column_code',$db->Quote(' '),
+              'column_short_label'));
+          $r->Attributes->set('orderby', Array('data_source_catalog'=>'','data_source_schema'=>'','data_source_name'=>'','column_index'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'relation_label_fk_pk':
+        case 'relation_label_pk_fk':
+          $r->Type= 'text';
+          break;
+        case 'relation_min_cardinality_fk_pk':
+        case 'relation_min_cardinality_pk_fk':
+          $r->Type= 'fromarray';
+          $r->Attributes->set('array', Array(
+            '-1'=>('?'),
+            '0'=>('0'),
+            '1'=>('1')));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'relation_max_cardinality_pk_fk':
+          $r->Type= 'fromarray';
+          $r->Attributes->set('array', Array(
+            '-1'=>('?'),
+            '0'=>('0'),
+            '1'=>('1'),
+            '2'=>('n')));
+          $r->Attributes->set('nullable', false);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo()
+    {
+      return $this->Attributes->Value('relation_label_fk_pk');
+    }
+    
+    function & destination_data_column()
+    {
+      $oConnections= & LibComponent::Load('connections');
+      if($this->destination_data_column===-1) {
+        $this->destination_data_column=
+          & $oConnections->GetSubItemByClassNameAndAttribute('data_column','id_data_column',
+            $this->Attributes->Value('dat_id_data_column'));
+      }
+      return $this->destination_data_column;
+    }
+
+  }
+
+
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/data_source.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/data_source.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/data_source.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,319 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Binding to table data_sources
+   *
+   * @author Mathieu Parent
+   * @copyright 2004-06, Mathieu PARENT
+   * @package include
+   * @subpackage model
+   * @since 2004-06
+   */
+  
+  
+  /**
+   */
+  require_once('data_column.class.php');
+  
+  /**
+   * data_sources
+   * @package include
+   */
+  class t_data_source extends t_component {
+    var $ChildObjectTypes=Array('data_column');
+    var $OrderBy='data_source_catalog, data_source_schema, data_source_name';
+    var $HasPrivilegeInfos=true;
+    //
+    var $db;
+    var $queries=Array();
+    var $data_code;
+    
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_data_source':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_connection':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'connections');
+          $r->Attributes->set('codefield', 'id_connection');
+          $r->Attributes->set('labelfield', 'connection_name');
+          $r->Attributes->set('orderby', Array('connection_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'id_projection':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'projections');
+          $r->Attributes->set('codefield', 'id_projection');
+          $r->Attributes->set('labelfield', 'projection_name');
+          $r->Attributes->set('orderby', Array('projection_name'=>''));
+          $r->Attributes->set('nullable', true);
+          break;
+        case 'data_source_catalog':
+        case 'data_source_schema':
+          $r->Type= 'text';
+          $r->Attributes->set('nullable', true);
+          break;
+        case 'data_source_name':
+        case 'data_source_label':
+          $r->Type= 'text';
+          break;
+        case 'data_source_params':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          break;
+        case 'data_source_type':
+          $r->Type= 'fromarray';
+          $r->Attributes->set('array', Array(
+            //Alpha
+            'T'=>html_l10n('Alpha').'&gt;'.html_l10n('Table'),
+            'D'=>html_l10n('Alpha').'&gt;'.html_l10n('Domain table'),
+            'B'=>html_l10n('Alpha').'&gt;'.html_l10n('Relations table'),
+            //Raster
+            'R'=>html_l10n('Raster').'&gt;'.html_l10n('Raster'),
+            'I'=>html_l10n('Raster').'&gt;'.html_l10n('Tile (Raster)'),
+            //Shape
+            'S'=>html_l10n('Shape').'&gt;'.html_l10n('Polygon'),
+            'P'=>html_l10n('Shape').'&gt;'.html_l10n('Point'),
+            'L'=>html_l10n('Shape').'&gt;'.html_l10n('Line'),
+            'A'=>html_l10n('Shape').'&gt;'.html_l10n('Label')));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'data_source_doc':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          break;
+        default:
+          unset($r);
+          $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function IsAlpha()
+    {
+      return in_array($this->Attributes->Value('data_source_type'),Array('T','D','B'));
+    }
+    
+    function IsRaster()
+    {
+      return in_array($this->Attributes->Value('data_source_type'),Array('R','I'));
+    }
+    
+    function IsShape()
+    {
+      return in_array($this->Attributes->Value('data_source_type'),Array('S','P','L','A'));
+    }
+    
+    function ShortInfo()
+    {
+      $data_source_code= !$this->Attributes->IsEmpty('data_source_catalog') ? 
+        $this->Attributes->Value('data_source_catalog').'.': '';
+      $data_source_code= !$this->Attributes->IsEmpty('data_source_schema') ? 
+        $data_source_code.$this->Attributes->Value('data_source_schema').'.': '';
+      return $this->Attributes->Value('data_source_label').' ('.
+             $data_source_code.$this->Attributes->Value('data_source_name').')';
+    }
+    
+    
+    
+    /**
+     * Execute a select query and return the result
+     *
+     * @param string $data_source_name
+     * @param string[][] $where_array Array(Array($field,$operator,$value,$type='string'),...)
+     *                   where $operator is one of '=','<>','<','<=','>=','>','LIKE'
+     * @param string[] $order_by_array array of fields
+     * @param string[] $fields array of fields
+     * @return mixed
+     */
+    function Select($where_array=Array(),$order_by_array=Array(),$fields=Array('*'))
+    {
+      $oParentNode = & $this->GetParent();
+      if($oParentNode) {
+        $oDb= & $oParentNode->GetDb(DB_SUPPORTS_SELECT);
+        if($oDb) {
+          return Array(
+            & $this,
+            & $oDb,
+            $oDb->Select(
+              $this->Attributes->Value('data_source_catalog'),
+              $this->Attributes->Value('data_source_schema'),
+              $this->Attributes->Value('data_source_name'),
+              $this->Attributes->Value('data_source_params'),
+              $where_array, $order_by_array, $fields));
+        } else {
+          add_error(l10n('No connection.'));
+          return false;
+        }
+      } else {
+        add_error(sprintf(l10n('%s not found.'),
+            ucfirst(translate('connection'))));
+        return false;
+      }
+    }
+    
+    
+    function rec_FetchAssoc($res,$deep=0)
+    {
+      $this->data_code= $this->Attributes->Value('data_source_catalog').'.'.
+            $this->Attributes->Value('data_source_schema').'.'.
+            $this->Attributes->Value('data_source_name');
+      $row= $res[1]->FetchAssoc($res[2]);
+      if(!$row) {
+        return $row;
+      }
+      foreach($row AS $item=>$value) {
+        $complete_row[$this->data_code.'.'.$item]= Array('value'=>$value,
+          'column_code'=>$item);
+      }
+      $oItemsEnum= & $this->Items->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        if($oItem->Attributes->IsEmpty('column_expression')) {
+          $complete_row= $oItem->complete_row(
+              $this->data_code, $complete_row,$deep);
+        }
+      }
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        if(!$oItem->Attributes->IsEmpty('column_expression')) {
+          $complete_row= $oItem->complete_row(
+              $this->data_code, $complete_row);
+        }
+      }
+      unset($oItemsEnum);
+      return $complete_row;
+    }
+    
+    function print_row($row,$row_no)
+    {
+      if($row_no == 1) {
+        echo '<tr class="columns-headers">'."\n";
+        foreach($row AS $code=>$item) {
+          if(isset($item['column_visible']) && !$item['column_visible']) {
+            continue;
+          }
+          echo '<th class="column-header" title="'.$code.'">';
+          if (isset($item['relation_label_fk_pk'])) {//relation + destination data source
+            echo $item['relation_label_fk_pk'];
+          } elseif (isset($item['relation_label_pk_fk'])) {//relation + origin data source
+            echo $item['relation_label_pk_fk'];
+          } elseif (!empty($item['column_short_label'])) {//column
+            echo '<a '.
+              'href="javascript:void(0);" '.
+              'onclick="orderBy('.$this->Attributes->Value('id_data_source').','.
+                '\''.$item['column_code'].'\')">';
+            echo $item['column_short_label'];
+            echo '</a>';
+          } else {
+            echo '<a '.
+              'href="javascript:void(0);" '.
+              'onclick="orderBy('.$this->Attributes->Value('id_data_source').','.
+                '\''.$item['column_code'].'\')">';
+            echo $item['column_code'];
+            echo '</a>';
+          }
+          echo '</th>'."\n";
+        }
+        echo '</tr>'."\n";
+      }
+      echo '<tr>';
+      foreach($row AS $code=>$item) {
+        if(isset($item['column_visible']) && !$item['column_visible']) {
+          continue;
+        }
+        if (isset($item['relation_label_fk_pk'])) {//relation + destination data source
+          echo '<td>';
+          echo '<a href="javascript:queryByAttributes(\''.$item['destination_id_data_source'].'\','.
+              '\''.$item['destination_column_code'].'\','.
+              '\''.$item['destination_value'].'\','.
+              '\''.$item['destination_column_type'].'\');" '.
+              'title="'.$item['destination_data_source_catalog'].'.'.$item['destination_data_source_schema'].'.'.
+                $item['destination_data_source_name'].'.'.
+                $item['destination_column_code'].'='.$item['destination_value'].'">';
+          echo $item['destination_data_source_label'].' &gt;&gt;';
+          echo '</a>';
+          echo '</td>';
+        } elseif (isset($item['relation_label_pk_fk'])) {//relation + origin data source
+          echo '<td>';
+          echo '<a href="javascript:queryByAttributes('.$item['origin_id_data_source'].','.
+              '\''.$item['origin_column_code'].'\','.
+              '\''.$item['value'].'\','.
+              '\''.$item['origin_column_type'].'\');" '.
+              'title="'.$item['origin_data_source_catalog'].'.'.$item['origin_data_source_schema'].'.'.
+                $item['origin_data_source_name'].'.'.
+                $item['origin_column_code'].'='.$item['value'].'">';
+          echo $item['origin_data_source_label'].' &gt;&gt;';
+          echo '</a>';
+          echo '</td>';
+        } else {//if (isset($item['column_short_label'])) {//column
+          echo '<td>';
+          if(!isset($item['value']) || ($item['value']=='')) {
+            echo '<i>'.l10n('[Empty]').'</i>';
+          } elseif($item['value']===NULL) {
+            echo '<i title="'.$item['value'].'">'.l10n('[NULL]').'</i>';
+          } else {
+            if(!isset($item['column_type'])) {
+              $item['column_type']='C';
+            }
+            if($item['column_type']=='L') {
+              echo '<a href="'.
+                cast($item['value'],$item['column_type']).'" target="_blank">';
+              echo cast($item['value'],$item['column_type']);
+              echo '</a>';
+            } elseif($item['column_type']=='I') {
+              echo '<img src="'.cast($item['value'],$item['column_type']).'" ';
+              echo 'alt="'.cast($item['value'],$item['column_type']).'"';
+              echo '>';
+            } else {
+              echo cast($item['value'],$item['column_type']);
+            }
+          }
+          echo '</td>';
+        }
+      }
+        echo '</tr>'."\n";
+    }
+    
+    function FreeResult($res)
+    {
+      $res[1]->FreeResult($res[2]);
+    }
+  }
+
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/dbrecordbinding.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/dbrecordbinding.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/dbrecordbinding.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,509 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Database binding class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2005-03
+ */
+  
+  define('MUSMAP_STATE_LOADING', 1);
+  define('MUSMAP_STATE_CREATED', 2);
+  define('MUSMAP_STATE_CHANGED', 4);
+  define('MUSMAP_STATE_DELETED', 8);
+  
+  /**
+   * Database binding
+   * @package include
+   * @subpackage model
+   */
+  class TDbRecordBinding extends TCollection {
+    /**
+     * Child object types
+     * @var string[]
+     */
+    var $ChildObjectTypes=Array();
+    
+    /**
+     * Foreign Tables
+     * @var TAttributes
+     */
+    var $ForeignTables;
+    
+    /**
+     * Has privilege info ?
+     * @var bool
+     */
+    var $HasPrivilegeInfos= false;
+    
+    /**
+     * Is it virtual ? (means, no table)
+     * @var bool
+     */
+    var $IsVirtual= false;
+    
+    /**
+     * Linked Tables
+     * @var TAttributes
+     */
+    var $LinkedTables;
+    
+    /**
+     * Fields name on which sorting is performed
+     * @var string[]
+     */
+    var $OrderBy= Array();
+    
+    /**
+     * Current state
+     * Set of MUSMAP_STATE_*
+     * @var integer
+     */
+    var $State= MUSMAP_STATE_LOADING;
+    
+    /**
+     * Constructor
+     */
+    function TDbRecordBinding($aAttributes= NULL) {
+      parent::TCollection();
+      $this->ForeignTables= & new TAttributes($this, 'ForeignTables');
+      $this->LinkedTables= & new TAttributes($this, 'LinkedTables');
+      if($aAttributes=== NULL) {
+        return;
+      }
+      $this->Attributes->SetTo($aAttributes);
+      $this->LoadMe();
+      foreach($this->ChildObjectTypes AS $sChildObjectType) {
+        $this->LoadChildRecordsOfType($sChildObjectType);
+      }
+      $this->State &= !MUSMAP_STATE_LOADING;
+    }
+    
+    /**
+     * Unset all properties
+     *
+     * @return void
+     */
+    function Destruct() {
+      unset($this->ChildObjectTypes);
+      $this->ForeignTables->Destruct();
+      unset($this->ForeignTables);
+      unset($this->HasPrivilegeInfos);
+      unset($this->IsVirtual);
+      $this->LinkedTables->Destruct();
+      unset($this->LinkedTables);
+      unset($this->OrderBy);
+      parent::Destruct();
+    }
+    
+    /**
+     * Does attributes exists
+     * @param string $sName attribute name
+     * @return bool
+     */
+    function AttributeExists($sName) {
+      $oType= $this->GetFieldType($sName);
+      return $oType && !$oType->Virtual;
+    }
+    
+    /**
+     * Build the node 
+     *
+     * Create MapScript object corresponding with
+     * the node
+     *
+     * @return void
+     */
+    function BuildMe() {
+    }
+    
+    /**
+     * Build = BuildMe + build_children
+     *
+     * @return void
+     */
+    function Build() {
+      $this->BuildMe();
+      $this->BuildChildRecords();
+    }
+    
+    /**
+     * Build child  nodes
+     *
+     * Tell every children to be built
+     *
+     * @return void
+     */
+    function BuildChildRecords() {
+      $oItemsEnum= & $this->Items->NewEnum();
+      $oItemsEnum->Reset();
+      while($oItem= & $oItemsEnum->Each()) {
+        $oItem->Build();
+      }
+      unset($oItemsEnum);
+    }
+    
+    /**
+     * Can the user create this object ?
+     * @param t_user $oUser
+     * @return bool
+     */
+    function CanCreate($oUser= NULL) {
+      if($oUser===NULL)
+        $oUser= & $GLOBALS['user'];
+      if($oParent= & $this->GetParent()) {
+        return $oParent->CanWrite($oUser);
+      } else {
+        return false;
+      }
+    }
+    
+    /**
+     * Can the user delete this object ?
+     * @param t_user $oUser
+     * @return bool
+     */
+    function CanDelete($oUser= NULL) {
+      if($oUser===NULL)
+        $oUser= & $GLOBALS['user'];
+      return $this->CanWrite($oUser);
+    }
+    
+    /**
+     * Can the user duplicate this object ?
+     * @param t_user $oUser
+     * @return bool
+     */
+    function CanDuplicate($oUser= NULL) {
+      if($oUser===NULL)
+        $oUser= & $GLOBALS['user'];
+      return $this->CanCreate($oUser);
+    }
+    
+    /**
+     * Can the user read this object ?
+     * @param t_user $oUser
+     * @return bool
+     */
+    function CanRead($oUser= NULL) {
+      if($oUser===NULL)
+        $oUser= & $GLOBALS['user'];
+      if($this->HasPrivilegeInfos) {
+        return $this->IsOwner($oUser) || $oUser->InGroup($this->ReaderGroupId());
+      } else {
+        if($oParent= & $this->GetParent()) {
+          return $oParent->CanRead($oUser);
+        } else {
+          return false;
+        }
+      }
+    }
+    
+    /**
+     * Can the user write this object ?
+     * @param t_user $oUser
+     * @return bool
+     */
+    function CanWrite($oUser= NULL) {
+      if($oUser===NULL)
+        $oUser= & $GLOBALS['user'];
+      if($this->HasPrivilegeInfos) {
+        return $this->IsOwner($oUser) 
+          || $oUser->InGroup($this->WriterGroupId());
+      } else {
+        if($oParent= & $this->GetParent()) {
+          return $oParent->CanWrite($oUser);
+        } else {
+          return false;
+        }
+      }
+    }
+    
+    
+    /**
+     * Return the class name
+     * @return string
+     */
+    function ClassName() {
+      return substr(get_class($this),2);
+    }
+    
+    /**
+     * Return the field prefix
+     * @return string
+     */
+    function FieldPrefix() {
+      return $this->ClassName();
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('unknow', $this->Attributes->GetAttribute($sFieldName));
+      if($sFieldName==$this->Id()) {
+        $r->Type= 'integer';
+        $r->Attributes->set('visible', false);
+      } elseif($sFieldName == $this->FieldPrefix() . '_owner_id') {
+        $oUsers= & LibComponent::Load('users');
+        $r->Type= 'fromtable';
+        $r->Attributes->set('showas', 'label');
+        $r->Attributes->set('tablename', 'users');
+        $r->Attributes->set('codefield', 'id_user');
+        $r->Attributes->set('labelfield', 'user_name');
+        $r->Attributes->set('nullable', true);
+        $r->Attributes->set('source', $oUsers);
+      } elseif(($sFieldName == $this->FieldPrefix() . '_reader_group_id')
+          ||   ($sFieldName == $this->FieldPrefix() . '_writer_group_id')) {
+        $oGroups= & LibComponent::Load('groups');
+        $r->Type= 'fromtable';
+        $r->Attributes->set('showas', 'label');
+        $r->Attributes->set('tablename', 'groups');
+        $r->Attributes->set('codefield', 'id_group');
+        $r->Attributes->set('labelfield', 'group_name');
+        $r->Attributes->set('nullable', true);
+        $r->Attributes->set('source', $oGroups);
+      } elseif($sFieldName == $this->FieldPrefix() . '_privileges') {
+        $r->Type= 'integer';
+        $r->Attributes->set('ignore', true);
+      } elseif(
+          ($sFieldName == $this->FieldPrefix() . '_modification_time')
+          || ($sFieldName == $this->FieldPrefix() . '_creation_time')) {
+        $r->Type= 'time';
+      } else {
+        $r->Virtual= true;
+      }
+      return $r;
+    }
+    
+    /**
+     * Return the foreign object with the link name
+     * @return TDbRecordBinding
+     */
+    function & GetForeignObject($sLinkName) {
+      global $g_aModelRoots;
+      if($this->ForeignTables->Exists($sLinkName)) {
+        $aForeignTable= & $this->ForeignTables->Value($sLinkName);
+        if(!isset($aForeignTable['object'])) {
+          if(is_a($g_aModelRoots[$aForeignTable['root']], 'TDbRecordBinding')) {
+            $oAttrFilter1= & new TAttributeFilter('','IS A','t_'.$aForeignTable['table'],'void');
+            $oAttrFilter2= & new TAttributeFilter(
+              $aForeignTable['destination_field'],
+              '=',
+              $this->Attributes->Value($aForeignTable['source_field']),TAttributeFilter);
+            $oAttrFilter0= & new TAttributeFilter($oAttrFilter1,'AND',$oAttrFilter2);
+            $aForeignTable['object']=
+              $g_aModelRoots[$aForeignTable['root']]->GetWithAttributeFilterRecursive(
+                $oAttrFilter0);
+          } else {
+            $aLinkedTable['object']= NULL;
+          }
+        }
+        return $aForeignTable['object'];
+      } else {
+        return false;
+      }
+    }
+    
+    /**
+     * Return the sub item
+     * @return TDbRecordBinding
+     */
+    function & GetItemByClassNameAndAttribute($sClassName,$sId, $iIdValue) {
+      $oQueryForms= & LibComponent::Load('query_forms');
+      $oAttrFilter1= & new TAttributeFilter(
+        '','IS A','t_'.$sClassName);
+      $oAttrFilter2= & new TAttributeFilter(
+        $sId,'=',$iIdValue);
+      $oAttrFilter12= & new TAttributeFilter(
+        $oAttrFilter1,'AND',$oAttrFilter2,'TAttributeFilter');
+      return $this->Items->GetWithAttributeFilter($oAttrFilter12);
+    }
+    
+    /**
+     * Return the sub item
+     * @return TDbRecordBinding
+     */
+    function & GetSubItemByClassNameAndAttribute($sClassName,$sId, $iIdValue) {
+      $oQueryForms= & LibComponent::Load('query_forms');
+      $oAttrFilter1= & new TAttributeFilter(
+        '','IS A','t_'.$sClassName);
+      $oAttrFilter2= & new TAttributeFilter(
+        $sId,'=',$iIdValue);
+      $oAttrFilter12= & new TAttributeFilter(
+        $oAttrFilter1,'AND',$oAttrFilter2,'TAttributeFilter');
+      $r= & $this->Items->GetWithAttributeFilterRecursive($oAttrFilter12);
+      return $r;
+    }
+    
+    /**
+     * Return the linked object
+     * @return TDbRecordBinding
+     * @todo GetLinkedObject & spec
+     */
+    function & GetLinkedObject($sLinkName) {
+      global $g_aModelRoots;
+      if($this->LinkedTables->Exists($sLinkName)) {
+        return NULL;
+      } else {
+        return false;
+      }
+    }
+    
+    /**
+     * Return the field name of the primary key
+     * @return string
+     */
+    function Id() {
+      return 'id_'.$this->ClassName();
+    }
+    
+    /**
+     * Return value of  Id
+     * @return string
+     */
+    function IdValue() {
+      if($this->Attributes) {
+        return $this->Attributes->Value($this->Id());
+      }
+    }
+    
+    /**
+     * Is it the owner ?
+     * @param integer|t_user
+     * @return bool
+     */
+    function IsOwner($mUser) {
+      if(is_a($mUser,'t_user')) {
+        return ($this->OwnerId()==$mUser->IdValue()) || ($mUser->IsLocalAdmin===true);
+      } else {
+        return $this->OwnerId()==$mUser;
+      }
+    }
+    
+    /**
+     * Load additionnal attributes 
+     *
+     * @return void
+     */
+    function LoadMe() {
+    }
+    
+    /**
+     * Load child nodes and put them into Items
+     * @param string
+     * @return void
+     */
+    function LoadChildRecordsOfType($sChildObjectType) {
+      global $db, $user;
+      if(!$this->IsVirtual && $this->IdValue()===NULL) {
+        return;
+      }
+      $sChildType='t_'.$sChildObjectType;
+      $aClassVars=get_class_vars($sChildType);
+      $sWhereClause= '';
+      if(!$this->IsVirtual) {
+        $sWhereClause= $db->QuoteIdentifier($this->id()).'='.$db->Quote($this->IdValue());
+      }
+      if($aClassVars['HasPrivilegeInfos']) {
+        if(!empty($sWhereClause)) {
+          $sWhereClause.=' AND ';
+        }
+        $sWhereClause.=$user->CanReadClause(
+          $sChildObjectType=='map_reference' ? 'reference' : $sChildObjectType);
+      }
+      $qChildNodes=$db->query(
+        'SELECT * '.
+        'FROM '.$db->QuoteIdentifier(LibComponent::plural($sChildObjectType))." \n".
+        (empty($sWhereClause) ? '' : ('WHERE '.$sWhereClause.' ')).
+        //don't escape $OrderBy it should be safe
+        // it can contain several fields
+        (empty($aClassVars['OrderBy']) ? '' : ('ORDER BY '.$aClassVars['OrderBy'])));
+      while($aChildRecord= $db->FetchAssoc($qChildNodes)) {
+        $oNewChild = & new $sChildType($aChildRecord);
+        $this->Items->Append($oNewChild);
+      }
+    }
+    
+    /**
+     * Owner id
+     * @return integer
+     */
+    function OwnerId() {
+      return (integer) $this->Attributes->Value($this->FieldPrefix().'_owner_id');
+    }
+    
+    /**
+     * Return the reader group id
+     * @return integer
+     */
+    function ReaderGroupId() {
+      return (integer) $this->Attributes->Value($this->FieldPrefix().'_reader_group_id');
+    }
+    
+    /**
+     * Return the table name
+     * @return string
+     */
+    function TableName() {
+      return LibComponent::Plural($this->ClassName());
+    }
+    
+    /**
+     * Return the writer group id
+     * @return integer
+     */
+    function WriterGroupId() {
+      return (integer) $this->Attributes->Value($this->FieldPrefix().'_writer_group_id');
+    }
+    
+    /* ========================================== */
+    /*                    EVENTS                  */
+    /* ========================================== */
+    /**
+     * Handle event
+     *
+     * @param TEvent $oEvent
+     * @return void
+     */
+    function HandleEvent(&$oEvent) {
+      if(is_a($oEvent,'TMutationEvent')) {
+        if(!($this->State & MUSMAP_STATE_LOADING)) {
+          $this->State|= MUSMAP_STATE_CHANGED;
+        }
+      }
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/dbrecordexplorer.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/dbrecordexplorer.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/dbrecordexplorer.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,163 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Database binding explorer class
+ *
+ * @author Mathieu Parent
+ * @copyright 2005-03, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2005-03
+ */
+  
+  /**
+   * Parent class
+   */
+  require_once('dbrecordbinding.class.php');
+  
+  /**
+   * Database binding explorer
+   * @package include
+   * @subpackage model
+   */
+  class TDbRecordExplorer extends TDbRecordBinding {
+  
+    /**
+     * Recursively build the node path
+     *
+     * @return void
+     */
+    function NodePath() {
+      $oParentNode = & $this->GetParent();
+      if($oParentNode) {
+        $oParentNode->NodePath();
+      }
+      echo '/ ';
+      $this->PrintLink(ucfirst(translate($this->ClassName())).': ');
+      echo "\n";
+    }
+    
+    /**
+     * Make an hidden field to redirect
+     *
+     * Used by
+     * {@link TDbRecordExplorer::Explore()} to 
+     * go to the right node.
+     *
+     * @param string $sPrefix
+     * @return void
+     */
+    function PrintId($sPrefix='') {
+      echo '<input type="hidden" name="go'.
+        '['.$sPrefix.($this->ClassName()).']'.
+        '['.$this->Id().']['.$this->IdValue().']" value="1">'."\n";
+    }
+    
+    /**
+     * link to the node <a href=...
+     *
+     * @param string $sTextBefore text to put before
+     * @return void
+     */
+    function PrintLink($sTextBefore = '')
+    {
+      $profile= $this->Profile();
+      echo '<a href="'.$_SERVER['SCRIPT_NAME'].
+        '?go['.$this->ClassName().']['.$this->Id().']'.
+        '['.$this->IdValue().']=1'.
+        (!empty($_GET['explore']) ? ('&amp;explore='.$_GET['explore']) : '').
+        (($profile && ($profile->ClassName() == 'profile'))
+          ? ('&amp;id_profile='.$profile->Attributes->Value('id_profile'))
+          : '').
+        '">'.
+          htmlentities(
+            $sTextBefore.
+            $this->ShortInfo()).
+        '</a>';
+    }
+    /**
+     * Display the object
+     *
+     * For example, classes are displayed
+     * with their legend item
+     *
+     * @return void
+     */
+    function PrintObject() {
+      //nothing by default
+    }
+    
+    /**
+     * Print special button (change password,
+     * view mapfile, wizards, ...)
+     */
+    function PrintSpecialButtons() {
+    }
+    
+    /**
+     * Print a tree (see mygosumenu)
+     *
+     * @param integer $l the deep
+     * @return void
+     */
+    function PrintTree($iDeep=0)
+    {
+      if($iDeep==0) {
+        echo '<div class="DynamicTree">'."\n";
+        echo '<div class="top">'.html_l10n('Tree View').'</div>'."\n";
+        echo '<div class="wrap" id="tree">'."\n";
+      }
+      $sNodeType = !empty($this->ChildObjectTypes) ? 'folder' : 'doc';
+      echo str_repeat('  ',$iDeep).'<div class="'.$sNodeType.'" >';
+      $this->PrintLink(ucfirst(translate($this->ClassName())).': ');
+      echo "\n";
+      $oItemsEnum= & $this->Items->NewEnum();
+      $oItemsEnum->Reset();
+      while($oChild= & $oItemsEnum->Each()) {
+        if($oChild->State & MUSMAP_STATE_DELETED) {
+          continue;
+        }
+        $oChild->PrintTree($iDeep+1);
+      }
+      echo str_repeat('  ',$iDeep).'</div>'."\n";
+      if($iDeep==0) {
+        echo '</div>'."\n";
+        echo '</div>'."\n";
+        echo '<script type="text/javascript">'."\n";
+        echo '  var tree = new DynamicTree("tree");'."\n";
+        echo '  tree.path = "'.Conf::get('musmap_root_url').'/js/contrib/mygosumenu/1.5/images/";'."\n";
+        echo '  tree.foldersAsLinks = true;'."\n";
+        echo '  tree.init();'."\n";
+        echo '</script>'."\n";
+      }
+    }
+  }
+  
+  ?>

Added: packages/musmap/branches/upstream/current/include/model/extent.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/extent.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/extent.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,180 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: extents
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  
+  /**
+   * Binding to table profile_extent
+   * @package include
+   * @subpackage model
+   */
+  class t_profile_extent extends t_component {
+    
+    function CanDelete() {
+      $oParent= & $this->GetParent();
+      $r= $oParent && $oParent->CanWrite();
+      unset($oParent);
+      return $r;
+    }
+    
+    function CanDuplicate() {
+      return false;
+    }
+    
+    function CanWrite() {
+      return false;
+    }
+    
+    function Id() {
+      return 'id_extent';
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_profile':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles');
+          $r->Attributes->set('codefield', 'id_profile');
+          $r->Attributes->set('labelfield', 'profile_name');
+          $r->Attributes->set('orderby', Array('profile_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'id_extent':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'extents');
+          $r->Attributes->set('codefield', 'id_extent');
+          $r->Attributes->set('labelfield', 'extent_name');
+          $r->Attributes->set('orderby', Array('extent_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'extent_name':
+        case 'extent_minx':
+        case 'extent_miny':
+        case 'extent_maxx':
+        case 'extent_maxy':
+          $r= & t_extent::GetFieldType($sFieldName);
+	  $r->Virtual= true;
+          break;
+        default:
+          $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('extent_name');
+    }
+  }
+  
+  /**
+   * Binding to table extent
+   * @package include
+   */
+  class t_extent extends t_component {
+    var $OrderBy='extent_name';
+    var $HasPrivilegeInfos=true;
+    
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_extent':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'extent_name':
+          $r->Type= 'text';
+          break;
+        case 'extent_minx':
+        case 'extent_miny':
+        case 'extent_maxx':
+        case 'extent_maxy':
+          $r->Type= 'float';
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    /**
+     * Print special button (change password,
+     * view mapfile, wizards, ...)
+     */
+    function PrintSpecialButtons() {
+      echo "</p>\n";
+      echo "<p>\n";
+      echo '  <input type="button" name="load_current_extent" '.
+        'value="'.html_l10n('Load current extent').'" '.
+        'onclick="return(loadCurrentExtent());">&nbsp;'."\n";
+      echo '  <input type="button" name="set_current_extent" '.
+        'value="'.html_l10n('Set current extent').'" '.
+        'onclick="return(setCurrentExtent());">&nbsp;'."\n";
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('extent_name');
+    }
+    
+    function set_ms_extent(&$ms_extent) {
+      if(($this->Attributes->Value('extent_minx')!=$this->Attributes->Value('extent_maxx'))
+          || ($this->Attributes->Value('extent_miny')!=$this->Attributes->Value('extent_maxy'))) {
+        $ms_extent->setextent(
+          $this->Attributes->Value('extent_minx'), $this->Attributes->Value('extent_miny'),
+          $this->Attributes->Value('extent_maxx'), $this->Attributes->Value('extent_maxy'));
+      }
+    }
+  }
+  
+  /**
+   * List extents
+   * @package include
+   */
+  class t_extents_list extends t_list {
+    var $ChildObjectTypes=Array('extent');
+  }
+  ?>

Added: packages/musmap/branches/upstream/current/include/model/group.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/group.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/group.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,82 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Groups list
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2005-11
+ */
+ 
+ 
+  require_once('user.class.php');
+  
+  //GROUP
+  class t_group extends t_component {
+    var $main_infos = Array(
+        'group_name'=>Array());
+    var $OrderBy='group_name';
+    
+    function CanDuplicate() {
+      return false;
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_group':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'group_name':
+          $r->Type= 'text';
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+  
+    function ShortInfo() {
+      return $this->Attributes->Value('group_name');
+    }
+    
+  }
+
+  class t_groups_list extends t_list {
+    var $ChildObjectTypes=Array('group');
+  }
+?>

Added: packages/musmap/branches/upstream/current/include/model/label.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/label.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/label.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,257 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Classes 'classe",annotation et style
+ *
+ * Données profil, Couches, ...
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  //USER -> PROFILES -> PROFILE_DATA @ LAYER -> CLASS -> label
+  class t_label extends t_component {
+    var $main_infos = Array('label_column'=>Array(),
+      'label_color'=>array());
+    function BuildMe() {
+      global $map;
+      //labelitem:
+      $parent_node             = & $this->GetParent();
+      $parent_node_parent_node = $parent_node->GetParent();
+      if($this->Attributes->IsEmpty('label_column'))
+      {
+        add_error(
+          sprintf(
+            l10n('The label column of layer "%s" is not set.'),
+            $parent_node_parent_node->Attributes->Value('profile_data_title')));
+        return;
+      }
+      $parent_node_parent_node->ms_layer->set('labelitem',
+        $this->Attributes->Value('label_column'));
+      //encoding:
+      if(isset($parent_node->ms_class->label->encoding)) {//MS>4.3
+        if(!$this->Attributes->IsEmpty('label_encoding')) {
+          $parent_node->ms_class->label->set(
+            "encoding",$this->Attributes->Value('label_encoding'));
+        }
+      }
+      //font:
+      if($this->Attributes->IsEmpty('label_font')) {
+        $parent_node->ms_class->label->set("font","vera");
+      } else {
+        $parent_node->ms_class->label->set("font",
+          $this->Attributes->Value('label_font'));
+      }
+      $parent_node->ms_class->label->set("antialias",MS_TRUE);
+      
+      //color:
+      LibVisual::setColor($parent_node->ms_class->label->color,
+          $this->Attributes->Value('label_color'));
+      
+      //scales:
+      if(!$this->Attributes->IsEmpty('label_maxscale')) {
+        $parent_node_parent_node->ms_layer->set('labelmaxscale',
+            $this->Attributes->Value('label_maxscale'));
+      }
+      if(!$this->Attributes->IsEmpty('label_minscale')) {
+        $parent_node_parent_node->ms_layer->set('labelminscale',
+            $this->Attributes->Value('label_minscale'));
+      }
+      
+      //superposition
+      $parent_node->ms_class->label->set("force",
+          $this->Attributes->Value('label_force_visibility'));
+          
+      //size:
+      if(!$this->Attributes->IsEmpty('label_size')) {
+        $parent_node_parent_node->set("labelsizeitem",
+            $this->Attributes->Value('label_size'));
+      } else {
+        $parent_node->ms_class->label->set("size",
+            $this->Attributes->Value('label_default_size'));
+      }
+      $parent_node->ms_class->label->set("type",MS_TRUETYPE);
+
+      //angle
+      if(!$this->Attributes->IsEmpty('label_default_angle')) {
+        $parent_node->ms_class->label->set("angle",
+            $this->Attributes->Value('label_default_angle'));
+      } else {
+        $parent_node->ms_class->label->set("autoangle",1);
+      }
+      if(!$this->Attributes->IsEmpty('label_angle')) {
+        $parent_node_parent_node->ms_layer->set("labelangleitem",
+            $this->Attributes->Value('label_angle'));
+      }
+      //position:
+      LibVisual::setPosition($parent_node->ms_class->label,$this->Attributes->Value('label_position'));
+          
+      //rectangle:
+      LibVisual::setColor($parent_node->ms_class->label->backgroundcolor,
+          $this->Attributes->Value('label_rect_color'));
+      LibVisual::setColor($parent_node->ms_class->label->backgroundshadowcolor ,
+          $this->Attributes->Value('label_rect_shadow_color'));
+      
+      $parent_node->ms_class->label->set('backgroundshadowsizex',
+          $this->Attributes->Value('label_rect_shadow_size'));
+      $parent_node->ms_class->label->set('backgroundshadowsizey',
+          $this->Attributes->Value('label_rect_shadow_size'));
+      $parent_node->ms_class->label->set('buffer',
+          $this->Attributes->Value('label_buffer'));
+          
+      //partial
+      $parent_node->ms_class->label->set('partials',
+          $this->Attributes->Value('label_partials')? MS_TRUE : MS_FALSE);
+      
+      //outline:
+      LibVisual::setColor($parent_node->ms_class->label->outlinecolor ,
+          $this->Attributes->Value('label_outline_color'));
+      LibVisual::setColor($parent_node->ms_class->label->shadowcolor ,
+          $this->Attributes->Value('label_shadow_color'));
+      $parent_node->ms_class->label->set('shadowsizex',
+          $this->Attributes->Value('label_shadow_size'));
+      $parent_node->ms_class->label->set('shadowsizey',
+          $this->Attributes->Value('label_shadow_size'));
+      
+      //avoid duplicate labels
+      $parent_node->ms_class->label->set('mindistance',1);
+       
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_label':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_class':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'classes');
+          $r->Attributes->set('codefield', 'id_class');
+          $r->Attributes->set('labelfield', 'class_name');
+          $r->Attributes->set('orderby', Array('class_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'label_column':
+        case 'label_encoding':
+          $r->Type= 'text';
+          break;
+        case 'label_font':
+          $r->Type= 'fromarray';
+          $aFontFileLines=file(Conf::get('font_list_path'));
+          $fonts= Array();
+          foreach($aFontFileLines AS $sFontFileLine) {
+            if(preg_match('/^(\S*)\s*(.*?)\s*$/',$sFontFileLine,$aMatches)) {
+              if(strtolower(substr($aMatches[2],-4)) == '.fdb') {
+                continue;//hiding fdb fonts (for swig)
+              }
+              $fonts[$aMatches[1]]=$aMatches[1];
+            }
+          }
+          $r->Attributes->set('array', $fonts);
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'label_color':
+          $r->Type= 'color';
+          break;
+        case 'label_minscale':
+        case 'label_maxscale':
+          $r->Type= 'float';
+          break;
+        case 'label_force_visibility':
+          $r->Type= 'bool';
+          break;
+        case 'label_default_size':
+          $r->Type= 'integer';
+          break;
+        case 'label_size':
+          $r->Type= 'text';
+          break;
+        case 'label_default_angle':
+          $r->Type= 'float';
+          break;
+        case 'label_angle':
+          $r->Type= 'text';
+          break;
+        case 'label_position':
+          $r->Type= 'fromarray';
+          $r->Attributes->set('array', Array(
+            'au'=>html_l10n('automatic'),
+            'ul'=>html_l10n('upper left'),
+            'uc'=>html_l10n('upper center'),
+            'ur'=>html_l10n('upper right'),
+            'cl'=>html_l10n('center left'),
+            'cc'=>html_l10n('center center'),
+            'cr'=>html_l10n('center right'),
+            'll'=>html_l10n('lower left'),
+            'lc'=>html_l10n('lower center'),
+            'lr'=>html_l10n('lower right')));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'label_rect_color':
+        case 'label_rect_shadow_color':
+          $r->Type= 'color';
+          break;
+        case 'label_rect_shadow_size':
+        case 'label_buffer':
+          $r->Type= 'integer';
+          break;
+        case 'label_outline_color':
+          $r->Type= 'color';
+          break;
+        case 'label_partials':
+          $r->Type= 'bool';
+          break;
+        case 'label_shadow_color':
+          $r->Type= 'color';
+          break;
+        case 'label_shadow_size':
+          $r->Type= 'integer';
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo() {
+      return sprintf(l10n('Label "%s"'),$this->Attributes->Value('label_column'));
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/list.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/list.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/list.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,64 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Lists
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-09
+ */
+
+  /**
+   * All virtual lists are descendants of this one
+   * @package include
+   */
+  class t_list extends t_component {
+    var $IsVirtual=true;
+    
+    function t_list() {
+      parent::TDbRecordBinding(Array());
+    }
+
+    function LoadMe() {
+      $this->Attributes->Set('id_'.$this->ClassName(),0);
+    }
+    
+    function ShortInfo() {
+      return '';
+    }
+    
+    function CanWrite() {
+      return true;
+    }
+  }
+
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/map_reference.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/map_reference.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/map_reference.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,146 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: map_references
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  //======================================================================
+  //======================================================================
+  //user -> profiles -> map_reference
+  class t_map_reference extends t_component {
+    var $OrderBy='reference_name';
+    var $HasPrivilegeInfos=true;
+    var $extent;
+    
+    function LoadMe() {
+      global $db;
+      $extent_q=$db->query("SELECT * FROM extents ".
+        "WHERE id_extent=".$db->Quote($this->Attributes->Value('id_extent')));
+      $aExtentAttributes= $db->FetchAssoc($extent_q);
+      if($aExtentAttributes) {
+        $this->extent=& new t_extent($aExtentAttributes);
+      }
+      $db->FreeResult($extent_q);
+    }
+    
+    function FieldPrefix() {
+      return 'reference';
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_map_reference':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_extent':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'extents');
+          $r->Attributes->set('codefield', 'id_extent');
+          $r->Attributes->set('labelfield', 'extent_name');
+          $r->Attributes->set('orderby', Array('extent_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'reference_name':
+          $r->Type= 'text';
+          break;
+        case 'reference_path':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('reference_name');
+    }
+    
+    function set_ms_reference(&$ms_map) {
+      global $user;
+      $sReferencePath= $this->Attributes->Value('reference_path');
+      if(empty($sReferencePath)) {
+        //
+      } elseif(!$user->CanReadFile($sReferencePath)) {
+        Information(sprintf(l10n('You don\'t have access to "%s".'),
+	  $sReferencePath));
+      }elseif(file_exists($sReferencePath)) {
+        $ms_map->reference->set('image',$sReferencePath);
+      } else {
+        add_error(sprintf(
+          l10n('Reference map not found: "%s".'),
+          $sReferencePath));
+      }
+      $this->set_ms_extent($ms_map->reference->extent);
+    }
+    function set_ms_extent(&$ms_extent) {
+      if($this->extent) {
+        $this->extent->set_ms_extent($ms_extent);
+      }
+    }
+
+  }
+  
+  class t_map_references_list extends t_list {
+    var $ChildObjectTypes=Array('map_reference');
+    
+    function & add_child($child_type,$params=Array()) {
+      global $db;
+      switch($child_type) {
+        case 'map_reference':
+          if(isset($params['id_extent'])){
+              $mExtentResult= $db->query("SELECT * FROM extents ".
+                "WHERE id_extent=".$db->Quote($params['id_extent'], 'integer')." ");
+              $aExtentAttributes=$db->FetchAssoc($mExtentResult);
+              $db->FreeResult($mExtentResult);
+              if($aExtentAttributes) {
+                $params['reference_name'] = $aExtentAttributes['extent_name'];
+              }
+          }
+          //break;//
+        default:
+          return parent::add_child($child_type,$params);
+      }
+    }
+  }
+  ?>

Added: packages/musmap/branches/upstream/current/include/model/profile.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/profile.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/profile.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,413 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Classe utilisateurs
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  /**
+   * Classe d'objet carte
+   */
+  
+  require_once('profile_data.class.php');
+  require_once('extent.class.php');
+  require_once('map_reference.class.php');
+  
+  class t_profiles_list extends t_list {
+    var $ChildObjectTypes=Array('profile');
+    var $LoadProfiles= NULL;
+    /**
+     * Constructor
+     */
+    function t_profiles_list($LoadProfiles=NULL) {
+      /*
+       $LoadProfiles : NULL    : current
+       $LoadProfiles : 'none'  : none
+       $LoadProfiles : '*'     : all
+       $LoadProfiles : integer : this profile (id_profile)
+      */
+      $this->LoadProfiles=$LoadProfiles;
+      parent::t_list(Array());
+      //After building the tree
+      $this->Build();
+    }
+    
+    function LoadChildRecordsOfType($sChildType) {
+      global $map, $db, $user;
+      switch($sChildType) {
+        case 'profile':
+          if($map!==NULL) {
+            Error(l10n('Instantiation of a new map.'));
+          }
+          $map = new TMap(Conf::get('blank_map_path'));
+          $oSymbols= & LibComponent::Load('symbols');
+          $oSymbols->Build();
+          unset($oSymbols);
+          $map->ms_map->setFontSet(Conf::get('font_list_path'));
+          switch($this->LoadProfiles) {
+            case 'none' : // none
+              break;
+            case NULL : // current
+              $this->LoadProfiles= $user->Session->Attributes->Value('id_profile');
+            case '*' : //all
+            default :
+              $profiles_query= $db->Query(
+                  "SELECT * \n".
+                  "FROM profiles \n".
+                  "WHERE (".$user->CanReadClause('profile').' '.
+                    "OR profile_is_public=1 ".
+                    "OR profile_owner_id=0) \n".
+                  (is_numeric($this->LoadProfiles) ? 
+                    ('AND id_profile='.$db->Quote($this->LoadProfiles,'integer')) :
+                    'ORDER BY profile_name ')
+                );
+              while($aChildRecord= $db->FetchAssoc($profiles_query)) {
+                $oNewChild = & new t_profile($aChildRecord);
+                $this->Items->Append($oNewChild);
+              }
+              if(!$this->Items->HasItems()) {
+                Information(l10n('Can\'t find any profile.'));
+              }
+              $db->FreeResult($profiles_query);
+          }
+          break;
+        default:
+          parent::LoadChildRecordsOfType($child_nodes_type);
+      }
+    }
+    
+    
+    function print_profiles_list($input_name,$id_profile=NULL,
+        $input_attributes,$profile_explorer=false) {
+      global $SESSION_INFOS,$db, $user;
+      echo '  <select '.$input_attributes.' name="'.$input_name.'">'."\n";
+        if(isset($user)) {
+          $profiles_query=$db->query(
+            'SELECT '.
+              'id_profile, '.
+              'profile_name, '.
+              'profile_is_public '.
+              'FROM profiles '."\n".
+            "WHERE (profile_owner_id=".$db->Quote((integer) $user->Attributes->Value('id_user'), 'integer').") ".
+              "OR (profile_is_public=1) ".
+              "OR (profile_owner_id=0) \n".
+            "ORDER BY profile_name");
+        } else {
+          $profiles_query=$db->query(
+            'SELECT id_profile, profile_name, profile_is_public '.
+              'FROM profiles '.
+            "WHERE (profile_is_public=1) ".
+              "OR (profile_owner_id=0) ");
+        }
+        while ($profile = $db->FetchAssoc($profiles_query)){
+          echo '    <option value="'.$profile['id_profile'].'" '.
+                ($id_profile==$profile['id_profile'] ? ' selected' : '').'>'.
+              $profile['profile_name'].
+              ($profile['profile_is_public'] ? ' (*)' : '').
+            '</option>'."\n";
+        }
+        if($profile_explorer) {
+          echo '    <option value="">-</option>'."\n";
+          echo '    <option value="explore-profiles" style="font-style:italic;">'.
+            html_l10n('Explore profiles...').'</option>'."\n";
+          echo '    <option value="reload-toolbar" style="font-style:italic;">'.
+            html_l10n('Reload toolbar').'</option>'."\n";
+        }
+        echo '  </select>'."\n";
+      $db->FreeResult($profiles_query);
+    }
+
+    /**
+     * Print special button: Profile wizard
+     */
+    function PrintSpecialButtons() {
+      echo '  <input type="button" name="profile_wizard" '.
+        'value="'.html_l10n('Profile wizard').'" '.
+        'onclick="return(profileWizard());">&nbsp;'."\n";
+		      
+    }
+  }
+  
+  //USER -> PROFILES
+  /**
+   * Classe du profil en cours de l'utilisateur
+   */
+  class t_profile extends t_component {
+    var $ChildObjectTypes=Array('profile_data','profile_extent');
+    var $main_infos = Array('profile_is_public'=>Array());
+    var $HasPrivilegeInfos=true;
+    //
+    var $map_reference;
+    var $projection;
+    
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_profile':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_map_reference':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'map_references');
+          $r->Attributes->set('codefield', 'id_map_reference');
+          $r->Attributes->set('labelfield', 'reference_name');
+          $r->Attributes->set('orderby', Array('reference_name'=>''));
+          $r->Attributes->set('nullable', true);
+          break;
+        case 'id_projection':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'projections');
+          $r->Attributes->set('codefield', 'id_projection');
+          $r->Attributes->set('labelfield', 'projection_name');
+          $r->Attributes->set('orderby', Array('projection_name'=>''));
+          $r->Attributes->set('nullable', true);
+          break;
+        case 'profile_name':
+          $r->Type= 'text';
+          break;
+        case 'profile_is_public':
+          $r->Type= 'bool';
+          break;
+        case 'the_one':
+          $r->Type= 'bool';
+          $r->Attributes->set('ignore', true);
+          $r->Virtual= true;
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function LoadMe() {
+      global $map,$db;
+      //map reference
+      if($this->Attributes->Value('id_map_reference')!=0) {
+        $map_reference_q=$db->query("SELECT * FROM map_references ".
+            "WHERE id_map_reference=".
+              $db->Quote($this->Attributes->Value('id_map_reference')));
+        $aMapReferenceAttributes= $db->FetchAssoc($map_reference_q);
+        if($aMapReferenceAttributes) {
+          $this->map_reference=& new t_map_reference($aMapReferenceAttributes);
+          $this->map_reference->set_ms_reference($map->ms_map);
+          $this->map_reference->set_ms_extent($map->ms_map->extent);
+        }
+        $db->FreeResult($map_reference_q);
+      }
+      //projection
+      if($this->Attributes->Value('id_projection')!=0) {
+        $projection_q=$db->query("SELECT * FROM projections ".
+            "WHERE id_projection=".$db->Quote($this->Attributes->Value('id_projection')));
+        $aProjectionAttributes= $db->FetchAssoc($projection_q);
+        if($aProjectionAttributes) {
+          $this->projection=& new t_projection($aProjectionAttributes);
+          $this->projection->set_projection($map->ms_map);
+        }
+        $db->FreeResult($projection_q);
+      }
+    }
+    
+    function LoadChildRecordsOfType($child_nodes_type) {
+      global $db, $user;
+      switch($child_nodes_type) {
+        case 'profile_data':
+          $fields=
+            // ids
+            "profiles_data.id_profile_data AS id_profile_data, \n".//SQLite fix
+            "profiles_data.id_profile AS id_profile, ".
+            "data_sources.id_data_source AS id_data_source, \n".//SQLite fix
+            "data_sources.id_connection AS id_connection, \n".//SQLite fix
+            "id_projection, ".//from data_sources
+            //connections
+            "connection_params, ".
+	    "connection_driver, ".
+            //data_sources
+            "data_source_catalog, ".
+            "data_source_schema, ".
+            "data_source_name, ".
+            "data_source_label, ".
+            "data_source_params, ".
+            "data_source_type, ".
+            "data_source_doc, \n".
+            //profiles_data
+            "profile_data_title, ".
+            "profile_data_index, ".
+            "profile_data_visible, \n".
+            //layers
+            "layer_minscale, ".
+            "layer_maxscale, ".
+            "layer_group, ".
+            "layer_symbols_scale, ".
+            "layer_classitem, ".
+            "layer_opacity, ".
+            "layer_type, \n".
+            //rasters
+            "raster_offsite, ".
+            //profile_data privileges
+            "profile_data_owner_id, \n".
+            "profile_data_reader_group_id, \n".
+            "profile_data_writer_group_id, \n".
+            "profile_data_privileges, \n".
+            "profile_data_modification_time \n";
+          $tables=
+              "profiles_data \n".
+              "LEFT JOIN data_sources ON profiles_data.id_data_source=data_sources.id_data_source \n".
+              "LEFT JOIN connections ON data_sources.id_connection=connections.id_connection \n";
+          $profile_data_r=$db->query("SELECT ".$fields.
+            "FROM ".$tables.
+            "WHERE id_profile=".$db->Quote($this->Attributes->Value('id_profile'), 'integer').' '.
+            'AND '.$user->CanReadClause('profile_data')."\n".
+            "AND (data_source_type='S' OR data_source_type='P' OR data_source_type='L' ".
+              "OR data_source_type='A' ".
+              "OR data_source_type='R' OR data_source_type='I') ".
+            "ORDER BY profile_data_index, profiles_data.id_profile_data ");
+          //For each graphic profile data :
+          while($profile_data=$db->FetchAssoc($profile_data_r)){
+            $oNewChild = & new t_profile_data($profile_data);
+            $this->Items->Append($oNewChild);
+          }
+          $db->FreeResult($profile_data_r);
+          
+          $profile_data_r=$db->query("SELECT ".$fields.
+            "FROM ".$tables.
+            "WHERE id_profile=".$db->Quote($this->Attributes->Value('id_profile'), 'integer').' '.
+            'AND '.$user->CanReadClause('profile_data')."\n".
+            "AND NOT (data_source_type='S' OR data_source_type='P' OR data_source_type='L' ".
+              "OR data_source_type='A' ".
+              "OR data_source_type='R' OR data_source_type='I') ".
+            "ORDER BY profile_data_index, profiles_data.id_profile_data ");
+          //For each non-graphic profile data :
+          while($profile_data=$db->FetchAssoc($profile_data_r)){
+            $oNewChild = & new t_profile_data($profile_data);
+            $this->Items->Append($oNewChild);
+          }
+          $db->FreeResult($profile_data_r);
+          break;
+        case 'profile_extent':
+          $profile_extents_r=$db->query("SELECT ".
+            "extents.id_extent AS id_extent, ".
+            "extent_name, ".
+            "extent_minx, ".
+            "extent_miny, ".
+            "extent_maxx, ".
+            "extent_maxy ".
+            //"extent_owner_id, ".
+            //"extent_reader_group_id, ".
+            //"extent_writer_group_id, ".
+            //"extent_privileges, ".
+            //"extent_modification_time ".
+            "FROM extents,profile_extents \n".
+            "WHERE ".
+              "profile_extents.id_profile=".$db->Quote($this->Attributes->Value('id_profile'), 'integer')." ".
+              "AND extents.id_extent=profile_extents.id_extent ");
+          while($extents_row=$db->FetchAssoc($profile_extents_r)){ //for each extent
+            $oNewChild = & new t_profile_extent($extents_row);
+            $this->Items->Append($oNewChild);
+          }
+          $db->FreeResult($profile_extents_r);
+          break;
+        default:
+          parent::LoadChildRecordsOfType($child_nodes_type);
+      }
+    }
+    
+    
+        /**
+     * Affiche une représentation de l'objet
+     *
+     * Par exemple, les classes sont représentées
+     * par leur élement de légende
+     */
+    function PrintObject() {
+      echo $this->CanWrite()
+        ? html_l10n('(Read & write privileges)')
+        : html_l10n('(Read only)');
+    }
+
+    /**
+     * Print special button (change password,
+     * view mapfile, wizards, ...)
+     */
+    function PrintSpecialButtons() {
+      global $INPUT;
+      if(!isset($INPUT['view_mapfile'])) {
+        echo '  <input type="submit" name="view_mapfile" '.
+          'value="'.html_l10n('Show mapfile').'">&nbsp;'."\n";
+      } else {
+        echo '  <input type="submit" name="dont_view_mapfile" '.
+          'value="'.html_l10n('Hide mapfile').'">&nbsp;'."\n";
+      }
+    }
+    
+    /**
+     * Profil parent
+     *
+     */
+    function & Profile() {
+      return $this;
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('profile_name');
+    }
+    
+    function & add_child($child_type,$params=Array()) {
+      global $db;
+      switch($child_type) {
+        case 'profile_data':
+          if(!isset($params['id_data_source'])){
+            $params['id_data_source'] = 0;
+          } elseif(empty($params['profile_data_title'])){
+              $ds_r=$db->query("SELECT * FROM data_sources ".
+                "WHERE id_data_source=".$db->Quote($params['id_data_source'])." ");
+              $ds=$db->FetchAssoc($ds_r);
+              $db->FreeResult($ds_r);
+              if($ds) {
+                $params['profile_data_title'] = $ds['data_source_label'];
+              }
+          }
+        default:
+          return parent::add_child($child_type,$params);
+      }
+    }
+  }
+  
+  
+  ?>

Added: packages/musmap/branches/upstream/current/include/model/profile_data.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/profile_data.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/profile_data.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,405 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Classe données du profil
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  require_once('class.class.php');
+  require_once('profiles_columns.class.php');
+  require_once('data_sources.inc.php');
+  
+  //======================================================================
+  //======================================================================
+  //USER -> PROFILES -> PROFILE_DATA 
+  class t_profile_data extends t_component {
+    var $main_infos = Array(
+        'profile_data_visible'=>Array(),
+        'profile_data_index'=>Array());
+    var $HasPrivilegeInfos=true;
+    var $ChildObjectTypes=Array(
+        'class',
+        'profile_column'
+      );
+    var $projection = NULL;
+    var $ms_layer = NULL;
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      global $db;
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_profile_data':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_profile':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles');
+          $r->Attributes->set('codefield', 'id_profile');
+          $r->Attributes->set('labelfield', 'profile_name');
+          $r->Attributes->set('orderby', Array('profile_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'id_projection':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'projections');
+          $r->Attributes->set('codefield', 'id_projection');
+          $r->Attributes->set('labelfield', 'projection_name');
+          $r->Attributes->set('orderby', Array('projection_name'=>''));
+          $r->Attributes->set('nullable', true);
+          $r->Attributes->set('ignore', !($this->IsRaster() || $this->IsShape()));
+          break;
+        case 'id_data_source':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'data_sources');
+          $r->Attributes->set('codefield', 'id_data_source');
+          $r->Attributes->set('labelfield', $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote(''))));
+          $r->Attributes->set('orderby', Array('data_source_catalog'=>'','data_source_schema'=>'','data_source_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'profile_data_title':
+          $r->Type= 'text';
+          break;
+        case 'profile_data_index':
+          $r->Type= 'index';
+          break;
+        case 'profile_data_visible':
+          $r->Type= 'bool';
+          break;
+        case 'layer_minscale':
+          $r->Type= 'float';
+          $r->Attributes->set('ignore', !($this->IsRaster() || $this->IsShape()));
+          break;
+        case 'layer_maxscale':
+          $r->Type= 'float';
+          $r->Attributes->set('ignore', !($this->IsRaster() || $this->IsShape()));
+          break;
+        case 'layer_group':
+          $r->Type= 'text';
+          $r->Attributes->set('ignore', !($this->IsRaster() || $this->IsShape()));
+          break;
+        case 'layer_symbols_scale':
+          $r->Type= 'float';
+          $r->Attributes->set('ignore', !($this->IsShape()));
+          break;
+        case 'layer_classitem':
+          $r->Type= 'text';
+          $r->Attributes->set('ignore', !($this->IsShape()));
+          break;
+        case 'layer_opacity':
+          $r->Type= 'integer';
+          $r->Attributes->set('ignore', !($this->IsRaster() || $this->IsShape()));
+          break;
+        case 'layer_type':
+          $r->Type= 'fromarray';
+          $r->Attributes->set('array', Array(
+            'S'=>html_l10n('Polygon'),
+            'P'=>html_l10n('Point'),
+            'L'=>html_l10n('Line'),
+            'A'=>html_l10n('Label')));
+          $r->Attributes->set('nullable', false);
+          $r->Attributes->set('ignore', !($this->IsShape()));
+          $r->Attributes->set('source', Array(
+            'S'=>html_l10n('Polygon'),
+            'P'=>html_l10n('Point'),
+            'L'=>html_l10n('Line'),
+            'A'=>html_l10n('Label')));
+          break;
+        case 'raster_offsite':
+          $r->Type= 'color';
+          $r->Attributes->set('ignore', !($this->IsRaster()));
+          break;
+        case 'is_displayed':
+          $r->Type= 'bool';
+          $r->Attributes->set('ignore', true);
+          $r->Virtual= true;
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      if(    ($sFieldName=='id_projection')
+          || (substr($sFieldName,0,12)=='data_source_')
+          || (substr($sFieldName,0,11)=='connection_')
+          || ($sFieldName=='id_connection')) {
+        $r->Attributes->set('ignore', true);
+      }
+      return $r;
+    }
+    
+    function IsRaster() {
+      return in_array($this->Attributes->Value('data_source_type'),Array('R','I'));
+    }
+    function IsShape() {
+      return in_array($this->Attributes->Value('data_source_type'),Array('S','P','L','A'));
+    }
+    function IsAlpha() {
+      return in_array($this->Attributes->Value('data_source_type'),Array('T','D','B'));
+    }
+    
+    /**
+     * Print special button (change password,
+     * view mapfile, wizards, ...)
+     */
+    function PrintSpecialButtons() {
+      echo '  <input type="button" name="presentation_wizard" '.
+        'value="'.html_l10n('Presentation wizard').'" '.
+        'onclick="return(presentationWizard());">&nbsp;'."\n";
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('profile_data_title');
+    }
+    
+    function load_projection() {
+      global $map,$db;
+      if($this->projection===NULL) {
+        $this->projection= false;
+        //projection
+        if($this->Attributes->Value('id_projection')!=0) {
+          $projection_q=$db->query("SELECT * FROM projections ".
+              "WHERE id_projection=".
+                $db->Quote($this->Attributes->Value('id_projection'), 'integer'));
+          $aProjectionAttributes= $db->FetchAssoc($projection_q);
+          if($aProjectionAttributes) {
+            $this->projection=& new t_projection($this,$aProjectionAttributes);
+          }
+          $db->FreeResult($projection_q);
+        }
+      }
+    }
+    
+    function BuildMe() {
+      global $map, $db;
+      /*
+       * Get the data type and set the layer properties
+       */
+      $this->ms_layer= ms_newLayerObj($map->ms_map);
+      if($this->ms_layer===false) {
+        return false;
+      }
+      $this->setConnection();
+      $this->setMetadata();
+      //$this->ms_layer->setMetaData('swfdumpattributes','');
+      return true;
+    }
+    
+    function GetLayerType(&$layer) {
+      if($layer===false) {
+        add_error(l10n('Unable to get layer type (layer not loaded).'));
+        return false;
+      }
+      switch($layer->type) {
+        case MS_LAYER_ANNOTATION://Annotation
+          return 'A';
+        case MS_LAYER_CIRCLE://Cercle
+          return 'C';
+        case MS_LAYER_LINE://Ligne
+          return 'L';
+        case MS_LAYER_POINT://Point
+          return 'P';
+        case MS_LAYER_QUERY://Query
+          return 'Q';
+        case MS_LAYER_RASTER://Raster
+          if(false) {//@todo!
+            return 'R';
+          } else {
+            return 'I';
+          }
+        case MS_LAYER_POLYGON://Polygone
+          return 'S';
+        case MS_LAYER_TILEINDEX://TileIndex
+          return 'T';
+        default://Autre
+          add_error(sprintf(l10n('Unknow layer type: "%s".'),
+            $layer->type));
+      }
+      return '';
+    }
+    
+    function SetLayerType(&$layer,$type) {
+      if($layer===false) {
+        add_error(l10n('Unable to change layer type (layer not loaded).'));
+        return false;
+      }
+      switch($type) {
+        case 'A'://Annotation
+          $layer->set("type",MS_LAYER_ANNOTATION);
+          break;
+        case 'C'://Cercle
+          $layer->set("type",MS_LAYER_CIRCLE);
+          break;
+        case 'L'://Ligne
+          $layer->set("type",MS_LAYER_LINE);
+          break;
+        case 'P'://Point
+          $layer->set("type",MS_LAYER_POINT);
+          break;
+        case 'Q'://Query
+          $layer->set("type",MS_LAYER_QUERY);
+          break;
+        case 'R'://Raster
+        case 'I'://TileIndex
+          $layer->set("type",MS_LAYER_RASTER);
+          break;
+        case 'S'://Polygone
+          $layer->set("type",MS_LAYER_POLYGON);
+          break;
+        case 'T'://TileIndex
+          $layer->set("type",MS_LAYER_TILEINDEX);
+          break;
+        default://Autre
+          add_error(sprintf(l10n('Unknow layer type: "%s".'),$type));
+      }
+      return true;
+    }
+    
+    function SetConnection() {
+      if(!$this->ms_layer) {
+        return false;
+      }
+      /*
+       * Connection
+       */
+      $connection= data_source_connection($this->Attributes->_Attributes);
+      $this->ms_layer->set("connectiontype",$connection['ms_connectiontype']);
+      if(isset($connection['data'])) {
+        $this->ms_layer->set('data',$connection['data']);
+      }
+      $this->ms_layer->set("connection",
+        isset($connection['connection'])
+          ? $connection['connection']
+          : '');
+      foreach($connection AS $param=>$value) {
+        if ((strtolower(substr($param,0,4)) == 'wms_')
+          || (strtolower(substr($param,0,4)) == 'wfs_')
+          || (strtolower(substr($param,0,4)) == 'ows_')
+        ){
+          $this->ms_layer->setMetaData($param, $value);
+        } elseif (strtolower($param) == 'processing') {
+          $this->ms_layer->setProcessing($value);
+        }
+      }
+      if($this->IsRaster()) {
+        t_profile_data::setLayerType($this->ms_layer,$this->Attributes->Value('data_source_type'));
+      } elseif($this->IsShape()) {
+        t_profile_data::setLayerType($this->ms_layer,$this->Attributes->Value('layer_type'));
+      }
+      switch($this->Attributes->Value('data_source_type')) {
+        case 'R' :
+          if($connection['driver'] == 'local') {
+            $this->ms_layer->set("data",$this->Attributes->Value('data_path'));
+          }
+          break;
+        case 'I' :
+          $this->ms_layer->set("tileindex",$connection['data']);
+          $this->ms_layer->set("data", NULL);
+          break;
+      }
+      return false;
+    }
+    
+    function SetMetadata() {
+      if(!$this->ms_layer) {
+        return false;
+      }
+      /*
+       * Meta
+       */
+      $this->ms_layer->setMetaData('id_connection',
+        $this->Attributes->Value('id_connection'));
+      $this->ms_layer->setMetaData('id_data_source',
+        $this->Attributes->Value('id_data_source'));
+      $this->ms_layer->setMetaData('data_source_name',
+        $this->Attributes->Value('data_source_name'));
+      /*
+      $this->ms_layer->setMetaData('data_batch_code',
+        $this->Attributes->Value('data_batch_code'));
+      $this->ms_layer->setMetaData('data_data_source_code',
+        $this->Attributes->Value('data_table_code'));
+      $this->ms_layer->setMetaData('data_short_label',
+        $this->Attributes->Value('data_short_label'));
+      $this->ms_layer->setMetaData('data_long_label',
+        $this->Attributes->Value('data_long_label'));
+      $this->ms_layer->setMetaData('data_driver',
+        $this->Attributes->Value('data_driver'));
+      $this->ms_layer->setMetaData('data_path',
+        $this->Attributes->Value('data_path'));
+      $this->ms_layer->setMetaData('data_doc',
+        $this->Attributes->Value('data_doc'));
+      //*/
+      $this->ms_layer->setMetaData('profile_data_title',
+        $this->Attributes->Value('profile_data_title'));
+      $this->ms_layer->setMetaData('id_profile_data',
+        $this->Attributes->Value('id_profile_data'));
+      /*
+       * Attributes
+       */
+      $this->ms_layer->set("name",
+        'profile_data_'.$this->Attributes->Value('id_profile_data'));
+      $this->ms_layer->set("status",
+        $this->Attributes->Value('profile_data_visible') ? MS_ON : MS_OFF);
+      $this->ms_layer->set("minscale",$this->Attributes->Value('layer_minscale'));
+      $this->ms_layer->set("maxscale",$this->Attributes->Value('layer_maxscale'));
+      $this->ms_layer->set("symbolscale",$this->Attributes->Value('layer_symbols_scale'));
+      $this->ms_layer->set("group",$this->Attributes->Value('layer_group'));
+      $this->ms_layer->set("transparency",
+                            ($this->Attributes->Value('layer_opacity')==0)
+                                ? '100' 
+                                : $this->Attributes->Value('layer_opacity'));
+      if(!$this->Attributes->IsEmpty('layer_classitem')) {
+        $this->ms_layer->set("classitem",$this->Attributes->Value('layer_classitem'));
+      }
+      if($this->IsRaster()) {
+        LibVisual::setColor(
+          $this->ms_layer->offsite,
+          $this->Attributes->Value('raster_offsite'));
+      }
+      /*
+       * Projection
+       */
+      $this->load_projection();
+      if($this->projection) {
+        $this->projection->set_projection($this->ms_layer);
+      }
+      return true;
+    }
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/profiles_columns.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/profiles_columns.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/profiles_columns.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,106 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: profiles_columns
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  //======================================================================
+  //======================================================================
+  //user -> profiles -> profile_data -> profiles_columns
+  class t_profile_column extends t_component {
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      global $db;
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_profile_column':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_profile_data':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles_data');
+          $r->Attributes->set('codefield', 'id_profile_data');
+          $r->Attributes->set('labelfield', 'profile_data_title');
+          $r->Attributes->set('orderby', Array('profile_data_title'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'id_data_column':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', Array('data_columns LEFT JOIN data_sources '.
+            'ON data_columns.id_data_source=data_sources.id_data_source'));
+          $r->Attributes->set('codefield', 'id_data_column');
+          $r->Attributes->set('labelfield', $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote('')),$db->Quote('.'),
+              'column_code',$db->Quote(' '),
+              'column_short_label'));
+          $r->Attributes->set('orderby', Array('data_source_catalog'=>'','data_source_schema'=>'','data_source_name'=>'','column_index'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'profile_column_index':
+          $r->Type= 'index';
+          break;
+        case 'profile_column_visible':
+          $r->Type= 'bool';
+          break;
+        default:
+          $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo() {
+      global $db;
+      $q=$db->query("SELECT * FROM data_columns ".
+        "WHERE id_data_column=".$db->Quote($this->Attributes->Value('id_data_column'), 'integer'));
+      $aDataColumnAttributes= $db->FetchAssoc($q);
+      if($aDataColumnAttributes) {
+        $r=$aDataColumnAttributes['column_long_label'];
+      } else {
+        $r='?';
+      }
+      $db->FreeResult($q);
+      return $r;
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/projection.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/projection.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/projection.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,84 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: projections
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-11
+ */
+  
+  //======================================================================
+  //======================================================================
+  //user -> profiles -> projection
+  class t_projection extends t_component {
+    var $OrderBy='projection_name';
+    var $HasPrivilegeInfos=true;
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_projection':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'projection_name':
+          $r->Type= 'text';
+          break;
+        case 'projection_params':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          $r->Attributes->set('rows', 2);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('projection_name');
+    }
+    
+    function set_projection(&$ms_obj) {
+      $ms_obj->setProjection($this->Attributes->Value('projection_params'));
+    }
+  }
+  
+  class t_projections_list extends t_list {
+    var $ChildObjectTypes=Array('projection');
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/query_form.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/query_form.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/query_form.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,95 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: query_forms
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  //======================================================================
+  //======================================================================
+  //query_forms -> query_form
+  class t_query_form extends t_component {
+    var $OrderBy='query_form_menu_title';
+    var $HasPrivilegeInfos=true;
+    
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      global $db;
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_query_form':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_data_source':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'data_sources');
+          $r->Attributes->set('codefield', 'id_data_source');
+          $r->Attributes->set('labelfield', $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote(''))));
+          $r->Attributes->set('orderby', Array('data_source_catalog'=>'','data_source_schema'=>'','data_source_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'query_form_menu_title':
+        case 'query_form_title':
+          $r->Type= 'text';
+          break;
+        case 'query_form_header':
+        case 'query_form_form':
+        case 'query_form_params':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('query_form_menu_title');
+    }
+  }
+  
+  class t_query_forms_list extends t_list {
+    var $ChildObjectTypes=Array('query_form');
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/query_result.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/query_result.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/query_result.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,171 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: query_results
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  //======================================================================
+  //======================================================================
+  //user -> query_result
+  class t_query_result extends t_component {
+    var $OrderBy='query_result_name';
+    var $HasPrivilegeInfos=true;
+    function ShortInfo() {
+      return $this->Attributes->Value('query_result_name');
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      global $db;
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_query_result':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_profile_data':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles_data');
+          $r->Attributes->set('codefield', 'id_profile_data');
+          $r->Attributes->set('labelfield', 'profile_data_title');
+          $r->Attributes->set('orderby', Array('profile_data_title'=>''));
+          $r->Attributes->set('nullable', false);
+          $r->Attributes->set('ignore', true);
+          break;
+        case 'id_data_source':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'data_sources');
+          $r->Attributes->set('codefield', 'id_data_source');
+          $r->Attributes->set('labelfield', $db->SQLConcat(
+              $db->SQLCoalesce('data_source_catalog',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_schema',$db->Quote('')),$db->Quote('.'),
+              $db->SQLCoalesce('data_source_name',$db->Quote(''))));
+          $r->Attributes->set('orderby', Array('data_source_catalog'=>'','data_source_schema'=>'','data_source_name'=>''));
+          $r->Attributes->set('nullable', false);
+          $r->Attributes->set('ignore', true);
+          break;
+        case 'query_result_name':
+          $r->Type= 'text';
+          break;
+        case 'query_result_data':
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          $r->Attributes->set('ignore', true);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    /**
+     * Print special button (change password,
+     * view mapfile, wizards, ...)
+     */
+    function PrintSpecialButtons() {
+      echo '  <input type="button" name="show_query_result" '.
+        'value="'.html_l10n('Show').'" '.
+        'onclick="return(showQueryResult('.$this->Attributes->Value('id_query_result').'));">&nbsp;'."\n";
+    }
+    
+    function show() {
+      global $map,  $user;
+      $oProfiles= & LibComponent::Load('profiles');
+      $oProfileData= & $oProfiles->GetSubItemByClassNameAndAttribute('profile_data','id_profile_data',
+        $this->Attributes->Value('id_profile_data'));
+      if(!$oProfileData) {
+        $oProfileData= $oProfiles->GetSubItemByClassNameAndAttribute(
+          'profile_data','id_data_source',$this->Attributes->Value('id_data_source'));
+      }
+      if($oProfileData) {
+        $oConnections= & LibComponent::Load('connections');
+        $oDataSource= & $oConnections->GetSubItemByClassNameAndAttribute('data_source','id_data_source',
+          $this->Attributes->Value('id_data_source'));
+        if($oDataSource) {
+          $oConnection= & $oDataSource->GetParent();
+          if($oConnection) {
+            $oDb= & $oConnection->GetDb(DB_SUPPORTS_DRAWING);
+            if($oDb) {
+              $tmp_name = tempnam(Conf::get('tmp_dir'),'q_');
+              $fp = fopen($tmp_name, 'w');
+              $ms_layer= $map->get_ms_layer_by_id_profile_data(
+                $oProfileData->Attributes->Value('id_profile_data'));
+              $qr= base64_decode($this->Attributes->Value('query_result_data'));
+              //layer count
+              $qr{0}= chr(1);
+              $qr{1}= chr(0);
+              $qr{2}= chr(0);
+              $qr{3}= chr(0);
+              //layer index (should be <256)
+              $qr{4}= chr($ms_layer->index);
+              $qr{5}= chr(0);
+              $qr{6}= chr(0);
+              $qr{7}= chr(0);
+              fwrite($fp, $qr);
+              fclose($fp);
+              $r = $map->ms_map->loadquery($tmp_name);
+              unlink($tmp_name);
+              return Array($oDataSource, $oDb, Array($ms_layer,$r));
+            } else {
+              add_error(l10n('Connection does not support Drawing.'));
+            }
+          } else {
+            add_error(sprintf(l10n('%s not found.'),
+                translate('connection')));
+          }
+        } else {
+          add_error(sprintf(l10n('%s not found: "%s".'),
+              translate('data_source'),
+              'id:'.$this->Attributes->Value('id_data_source')));
+        }
+      } else {
+        add_error(sprintf(l10n('%s not found: "%s".'),
+            translate('profile_data'),
+            'id:'.$this->Attributes->Value('id_profile_data').','.
+            'id_data_source:'.$this->Attributes->Value('id_data_source')));
+      }
+      return false;
+    }
+  }
+  
+  class t_query_results_list extends t_list {
+    var $ChildObjectTypes=Array('query_result');
+  }
+  
+  ?>

Added: packages/musmap/branches/upstream/current/include/model/session.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/session.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/session.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,128 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * binding to table: sessions
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  //======================================================================
+  //======================================================================
+  //user -> sessions
+  class t_session extends t_component {
+    var $OrderBy='session_modification_time ';
+    function ShortInfo() {
+      return date(l10n('_date'),$this->Attributes->Value('session_creation_time'));
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'session_id':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_user':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'users');
+          $r->Attributes->set('codefield', 'id_user');
+          $r->Attributes->set('labelfield', 'user_name');
+          $r->Attributes->set('orderby', Array('user_name'=>''));
+          $r->Attributes->set('nullable', false);
+          $r->Attributes->set('ignore', true);
+          break;
+        case 'id_profile':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles');
+          $r->Attributes->set('codefield', 'id_profile');
+          $r->Attributes->set('labelfield', 'profile_name');
+          $r->Attributes->set('orderby', Array('profile_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'id_query_result':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'query_results');
+          $r->Attributes->set('codefield', 'id_query_result');
+          $r->Attributes->set('labelfield', 'query_result_name');
+          $r->Attributes->set('orderby', Array('query_result_name'=>''));
+          $r->Attributes->set('nullable', true);
+          break;
+        case 'session_security_id':
+          $r->Type= 'text';
+          $r->Attributes->set('ignore', true);
+          break;
+        default:
+          $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function Id() {
+      return 'session_id';
+    }
+    
+    function CanDelete() {
+      $user= & $this->GetParent();
+      return is_object($user) 
+        && ($this->Attributes->Value('id_user') == $user->Attributes->Value('id_user'));
+    }
+    
+    function CanWrite() {
+      $user= & $this->GetParent();
+      return is_object($user) 
+        && ($this->Attributes->Value('id_user') == $user->Attributes->Value('id_user'));
+    }
+    
+    function CanDuplicate() {
+      return false;
+    }
+    
+    
+    function Change($params, $bVerbose= true) {
+      $params2= Array();
+      if(isset($params['id_profile'])) {
+        $params2['id_profile']= $params['id_profile'];
+      }
+      if(isset($params['id_query_result'])) {
+        $params2['id_query_result']= $params['id_query_result'];
+      }
+      parent::Change($params2,$bVerbose);
+    }
+  }
+  
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/style.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/style.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/style.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,150 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Classes 'classe",annotation et style
+ *
+ * Données profil, Couches, ...
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+ 
+  //USER->PROFILES->PROFILE_DATA LAYER->CLASS->STYLE
+  class t_style extends t_component {
+    var $ms_style;
+    var $main_infos = Array('style_color'=>Array(),
+      'style_background_color'=>array(),
+      'style_index'=>array());
+    var $OrderBy='style_index';
+    
+    function BuildMe() {
+      global $map,$db;
+      $parent_node= & $this->GetParent();
+      if($parent_node->ms_class===NULL) {
+        return;
+      }
+      $this->ms_style=ms_newStyleObj($parent_node->ms_class);
+      //Attach symbol
+      if($this->Attributes->Value('id_symbol')) {//doesn't load symmbol of id=0
+        $symbol_r=$db->query("SELECT * ".
+            "FROM symbols ".
+            "WHERE id_symbol=".$db->Quote($this->Attributes->Value('id_symbol'), 'integer')." ");
+        while($symbol_row=$db->FetchAssoc($symbol_r)){
+          if($symbol_row['symbol_type']=='P') { //pixmap
+            $this->ms_style->set("symbolname", $symbol_row['symbol_image_path']);
+          } else {
+            $this->ms_style->set("symbolname", 's'.$symbol_row['id_symbol']);
+          }
+        }
+        $db->FreeResult($symbol_r);
+      }
+      //colors
+      LibVisual::setColor($this->ms_style->backgroundcolor,
+          $this->Attributes->Value("style_background_color"));
+      LibVisual::setColor($this->ms_style->color,$this->Attributes->Value("style_color"));
+      LibVisual::setColor($this->ms_style->outlinecolor,$this->Attributes->Value("style_outline_color"));
+      
+      //size
+      $this->ms_style->set("size",$this->Attributes->Value("style_size"));
+      if($this->Attributes->Value("style_symbol_maxsize")>0) {
+        $this->ms_style->set("maxsize",$this->Attributes->Value("style_symbol_maxsize"));
+      }
+      $this->ms_style->set("minsize",$this->Attributes->Value("style_symbol_minsize"));
+      
+      //
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      global $db;
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_style':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_class':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'classes');
+          $r->Attributes->set('codefield', 'id_class');
+          $r->Attributes->set('labelfield', 'class_name');
+          $r->Attributes->set('orderby', Array('class_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'id_symbol':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'symbols');
+          $r->Attributes->set('codefield', 'id_symbol');
+          $r->Attributes->set('labelfield', $db->SQLConcat(
+              'symbol_family',$db->Quote('>'),
+              'symbol_name'));
+          $r->Attributes->set('orderby', Array('symbol_family'=>'','symbol_name'=>''));
+          $r->Attributes->set('nullable', true);
+          break;
+        case 'style_name':
+          $r->Type= 'text';
+          break;
+        case 'style_background_color':
+        case 'style_color':
+        case 'style_outline_color':
+          $r->Type= 'color';
+          break;
+        case 'style_size':
+        case 'style_symbol_maxsize':
+        case 'style_symbol_minsize':
+          $r->Type= 'integer';
+          break;
+        case 'style_index':
+          $r->Type= 'index';
+          $r->Attributes->set('max', 999);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function PrintObject() {
+      $parent_node = & $this->GetParent();
+      $parent_node->PrintObject();//Draw the class
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('style_name');
+    }
+    
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/model/symbol.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/symbol.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/symbol.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,253 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Liste des symbols
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-07
+ */
+ 
+  require_once('visual.inc.php');
+ 
+  class t_symbols_list extends t_list {
+    var $ChildObjectTypes=Array('symbol');
+    /**
+     * Ajout d'un enfant
+     *
+     * Modification directement dans la base
+     * La page devra ensuite être rechargée pour
+     * tenir compte des modifications
+     * 
+     */
+    function & add_child($child_type,$params=Array()) {
+      global $db;
+      if(    ($child_type=='symbol')
+          && (empty($params['symbol_name']))) {
+        $params['symbol_name'] = l10n('Untitled symbol');
+      }
+      if(    ($child_type=='symbol')
+          && (empty($params['symbol_type']))) {
+        $params['symbol_type'] = 'S';
+      }
+      return parent::add_child($child_type,$params);
+    }
+  }
+
+  //SYMBOL
+  class t_symbol extends t_component {
+    var $ms_symbol;
+    var $OrderBy='symbol_family,symbol_name';
+    var $HasPrivilegeInfos=true;
+    
+    function BuildMe() {
+      global $map;
+      if($this->ms_symbol) {
+        return;
+      }
+      if(empty($map)) {
+        return;
+      }
+      $symbol_id= @ms_newSymbolObj($map->ms_map, 's'.$this->Attributes->Value('id_symbol'));
+      $this->ms_symbol= $map->ms_map->getSymbolObjectById($symbol_id);
+      t_symbol::setSymbolType($this->ms_symbol,$this->Attributes->Value('symbol_type'));
+      $this->ms_symbol->set('filled',$this->Attributes->Value('symbol_filled'));
+      $this->ms_symbol->set('inmapfile',MS_TRUE);
+      preg_match_all("/\s*(\S+)\s*/",
+               $this->Attributes->Value('symbol_points'), $points);
+      if(sizeof($points[1])) {
+        $this->ms_symbol->setpoints($points[1]);
+      }
+      if(!$this->Attributes->IsEmpty('symbol_style')) {
+        preg_match_all("/\s*(\S+)\s*/",
+                 $this->Attributes->Value('symbol_style'), $style);
+        if(sizeof($style[1])) {
+          $this->ms_symbol->setStyle($style[1]);
+        }
+      }
+      if($this->Attributes->Value('symbol_type')=='T') {
+        /*
+        $this->ms_symbol->set("character","é");
+        if(empty($this->Attributes->Value('symbol_font'))) {
+          $this->ms_symbol->set("font","vera");
+        } else {
+          $this->ms_symbol->set("font",
+              $this->Attributes->Value('symbol_font'));
+        }
+        //*/
+      }
+      if($this->Attributes->Value('symbol_type')=='P') {
+        /*
+	$sImagePath= $this->Attributes->Value('symbol_image_path');
+	if($user->CanReadFile($sImagePath)) {
+          $this->ms_symbol->set('imagepath', $sImagePath);
+	} else {
+          Information(sprintf(l10n('You don\'t have access to "%s".'),
+	            $sImagePath));
+	}
+        //*/
+      }
+      
+      $this->ms_symbol->set('sizex',2);
+      $this->ms_symbol->set('sizey',2);
+      //*/
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('string', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_symbol':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'symbol_family':
+        case 'symbol_name':
+          $r->Type= 'text';
+          break;
+        case 'symbol_type':
+          $r->Type= 'fromarray';
+          $r->Attributes->set('array', Array(
+            'V'=>html_l10n('Vector'),
+            'E'=>html_l10n('Ellipse'),
+            'P'=>html_l10n('Image'),
+            'T'=>html_l10n('Font'),
+            'S'=>html_l10n('Simple')));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'symbol_filled':
+          $r->Attributes->set('ignore', $this->Attributes->Value('symbol_type')==='P');
+          $r->Type= 'bool';
+          break;
+        case 'symbol_font':
+          $r->Attributes->set('ignore', $this->Attributes->Value('symbol_type')!=='F');
+          $r->Type= 'fromarray';
+          $aFontFileLines=file(Conf::get('font_list_path'));
+          $fonts= Array();
+          foreach($aFontFileLines AS $sFontFileLine) {
+            if(preg_match('/^(\S*)\s*(.*?)\s*$/',$sFontFileLine,$aMatches)) {
+              if(strtolower(substr($aMatches[2],-4)) == '.fdb') {
+                continue;//hiding fdb fonts (for swig)
+              }
+              $fonts[$aMatches[1]]=$aMatches[1];
+            }
+          }
+          $r->Attributes->set('array', $fonts);
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'symbol_image_path':
+          $r->Attributes->set('ignore', $this->Attributes->Value('symbol_type')!=='P');
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          $r->Attributes->set('rows', 2);
+          break;
+        case 'symbol_points':
+          $r->Attributes->set('ignore', !in_array($this->Attributes->Value('symbol_type'),
+            Array('V','E')));
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          break;
+        case 'symbol_style':
+          $r->Attributes->set('ignore', !in_array($this->Attributes->Value('symbol_type'),
+            Array('V','E','S')));
+          $r->Type= 'text';
+          $r->Attributes->set('memo', true);
+          $r->Attributes->set('rows', 1);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function PrintObject() {
+      global $map;
+      $this->BuildMe();
+      $ms_layer=ms_newLayerObj($map->ms_map);
+      $ms_class=ms_newClassObj($ms_layer);
+      $ms_style=ms_newStyleObj($ms_class);
+      if($this->Attributes->Value('symbol_type')=='P') {
+        $ms_style->set('symbolname', $this->Attributes->Value('symbol_image_path'));
+      } else {
+        $ms_style->set('symbolname', 's'.$this->Attributes->Value('id_symbol'));
+      }
+      //colors
+      LibVisual::setColor($ms_style->backgroundcolor,'#FF0000');
+      LibVisual::setColor($ms_style->color,'#00FF00');
+      LibVisual::setColor($ms_style->outlinecolor,'#0000FF');
+      foreach(
+          Array(MS_LAYER_POINT=>l10n('Point'),
+            MS_LAYER_LINE=>l10n('Line'),
+            MS_LAYER_POLYGON=>l10n('Polygon'),
+            ) AS $ms_type=>$var_name) {
+        $ms_layer->set('type',$ms_type);
+        ${$var_name.'_img'}= $ms_class->CreateLegendIcon(50,30);
+        echo '<img src='.
+          '"'.(${$var_name.'_img'}->saveWebImage()).'"'.
+          'border="0" title="'.$var_name.'">';
+      }
+    }
+    
+    function setSymbolType(&$symbol,$type) {
+      switch($type) {
+        case 'V'://Vector
+          $symbol->set("type",MS_SYMBOL_VECTOR);
+          break;
+        case 'E'://Ellipse
+          $symbol->set("type",MS_SYMBOL_ELLIPSE);
+          break;
+        case 'P'://Pixmap
+          $symbol->set("type",MS_SYMBOL_PIXMAP);
+          break;
+        case 'T'://Truetype (police)
+          $symbol->set("type",MS_SYMBOL_TRUETYPE);
+          break;
+        case 'S'://Simple
+          $symbol->set("type",MS_SYMBOL_SIMPLE);
+          break;
+        default://Autre
+          add_error(sprintf(l10n('Unknown symbol type: "%s".'),$type));
+          break;
+      }
+    }
+  
+    function ShortInfo() {
+      return $this->Attributes->Value('symbol_name');
+    }
+    
+  }
+
+
+?>

Added: packages/musmap/branches/upstream/current/include/model/user.class.php
===================================================================
--- packages/musmap/branches/upstream/current/include/model/user.class.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/model/user.class.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,322 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * classe profils
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @subpackage model
+ * @since 2004-06
+ */
+  
+  require_once('auth/basic.auth.class.php');
+  require_once('session.class.php');
+  require_once('query_result.class.php');
+  
+  
+  /* \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+   * ===================================================================
+   * ////////////////////////////////////////////////////////////////*/
+  //USER
+  class t_user extends t_component {
+    var $_Auth= NULL;
+    var $ChildObjectTypes=Array('session');
+    var $user_ok=false;
+    var $IsLocalAdmin=false;
+    var $_groups= NULL;
+    var $Session= NULL;
+    
+    function t_user() {
+      parent::TDbRecordBinding(Array());
+    }
+
+    /**
+     * Does user have access to a file ?
+     * @param string $sPath File path to test
+     * @return bool
+     */
+    function CanReadFile($sPath) {
+      return true;
+    }
+    
+    /**
+     * Return the field type
+     * @return TType
+     */
+    function & GetFieldType($sFieldName) {
+      $r= & new TType('text', $this->Attributes->GetAttribute($sFieldName));
+      switch($sFieldName) {
+        case 'id_user':
+          $r->Type= 'integer';
+          $r->Attributes->set('visible', false);
+          break;
+        case 'id_profile':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles');
+          $r->Attributes->set('codefield', 'id_profile');
+          $r->Attributes->set('labelfield', 'profile_name');
+          $r->Attributes->set('orderby', Array('profile_name'=>''));
+          $r->Attributes->set('nullable', false);
+          break;
+        case 'user_name':
+          $r->Type= 'text';
+          break;
+        case 'user_password':
+          $r->Type= 'text';
+          $r->Attributes->set('ignore', true);
+          break;
+        case 'session_id_profile':
+          $r->Type= 'fromtable';
+          $r->Attributes->set('tablename', 'profiles');
+          $r->Attributes->set('codefield', 'id_profile');
+          $r->Attributes->set('labelfield', 'profile_name');
+          $r->Attributes->set('orderby', Array('profile_name'=>''));
+          $r->Attributes->set('nullable', false);
+          $r->Virtual= true;
+          $r->Attributes->set('ignore', true);
+          break;
+        case 'session_id':
+        case 'session_security_id':
+        case 'id_query_result':
+          $r= & t_session::GetFieldType($sFieldName);
+          $r->Attributes->set('ignore', true);
+          break;
+        default:
+        $r= & parent::GetFieldType($sFieldName);
+      }
+      return $r;
+    }
+    
+    function LoadMe() {
+      if($_SERVER["REMOTE_ADDR"]==='127.0.0.1'
+          && defined('MUSMAP_IS_ADMIN_FILE')) {
+        //Local admin
+        $this->IsLocalAdmin= true;
+        $this->Attributes->Set('id_user', NULL);
+      } else {
+        $this->Authenticate();
+      }
+    }
+    
+    
+    /**
+     * Show a logging form
+     */
+    function print_logging_form($message_id,$message) {
+      require_once('badlog.tmpl.php');
+      exit;
+    }
+    
+    /**
+     * Print special button (change password,
+     * view mapfile, wizards, ...)
+     */
+    function PrintSpecialButtons() {
+      echo '  <input type="button" name="change_password'.
+          '['.$this->ClassName().']'.
+          '['.$this->Id().']'.
+          '['.$this->IdValue().']" '.
+        'value="'.html_l10n('Change password').'" '.
+        'onclick="return(changePassword());">&nbsp;'."\n";
+      echo '  <a href="import_mapfile.php">'.
+        html_l10n('Mapfile importation').
+        '</a>&nbsp;';
+    }
+    
+    /**
+     * Authentificate
+     *
+     * <p>Check if the user and the password is correct.
+     * Then create a session cookie, stored in <i>sessions</i> table
+     * to follow the user without sending the password each time.</p>
+     * <p><u>NB:</u> When the user is logged in, only two cookies are
+     * sent : MusmapSession and MusmapSessionSecurity.
+     * Password is only sent once.
+     * </p>
+     */
+    function Authenticate(){
+      global $db;
+      isset($_POST['user_name']) || ($_POST['user_name']= '');
+      isset($_POST['user_password']) || ($_POST['user_password']= '');
+      $this->Attributes->SetTo(Array(
+        'user_name'=>$_POST['user_name'],
+        'user_password'=>$_POST['user_password']));
+      $message='';
+      $message_id="login";
+      $this->_Auth= & new TAuthBasic();
+      //$this->_Auth= & new TAuthBasicLDAP();
+      switch($this->_Auth->Authenticate($this, $this->Session)) {
+        case MUSMAP_AUTH_USER_OK:
+          if(defined('MUSMAP_IS_ADMIN_FILE')
+              && !in_array($this->Attributes->Value('user_name'),Conf::get('admin_users'))) {
+            $message= l10n("You need special privileges to enter in this area.");
+            $message_id="error";
+            break;
+          } else {
+            //current_profile change
+            if(isset($_REQUEST['CHANGE_id_profile'])) {
+              $this->Session->Change(Array('id_profile'=>$_REQUEST['CHANGE_id_profile']), false);
+            }
+            //user is valid
+            return;
+          }
+        case MUSMAP_AUTH_USER_INVALID:
+          $message=l10n("Your user name or password is invalid.").' '.
+            l10n("Please enter valid user name and password.");
+          $message_id="error";
+          break;
+        case MUSMAP_AUTH_USER_NO_DATA:
+          $message= l10n("Please enter valid user name and password.");
+          break;
+        case MUSMAP_AUTH_UNAVAILABLE:
+          $message= l10n("Authentication service is unavailable.");
+          $message_id="error";
+          break;
+        case MUSMAP_AUTH_LOGOUT:
+          $message= l10n('You have logged out.').' '.
+            l10n("Please enter valid user name and password.");
+          break;
+        case MUSMAP_AUTH_USER_EXPIRED:
+          $message= l10n('Your session has expired.').' '.
+            l10n("Please enter valid user name and password.");
+          break;
+        case MUSMAP_AUTH_INSUFFICIENT_PRIVILEGES:
+          $message= l10n("You don't have sufficient privileges for this area.");
+          break;
+        default:
+      }
+      t_user::print_logging_form($message_id,$message);
+    }
+    //end authenticate
+    
+    function change_password($old_password,$new_password,$new_password2) {
+      global $db;
+      if(empty($new_password) || empty($new_password2)) {
+        add_error(l10n('Your new password is empty!'));
+      } elseif($new_password!=$new_password2) {
+        add_error(l10n('Your new password should be repeated exactly!'));
+      } else {
+        $user_exists=$db->Query("SELECT * FROM users ".
+            "WHERE id_user=".$db->Quote($this->Attributes->Value('id_user'))." ".
+              "AND user_password=".$db->Quote(password($old_password)));
+        $aUserAttributes= $db->FetchAssoc($user_exists);
+        if($aUserAttributes) {
+          $db->Query("UPDATE users ".
+              "SET user_password=".$db->Quote(password($new_password))." ".
+              "WHERE id_user=".$db->Quote($this->Attributes->Value('id_user'))." ".
+                "AND user_password=".$db->Quote(password($old_password)));
+          add_error(l10n('Done'));
+        } else {
+          add_error(l10n('The old password is not good!'));
+        }
+      }
+    }
+    
+    function ShortInfo() {
+      return $this->Attributes->Value('user_name');
+    }
+    
+    function print_logout_button() {
+      if($this->Attributes->Value('id_user')!==NULL) {
+        echo "\n";
+        echo '    <form method="GET">'."\n";
+        echo '      <input type="hidden" name="logout" value="1">'."\n";
+        echo '      <input type="submit" value="'.html_l10n('Log out').'">'."\n";
+        echo '    </form>'."\n";
+      }
+    }
+    
+    function CanWrite() {
+      return true;
+    }
+    
+    function CanDuplicate() {
+      return false;
+    }
+    function CanDelete() {
+      return false;
+    }
+    
+    /**
+     *
+     */
+    function InGroup($group_id) {
+      return in_array($group_id, $this->GetGroups());
+    }
+    
+    function GetGroups() {
+      global $db;
+      if($this->_groups === NULL) {
+        $this->_groups= Array();
+        if($this->Attributes->Value('id_user')===NULL) {
+          //admin is in all groups
+          $rGroups= $db->Query("SELECT * FROM groups ");
+        } else {
+          $rGroups= $db->Query("SELECT * FROM users_groups ".
+              "WHERE id_user=".$db->Quote($this->Attributes->Value('id_user'),'integer'));
+        }
+        while($aGroup= $db->FetchAssoc($rGroups)) {
+          $this->_groups[]= (integer) $aGroup['id_group'];
+        }
+        $db->FreeResult($rGroups);
+        unset($rGroups);
+      }
+      return $this->_groups;
+    }
+    
+    function InGroupClause($field) {
+      global $db;
+      $aGroups= $this->GetGroups();
+      $r= '0=1 ';
+      while(count($aGroups)>0) {
+        $r.='OR '.$db->QuoteIdentifier($field).'='.((integer) array_pop($aGroups)).' ';
+      }
+      if($r<>'0=1 ') {
+        $r= substr($r,7);
+      }
+      return $r;
+    }
+    
+    function CanReadClause($sChildObjectPrefix) {
+      return '('.
+        $sChildObjectPrefix.'_owner_id IS NULL '.
+        'OR '.$sChildObjectPrefix.'_owner_id='.((integer) $this->Idvalue()).' '.
+        'OR '.$this->InGroupClause($sChildObjectPrefix.'_reader_group_id').
+        'OR '.$this->InGroupClause($sChildObjectPrefix.'_writer_group_id').
+        ')';
+    }
+    
+  }
+  
+  class t_users_list extends t_list {
+    var $ChildObjectTypes=Array('user');
+  }
+  ?>

Added: packages/musmap/branches/upstream/current/include/musmap_meta.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/musmap_meta.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/musmap_meta.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,105 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 2005-05                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Musmap metadata
+ * @author Mathieu Parent
+ * @copyright 2005-05, Mathieu PARENT
+ * @package include
+ * @subpackage development
+ * @since 2005-05
+ */
+  
+  /**
+   * Musmap foreign keys
+   *
+   * Format: 'table containing the foreign key'=> Array(
+   *           Array(fk, destination table, primary key=fk, Array(skipped values)=none, delete=false),
+   *           ...)
+   */
+  $relations=Array(
+    'classes'=>           Array(Array('id_profile_data','profiles_data')),
+    'connections'=>       Array(),
+    'data_columns'=>      Array(Array('id_data_source','data_sources')),
+    'extents'=>           Array(),
+    'groups'=>            Array(),
+    'labels'=>            Array(Array('id_class','classes')),
+    'map_references'=>    Array(Array('id_extent','extents')),
+    'profiles'=>          Array(),
+    'profiles_columns'=>  Array(Array('id_profile_data','profiles_data'),
+                                Array('id_data_column','data_columns')),
+    'profiles_data'=>     Array(Array('id_data_source','data_sources', NULL, NULL,false),
+                                Array('id_profile','profiles')),
+    'profile_extents'=>   Array(Array('id_profile','profiles'),
+                                Array('id_extent','extents')),
+    'projections'=>            Array(),
+    'query_forms'=>       Array(Array('id_data_source','data_sources')),
+    'query_results'=>     Array(Array('id_data_source','data_sources'),
+                                Array('id_profile_data','profiles_data', NULL, NULL,false)),
+    'relations'=>         Array(Array('id_data_column','data_columns'),
+                                Array('dat_id_data_column','data_columns','id_data_column')),
+    'sessions'=>          Array(Array('id_user','users'),
+                                Array('id_profile','profiles',NULL,NULL,false),
+                                Array('id_query_result','query_results',NULL,NULL,false)),
+    'styles'=>            Array(Array('id_class','classes'),
+                                Array('id_symbol','symbols',NULL,Array(0))),
+    'symbols'=>           Array(),
+    'data_sources'=>      Array(Array('id_connection','connections'),
+                                Array('id_projection','projections', NULL,Array(0))),
+    'tool_settings'=>     Array(),
+    'users'=>             Array(Array('id_profile','profiles', NULL, NULL, false)),
+    'users_groups'=>      Array(Array('id_user','users'),
+                                Array('id_group','groups'))
+  );
+  
+  $primary_keys=Array(
+    'classes'=>           Array('id_class'),
+    'connections'=>       Array('id_connection'),
+    'data_columns'=>      Array('id_data_column'),
+    'extents'=>           Array('id_extent'),
+    'groups'=>            Array('id_group'),
+    'labels'=>            Array('id_label'),
+    'map_references'=>    Array('id_map_reference'),
+    'profiles'=>          Array('id_profile'),
+    'profiles_columns'=>  Array('id_profile_column'),
+    'profiles_data'=>     Array('id_profile_data'),
+    'profile_extents'=>   Array('id_profile','id_extent'),
+    'projections'=>       Array('id_projection'),
+    'query_forms'=>       Array('id_query_form'),
+    'query_results'=>     Array('id_query_result'),
+    'relations'=>         Array('id_relation'),
+    'sessions'=>          Array(),//non numeric
+    'styles'=>            Array('id_style'),
+    'symbols'=>           Array('id_symbol'),
+    'data_sources'=>      Array('id_data_source'),
+    'tool_settings'=>     Array(),//non numeric
+    'users'=>             Array('id_user'),
+    'users_groups'=>      Array('id_user','id_group')
+  );
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/pre.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/pre.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/pre.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,260 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Startup file
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+
+ define('MUSMAP_ROOT_DIR',
+  substr(str_replace('\\', '/', __FILE__),0,-strlen('/include/pre.inc.php')));
+
+  if(!defined("MUSMAP_VERSION")) {
+    define("MUSMAP_VERSION_MAJOR",0);
+    define("MUSMAP_VERSION_MINOR",9);
+    define("MUSMAP_VERSION_REVISION",1);
+    // '', '-dev', '-beta', '-rc1', '-rc2'
+    define("MUSMAP_VERSION_DEV",'');
+    define("MUSMAP_VERSION",
+      MUSMAP_VERSION_MAJOR.'.'.
+      MUSMAP_VERSION_MINOR.'.'.
+      MUSMAP_VERSION_REVISION.
+      MUSMAP_VERSION_DEV);
+  }
+
+ 
+  /**
+   * Misc functions
+   */
+  require_once('misc.inc.php');
+  
+  //Initial time point
+  LibMisc::TimePoint('start include/pre.inc.php');
+  
+  //unquotes if magic quote enabled
+  if(get_magic_quotes_gpc()) {
+    function stripslashes_deep($value)
+    {
+      $value = is_array($value) ?
+        array_map('stripslashes_deep', $value) :
+        stripslashes($value);
+      return $value;
+    }
+    $_POST = array_map('stripslashes_deep', $_POST);
+    $_GET = array_map('stripslashes_deep', $_GET);
+    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
+    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
+  }
+
+  ini_set('include_path',ini_get('include_path')
+    .PATH_SEPARATOR.MUSMAP_ROOT_DIR.'/include');
+  
+  /**
+   * Localization
+   */
+  require_once('localization.inc.php');
+
+  /**
+   * Collection
+   */
+  require_once('library/collection.class.php');
+  
+  /**
+   * FrameWork
+   */
+  require_once('framework/framework.class.php');
+  
+  /**
+   * HTML frameWork
+   */
+  require_once('framework/html/htmlframework.class.php');
+  
+  /**
+   * Current framework
+   * For now, framework is HTML
+   * @global TFrameWork
+   */
+  $fw= & new THTMLFrameWork();
+  
+  /**
+   * FrameWork functions
+   */
+  require_once('framework/framework.inc.php');
+  
+  /**
+   * Errors handling
+   */
+  require_once('error.inc.php');
+	  
+  /**
+   * Settings functions
+   * require l10n
+   */
+  require_once('conf.inc.php');
+  
+  /**
+   * Settings
+   */
+  require_once('conf/config.php');
+  
+  /**
+   * Logging
+   */
+  require_once('log.class.php');
+  
+  // Start loging
+  $log=new TLog();
+  
+  //no max execution time
+  // (some processes can take a long time)
+  ini_set('max_execution_time',0);
+  
+  /*
+   * Load mapscript extension
+   */
+	if (!extension_loaded('mapscript' )) {
+	  if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
+	   @dl('php_mapscript.dll');
+	  } else {
+	   @dl('php_mapscript.so');
+	  }
+	}
+  
+  /**
+   * Database misc functions
+   */
+  require_once('database/db.inc.php');
+  
+  /**
+   * Base database engine class
+   */
+  require_once('database/db.class.php');
+  
+  /**
+   * Load database specific engine drivers
+   */
+  $d=dir(Conf::Get('musmap_root_dir').'/include/database');
+  while(false !== ($entry = $d->read())) {
+    if($entry=='.' || $entry=='..'
+        ||is_dir($d->path.'/'.$entry)
+        || substr($entry,-13)!='.db.class.php') {
+      continue;
+    }
+    require_once($d->path."/$entry");
+  }
+  $d->close();
+  unset($entry);
+  unset($d);
+  //sort by name to have always the same result
+  ksort($g_oDbEngines);
+  
+  /*
+   * Load musmap database and connect
+   */
+  $sDbEngine= getDbEngine(Conf::get('db_engine'),
+    DB_SUPPORTS_SQL | DB_SUPPORTS_GET_LAST_INSERT_ROW_ID);
+  if($sDbEngine === false) {
+    Warning(sprintf(l10n('Database engine not found for "%s".'),
+      Conf::get('db_engine')));
+    exit;
+  }
+  /**
+   * Musmap database
+   * @global TDbEngine
+   */
+  $db = new $sDbEngine();
+  unset($sDbEngine);
+  
+  //Connect
+  $db->Connect(Conf::get('db_params'));
+  
+  
+  /**
+   * Current map
+   * @global TMap
+   */
+  global $map;
+  $map= NULL;
+  
+  /**
+   * Map class
+   */
+  require_once('map.class.php');
+  
+  /**
+   * Component class
+   */
+  require_once('model/component.class.php');
+  
+  /**
+   * Base list class
+   */
+  require_once('model/list.class.php');
+  
+  /**
+   * Connection class and children
+   */
+  require_once('model/connection.class.php');
+  
+  /**
+   * Projection class
+   */
+  require_once('model/projection.class.php');
+  
+  /**
+   * Profile class and children
+   */
+  require_once('model/profile.class.php');
+  
+  /**
+   * Query form class
+   */
+  require_once('model/query_form.class.php');
+  
+  /**
+   * User class
+   */
+  require_once('model/group.class.php');
+
+  /**
+   * ESRI XML metadata
+   */
+  require_once('contrib/metadata/esri_meta.inc.php');
+  
+  /**
+   * Override configuration using database
+   */
+  Conf::Override();
+  
+  LibMisc::TimePoint('end include/pre.inc.php');
+?>

Added: packages/musmap/branches/upstream/current/include/pre_admin.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/pre_admin.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/pre_admin.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,47 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Startup file for admin
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+
+  define('MUSMAP_IS_ADMIN_FILE', 1);
+  /**
+   * Startup file
+   */
+  require_once('pre.inc.php');
+  
+  
+  $user=& new t_user();
+?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/sql/create_tables.firebird.sql
===================================================================
--- packages/musmap/branches/upstream/current/include/sql/create_tables.firebird.sql	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/sql/create_tables.firebird.sql	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,144 @@
+/* Generators */
+CREATE GENERATOR classes_id_class;;
+CREATE TRIGGER insert_class FOR classes
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_class = GEN_ID(classes_id_class, 1);
+  END;;
+
+CREATE GENERATOR data_columns_id_data_column;;
+CREATE TRIGGER insert_data_column FOR data_columns
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_data_column = GEN_ID(data_columns_id_data_column, 1);
+  END;;
+
+CREATE GENERATOR data_sources_id_data_source;;
+CREATE TRIGGER insert_data_source FOR data_sources
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_data_source = GEN_ID(data_sources_id_data_source, 1);
+  END;;
+
+CREATE GENERATOR connections_id_connection;;
+CREATE TRIGGER insert_connection FOR connections
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_connection = GEN_ID(connections_id_connection, 1);
+  END;;
+
+CREATE GENERATOR extents_id_extent;;
+CREATE TRIGGER insert_extent FOR extents
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_extent = GEN_ID(extents_id_extent, 1);
+  END;;
+
+CREATE GENERATOR groups_id_group;;
+CREATE TRIGGER insert_group FOR groups
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_group = GEN_ID(groups_id_group, 1);
+  END;;
+
+CREATE GENERATOR labels_id_label;;
+CREATE TRIGGER insert_label FOR labels
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_label = GEN_ID(labels_id_label, 1);
+  END;;
+
+CREATE GENERATOR profiles_id_profile;;
+CREATE TRIGGER insert_profile FOR profiles
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_profile = GEN_ID(profiles_id_profile, 1);
+  END;;
+  
+ /* Cut at 31 chars */
+CREATE GENERATOR profiles_columns_id_profile_col;;
+CREATE TRIGGER insert_profiles_column FOR profiles_columns
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_profile_column = GEN_ID(profiles_columns_id_profile_col, 1);
+  END;;
+
+CREATE GENERATOR profiles_data_id_profile_data;;
+CREATE TRIGGER insert_profile_data FOR profiles_data
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_profile_data = GEN_ID(profiles_data_id_profile_data, 1);
+  END;;
+
+CREATE GENERATOR projections_id_projection;;
+CREATE TRIGGER insert_projection FOR projections
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_projection = GEN_ID(projections_id_projection, 1);
+  END;;
+
+CREATE GENERATOR map_references_id_map_reference;;
+CREATE TRIGGER insert_map_reference FOR map_references
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_map_reference = GEN_ID(map_references_id_map_reference, 1);
+  END;;
+
+CREATE GENERATOR query_forms_id_query_form;;
+CREATE TRIGGER insert_query_form FOR query_forms
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_query_form = GEN_ID(query_forms_id_query_form, 1);
+  END;;
+
+CREATE GENERATOR query_results_id_query_result;;
+CREATE TRIGGER insert_query_result FOR query_results
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_query_result = GEN_ID(query_results_id_query_result, 1);
+  END;;
+
+CREATE GENERATOR relations_id_relation;;
+CREATE TRIGGER insert_relation FOR relations
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_relation = GEN_ID(relations_id_relation, 1);
+  END;;
+
+/* sessions */
+
+CREATE GENERATOR styles_id_style;;
+CREATE TRIGGER insert_style FOR styles
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_style = GEN_ID(styles_id_style, 1);
+  END;;
+
+CREATE GENERATOR symbols_id_symbol;;
+CREATE TRIGGER insert_symbol FOR symbols
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_symbol = GEN_ID(symbols_id_symbol, 1);
+  END;;
+
+
+/* tool_setings */
+
+CREATE GENERATOR users_id_user;;
+CREATE TRIGGER insert_user FOR users
+  BEFORE INSERT POSITION 0
+  AS BEGIN
+    NEW.id_user = GEN_ID(users_id_user, 1);
+  END;;
+
+
+/* IFNULL */
+CREATE PROCEDURE IFNULL (V1 VARCHAR(255), V2 VARCHAR(255))
+RETURNS (R1 VARCHAR(255)) AS
+BEGIN
+  IF (V1 IS NULL) THEN
+    R1=  V2;
+  ELSE
+    R1= V1;
+  SUSPEND;
+END;;

Added: packages/musmap/branches/upstream/current/include/sql/create_tables.mysql.sql
===================================================================
--- packages/musmap/branches/upstream/current/include/sql/create_tables.mysql.sql	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/sql/create_tables.mysql.sql	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,39 @@
+ALTER TABLE classes CHANGE id_class id_class INT NOT NULL AUTO_INCREMENT;;
+
+ALTER TABLE data_columns CHANGE id_data_column id_data_column INT NOT NULL AUTO_INCREMENT;;
+
+ALTER TABLE connections CHANGE id_connection id_connection INT NOT NULL AUTO_INCREMENT;;
+
+ALTER TABLE extents CHANGE id_extent id_extent INT NOT NULL AUTO_INCREMENT;;
+
+ALTER TABLE groups CHANGE id_group id_group INT NOT NULL AUTO_INCREMENT;;
+
+ALTER TABLE labels CHANGE id_label id_label INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE profiles CHANGE id_profile id_profile INT NOT NULL AUTO_INCREMENT;;
+
+ALTER TABLE profiles_columns CHANGE id_profile_column id_profile_column INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE profiles_data CHANGE id_profile_data id_profile_data INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE projections CHANGE id_projection id_projection INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE map_references CHANGE id_map_reference id_map_reference INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE query_forms CHANGE id_query_form id_query_form INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE query_results CHANGE id_query_result id_query_result INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE relations CHANGE id_relation id_relation INT NOT NULL AUTO_INCREMENT ;;
+
+#sessions
+
+ALTER TABLE styles CHANGE id_style id_style INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE symbols CHANGE id_symbol id_symbol INT NOT NULL AUTO_INCREMENT ;;
+
+ALTER TABLE data_sources CHANGE id_data_source id_data_source INT NOT NULL AUTO_INCREMENT;;
+
+#tool_settings
+
+ALTER TABLE users CHANGE id_user id_user INT NOT NULL AUTO_INCREMENT ;;

Added: packages/musmap/branches/upstream/current/include/sql/create_tables.postgresql.sql
===================================================================
--- packages/musmap/branches/upstream/current/include/sql/create_tables.postgresql.sql	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/sql/create_tables.postgresql.sql	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,60 @@
+CREATE SEQUENCE classes_id_class_seq;;
+ALTER TABLE classes ALTER COLUMN id_class SET DEFAULT nextval('classes_id_class_seq');;
+
+CREATE SEQUENCE data_columns_id_data_column_seq;;
+ALTER TABLE data_columns ALTER COLUMN id_data_column SET DEFAULT nextval('data_columns_id_data_column_seq');;
+
+CREATE SEQUENCE data_sources_id_data_source_seq;;
+ALTER TABLE data_sources ALTER COLUMN id_data_source SET DEFAULT nextval('data_sources_id_data_source_seq');;
+
+CREATE SEQUENCE connections_id_connection_seq;;
+ALTER TABLE connections ALTER COLUMN id_connection SET DEFAULT nextval('connections_id_connection_seq');;
+
+CREATE SEQUENCE extents_id_extent_seq;;
+ALTER TABLE extents ALTER COLUMN id_extent SET DEFAULT nextval('extents_id_extent_seq');;
+
+CREATE SEQUENCE groups_id_group_seq;;
+ALTER TABLE groups ALTER COLUMN id_group SET DEFAULT nextval('groups_id_group_seq');;
+
+CREATE SEQUENCE labels_id_label_seq;;
+ALTER TABLE labels ALTER COLUMN id_label SET DEFAULT nextval('labels_id_label_seq');;
+
+CREATE SEQUENCE profiles_id_profile_seq;;
+ALTER TABLE profiles ALTER COLUMN id_profile SET DEFAULT nextval('profiles_id_profile_seq');;
+
+CREATE SEQUENCE profiles_columns_id_profile_column_seq;;
+ALTER TABLE profiles_columns ALTER COLUMN id_profile_column SET DEFAULT nextval('profiles_columns_id_profile_column_seq');;
+
+CREATE SEQUENCE profiles_data_id_profile_data_seq;;
+ALTER TABLE profiles_data ALTER COLUMN id_profile_data SET DEFAULT nextval('profiles_data_id_profile_data_seq');;
+
+CREATE SEQUENCE projections_id_projection_seq;;
+ALTER TABLE projections ALTER COLUMN id_projection SET DEFAULT nextval('projections_id_projection_seq');;
+
+CREATE SEQUENCE map_references_id_map_reference_seq;;
+ALTER TABLE map_references ALTER COLUMN id_map_reference SET DEFAULT nextval('map_references_id_map_reference_seq');;
+
+CREATE SEQUENCE query_forms_id_query_form_seq;;
+ALTER TABLE query_forms ALTER COLUMN id_query_form SET DEFAULT nextval('query_forms_id_query_form_seq');;
+
+CREATE SEQUENCE query_results_id_query_result_seq;;
+ALTER TABLE query_results ALTER COLUMN id_query_result SET DEFAULT nextval('query_results_id_query_result_seq');;
+
+CREATE SEQUENCE relations_id_relation_seq;;
+ALTER TABLE relations ALTER COLUMN id_relation SET DEFAULT nextval('relations_id_relation_seq');;
+
+/* sessions */
+
+CREATE SEQUENCE styles_id_style_seq;;
+ALTER TABLE styles ALTER COLUMN id_style SET DEFAULT nextval('styles_id_style_seq');;
+
+CREATE SEQUENCE symbols_id_symbol_seq;;
+ALTER TABLE symbols ALTER COLUMN id_symbol SET DEFAULT nextval('symbols_id_symbol_seq');;
+
+/* tool_setings */
+
+CREATE SEQUENCE users_id_user_seq;;
+ALTER TABLE users ALTER COLUMN id_user SET DEFAULT nextval('users_id_user_seq');;
+
+CREATE FUNCTION IFNULL(VARCHAR, VARCHAR) RETURNS VARCHAR AS 
+'SELECT CASE WHEN $1 IS NULL THEN $2 ELSE $1 END AS result' LANGUAGE SQL;;

Added: packages/musmap/branches/upstream/current/include/sql/create_tables.sql
===================================================================
--- packages/musmap/branches/upstream/current/include/sql/create_tables.sql	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/sql/create_tables.sql	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,660 @@
+/*==============================================================*/
+/* Table : classes                                              */
+/*==============================================================*/
+CREATE TABLE classes
+(
+   id_class                       INTEGER                          NOT NULL,
+   id_profile_data                INTEGER                          NOT NULL,
+   class_name                     VARCHAR(32)      DEFAULT '?'     NOT NULL,
+   class_expression               VARCHAR(1024)    DEFAULT ''      NOT NULL,
+   class_index                    INTEGER          DEFAULT 0       NOT NULL,
+   PRIMARY KEY (id_class)
+);
+
+/*==============================================================*/
+/* Index : link_class_to_layer_fk                               */
+/*==============================================================*/
+CREATE INDEX i_cl_id_profile_data_fk on classes
+(
+   id_profile_data
+);
+
+/*==============================================================*/
+/* Index : class_index                                          */
+/*==============================================================*/
+CREATE INDEX i_cl_class_index on classes
+(
+   class_index
+);
+
+/*==============================================================*/
+/* Table : connections                                          */
+/*==============================================================*/
+CREATE TABLE connections
+(
+   id_connection                  INTEGER                          NOT NULL,
+   connection_name                VARCHAR(32)      DEFAULT '?'     NOT NULL,
+   connection_driver              VARCHAR(16)      DEFAULT 'local' NOT NULL,
+   connection_params              VARCHAR(1024)    DEFAULT ''      NOT NULL,
+   connection_owner_id            INTEGER          DEFAULT NULL,
+   connection_reader_group_id     INTEGER          DEFAULT NULL,
+   connection_writer_group_id     INTEGER          DEFAULT NULL,
+   connection_privileges          SMALLINT         DEFAULT NULL,
+   connection_modification_time   INTEGER          DEFAULT 0       NOT NULL,
+   PRIMARY KEY (id_connection)
+);
+
+/*==============================================================*/
+/* Table : data_columns                                         */
+/*==============================================================*/
+CREATE TABLE data_columns
+(
+   id_data_column                 INTEGER                          NOT NULL,
+   id_data_source                 INTEGER                          NOT NULL,
+   column_code                    VARCHAR(32)      DEFAULT '?'     NOT NULL,
+   column_short_label             VARCHAR(64)      DEFAULT '?'     NOT NULL,
+   column_long_label              VARCHAR(64)      DEFAULT '?'     NOT NULL,
+   column_visible                 SMALLINT         DEFAULT 1       NOT NULL,
+   column_index                   INTEGER          DEFAULT -1      NOT NULL, 
+   column_is_decodification       SMALLINT         DEFAULT 0       NOT NULL,
+   column_type                    CHAR(1)          DEFAULT NULL,
+   column_expression              VARCHAR(1024),
+   PRIMARY KEY (id_data_column)
+);
+
+/*==============================================================*/
+/* Unique : data_column_code                                    */
+/*==============================================================*/
+CREATE UNIQUE INDEX data_column_code ON data_columns 
+(
+   id_data_source,
+   column_code 
+);
+
+/*==============================================================*/
+/* Index : column_code                                          */
+/*==============================================================*/
+CREATE INDEX i_dc_column_code ON data_columns 
+(
+   column_code 
+);
+
+/*==============================================================*/
+/* Index : i_dc_data_source_fk                                  */
+/*==============================================================*/
+CREATE INDEX i_dc_data_source_fk ON data_columns
+(
+   id_data_source
+);
+
+
+/*==============================================================*/
+/* Table : data_sources                                         */
+/*==============================================================*/
+CREATE TABLE data_sources
+(
+   id_data_source                 INTEGER                            NOT NULL,
+   id_connection                  INTEGER                            NOT NULL,
+   id_projection                  INTEGER           DEFAULT 0        NOT NULL,
+   data_source_catalog            VARCHAR(32)       DEFAULT NULL,
+   data_source_schema             VARCHAR(32)       DEFAULT NULL,
+   data_source_name               VARCHAR(32)       DEFAULT '?'      NOT NULL,
+   data_source_label              VARCHAR(32)       DEFAULT '?'      NOT NULL,
+   data_source_params             VARCHAR(1024)     DEFAULT ''       NOT NULL,
+   data_source_type               CHAR(1)           DEFAULT NULL,
+   data_source_doc                VARCHAR(255)      DEFAULT NULL,
+   data_source_owner_id           INTEGER           DEFAULT NULL,
+   data_source_reader_group_id    INTEGER           DEFAULT NULL,
+   data_source_writer_group_id    INTEGER           DEFAULT NULL,
+   data_source_privileges         SMALLINT          DEFAULT NULL,
+   data_source_modification_time  INTEGER           DEFAULT 0        NOT NULL,
+   PRIMARY KEY (id_data_source)
+);
+
+/*==============================================================*/
+/* Unique : data_source_code                                    */
+/*==============================================================*/
+CREATE UNIQUE INDEX data_source_code ON data_sources (
+   id_connection,
+   data_source_catalog,
+   data_source_schema,
+   data_source_name
+);
+
+
+/*==============================================================*/
+/* Index : data_source_type                                     */
+/*==============================================================*/
+CREATE INDEX i_tb_data_type ON data_sources
+(
+   data_source_type
+);
+
+/*==============================================================*/
+/* Table : extents                                              */
+/*==============================================================*/
+CREATE TABLE extents (
+   id_extent                      INTEGER                          NOT NULL,
+   extent_name                    VARCHAR(32)      DEFAULT '?'     NOT NULL,
+   extent_minx                    DOUBLE PRECISION DEFAULT 0       NOT NULL,
+   extent_miny                    DOUBLE PRECISION DEFAULT 0       NOT NULL,
+   extent_maxx                    DOUBLE PRECISION DEFAULT 0       NOT NULL,
+   extent_maxy                    DOUBLE PRECISION DEFAULT 0       NOT NULL,
+   extent_owner_id                INTEGER          DEFAULT NULL,
+   extent_reader_group_id         INTEGER          DEFAULT NULL,
+   extent_writer_group_id         INTEGER          DEFAULT NULL,
+   extent_privileges              SMALLINT         DEFAULT NULL,
+   extent_modification_time       INTEGER          DEFAULT 0       NOT NULL,
+   PRIMARY KEY (id_extent)                       
+);
+
+/*==============================================================*/
+/* Index : extent_name                                          */
+/*==============================================================*/
+CREATE INDEX i_ex_extent_name ON extents
+(
+   extent_name
+);
+
+/*==============================================================*/
+/* Table : groups                                               */
+/*==============================================================*/
+CREATE TABLE groups (
+   id_group                       INTEGER                          NOT NULL,
+   group_name                     VARCHAR(32)      DEFAULT '?'     NOT NULL,
+   PRIMARY KEY (id_group)
+);
+
+/*==============================================================*/
+/* Unique : group_name                                          */
+/*==============================================================*/
+CREATE UNIQUE INDEX i_gr_group_name ON groups (
+   group_name
+);
+
+
+/*==============================================================*/
+/* Table : labels                                               */
+/*==============================================================*/
+CREATE TABLE labels
+(
+   id_label                       INTEGER                            NOT NULL,
+   id_class                       INTEGER                            NOT NULL,
+   label_column                   VARCHAR(32)      DEFAULT ''        NOT NULL,
+   label_encoding                 VARCHAR(32)      DEFAULT ''        NOT NULL,
+   label_font                     VARCHAR(32)      DEFAULT ''        NOT NULL,
+   label_color                    CHAR(7)          DEFAULT '#000000' NOT NULL,
+   label_minscale                 FLOAT            DEFAULT 0         NOT NULL,
+   label_maxscale                 FLOAT            DEFAULT 0         NOT NULL,
+   label_force_visibility         SMALLINT         DEFAULT 0         NOT NULL,
+   label_default_size             INTEGER          DEFAULT 12        NOT NULL,
+   label_size                     VARCHAR(32)      DEFAULT ''        NOT NULL,
+   label_default_angle            FLOAT            DEFAULT 0         NOT NULL,
+   label_angle                    VARCHAR(32)      DEFAULT ''        NOT NULL,
+   label_position                 CHAR(2)          DEFAULT 'au'      NOT NULL,
+   label_rect_color               CHAR(7)          DEFAULT ''        NOT NULL,
+   label_rect_shadow_color        CHAR(7)          DEFAULT ''        NOT NULL,
+   label_rect_shadow_size         INTEGER          DEFAULT 0         NOT NULL,
+   label_buffer                   INTEGER          DEFAULT 0         NOT NULL,
+   label_outline_color            CHAR(7)          DEFAULT ''        NOT NULL,
+   label_partials                 SMALLINT         DEFAULT 0         NOT NULL,
+   label_shadow_color             CHAR(7)          DEFAULT ''        NOT NULL,
+   label_shadow_size              INTEGER          DEFAULT 0         NOT NULL,
+   PRIMARY KEY (id_label)
+);
+
+/*==============================================================*/
+/* Index : link_label_to_class_fk                               */
+/*==============================================================*/
+CREATE INDEX i_lb_id_class_fk ON labels
+(
+   id_class
+);
+
+
+/*==============================================================*/
+/* Table : map_references                                       */
+/*==============================================================*/
+CREATE TABLE map_references
+(
+   id_map_reference               INTEGER                            NOT NULL,
+   id_extent                      INTEGER                            NOT NULL,
+   reference_name                 VARCHAR(32)      DEFAULT '?'       NOT NULL,
+   reference_path                 VARCHAR(255)     DEFAULT '?'       NOT NULL,
+   reference_owner_id             INTEGER          DEFAULT NULL,
+   reference_reader_group_id      INTEGER          DEFAULT NULL,
+   reference_writer_group_id      INTEGER          DEFAULT NULL,
+   reference_privileges           SMALLINT         DEFAULT NULL,
+   reference_modification_time    INTEGER          DEFAULT 0         NOT NULL,
+   PRIMARY KEY (id_map_reference)
+);
+
+/*==============================================================*/
+/* Index : id_extent                                            */
+/*==============================================================*/
+CREATE INDEX i_mr_id_extent_fk ON map_references
+(
+   id_extent
+);
+
+/*==============================================================*/
+/* Index : reference_name                                       */
+/*==============================================================*/
+CREATE INDEX i_mr_reference_name ON map_references
+(
+   reference_name
+);
+
+/*==============================================================*/
+/* Table : profiles                                             */
+/*==============================================================*/
+CREATE TABLE profiles
+(
+   id_profile                     INTEGER                            NOT NULL,
+   id_map_reference               INTEGER          DEFAULT 0         NOT NULL,
+   id_projection                  INTEGER          DEFAULT 0         NOT NULL,
+   profile_name                   VARCHAR(32)      DEFAULT '?'       NOT NULL,
+   profile_is_public              SMALLINT         DEFAULT 0         NOT NULL,
+   profile_owner_id               INTEGER          DEFAULT NULL,
+   profile_reader_group_id        INTEGER          DEFAULT NULL,
+   profile_writer_group_id        INTEGER          DEFAULT NULL,
+   profile_privileges             SMALLINT         DEFAULT NULL,
+   profile_modification_time      INTEGER          DEFAULT 0         NOT NULL,
+   PRIMARY KEY (id_profile)
+);
+
+
+/*==============================================================*/
+/* Index : profile_owner_fk                                     */
+/*==============================================================*/
+CREATE INDEX i_pr_profile_owner_id_fk on profiles
+(
+   profile_owner_id
+);
+
+/*==============================================================*/
+/* Index : profile_is_public                                    */
+/*==============================================================*/
+CREATE INDEX i_pr_profile_is_public on profiles
+(
+   profile_is_public
+);
+
+/*==============================================================*/
+/* Table : profiles_columns                                     */
+/*==============================================================*/
+CREATE TABLE profiles_columns
+(
+   id_profile_column              INTEGER                            NOT NULL,
+   id_data_column                 INTEGER                            NOT NULL,
+   id_profile_data                INTEGER                            NOT NULL,
+   profile_column_index           INTEGER          DEFAULT -1        NOT NULL,
+   profile_column_visible         SMALLINT         DEFAULT 1         NOT NULL,
+   PRIMARY KEY (id_profile_column)
+);
+
+/*==============================================================*/
+/* Index : link_profile_column_to_data_column_fk                */
+/*==============================================================*/
+CREATE INDEX i_pc_id_data_column_fk on profiles_columns
+(
+   id_data_column
+);
+
+/*==============================================================*/
+/* Index : link_profile_column_to_profile_data_fk               */
+/*==============================================================*/
+CREATE INDEX i_pc_id_profile_data_fk on profiles_columns
+(
+   id_profile_data
+);
+
+/*==============================================================*/
+/* Index : profile_column_index                                 */
+/*==============================================================*/
+CREATE INDEX i_pc_profile_column_index on profiles_columns
+(
+   profile_column_index
+);
+
+/*==============================================================*/
+/* Table : profiles_data                                        */
+/*==============================================================*/
+CREATE TABLE profiles_data
+(
+   id_profile_data                INTEGER                            NOT NULL,
+   id_profile                     INTEGER                            NOT NULL,
+   id_data_source                 INTEGER                            NOT NULL,
+   profile_data_title             VARCHAR(64)      DEFAULT '?'       NOT NULL,
+   profile_data_index             INTEGER          DEFAULT 0         NOT NULL,
+   profile_data_visible           SMALLINT         DEFAULT 1         NOT NULL,
+   profile_data_owner_id          INTEGER          DEFAULT NULL,
+   profile_data_reader_group_id   INTEGER          DEFAULT NULL,
+   profile_data_writer_group_id   INTEGER          DEFAULT NULL,
+   profile_data_privileges        SMALLINT         DEFAULT NULL,
+   profile_data_modification_time INTEGER          DEFAULT 0         NOT NULL,
+   layer_minscale                 FLOAT            DEFAULT 0,
+   layer_maxscale                 FLOAT            DEFAULT 0,
+   layer_group                    VARCHAR(32)      DEFAULT NULL,
+   layer_symbols_scale            FLOAT            DEFAULT NULL,
+   layer_classitem                VARCHAR(16)      DEFAULT NULL,
+   layer_opacity                  SMALLINT         DEFAULT NULL,
+   layer_type                     CHAR(1)          DEFAULT NULL,
+   raster_offsite                 CHAR(7)          DEFAULT NULL,
+   PRIMARY KEY (id_profile_data)
+);
+
+/*==============================================================*/
+/* Index : link_profile_data_to_profile_fk                      */
+/*==============================================================*/
+CREATE INDEX i_pd_id_profile_fk on profiles_data
+(
+   id_profile
+);
+
+/*==============================================================*/
+/* Index : link_profile_data_to_table_fk                        */
+/*==============================================================*/
+CREATE INDEX i_pd_id_data_source_fk on profiles_data
+(
+   id_data_source
+);
+
+/*==============================================================*/
+/* Index : profile_data_index                                   */
+/*==============================================================*/
+CREATE INDEX i_pd_profile_data_index on profiles_data
+(
+   profile_data_index
+);
+
+/*==============================================================*/
+/* Table : profile_extents                                      */
+/*==============================================================*/
+CREATE TABLE profile_extents
+(
+   id_profile                     INTEGER                            NOT NULL,
+   id_extent                      INTEGER                            NOT NULL,
+   PRIMARY KEY (id_profile,id_extent)
+);
+
+/*==============================================================*/
+/* Table : projections                                          */
+/*==============================================================*/
+CREATE TABLE projections
+(
+   id_projection                  INTEGER                            NOT NULL,
+   projection_name                VARCHAR(32)      DEFAULT '?'       NOT NULL,
+   projection_params              VARCHAR(1024)                      NOT NULL,
+   projection_owner_id            INTEGER          DEFAULT NULL,
+   projection_reader_group_id     INTEGER          DEFAULT NULL,
+   projection_writer_group_id     INTEGER          DEFAULT NULL,
+   projection_privileges          SMALLINT         DEFAULT NULL,
+   projection_modification_time   INTEGER          DEFAULT 0         NOT NULL,
+   PRIMARY KEY (id_projection)
+);
+
+/*==============================================================*/
+/* Index : projection_name                                      */
+/*==============================================================*/
+CREATE INDEX i_pj_projection_name on projections
+(
+   projection_name
+);
+
+/*==============================================================*/
+/* Table : query_results                                        */
+/*==============================================================*/
+CREATE TABLE query_results
+(
+   id_query_result                  INTEGER                          NOT NULL,
+   id_data_source                   INTEGER                          NOT NULL,
+   id_profile_data                  INTEGER,
+   query_result_name                VARCHAR(32)    DEFAULT '?'       NOT NULL,
+   query_result_data                VARCHAR(1024)                    NOT NULL,
+   query_result_owner_id            INTEGER        DEFAULT NULL,
+   query_result_reader_group_id     INTEGER        DEFAULT NULL,
+   query_result_writer_group_id     INTEGER        DEFAULT NULL,
+   query_result_privileges          SMALLINT       DEFAULT NULL,
+   query_result_modification_time   INTEGER        DEFAULT 0         NOT NULL,
+   PRIMARY KEY (id_query_result)
+);
+
+/*==============================================================*/
+/* Index : id_data_source                                             */
+/*==============================================================*/
+CREATE INDEX i_qr_id_data_source_fk ON query_results 
+(
+   id_data_source 
+);
+
+
+/*==============================================================*/
+/* Table : query_forms                                          */
+/*==============================================================*/
+CREATE TABLE query_forms
+(
+   id_query_form                  INTEGER                            NOT NULL,
+   id_data_source                 INTEGER           DEFAULT 0        NOT NULL,
+   query_form_menu_title          VARCHAR(32)       DEFAULT ''       NOT NULL,
+   query_form_title               VARCHAR(32)       DEFAULT ''       NOT NULL,
+   query_form_header              VARCHAR(1024)                      NOT NULL,
+   query_form_form                VARCHAR(1024)                      NOT NULL,
+   query_form_params              VARCHAR(1024)                      NOT NULL,
+   query_form_owner_id            INTEGER           DEFAULT NULL,
+   query_form_reader_group_id     INTEGER           DEFAULT NULL,
+   query_form_writer_group_id     INTEGER           DEFAULT NULL,
+   query_form_privileges          SMALLINT          DEFAULT NULL,
+   query_form_modification_time   INTEGER           DEFAULT 0        NOT NULL,
+   PRIMARY KEY (id_query_form)
+);
+
+/*==============================================================*/
+/* Index : id_data_source                                       */
+/*==============================================================*/
+CREATE INDEX i_qf_id_data_source_fk ON query_forms 
+(
+   id_data_source 
+);
+
+/*==============================================================*/
+/* Index : query_form_menu_title                                */
+/*==============================================================*/
+CREATE INDEX i_qf_query_form_menu_title ON query_forms 
+(
+   query_form_menu_title 
+);
+
+/*==============================================================*/
+/* Table : relations                                            */
+/*==============================================================*/
+CREATE TABLE relations
+(
+   id_relation                    INTEGER                            NOT NULL,
+   id_data_column                 INTEGER                            NOT NULL,
+   dat_id_data_column             INTEGER           DEFAULT 0        NOT NULL,
+   relation_label_fk_pk           VARCHAR(32)       DEFAULT '?'      NOT NULL,
+   relation_min_cardinality_fk_pk SMALLINT          DEFAULT -1       NOT NULL,
+   relation_label_pk_fk           VARCHAR(32)       DEFAULT '?'      NOT NULL,
+   relation_min_cardinality_pk_fk SMALLINT          DEFAULT -1       NOT NULL,
+   relation_max_cardinality_pk_fk SMALLINT          DEFAULT -1       NOT NULL,
+   PRIMARY KEY (id_relation)
+);
+
+/*==============================================================*/
+/* Unique : index_columns                                       */
+/*==============================================================*/
+CREATE UNIQUE INDEX i_rl_index_columns ON relations (
+   id_data_column,
+   dat_id_data_column
+);
+
+/*==============================================================*/
+/* Index : origine_fk_fk                                        */
+/*==============================================================*/
+CREATE INDEX i_rl_origin_id_data_column_fk on relations
+(
+   id_data_column
+);
+
+/*==============================================================*/
+/* Index : destination_pk_fk                                    */
+/*==============================================================*/
+CREATE INDEX i_rl_dat_id_data_column_fk on relations
+(
+   dat_id_data_column
+);
+
+/*==============================================================*/
+/* Table : sessions                                             */
+/*==============================================================*/
+CREATE TABLE sessions
+(
+   session_id                     VARCHAR(32)                        NOT NULL,
+   id_user                        INTEGER                            NOT NULL,
+   id_profile                     INTEGER                                NULL,
+   id_query_result                INTEGER           DEFAULT 0        NOT NULL,
+   session_security_id            VARCHAR(32)                        NOT NULL,
+   session_creation_time          INTEGER                            NOT NULL,
+   session_modification_time      INTEGER                            NOT NULL,
+   PRIMARY KEY (session_id)
+);
+
+/*==============================================================*/
+/* Index : link_session_to_user_fk                              */
+/*==============================================================*/
+CREATE INDEX i_se_id_user_fk on sessions
+(
+   id_user
+);
+
+/*==============================================================*/
+/* Index : link_session_to_profile_fk                           */
+/*==============================================================*/
+CREATE INDEX i_se_id_profile_fk on sessions
+(
+   id_profile
+);
+
+/*==============================================================*/
+/* Index : session_security_id                                  */
+/*==============================================================*/
+CREATE INDEX i_se_session_security_id on sessions
+(
+   session_security_id
+);
+
+/*==============================================================*/
+/* Table : styles                                               */
+/*==============================================================*/
+CREATE TABLE styles
+(
+   id_style                       INTEGER                            NOT NULL,
+   id_class                       INTEGER                            NOT NULL,
+   id_symbol                      INTEGER           DEFAULT 0        NOT NULL,
+   style_name                     VARCHAR(32)       DEFAULT '?'      NOT NULL,
+   style_background_color         CHAR(7)           DEFAULT ''       NOT NULL,
+   style_color                    CHAR(7)           DEFAULT ''       NOT NULL,
+   style_outline_color            CHAR(7)           DEFAULT ''       NOT NULL,
+   style_size                     INTEGER           DEFAULT 1        NOT NULL,
+   style_symbol_maxsize           INTEGER           DEFAULT 0        NOT NULL,
+   style_symbol_minsize           INTEGER           DEFAULT 0        NOT NULL,
+   style_index                    INTEGER           DEFAULT 0        NOT NULL,
+   PRIMARY KEY (id_style)
+);
+
+/*==============================================================*/
+/* Index : link_style_to_class_fk                               */
+/*==============================================================*/
+CREATE INDEX i_st_id_class_fk on styles
+(
+   id_class
+);
+
+/*==============================================================*/
+/* Index : style_index                                          */
+/*==============================================================*/
+CREATE INDEX i_st_style_index on styles
+(
+   style_index
+);
+
+/*==============================================================*/
+/* Table : symbols                                              */
+/*==============================================================*/
+CREATE TABLE symbols
+(
+   id_symbol                      INTEGER                            NOT NULL,
+   symbol_family                  VARCHAR(16)       DEFAULT '?'      NOT NULL,
+   symbol_name                    VARCHAR(32)       DEFAULT '?'      NOT NULL,
+   symbol_type                    CHAR(1)           DEFAULT 'E'      NOT NULL,
+   symbol_filled                  SMALLINT          DEFAULT 0            NULL,
+   symbol_font                    VARCHAR(32)       DEFAULT ''           NULL,
+   symbol_image_path              VARCHAR(512)                           NULL,
+   symbol_points                  VARCHAR(1024)                          NULL,
+   symbol_style                   VARCHAR(16)       DEFAULT ''           NULL,
+   symbol_owner_id                INTEGER           DEFAULT NULL,
+   symbol_reader_group_id         INTEGER           DEFAULT NULL,
+   symbol_writer_group_id         INTEGER           DEFAULT NULL,
+   symbol_privileges              SMALLINT          DEFAULT NULL,
+   symbol_modification_time       INTEGER           DEFAULT 0        NOT NULL,
+   PRIMARY KEY (id_symbol)
+);
+
+/*==============================================================*/
+/* Unique : symbol_complete_name                                */
+/*==============================================================*/
+CREATE UNIQUE INDEX i_sy_symbol_complete_name on symbols
+(
+   symbol_family,
+   symbol_name
+);
+
+/*==============================================================*/
+/* Table : tool_settings                                        */
+/*==============================================================*/
+CREATE TABLE tool_settings
+(
+   setting_code                   VARCHAR(32)                        NOT NULL,
+   setting_value                  VARCHAR(1024)                      NOT NULL,
+   PRIMARY KEY (setting_code)
+);
+
+/*==============================================================*/
+/* Table : users                                                */
+/*==============================================================*/
+CREATE TABLE users
+(
+   id_user                        INTEGER                            NOT NULL,
+   id_profile                     INTEGER,
+   user_name                      VARCHAR(32)                        NOT NULL,
+   user_password                  VARCHAR(48)                            NULL,
+   user_email                     VARCHAR(255)                           NULL,
+   PRIMARY KEY (id_user)
+);
+
+/*==============================================================*/
+/* Unique : user_name                                           */
+/*==============================================================*/
+CREATE UNIQUE INDEX i_us_user_name on users
+(
+   user_name
+);
+
+/*==============================================================*/
+/* Index : default_profile_fk                                   */
+/*==============================================================*/
+CREATE INDEX i_us_id_profile_fk on users
+(
+   id_profile
+);
+
+/*==============================================================*/
+/* Table : users_groups                                         */
+/*==============================================================*/
+CREATE TABLE users_groups
+(
+   id_user                        INTEGER                            NOT NULL,
+   id_group                       INTEGER                            NOT NULL,
+   PRIMARY KEY (id_user,id_group)
+);

Added: packages/musmap/branches/upstream/current/include/sql/create_tables.sqlite.sql
===================================================================
--- packages/musmap/branches/upstream/current/include/sql/create_tables.sqlite.sql	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/sql/create_tables.sqlite.sql	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,3 @@
+/* SQLite doesn't support ALTER TABLE */
+/* But INTEGER PRIMARY KEY column are used like AUTO_INCREMENT when setting to NULL */
+SELECT 1;;
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/user.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/user.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/user.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,93 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * user functions
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+  
+  class LibUser {
+    /**
+     *
+     */
+    function get_user_name($user_id) {
+      global $db;
+      if($user_id===NULL) {
+        return '<i>'.html_l10n('None').'</i>';
+      }
+      $user_q=$db->query("SELECT * FROM users ".
+          "WHERE id_user=".$db->Quote($user_id, 'integer'));
+      $aUserAttributes= $db->FetchAssoc($user_q);
+      if($aUserAttributes) {
+        $r=$aUserAttributes['user_name'];
+      } else {
+        $r=NULL;
+      }
+      $db->FreeResult($user_q);
+      return $r;
+    }
+    
+    /**
+     *
+     */
+    function get_group_name($group_id) {
+      global $db;
+      if($group_id===NULL) {
+        return '<i>'.html_l10n('None').'</i>';
+      }
+      $group_q=$db->query("SELECT * FROM groups ".
+          "WHERE id_group=".$db->Quote($group_id, 'integer'));
+      $aGroupAttributes= $db->FetchAssoc($group_q);
+      if($aGroupAttributes) {
+        $r=$aGroupAttributes['group_name'];
+      } else {
+        $r=NULL;
+      }
+      $db->FreeResult($group_q);
+      return $r;
+    }
+    
+    /**
+     *
+     */
+    function is_in_group($user_o,$group_id) {
+      global $db;
+      $users_groups_q=$db->query("SELECT * FROM users_groups ".
+          "WHERE id_group=".$db->Quote($group_id)." ".
+            "AND id_user=".$db->Quote($user_o->Attributes->Value('id_user')));
+      $r= (bool) $db->FetchAssoc($users_groups_q);
+      $db->FreeResult($users_groups_q);
+      return $r;
+    }
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/include/visual.inc.php
===================================================================
--- packages/musmap/branches/upstream/current/include/visual.inc.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/include/visual.inc.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,122 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Classes 'classe",annotation et style
+ *
+ * Données profil, Couches, ...
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package include
+ * @since 2004-06
+ */
+  
+  class LibVisual {
+    function setColor(&$colorobj,$color) {
+      if(substr($color,0,1)=='#') {
+        $r=hexdec(substr($color,1,2));
+        $g=hexdec(substr($color,3,2));
+        $b=hexdec(substr($color,5,2));
+        $colorobj->setRgb($r,$g,$b);
+      } else {
+        $colorobj->setRgb(-1,-1,-1);
+      }
+    }
+    
+    function getColor(&$colorobj) {
+      if(    ($colorobj->red < 0)
+          || ($colorobj->green < 0)
+          || ($colorobj->blue < 0)
+      ) {
+        return '';
+      } else {
+        return sprintf("#%02x%02x%02x",
+          $colorobj->red,
+          $colorobj->green,
+          $colorobj->blue);
+      }
+    }
+    
+    function setPosition(&$labelobj,$position) {
+      switch($position) {
+        case 'ul':
+          $labelobj->set('position',MS_UL);
+          break;
+        case 'uc':
+          $labelobj->set('position',MS_UC);
+          break;
+        case 'ur':
+          $labelobj->set('position',MS_UR);
+          break;
+        case 'cl':
+          $labelobj->set('position',MS_CL);
+          break;
+        case 'cc':
+          $labelobj->set('position',MS_CC);
+          break;
+        case 'cr':
+          $labelobj->set('position',MS_CR);
+          break;
+        case 'll':
+          $labelobj->set('position',MS_LL);
+          break;
+        case 'lc':
+          $labelobj->set('position',MS_LC);
+          break;
+        case 'lr':
+          $labelobj->set('position',MS_LR);
+          break;
+        case 'xy':
+          $labelobj->set('position',MS_XY);
+          break;
+        case 'au' :
+        default :
+          $labelobj->set('position',MS_AUTO);
+      }
+    }
+    
+    function getPosition($ms_label) {
+      switch($ms_label->position) {
+        case MS_UL: return 'ul';
+        case MS_UC: return 'uc';
+        case MS_UR: return 'ur';
+        case MS_CL: return 'cl';
+        case MS_CC: return 'cc';
+        case MS_CR: return 'cr';
+        case MS_LL: return 'll';
+        case MS_LC: return 'lc';
+        case MS_LR: return 'lr';
+        case MS_XY: return 'xy';
+        case MS_AUTO:
+        default:    return 'au';
+      }
+    }
+  }
+  ?>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/index.php
===================================================================
--- packages/musmap/branches/upstream/current/index.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/index.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,96 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Conteneur des frames
+ * @package interface
+ */
+
+  /**
+   * 
+   * This page has frames
+   */
+  define('MUSMAP_HAS_FRAME',true);
+  
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  $user= & new t_user();
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+"http://www.w3.org/TR/html4/frameset.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title>Musmap <?php echo MUSMAP_VERSION;?></title>
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xb.js">
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xbgeo.js">
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/mapinfos.js">
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/map.class.js">
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/events.js">
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/layers.js">
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/top.js">
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/l10n.php">
+  </script>
+  <script type="text/javascript" language="JavaScript">
+  <!--
+  var curDateTime = new Date();
+  setCookie('TIME_ZONE', curDateTime.getTimezoneOffset());
+  //-->
+  </script>
+</head>
+
+<frameset rows="28, *, 0" onunload="top.unload();">
+  <frame src="tools.php" name="tools" id="tools" frameborder="0" scrolling="no">
+  <frameset cols="320, *">
+    <frame src="layers.php" name="layers" id="layers" frameborder="0">
+    <frame src="main.php" name="main" id="main" frameborder="0" scrolling="no">
+  </frameset>
+  <frame src="about:blank" name="socket" id="socket" frameborder="0">
+<noframes>
+<body>
+  <p><?php 
+  echo html_l10n('Musmap uses frames, please change your browser settings to allow frames.');
+    ?></p>
+  <p><?php
+  echo html_l10n('Your browser seems to be to old, please download a modern browser.');
+    ?></p>
+  <p><a href="http://www.mozilla.org">Mozilla</a></p>
+</body>
+</noframes>
+</frameset>
+</html>

Added: packages/musmap/branches/upstream/current/js/color_picker.js
===================================================================
--- packages/musmap/branches/upstream/current/js/color_picker.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/color_picker.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,105 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+  var mouseCoords;
+  var paletteCoords;
+  var coordsOnScreen;
+  var click_color_squareEl;
+  var mousemove_color_squareEl;
+  var currentLuminance = 128;
+  
+    
+  function colorFromPoint(p, isClick) {
+    if(p.y>255) {
+      if(isClick) {
+        if(p.x>128) {
+          document.getElementById('palette-container').style.backgroundColor= 'white';
+          XBsetOpacity(document.images[0],100-(p.x-128)/1.28);
+        } else if(p.x<128) {
+          document.getElementById('palette-container').style.backgroundColor= 'black';
+          XBsetOpacity(document.images[0],100-(128-p.x)/1.28);
+        } else {
+          XBsetOpacity(document.images[0],100);
+        }
+        currentLuminance= p.x;
+      }
+      return hsl2rgb_string(128,0,Math.min(p.x,255));
+    } else {
+      return hsl2rgb_string(p.x,255-p.y,currentLuminance);
+    }
+  }
+  function reseteLuminance() {
+    XBsetOpacity(document.images[0],100);
+    currentLuminance= 128;
+  }
+  
+  function load() {
+    document.images[0].onclick=paletteClick;
+    document.images[0].onmousemove=paletteMouseMove;
+    document.images[1].onclick=paletteClick;
+    document.images[1].onmousemove=paletteMouseMove;
+    document.images[1].ondblclick=reseteLuminance;
+    click_color_squareEl=new XBgetElementById('click_color_square');
+    mousemove_color_squareEl=new XBgetElementById('mousemove_color_square');
+  }
+  
+  function paletteMouseMove(e) {
+    if(!e) {e = window.event;}
+    mouseCoords = XBgetAbsoluteCoords(e);
+    paletteCoords = XBabsoluteOffset(document.images[0]);
+    coordsOnScreen = 
+      new TPoint(
+        mouseCoords.x-paletteCoords.x,
+        mouseCoords.y-paletteCoords.y);
+    document.forms[0]['mouse_color'].value =
+      colorFromPoint(coordsOnScreen);
+    mousemove_color_squareEl.style.backgroundColor =
+      document.forms[0]['mouse_color'].value;
+  }
+  
+  function paletteClick(e) {
+    if(!e) {e=window.event;}
+    mouseCoords=XBgetAbsoluteCoords(e);
+    paletteCoords=XBabsoluteOffset(document.images[0]);
+    coordsOnScreen =
+      new TPoint(
+        mouseCoords.x-paletteCoords.x,
+        mouseCoords.y-paletteCoords.y);
+    document.forms[0]['click_color'].value = colorFromPoint(coordsOnScreen, true);
+    click_color_squareEl.style.backgroundColor =
+      document.forms[0]['click_color'].value;
+    if(window.colorInput) {
+      window.colorInput.value=document.forms[0]['click_color'].value;
+    }
+    if(window.colorSpan) {
+      window.colorSpan.style.backgroundColor =
+        document.forms[0]['click_color'].value;
+    }
+  }

Added: packages/musmap/branches/upstream/current/js/colors.js
===================================================================
--- packages/musmap/branches/upstream/current/js/colors.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/colors.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,198 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+  function RGB2HSL (r, g, b)
+  {
+    var red = Math.round (r);
+    var green = Math.round (g);
+    var blue = Math.round (b);
+    var minval = Math.min (red, Math.min(green, blue));
+    var maxval = Math.max (red, Math.max(green, blue));
+    var mdiff = maxval - minval + 0.0;
+    var msum = maxval + minval + 0.0;
+    var luminance = msum / 510.0;
+    if(maxval == minval) {
+      saturation = 0.0;
+      hue = 0.0;
+    } else {
+      rnorm = (maxval - red) / mdiff;
+      gnorm = (maxval - green) / mdiff;
+      bnorm = (maxval - blue) / mdiff;
+      saturation =
+        (luminance <= 0.5)
+          ? (mdiff / msum)
+          : (mdiff / (510.0 - msum));
+      if(red == maxval)
+        hue = 60.0 * (6.0 + bnorm - gnorm);
+      if(green == maxval)
+        hue = 60.0 * (2.0 + rnorm - bnorm);
+      if(blue == maxval)
+        hue = 60.0 * (4.0 + gnorm - rnorm);
+      if(hue > 360.0)
+        hue -= 360.0;
+    }
+    return Array(
+      Math.round(hue * 255.0 / 360.0),
+      Math.round(saturation * 255.0),
+      Math.round(luminance * 255.0));
+  }
+  
+  function Magic(rm1, rm2, rh)
+  {
+    var retval = rm1;
+    if(rh > 360.0)
+      rh -= 360.0;
+    if(rh < 0.0)
+      rh += 360.0;
+    if(rh < 60.0)
+      retval = rm1 + (rm2 - rm1) * rh / 60.0;
+    else if(rh < 180.0)
+      retval = rm2;
+    else if(rh < 240.0)
+      retval = rm1 + (rm2 - rm1) * (240.0 - rh) / 60.0;
+    return Math.round(retval * 255);
+  }
+  
+  //Retourne un tableau de 3 valeurs : R,G,B
+  function HSL2RGB(h, s, l)
+  {
+    var hue = h * 360.0 / 255.0;
+    var saturation = s / 255.0;
+    var luminance = l / 255.0;
+    var red, green, blue;
+    if(saturation == 0.0) {
+      red =  Math.round(luminance * 255.0);
+      green =  Math.round(luminance * 255.0);
+      blue = Math.round(luminance * 255.0);
+    } else {
+      var rm2;
+      if(luminance <= 0.5) {
+        rm2 = luminance + luminance * saturation;
+      } else {
+        rm2 = luminance + saturation - luminance * saturation;
+      }
+      var rm1 = 2.0 * luminance - rm2;
+      red = Magic(rm1, rm2, hue + 120.0);
+      green = Magic(rm1, rm2, hue);
+      blue = Magic(rm1, rm2, hue - 120.0);
+    }
+    return Array(red, green, blue);
+  }
+  
+  function hsl2rgb_string(h,s,l) {
+    var rgb=HSL2RGB(h,s,l);
+    var t= 
+      (new Number(
+        rgb[0]*256*256 +
+        rgb[1]*256 +
+        rgb[2])
+      ).toString(16)
+      .toUpperCase();
+    for(var i=t.length;i<6;i++) {
+      t='0'+t;
+    }
+    return '#'+t;
+  }
+
+  /**
+   * MultiGradient
+   * @param integer iColorsCount
+   * @param string sStartColor
+   * @param string sNextColor
+   * @param float iColorPlace between 0 and 1
+   * @param string sNextColor
+   * @param float iColorPlace between 0 and 1
+   */
+  function multiGradient() {
+    var iParam=0;
+    var iColorsCount= arguments[iParam++];
+    var sOriginColor= arguments[iParam++];
+    var fOriginColorPlace= 0.0;
+    var sNextColor;
+    var fNextColorPlace;
+    var iR, iG, iB, iR2, iG2, iB2;
+    if(!(sNextColor= arguments[iParam++])) {
+      sNextColor= sOriginColor;
+    }
+    if(!(fNextColorPlace= arguments[iParam++])) {
+      fNextColorPlace= 1.0;
+    }
+    var r= Array();
+    for(var i=0; i<iColorsCount; i++) {
+      if(i/(iColorsCount-1)>fNextColorPlace) {
+        sOriginColor= sNextColor;
+        fOriginColorPlace= fNextColorPlace;
+        if(!(sNextColor= arguments[iParam++])) {
+          sNextColor= sOriginColor;
+        }
+        if(!(fNextColorPlace= arguments[iParam++])) {
+          fNextColorPlace= 1.0;
+        }
+      }
+      iR= parseInt(sOriginColor.substring(1,3),16);
+      iG= parseInt(sOriginColor.substring(3,5),16);
+      iB= parseInt(sOriginColor.substring(5,7),16);
+      iR2=parseInt(sNextColor.substring(1,3),16);
+      iG2=parseInt(sNextColor.substring(3,5),16);
+      iB2=parseInt(sNextColor.substring(5,7),16);
+      r.push(RGB2String(
+        iR+(iR2-iR)*(i/(iColorsCount-1)-fOriginColorPlace)/(fNextColorPlace-fOriginColorPlace),
+        iG+(iG2-iG)*(i/(iColorsCount-1)-fOriginColorPlace)/(fNextColorPlace-fOriginColorPlace),
+        iB+(iB2-iB)*(i/(iColorsCount-1)-fOriginColorPlace)/(fNextColorPlace-fOriginColorPlace)));
+    }
+    return r;
+  }
+
+
+  function RGB2String(iR, iG, iB) {
+    return String('#').concat(
+      Number(iR).toString(16).fixLength(2,'0'),
+      Number(iG).toString(16).fixLength(2,'0'),
+      Number(iB).toString(16).fixLength(2,'0'));
+  }
+  
+  function String_fixLength(l, c) {
+    if(this.length>l) {
+      return this.substring(0, l);
+    } else if (this.length<l) {
+      return String(c).repeat(l-this.length).concat(this);
+    } else {
+      return this;
+    }
+  }
+  String.prototype.fixLength = String_fixLength;
+  
+  // Create a repeat-string-N-times method for all String objects
+  function String_repeat(n) {
+     var s = String(""), t = this.toString();
+     while (--n >= 0) s = s.concat(t);
+     return s;
+  }
+  String.prototype.repeat = String_repeat;

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.css
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.css	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.css	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,90 @@
+.DynamicTree {
+    font-family: georgia, tahoma;
+    font-size: 11px;
+    white-space: nowrap;
+    cursor: default;
+}
+.DynamicTree .doc img,
+.DynamicTree .folder img { border: 0; vertical-align: -4px; }
+* html .DynamicTree .doc img,
+* html .DynamicTree .folder img { border: 0; vertical-align: middle; vertical-align: -4px; }
+.DynamicTree .section { background: url(images/tree-branch.gif) repeat-y; display: none; }
+.DynamicTree .last { background: none; }
+.DynamicTree .folder .folder { margin-left: 18px; }
+.DynamicTree .doc .doc, .DynamicTree .folder .doc { margin-left: 18px; }
+
+.DynamicTree .doc a { color: #000000; text-decoration: none; }
+.DynamicTree .doc a:hover { color: #000000; text-decoration: underline; }
+
+.DynamicTree .folder a { color: #000000; text-decoration: none; }
+.DynamicTree .folder a:hover { color: #000000; text-decoration: underline; }
+
+.DynamicTree .text { padding: 1px; }
+.DynamicTree .text-active { background: #CEE3FF;  padding: 1px; }
+
+/* hack for IE to fix a bug (background of .section disappearing when mouse is over a link, for example Node 1.1.1.1) */
+* html .DynamicTree .doc { position: relative; }
+* html .DynamicTree .doc a { position: absolute; top: 3px; }
+
+.DynamicTree img { border: 0; }
+
+.DynamicTree .actions {
+    position: relative;
+    margin-top: 7px;
+    margin-left: 10px;
+    height: 20px;
+}
+.DynamicTree .tooltip {
+    position: absolute;
+    line-height: 22px;
+    left: 185px;
+}
+.DynamicTree .moveUp,
+.DynamicTree .moveDown,
+.DynamicTree .moveLeft,
+.DynamicTree .moveRight,
+.DynamicTree .insert,
+.DynamicTree .info,
+.DynamicTree .remove {
+    width: 20px;
+    height: 20px;
+    display: block;
+    position: absolute;
+    border: 1px solid #F1EFE2;
+    z-index: 5;
+    cursor: default;
+}
+.DynamicTree .moveUp:hover,
+.DynamicTree .moveDown:hover,
+.DynamicTree .moveLeft:hover,
+.DynamicTree .moveRight:hover,
+.DynamicTree .insert:hover,
+.DynamicTree .info:hover,
+.DynamicTree .remove:hover {
+    background-color: #ffffff;
+    border: 1px solid #ACA899;
+}
+.DynamicTree .moveUp { left: 0px; }
+.DynamicTree .moveDown { left: 25px; }
+.DynamicTree .moveLeft { left: 50px; }
+.DynamicTree .moveRight { left: 75px; }
+.DynamicTree .insert { left: 100px; }
+.DynamicTree .info { left: 125px; }
+.DynamicTree .remove { left: 150px; }
+
+.DynamicTree .wrap { margin-left: 2px; }
+.DynamicTree .top { background: url(images/tree.gif) no-repeat; padding-left: 25px; line-height: 20px; color: #333333; }
+.DynamicTree .wrap1 { background: #ffffff; padding: 10px; border: 1px solid #919B9C; width: 250px; }
+.DynamicTree .wrap2 { margin-left: 2px; }
+
+.DynamicTree #tree-insert-form { display: none; margin-top: 1em; }
+.DynamicTree #tree-insert-form .label { text-align: right; width: 50px; padding-right: 8px; }
+.DynamicTree #tree-insert-form .input { margin-bottom: 2px; padding-left: 3px; }
+.DynamicTree #tree-insert-form select { margin-bottom: 2px; }
+.DynamicTree #tree-insert-form .button { margin-top: 4px; }
+
+.DynamicTree #tree-info-form { display: none; margin-top: 1em; }
+.DynamicTree #tree-info-form .label { text-align: right; width: 50px; padding-right: 8px; }
+.DynamicTree #tree-info-form .input { margin-bottom: 2px; padding-left: 3px; }
+.DynamicTree #tree-info-form select { margin-bottom: 2px; }
+.DynamicTree #tree-info-form .button { margin-top: 4px; }
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.js
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,285 @@
+// +---------------------------------------------------------------+
+// | DO NOT REMOVE THIS                                            |
+// +---------------------------------------------------------------+
+// | DynamicTree 1.5.2                                             |
+// | Author: Cezary Tomczak [www.gosu.pl]                          |
+// | Free for any use as long as all copyright messages are intact |
+// +---------------------------------------------------------------+
+
+function DynamicTree(id) {
+    this.foldersAsLinks = false;
+    this.path = "images/";
+    this.img = {
+        "branch": "tree-branch.gif",
+        "doc": "tree-doc.gif",
+        "folder": "tree-folder.gif",
+        "folderOpen": "tree-folder-open.gif",
+        "leaf": "tree-leaf.gif",
+        "leafEnd": "tree-leaf-end.gif",
+        "node": "tree-node.gif",
+        "nodeEnd": "tree-node-end.gif",
+        "nodeOpen": "tree-node-open.gif",
+        "nodeOpenEnd": "tree-node-open-end.gif" };
+    this.cookiePath = "";
+    this.cookieDomain = "";
+    this.init = function() {
+        var p, img;
+        for (p in this.img) {
+            this.img[p] = this.path + this.img[p];
+        }
+        for (p in this.img) {
+            this.imgObjects.push(new Image());
+            this.imgObjects.getLast().src = this.img[p];
+            this.img[p] = this.imgObjects.getLast().src;
+        }
+        this.parse(document.getElementById(this.id).childNodes, this.tree, 1);
+        this.loadState();
+        if (window.addEventListener) { window.addEventListener("unload", function(e) { self.saveState(); }, false); }
+        else if (window.attachEvent) { window.attachEvent("onunload", function(e) { self.saveState(); }); }
+        this.updateHtml();
+    };
+    this.parse = function(nodes, tree) {
+        for (var i = 0; i < nodes.length; i++) {
+            if (nodes[i].nodeType == 1) {
+                if (!nodes[i].className) { continue; }
+                if (!nodes[i].id) {
+                    nodes[i].id = this.id + "-" + (++this.count);
+                }
+                var node = new Node();
+                node.id = nodes[i].id;
+                if (nodes[i].firstChild) {
+                    if (nodes[i].firstChild.tagName == "A") {
+                        var a = nodes[i].firstChild;
+                        if (a.firstChild) {
+                            node.text = a.firstChild.nodeValue.trim();
+                        }
+                        if (a.href) {
+                            node.href = a.href;
+                        }
+                        if (a.title) {
+                            node.title = a.title;
+                        }
+                        if (a.target) {
+                            node.target = a.target;
+                        }
+                    } else {
+                        node.text = nodes[i].firstChild.nodeValue.trim();
+                    }
+                }
+                node.parentNode = tree;
+                node.childNodes = (nodes[i].className == "folder" ? new Array() : null);
+                node.isDoc      = (nodes[i].className == "doc");
+                node.isFolder   = (nodes[i].className == "folder");
+                tree.childNodes.push(node);
+                this.allNodes[node.id] = node;
+            }
+            if (nodes[i].nodeType == 1 && nodes[i].childNodes) {
+                this.parse(nodes[i].childNodes, tree.childNodes.getLast());
+            }
+        }
+    };
+    this.nodeClick = function(id) {
+        var el = document.getElementById(id+"-section");
+        var node = document.getElementById(id+"-node");
+        var icon = document.getElementById(id+"-icon");
+        if (el.style.display == "block") {
+            el.style.display = "none";
+            if (this.allNodes[id].isLast()) { node.src = this.img.nodeEnd; }
+            else { node.src = this.img.node; }
+            icon.src = this.img.folder;
+            this.opened.removeByValue(id);
+        } else {
+            el.style.display = "block";
+            if (this.allNodes[id].isLast()) { node.src = this.img.nodeOpenEnd; }
+            else { node.src = this.img.nodeOpen; }
+            icon.src = this.img.folderOpen;
+            this.opened.push(id);
+        }
+        /* fix ie bug - images not showing */
+        if (node.outerHTML) { node.outerHTML = node.outerHTML; }
+        if (icon.outerHTML) { icon.outerHTML = icon.outerHTML; }
+    };
+    this.toHtml = function() {
+        var s = "";
+        var nodes = this.tree.childNodes;
+        for (var i = 0; i < nodes.length; i++) {
+            s += nodes[i].toHtml();
+        }
+        return s;
+    };
+    this.updateHtml = function() {
+        document.getElementById(this.id).innerHTML = this.toHtml();
+    };
+    this.loadState = function() {
+        var opened = this.cookie.get("opened");
+        if (opened) {
+            this.opened = opened.split("|");
+            this.opened.filter(function(id) { return self.allNodes[id] && self.allNodes[id].isFolder && self.allNodes[id].childNodes.length;  });
+        }
+    };
+    this.saveState = function() {
+        if (this.opened.length) {
+            this.cookie.set("opened", this.opened.join("|"), 3600*24*30, this.cookiePath, this.cookieDomain);
+        } else {
+            this.clearState();
+        }
+    };
+    this.clearState = function() {
+        this.cookie.del("opened");
+    };
+    function Node(id, text, parentNode, childNodes, isDoc, isFolder) {
+        this.id = id;
+        this.text = text;
+        this.parentNode = parentNode;
+        this.childNodes = childNodes;
+        this.isDoc = isDoc;
+        this.isFolder = isFolder;
+        this.href = "";
+        this.title = "";
+        this.target = "";
+        this.isLast = function() {
+            if (this.parentNode) {
+                return this.parentNode.childNodes.getLast().id == this.id;
+            }
+            throw "DynamicTree.Node.isLast() failed, this func cannot be called for the root element";
+        };
+        this.toHtml = function() {
+            var s = '<div class="?" id="?">'.format((this.isFolder ? "folder" : "doc"), this.id);
+            if (this.isFolder) {
+                var nodeIcon;
+                if (this.childNodes.length) {
+                    nodeIcon = (self.opened.contains(this.id) ? (this.isLast() ? self.img.nodeOpenEnd : self.img.nodeOpen) : (this.isLast() ? self.img.nodeEnd : self.img.node));
+                } else {
+                    nodeIcon = (this.isLast() ? self.img.leafEnd : self.img.leaf);
+                }
+                var icon = ((self.opened.contains(this.id) && this.childNodes.length) ? self.img.folderOpen : self.img.folder);
+                if (this.childNodes.length) { s += '<a href="javascript:void(0)" onclick="?.nodeClick(\'?\')">'.format(self.id, this.id); }
+                s += '<img id="?-node" src="?" width="18" height="18" alt="" />'.format(this.id, nodeIcon);
+                if (this.childNodes.length) { s += '</a>'; }
+                s += '<img id="?-icon" src="?" width="18" height="18" alt="" />'.format(this.id, icon);
+                if (self.foldersAsLinks) {
+                    s += '<a href="?"??>?</a>'.format(this.href, (this.title ? ' title="?"'.format(this.title) : ""), (this.target ? ' target="?"'.format(this.target) : ""), this.text);
+                } else {
+                    s += this.text;
+                }
+                if (this.childNodes.length) {
+                    s += '<div class="section?" id="?-section"'.format((this.isLast() ? " last" : ""), this.id);
+                    if (self.opened.contains(this.id)) {
+                        s += '  style="display: block;"'; }
+                    s += '>';
+                    for (var i = 0; i < this.childNodes.length; i++) {
+                        s += this.childNodes[i].toHtml();
+                    }
+                    s += '</div>';
+                }
+            }
+            if (this.isDoc) {
+                s += '<img src="?" width="18" height="18" alt="" /><img src="?" width="18" height="18" alt="" />'.format((this.isLast() ? self.img.leafEnd : self.img.leaf), self.img.doc);
+                s += '<a href="?"??>?</a>'.format(this.href, (this.title ? ' title="?"'.format(this.title) : ""), (this.target ? ' target="?"'.format(this.target) : ""), this.text);
+            }
+            s += '</div>';
+            return s;
+        };
+    }
+    function Cookie() {
+        this.get = function(name) {
+            var cookies = document.cookie.split(";");
+            for (var i = 0; i < cookies.length; ++i) {
+                var a = cookies[i].split("=");
+                if (a.length == 2) {
+                    a[0] = a[0].trim();
+                    a[1] = a[1].trim();
+                    if (a[0] == name) {
+                        return unescape(a[1]);
+                    }
+                }
+            }
+            return "";
+        };
+        this.set = function(name, value, seconds, path, domain, secure) {
+            var cookie = (name + "=" + escape(value));
+            if (seconds) {
+                var date = new Date(new Date().getTime()+seconds*1000);
+                cookie += ("; expires="+date.toGMTString());
+            }
+            cookie += (path    ? "; path="+path : "");
+            cookie += (domain  ? "; domain="+domain : "");
+            cookie += (secure  ? "; secure" : "");
+            document.cookie = cookie;
+        };
+        this.del = function(name) {
+            document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
+        };
+    }
+    var self = this;
+    this.id = id;
+    this.tree = new Node("tree", "", null, new Array(), false, true);
+    this.allNodes = {}; // id => object
+    this.opened = []; // opened folders
+    this.active = ""; // active node, text clicked
+    this.cookie = new Cookie();
+    this.imgObjects = [];
+    this.count = 0;
+}
+
+/* Check whether array contains given string */
+if (!Array.prototype.contains) {
+    Array.prototype.contains = function(s) {
+        for (var i = 0; i < this.length; ++i) {
+            if (this[i] === s) { return true; }
+        }
+        return false;
+    };
+}
+
+/* Remove elements with such value (mutates) */
+if (!Array.prototype.removeByValue) {
+    Array.prototype.removeByValue = function(value) {
+        var i, indexes = [];
+        for (i = 0; i < this.length; ++i) {
+            if (this[i] === value) { indexes.push(i); }
+        }
+        for (i = indexes.length - 1; i >= 0; --i) {
+            this.splice(indexes[i], 1);
+        }
+    };
+}
+
+/* Remove elements judged 'false' by the passed function (mutates) */
+if (!Array.prototype.filter) {
+    Array.prototype.filter = function(func) {
+        var i, indexes = [];
+        for (i = 0; i < this.length; ++i) {
+            if (!func(this[i])) { indexes.push(i); }
+        }
+        for (i = indexes.length - 1; i >= 0; --i) {
+            this.splice(indexes[i], 1);
+        }
+    };
+}
+
+/* Get the last element from the array */
+if (!Array.prototype.getLast) {
+    Array.prototype.getLast = function() {
+        return this[this.length-1];
+    };
+}
+
+/* Strip whitespace from the beginning and end of a string */
+if (!String.prototype.trim) {
+    String.prototype.trim = function() {
+        return this.replace(/^\s*|\s*$/g, "");
+    };
+}
+
+/* Replace ? tokens with variables passed as arguments in a string */
+String.prototype.format = function() {
+    if (!arguments.length) { throw "String.format() failed, no arguments passed, this = "+this; }
+    var tokens = this.split("?");
+    if (arguments.length != (tokens.length - 1)) { throw "String.format() failed, tokens != arguments, this = "+this; }
+    var s = tokens[0];
+    for (var i = 0; i < arguments.length; ++i) {
+        s += (arguments[i] + tokens[i + 1]);
+    }
+    return s;
+};
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.txt
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTree.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,36 @@
+---------
+! INSTALL
+---------
+
+.. soon ..
+
+Warning:
+- id of the menu and object variable need to be the same
+
+------
+! TODO
+------
+
+- documentation
+
+----------------
+! KNOWN PROBLEMS
+----------------
+
+* Opera - seems like there is no way to get the original href attribute from <a> elements,
+  they are converted to absolute paths. This can be a problem in TreeBuilder. IE had the same
+  problem, but a dirty hack helped to solve it.
+
+* IE 5.0 - plugins don't work in TreeBuilder, Function.call() method is missing in its implementation.
+
+---------
+! CHANGES
+---------
+
+*** 1.5.2 ***
+
+  - added /tests/foldersAsLinks.html [minor changes in DynamicTree.js & .css]
+
+*** 1.5.1 ***
+  - [DynamicTreeBuilder] tmpTreeId was replaced with tree.count in actions.js, this bug could
+    affect you if you had more than 20 records in a tree when starting editing.
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTreeBuilder.js
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTreeBuilder.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/DynamicTreeBuilder.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,548 @@
+// +---------------------------------------------------------------+
+// | DO NOT REMOVE THIS                                            |
+// +---------------------------------------------------------------+
+// | DynamicTree 1.5.0                                             |
+// | Author: Cezary Tomczak [www.gosu.pl]                          |
+// | Free for any use as long as all copyright messages are intact |
+// +---------------------------------------------------------------+
+
+function DynamicTreeBuilder(id) {
+    this.path = "images/";
+    this.img = {
+        "branch": "tree-branch.gif",
+        "doc": "tree-doc.gif",
+        "folder": "tree-folder.gif",
+        "folderOpen": "tree-folder-open.gif",
+        "leaf": "tree-leaf.gif",
+        "leafEnd": "tree-leaf-end.gif",
+        "node": "tree-node.gif",
+        "nodeEnd": "tree-node-end.gif",
+        "nodeOpen": "tree-node-open.gif",
+        "nodeOpenEnd": "tree-node-open-end.gif" };
+    this.cookiePath = "";
+    this.cookieDomain = "";
+    this.init = function() {
+        var p, img;
+        for (p in this.img) {
+            this.img[p] = this.path + this.img[p];
+        }
+        for (p in this.img) {
+            this.imgObjects.push(new Image());
+            this.imgObjects.getLast().src = this.img[p];
+            this.img[p] = this.imgObjects.getLast().src;
+        }
+        this.parse(document.getElementById(this.id).childNodes, this.tree);
+        this.loadState();
+        if (window.addEventListener) { window.addEventListener("unload", function(e) { self.saveState(); }, false); }
+        else if (window.attachEvent) { window.attachEvent("onunload", function(e) { self.saveState(); }); }
+        this.updateHtml();
+    };
+    this.reset = function() {
+        this.clearState();
+        this.tree = new Node("tree", "", null, new Array(), false, true);
+        this.allNodes = {};
+        this.opened = [];
+        this.active = "";
+        this.count = 0;
+        this.parse(document.getElementById(this.id).childNodes, this.tree);
+        this.updateHtml();
+    };
+    this.parse = function(nodes, tree) {
+        for (var i = 0; i < nodes.length; i++) {
+            if (nodes[i].nodeType == 1) {
+                if (!nodes[i].className) { continue; }
+                nodes[i].id = this.id + "-" + (++this.count);
+                var node = new Node();
+                node.id = nodes[i].id;
+                if (nodes[i].firstChild) {
+                    if (nodes[i].firstChild.tagName == "A") {
+                        var a = nodes[i].firstChild;
+                        if (a.firstChild) {
+                            node.text = a.firstChild.nodeValue.trim();
+                        }
+                        if (a.href) {
+                            // dirty hack for ie (automatic conversion to absolute paths problem), see also DynamicTreePlugins.importFromHtml()
+                            var s = a.parentNode.innerHTML.match(/href=["'](dynamictree:\/\/dynamictree\/)?([^"']*)["']/i);
+                            if (s) { node.href = s[2]; }
+                        }
+                        if (a.title) {
+                            node.title = a.title;
+                        }
+                        if (a.target) {
+                            node.target = a.target;
+                        }
+                    } else {
+                        node.text = nodes[i].firstChild.nodeValue.trim();
+                    }
+                }
+                node.parentNode = tree;
+                node.childNodes = (nodes[i].className == "folder" ? new Array() : null);
+                node.isDoc      = (nodes[i].className == "doc");
+                node.isFolder   = (nodes[i].className == "folder");
+                tree.childNodes.push(node);
+                this.allNodes[node.id] = node;
+            }
+            if (nodes[i].nodeType == 1 && nodes[i].childNodes) {
+                this.parse(nodes[i].childNodes, tree.childNodes.getLast());
+            }
+        }
+    };
+    this.nodeClick = function(id) {
+        var el = document.getElementById(id+"-section");
+        var node = document.getElementById(id+"-node");
+        var icon = document.getElementById(id+"-icon");
+        if (el.style.display == "block") {
+            el.style.display = "none";
+            if (this.allNodes[id].isLast()) { node.src = this.img.nodeEnd; }
+            else { node.src = this.img.node; }
+            icon.src = this.img.folder;
+            this.opened.removeByValue(id);
+        } else {
+            el.style.display = "block";
+            if (this.allNodes[id].isLast()) { node.src = this.img.nodeOpenEnd; }
+            else { node.src = this.img.nodeOpen; }
+            icon.src = this.img.folderOpen;
+            this.opened.push(id);
+        }
+        /* fix ie bug - images not showing */
+        if (node.outerHTML) { node.outerHTML = node.outerHTML; }
+        if (icon.outerHTML) { icon.outerHTML = icon.outerHTML; }
+    };
+    this.textClick = function(id) {
+        if (this.active) {
+            document.getElementById(this.active+"-text").className = "text";
+        }
+        document.getElementById(id+"-text").className = "text-active";
+        this.active = id;
+        this.textClickListener.call();
+    };
+    this.toHtml = function() {
+        var s = "";
+        var nodes = this.tree.childNodes;
+        for (var i = 0; i < nodes.length; i++) {
+            s += nodes[i].toHtml();
+        }
+        return s;
+    };
+    this.updateHtml = function() {
+        document.getElementById(this.id).innerHTML = this.toHtml();
+    };
+    this.loadState = function() {
+        var opened = this.cookie.get("opened");
+        if (opened) {
+            this.opened = opened.split("|");
+            this.opened.filter(function(id) { return self.allNodes[id] && self.allNodes[id].isFolder && self.allNodes[id].childNodes.length; });
+        }
+    };
+    this.saveState = function() {
+        if (this.opened.length) {
+            this.cookie.set("opened", this.opened.join("|"), 3600*24*30, this.cookiePath, this.cookieDomain);
+        } else {
+            this.clearState();
+        }
+    };
+    this.clearState = function() {
+        this.cookie.del("opened");
+    };
+    this.getActiveNode = function() {
+        if (!this.active) { throw "DynamicTreeBuilder.getActiveNode() failed, there is no active node"; }
+        return this.allNodes[this.active];
+    }
+    this.mayMoveUp = function() {
+        return this.active && !this.allNodes[this.active].isFirst();
+    };
+    this.mayMoveDown = function() {
+        return this.active && !this.allNodes[this.active].isLast();
+    };
+    this.mayMoveLeft = function() {
+        return this.active && (this.allNodes[this.active].getLevel() > 1);
+    };
+    this.mayMoveRight = function() {
+        if (this.active) {
+            var node = this.allNodes[this.active].getNextSibling();
+            while (node) {
+                if (node.isFolder) { return true; }
+                node = node.getNextSibling();
+            }
+        }
+        return false;
+    };
+    this.mayInsertBefore = function() {
+        return Boolean(this.active);
+    };
+    this.mayInsertAfter = function() {
+        return Boolean(this.active);
+    };
+    this.mayInsertInside = function() {
+        return this.active && this.allNodes[this.active].isFolder;
+    };
+    this.mayRemove = function() {
+        if (this.active) {
+            var node = this.allNodes[this.active];
+            if (node.isDoc) { return true; }
+            if (node.isFolder && !node.childNodes.length) { return true; }
+        }
+        return false;
+    };
+    this.moveUp = function() {
+        var node = this.allNodes[this.active];
+        var index = node.getIndex();
+        var parent = node.parentNode;
+        parent.removeChild(node);
+        parent.appendChildAtIndex(node, index-1);
+        this.updateHtml();
+    };
+    this.moveDown = function() {
+        var node = this.allNodes[this.active];
+        var index = node.getIndex();
+        var parent = node.parentNode;
+        parent.removeChild(node);
+        parent.appendChildAtIndex(node, index+1);
+        this.updateHtml();
+    };
+    this.moveLeft = function() {
+        var node = this.allNodes[this.active];
+        var left = node.parentNode;
+        left.removeChild(node);
+        left.parentNode.appendChildAtIndex(node, left.getIndex());
+        this.updateHtml();
+    };
+    this.moveRight = function() {
+        var node = this.allNodes[this.active];
+        var next = node.getNextSibling();
+        var rightId = null;
+        while (next) {
+            if (next.isFolder) {
+                rightId = next.id;
+                break;
+            }
+            next = next.getNextSibling();
+        }
+        var right = this.allNodes[rightId];
+        node.parentNode.removeChild(node);
+        if (right.childNodes.length) {
+            right.appendChildAtIndex(node, 0);
+        } else {
+            right.appendChild(node);
+        }
+        this.updateHtml();
+    };
+    this.createNode = function(id, text, type, object) {
+        if (!id || this.allNodes[id] || !text || (type != "doc" && type != "folder")) {
+            throw this.id+'.createNode("'+id+'", "'+text+'", "'+type+'") failed, illegal action';
+        }
+        var node;
+        if (type == "doc") {
+            node = new Node(id, text, null, null, true, false);
+        } else {
+            node = new Node(id, text, null, new Array(), false, true);
+        }
+        if (object) {
+            for (var p in object) {
+                node[p] = object[p];
+            }
+        }
+        this.allNodes[id] = node;
+        return node;
+    };
+    this.insert = function(id, text, type, object) {
+        var node = this.createNode(id, text, type, object);
+        if (this.tree.childNodes.length) {
+            this.tree.appendChildAtIndex(node, 0);
+        } else {
+            this.tree.appendChild(node);
+        }
+        this.updateHtml();
+    };
+    this.insertBefore = function(id, text, type, object) {
+        if (!this.mayInsertBefore()) {
+            throw this.id+'.insertBefore() failed, illegal action';
+        }
+        var node = this.createNode(id, text, type, object);
+        var active = this.allNodes[this.active];
+        active.parentNode.appendChildAtIndex(node, active.getIndex());
+        this.updateHtml();
+    };
+    this.insertAfter = function(id, text, type, object) {
+        if (!this.mayInsertAfter()) {
+            throw this.id+'.insertAfter() failed, illegal action';
+        }
+        var node = this.createNode(id, text, type, object);
+        var active = this.allNodes[this.active];
+        if (active.parentNode.childNodes[active.getIndex()+1]) {
+            active.parentNode.appendChildAtIndex(node, active.getIndex()+1);
+        } else {
+            active.parentNode.appendChild(node);
+        }
+        this.updateHtml();
+    };
+    this.insertInsideAtStart = function(id, text, type, object) {
+        if (!this.mayInsertInside()) {
+            throw this.id+'.insertInsideAtStart() failed, illegal action';
+        }
+        var node = this.createNode(id, text, type, object);
+        var active = this.allNodes[this.active];
+        if (active.childNodes.length) {
+            active.appendChildAtIndex(node, 0);
+        } else {
+            active.appendChild(node);
+        }
+        this.updateHtml();
+    };
+    this.insertInsideAtEnd = function(id, text, type, object) {
+        if (!this.mayInsertInside()) {
+            throw this.id+'.insertInsideAtEnd() failed, illegal action';
+        }
+        var node = this.createNode(id, text, type, object);
+        var active = this.allNodes[this.active];
+        active.appendChild(node);
+        this.updateHtml();
+    };
+    this.remove = function() {
+        var node = this.allNodes[this.active];
+        node.parentNode.removeChild(node);
+        this.allNodes[this.active] = null;
+        this.active = "";
+        this.updateHtml();
+    };
+    function Node(id, text, parentNode, childNodes, isDoc, isFolder) {
+        this.id = id;
+        this.text = text;
+        this.parentNode = parentNode;
+        this.childNodes = childNodes;
+        this.isDoc = isDoc;
+        this.isFolder = isFolder;
+        this.href = "";
+        this.title = "";
+        this.target = "";
+        this.isFirst = function() {
+            if (this.parentNode) {
+                return this.parentNode.childNodes[0].id == this.id;
+            }
+            throw "DynamicTreeBuilder.Node.isFirst() failed, this func cannot be called for the root element";
+        };
+        this.isLast = function() {
+            if (this.parentNode) {
+                return this.parentNode.childNodes.getLast().id == this.id;
+            }
+            throw "DynamicTreeBuilder.Node.isLast() failed, this func cannot be called for the root element";
+        };
+        this.getLevel = function() {
+            var level = 0;
+            var node = this;
+            while (node.parentNode) {
+                level++;
+                node = node.parentNode;
+            }
+            return level;
+        };
+        this.getNextSibling = function() {
+            if (this.parentNode) {
+                var nodes = this.parentNode.childNodes;
+                var start = false;
+                for (var i = 0; i < nodes.length; i++) {
+                    if (start) { return nodes[i]; }
+                    if (!start && this.id != nodes[i].id) { continue; }
+                    start = true;
+                }
+                return false;
+            }
+            throw "DynamicTreeBuilder.Node.getNextSibling() failed, this func cannot be called for the root element";
+        };
+        this.getPreviousSibling = function() {
+            if (this.parentNode) {
+                var nodes = this.parentNode.childNodes;
+                for (var i = 0; i < nodes.length; i++) {
+                    if (nodes[i].id == this.id) {
+                        if (i) { return nodes[i-1]; }
+                        else { return false; }
+                    }
+                }
+                throw "DynamicTreeBuilder.Node.getPreviousSibling() failed, unknown error";
+            }
+            throw "DynamicTreeBuilder.Node.getPreviousSibling() failed, this func cannot be called for the root element";
+        };
+        this.getIndex = function() {
+            if (this.parentNode) {
+                var nodes = this.parentNode.childNodes;
+                for (var i = 0; i < nodes.length; i++) {
+                    if (nodes[i].id == this.id) { return i; }
+                }
+                throw "DynamicTreeBuilder.Node.getIndex() failed, unknown error";
+            }
+            throw "DynamicTreeBuilder.Node.getIndex() failed, this func cannot be called for the root element";
+        };
+        this.removeChild = function(node) {
+            this.childNodes.removeByIndex(node.getIndex());
+            node.parentNode = null;
+        };
+        this.appendChild = function(node) {
+            this.childNodes.push(node);
+            node.parentNode = this;
+        };
+        this.appendChildAtIndex = function(node, index) {
+            this.childNodes.pushAtIndex(node, index);
+            node.parentNode = this;
+        };
+        this.toHtml = function() {
+            var s = '<div class="?" id="?">'.format((this.isFolder ? "folder" : "doc"), this.id);
+            if (this.isFolder) {
+                var nodeIcon;
+                if (this.childNodes.length) {
+                    nodeIcon = (self.opened.contains(this.id) ? (this.isLast() ? self.img.nodeOpenEnd : self.img.nodeOpen) : (this.isLast() ? self.img.nodeEnd : self.img.node));
+                } else {
+                    nodeIcon = (this.isLast() ? self.img.leafEnd : self.img.leaf);
+                }
+                var icon = ((self.opened.contains(this.id) && this.childNodes.length) ? self.img.folderOpen : self.img.folder);
+                if (this.childNodes.length) { s += '<a href="javascript:void(0)" onclick="?.nodeClick(\'?\')">'.format(self.id, this.id); }
+                s += '<img id="?-node" src="?" width="18" height="18" alt="" />'.format(this.id, nodeIcon);
+                if (this.childNodes.length) { s += '</a>'; }
+                s += '<img id="?-icon" src="?" width="18" height="18" alt="" />'.format(this.id, icon);
+                s += '<span id="?-text" class="text?" onclick="?.textClick(\'?\')">?</span>'.format(this.id, (self.active == this.id ? '-active' : ''), self.id, this.id, this.text);
+                if (this.childNodes.length) {
+                    s += '<div class="section?" id="?-section"'.format((this.isLast() ? " last" : ""), this.id);
+                    if (self.opened.contains(this.id)) {
+                        s += '  style="display: block;"'; }
+                    s += '>';
+                    for (var i = 0; i < this.childNodes.length; i++) {
+                        s += this.childNodes[i].toHtml();
+                    }
+                    s += '</div>';
+                }
+            }
+            if (this.isDoc) {
+                s += '<img src="?" width="18" height="18" alt="" /><img src="?" />'.format((this.isLast() ? self.img.leafEnd : self.img.leaf), self.img.doc);
+                s += '<span id="?-text" class="text?" onclick="?.textClick(\'?\')">?</span>'.format(this.id, (self.active == this.id ? '-active' : ''), self.id, this.id, this.text);
+            }
+            s += '</div>';
+            return s;
+        };
+    }
+    function Cookie() {
+        this.get = function(name) {
+            var cookies = document.cookie.split(";");
+            for (var i = 0; i < cookies.length; ++i) {
+                var a = cookies[i].split("=");
+                if (a.length == 2) {
+                    a[0] = a[0].trim();
+                    a[1] = a[1].trim();
+                    if (a[0] == name) {
+                        return unescape(a[1]);
+                    }
+                }
+            }
+            return "";
+        };
+        this.set = function(name, value, seconds, path, domain, secure) {
+            var cookie = (name + "=" + escape(value));
+            if (seconds) {
+                var date = new Date(new Date().getTime()+seconds*1000);
+                cookie += ("; expires="+date.toGMTString());
+            }
+            cookie += (path    ? "; path="+path : "");
+            cookie += (domain  ? "; domain="+domain : "");
+            cookie += (secure  ? "; secure" : "");
+            document.cookie = cookie;
+        };
+        this.del = function(name) {
+            document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
+        };
+    }
+    function Listener() {
+        this.funcs = [];
+        this.add = function(func) {
+            this.funcs.push(func);
+        };
+        this.call = function() {
+            for (var i = 0; i < this.funcs.length; i++) {
+                this.funcs[i]();
+            }
+        };
+    }
+    var self = this;
+    this.id = id;
+    this.tree = new Node("tree", "", null, new Array(), false, true);
+    this.allNodes = {}; // id => object
+    this.opened = []; // opened folders
+    this.active = ""; // active node, text clicked
+    this.cookie = new Cookie();
+    this.imgObjects = [];
+    this.count = 0;
+    this.textClickListener = new Listener(); // other modules also may need to know when user clicks on text
+}
+
+/* Check whether array contains given string */
+if (!Array.prototype.contains) {
+    Array.prototype.contains = function(s) {
+        for (var i = 0; i < this.length; ++i) {
+            if (this[i] === s) { return true; }
+        }
+        return false;
+    };
+}
+
+/* Remove elements with such value (mutates) */
+if (!Array.prototype.removeByValue) {
+    Array.prototype.removeByValue = function(value) {
+        var i, indexes = [];
+        for (i = 0; i < this.length; ++i) {
+            if (this[i] === value) { indexes.push(i); }
+        }
+        for (i = indexes.length - 1; i >= 0; --i) {
+            this.splice(indexes[i], 1);
+        }
+    };
+}
+
+/* Remove elements judged 'false' by the passed function (mutates) */
+if (!Array.prototype.filter) {
+    Array.prototype.filter = function(func) {
+        var i, indexes = [];
+        for (i = 0; i < this.length; ++i) {
+            if (!func(this[i])) { indexes.push(i); }
+        }
+        for (i = indexes.length - 1; i >= 0; --i) {
+            this.splice(indexes[i], 1);
+        }
+    };
+}
+
+/* Get the last element from the array */
+if (!Array.prototype.getLast) {
+    Array.prototype.getLast = function() {
+        return this[this.length-1];
+    };
+}
+
+/* Strip whitespace from the beginning and end of a string */
+if (!String.prototype.trim) {
+    String.prototype.trim = function() {
+        return this.replace(/^\s*|\s*$/g, "");
+    };
+}
+
+/* Replace ? tokens with variables passed as arguments in a string */
+String.prototype.format = function() {
+    if (!arguments.length) { throw "String.format() failed, no arguments passed, this = "+this; }
+    var tokens = this.split("?");
+    if (arguments.length != (tokens.length - 1)) { throw "String.format() failed, tokens != arguments, this = "+this; }
+    var s = tokens[0];
+    for (var i = 0; i < arguments.length; ++i) {
+        s += (arguments[i] + tokens[i + 1]);
+    }
+    return s;
+};
+
+/* Remove element with given index (mutates) */
+if (!Array.prototype.removeByIndex) {
+    Array.prototype.removeByIndex = function(index) {
+        this.splice(index, 1);
+    };
+}
+
+/* Push an element at specified index */
+if (!Array.prototype.pushAtIndex) {
+    Array.prototype.pushAtIndex = function(el, index) {
+        this.splice(index, 0, el);
+    };
+}
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/actions.js
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/actions.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/actions.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,234 @@
+function treeTooltipOn() { document.getElementById("tree-tooltip").innerHTML = treeTooltips[treeElements.indexOf(this.id)]; }
+function treeTooltipOff() { document.getElementById("tree-tooltip").innerHTML = ""; }
+
+var treeElements = ["tree-moveUp", "tree-moveDown", "tree-moveLeft", "tree-moveRight", "tree-insert", "tree-info", "tree-remove"];
+var treeTooltips = ["Move Up", "Move Down", "Move Left", "Move Right", "Insert", "Info", "Delete"];
+
+for (var i = 0; i < treeElements.length; i++) {
+    document.getElementById(treeElements[i]).onmouseover = treeTooltipOn;
+    document.getElementById(treeElements[i]).onmouseout = treeTooltipOff;
+}
+
+function treeMoveUp() {
+    if (tree.mayMoveUp()) {
+        tree.moveUp();
+    }
+}
+function treeMoveDown() {
+    if (tree.mayMoveDown()) {
+        tree.moveDown();
+    }
+}
+function treeMoveLeft() {
+    if (tree.mayMoveLeft()) {
+        tree.moveLeft();
+    }
+}
+function treeMoveRight() {
+    if (tree.mayMoveRight()) {
+        tree.moveRight();
+    }
+}
+function treeInsert() {
+    treeHideInfo();
+    document.getElementById("tree-insert-form").style.display = "block";
+    document.getElementById("tree-insert-where-div").style.display = (tree.active ? "" : "none");
+    if (tree.active) {
+        var where = document.getElementById("tree-insert-where");
+        if (tree.mayInsertInside()) {
+            if (!where.options[2] && !where.options[3]) {
+                where.options[2] = new Option("Inside at start", "inside_start");
+                where.options[3] = new Option("Inside at end", "inside_end");
+            }
+        } else if (where.options[2] && where.options[3]) {
+            where.options[2] = null;
+            where.options[3] = null;
+            where.options.length = 2;
+        }
+    }
+}
+function treeHideInsert() {
+    var name = document.getElementById("tree-insert-name");
+    var href = document.getElementById("tree-insert-href");
+    var title = document.getElementById("tree-insert-title");
+    var target = document.getElementById("tree-insert-target");
+    name.value = "";
+    href.value = "";
+    title.value = "";
+    target.value = "";
+    document.getElementById("tree-insert-form").style.display = "none";
+}
+function treeInfo() {
+    treeHideInsert();
+    var name = document.getElementById("tree-info-name");
+    var href = document.getElementById("tree-info-href");
+    var title = document.getElementById("tree-info-title");
+    var target = document.getElementById("tree-info-target");
+    name.value = "";
+    href.value = "";
+    title.value = "";
+    target.value = "";
+    document.getElementById("tree-info-form").style.display = "block";
+    if (tree.active) {
+        var node = tree.getActiveNode();
+        name.value = node.text;
+        href.value = node.href;
+        title.value = node.title;
+        target.value = node.target;
+    }
+}
+function treeInfoUpdate() {
+    var name = document.getElementById("tree-info-name");
+    var href = document.getElementById("tree-info-href");
+    var title = document.getElementById("tree-info-title");
+    var target = document.getElementById("tree-info-target");
+    name.value = name.value.trim();
+    href.value = href.value.trim();
+    if (!name.value) {
+        return false;
+    }
+    if (tree.active) {
+        var node = tree.getActiveNode();
+        node.text = name.value;
+        node.href = href.value;
+        node.title = title.value;
+        node.target = target.value;
+        tree.updateHtml();
+    }
+}
+function treeHideInfo() {
+    var name = document.getElementById("tree-info-name");
+    var href = document.getElementById("tree-info-href");
+    var title = document.getElementById("tree-info-title");
+    var target = document.getElementById("tree-info-target");
+    name.value = "";
+    href.value = "";
+    title.value = "";
+    target.value = "";
+    document.getElementById("tree-info-form").style.display = "none";
+}
+
+/* only event - blur */
+function treeInsertExecute() {
+    var where = document.getElementById("tree-insert-where");
+    var type = document.getElementById("tree-insert-type");
+    var name = document.getElementById("tree-insert-name");
+    var href = document.getElementById("tree-insert-href");
+    var title = document.getElementById("tree-insert-title");
+    var target = document.getElementById("tree-insert-target");
+    name.value = name.value.trim();
+    href.value = href.value.trim();
+    if (!name.value) {
+        return false;
+    }
+    var o = {"href": href.value, "title": title.value, "target": target.value};
+    if (tree.active) {
+        switch (where.value) {
+            case "before":
+                tree.insertBefore("tree-"+(++tree.count), name.value, type.value, o);
+                break;
+            case "after":
+                tree.insertAfter("tree-"+(++tree.count), name.value, type.value, o);
+                break;
+            case "inside_start":
+                tree.insertInsideAtStart("tree-"+(++tree.count), name.value, type.value, o);
+                break;
+            case "inside_end":
+                tree.insertInsideAtEnd("tree-"+(++tree.count), name.value, type.value, o);
+                break;
+        }
+    } else {
+        tree.insert("tree-"+(++tree.count), name.value, type.value, o);
+    }
+    name.value = "";
+    href.value = "";
+    title.value = "";
+    target.value = "";
+    this.blur();
+}
+function treeRemove() {
+    if (tree.mayRemove()) {
+        if (confirm("Delete current node ?")) {
+            tree.remove();
+            if (document.getElementById("tree-insert-form").style.display == "block") {
+                treeInsert();
+            }
+            if (document.getElementById("tree-info-form").style.display == "block") {
+                treeInfo();
+            }
+        }
+    }
+}
+
+document.getElementById("tree-moveUp").onclick    = treeMoveUp;
+document.getElementById("tree-moveDown").onclick  = treeMoveDown;
+document.getElementById("tree-moveLeft").onclick  = treeMoveLeft;
+document.getElementById("tree-moveRight").onclick = treeMoveRight;
+
+if (document.all && !/opera/i.test(navigator.userAgent)) {
+    document.getElementById("tree-moveUp").ondblclick    = treeMoveUp;
+    document.getElementById("tree-moveDown").ondblclick  = treeMoveDown;
+    document.getElementById("tree-moveLeft").ondblclick  = treeMoveLeft;
+    document.getElementById("tree-moveRight").ondblclick = treeMoveRight;
+}
+
+document.getElementById("tree-insert").onclick = treeInsert;
+document.getElementById("tree-info").onclick = treeInfo;
+document.getElementById("tree-remove").onclick = treeRemove;
+
+document.getElementById("tree-insert-button").onclick = treeInsertExecute;
+document.getElementById("tree-insert-cancel").onclick = treeHideInsert;
+
+document.getElementById("tree-info-button").onclick = treeInfoUpdate;
+document.getElementById("tree-info-cancel").onclick = treeHideInfo;
+
+tree.textClickListener.add(function() { if (document.getElementById("tree-insert-form").style.display == "block") { treeInsert(); } });
+tree.textClickListener.add(function() { if (document.getElementById("tree-info-form").style.display == "block") { treeInfo(); } });
+
+/* Finds the index of the first occurence of item in the array, or -1 if not found */
+if (!Array.prototype.indexOf) {
+    Array.prototype.indexOf = function(item) {
+        for (var i = 0; i < this.length; ++i) {
+            if (this[i] === item) { return i; }
+        }
+        return -1;
+    };
+}
+
+// ---------
+// ! PLUGINS
+// ---------
+
+function treePluginImportHtml() {
+    document.getElementById("tree-plugin").style.display = "block";
+    document.getElementById("tree-plugin-header").innerHTML = "Import from Html";
+    document.getElementById("tree-plugin-button-import-html").style.display = "block";
+}
+function treePluginImportHtmlExecute() {
+    var html = document.getElementById("tree-plugin-textarea");
+    tree.importFromHtml(html.value);
+}
+function treePluginExportHtml() {
+    var w = window.open("", "exportToHtml", "width=600,height=600,scrollbars=yes,resizable=yes");
+    w.document.write('<html><body><pre>'+tree.exportToHtml().replace(/</g, "&lt;").replace(/>/g, "&gt;")+'</pre></body></html>');
+}
+function treePluginExportPhp() {
+    var w = window.open("", "exportToPhp", "width=600,height=600,scrollbars=yes,resizable=yes");
+    w.document.write('<pre>'+tree.exportToPhp().replace(/</g, "&lt;").replace(/>/g, "&gt;")+'</pre>');
+}
+function treePluginExportSql() {
+    var w = window.open("", "exportToSql", "width=600,height=600,scrollbars=yes,resizable=yes");
+    w.document.write('<pre>'+tree.exportToSql().replace(/</g, "&lt;").replace(/>/g, "&gt;")+'</pre>');
+}
+function treePluginHide() {
+    document.getElementById("tree-plugin").style.display = "none";
+    document.getElementById("tree-plugin-header").innerHTML = "";
+    document.getElementById("tree-plugin-textarea").value = "";
+    document.getElementById("tree-plugin-button-import-html").style.display = "none";
+}
+
+document.getElementById("tree-plugin-import-html").onclick = function() { this.blur(); treePluginHide(); treePluginImportHtml(); };
+document.getElementById("tree-plugin-button-import-html").onclick = treePluginImportHtmlExecute;
+document.getElementById("tree-plugin-export-html").onclick = function() { this.blur(); treePluginHide(); treePluginExportHtml(); };
+document.getElementById("tree-plugin-export-php").onclick = function() { this.blur(); treePluginHide(); treePluginExportPhp(); };
+document.getElementById("tree-plugin-export-sql").onclick = function() { this.blur(); treePluginHide(); treePluginExportSql(); }
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example1.html
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example1.html	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example1.html	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+    <title>DynamicTree example 1</title>
+    <link rel="stylesheet" type="text/css" href="DynamicTree.css" />
+    <script type="text/javascript" src="../ie5.js"></script>
+    <script type="text/javascript" src="DynamicTree.js"></script>
+    <style type="text/css">
+    p { font-family: georgia, sans-serif; font-size: 11px; }
+    </style>
+</head>
+<body>
+
+    <p>
+        <b>Project:</b> <a href="http://gosu.pl/dhtml/mygosumenu.html">mygosuMenu</a> <br />
+        <b>Menu type:</b> #1.5 DynamicTree example 1 <br />
+        <b>Features:</b> <br />
+        - Dynamically editable in browser (see example 2) <br />
+        - Export the structure of the tree to Html, Php or Sql <br />
+        - State of the menu is saved in cookie <br />
+        - Unlimited nesting <br />
+        - Links are visible to search engines <br />
+        - Accessible for user agents with javascript disabled (see /tests/test2.html) <br />
+        - Object Oriented code, so you can create many menus on the same page <br />
+        - Free for any use (BSD license) <br />
+        <b>Compatibility:</b> Tested on: IE 5.0/5.5/6.0, Mozilla 1.4/1.7, Opera 7.11/7.23/7.52, Netscape 7.11, Firefox 0.7/0.8/0.9, Safari 1.2
+    </p>
+
+    <div class="DynamicTree">
+        <div class="top">Tree View</div>
+        <div class="wrap" id="tree">
+            <div class="folder">Node 1
+                <div class="folder">Node 1.1
+                    <div class="folder">Node 1.1.1
+                        <div class="doc"><a href="example1.html" title="Node 1.1.1.1" target="_self">Node 1.1.1.1</a></div>
+                    </div>
+                </div>
+                <div class="doc"><a href="example1.html">Node 1.2</a></div>
+            </div>
+            <div class="doc"><a href="example1.html">Node 2</a></div>
+            <div class="doc"><a href="example1.html">Node 3</a></div>
+            <div class="doc"><a href="example1.html">Node 4</a></div>
+            <div class="folder">Node 5
+                <div class="doc"><a href="example1.html">Node 5.1</a></div>
+                <div class="doc"><a href="example1.html">Node 5.2</a></div>
+            </div>
+        </div>
+    </div>
+
+    <script type="text/javascript">
+    var tree = new DynamicTree("tree");
+    tree.init();
+    </script>
+
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example2.html
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example2.html	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/example2.html	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,175 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+    <title>DynamicTree example 2</title>
+    <link rel="stylesheet" type="text/css" href="DynamicTree.css" />
+    <script type="text/javascript" src="../ie5.js"></script>
+    <script type="text/javascript" src="DynamicTreeBuilder.js"></script>
+    <script type="text/javascript" src="plugins.js"></script>
+    <style type="text/css">
+    body { background: #F1EFE2; }
+    body, table { font-family: georgia, sans-serif; font-size: 11px; }
+    form { margin: 0; }
+    input,select { font-size: 11px; font-family: georgia, tahoma, verdana; }
+    input[readonly] { border: 1px solid #7F9DB9; background: #ffffff; }
+    a { color: #0000ee; text-decoration: none; }
+    a:hover { color: #0000ee; text-decoration: underline; }
+    p { margin-top: 0; margin-bottom: 1em; }
+    #tree-plugin, #tree-plugin-button-import-html { display: none; }
+    #tree-plugin-textarea { white-space: nowrap; }
+    </style>
+</head>
+<body>
+
+    <div><b>Project:</b> <a href="http://gosu.pl/dhtml/mygosumenu.html">mygosuMenu</a></div>
+    <div><b>Menu type:</b> #1.5 DynamicTree example 2</div>
+    <div><b>Features:</b> <a href="javascript:void(document.getElementById('features').style.display = (document.getElementById('features').style.display == 'block' ? 'none' : 'block'))">View/Hide</a></div>
+    <div id="features" style="display: none;">
+    - Dynamically editable in browser (see example 2) <br />
+    - Export the structure of the tree to Html, Php or Sql <br />
+    - State of the menu is saved in cookie <br />
+    - Unlimited nesting <br />
+    - Links are visible to search engines <br />
+    - Accessible for user agents with javascript disabled (see /tests/test2.html) <br />
+    - Object Oriented code, so you can create many menus on the same page <br />
+    - Free for any use (BSD license)
+    </div>
+    <div><b>Compatibility:</b> Tested on: IE 5.0/5.5/6.0, Mozilla 1.4/1.7, Opera 7.11/7.23/7.52 Netscape 7.11, Firefox 0.7/0.8/0.9, Safari 1.2</div>
+
+    <table cellspacing="0" cellpadding="10" style="margin-top: 1em;">
+    <tr>
+        <td valign="top">
+
+            <div class="DynamicTree">
+                <div class="wrap1">
+                    <div class="top">Tree Builder</div>
+                    <div class="wrap2" id="tree">
+                        <div class="folder">Node 1
+                            <div class="folder">Node 1.1
+                                <div class="folder">Node 1.1.1
+                                    <div class="doc"><a href="example1.html" title="Node 1.1.1.1" target="_self">Node 1.1.1.1</a></div>
+                                </div>
+                            </div>
+                            <div class="doc"><a href="example2.html">Node 1.2</a></div>
+                        </div>
+                        <div class="doc"><a href="example3.html">Node 2</a></div>
+                        <div class="doc"><a href="/test/example1.html">Node 3</a></div>
+                        <div class="doc"><a href="example1.html">Node 4</a></div>
+                        <div class="folder">Node 5
+                            <div class="doc"><a href="example1.html">Node 5.1</a></div>
+                            <div class="doc"><a href="example1.html">Node 5.2</a></div>
+                        </div>
+                    </div>
+                </div>
+                <div class="actions">
+                    <a id="tree-moveUp" class="moveUp" href="javascript:void(0)"><img src="images/moveUp.gif" width="20" height="20" alt="" /></a>
+                    <a id="tree-moveDown" class="moveDown" href="javascript:void(0)"><img src="images/moveDown.gif" width="20" height="20" alt="" /></a>
+                    <a id="tree-moveLeft" class="moveLeft" href="javascript:void(0)"><img src="images/moveLeft.gif" width="20" height="20" alt="" /></a>
+                    <a id="tree-moveRight" class="moveRight" href="javascript:void(0)"><img src="images/moveRight.gif" width="20" height="20" alt="" /></a>
+                    <a id="tree-insert" class="insert" href="javascript:void(0)"><img src="images/insert.gif" width="20" height="20" alt="" /></a>
+                    <a id="tree-info" class="info" href="javascript:void(0)"><img src="images/info.gif" width="20" height="20" alt="" /></a>
+                    <a id="tree-remove" class="remove" href="javascript:void(0)"><img src="images/delete.gif" width="20" height="20" alt="" /></a>
+                    <div class="tooltip" id="tree-tooltip"></div>
+                </div>
+                <div id="tree-insert-form">
+                    <form action="javascript:void(0)" method="get">
+                        <table cellspacing="0" cellpadding="0">
+                        <tr id="tree-insert-where-div">
+                            <td class="label">Where</td>
+                            <td><select id="tree-insert-where" name="tree-insert-where" class="where"><option value="before">Before</option><option value="after">After</option></select></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Type</td>
+                            <td><select id="tree-insert-type" name="tree-insert-type"><option value="doc">Document</option><option value="folder">Folder</option></select></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Name</td>
+                            <td><input class="input" size="20" id="tree-insert-name" name="tree-insert-name" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Href</td>
+                            <td><input class="input" size="20" id="tree-insert-href" name="tree-insert-href" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Title</td>
+                            <td><input class="input" size="20" id="tree-insert-title" name="tree-insert-href" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Target</td>
+                            <td><input class="input" size="20" id="tree-insert-target" name="tree-insert-target" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td colspan="2" align="center">
+                                <input id="tree-insert-button" class="button" type="button" value="Insert" />
+                                <input id="tree-insert-cancel" type="button" value="Cancel" />
+                            </td>
+                        </tr>
+                        </table>
+                    </form>
+                </div>
+                <div id="tree-info-form">
+                    <form action="javascript:void(0)" method="get">
+                        <table cellspacing="0" cellpadding="0">
+                        <tr>
+                            <td class="label">Name</td>
+                            <td><input class="input" size="20" id="tree-info-name" name="tree-info-name" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Href</td>
+                            <td><input class="input" size="20" id="tree-info-href" name="tree-info-href" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Title</td>
+                            <td><input class="input" size="20" id="tree-info-title" name="tree-info-href" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td class="label">Target</td>
+                            <td><input class="input" size="20" id="tree-info-target" name="tree-info-target" type="text" value="" /></td>
+                        </tr>
+                        <tr>
+                            <td colspan="2" align="center">
+                                <input id="tree-info-button" class="button" type="button" value="Update" />
+                                <input id="tree-info-cancel" type="button" value="Cancel" />
+                            </td>
+                        </tr>
+                        </table>
+                    </form>
+                </div>
+            </div>
+
+        </td>
+        <td valign="top">
+
+            <a href="javascript:void(window.open('help.html', 'Contents', 'width=400,height=400,scrollbars=yes'))">HELP</a> <br />
+            <br />
+
+            <a id="tree-plugin-import-html" href="javascript:void(0)">Import from Html</a> <br />
+            <a id="tree-plugin-export-html" href="javascript:void(0)">Export to Html</a> <br />
+            <a id="tree-plugin-export-php" href="javascript:void(0)">Export to Php</a> <br />
+            <a id="tree-plugin-export-sql" href="javascript:void(0)">Export to Sql</a> <br />
+
+        </td>
+        <td valign="top">
+
+            <div id="tree-plugin">
+        
+                <b id="tree-plugin-header">Import from html</b> <br />
+                <textarea id="tree-plugin-textarea" cols="50" rows="10"></textarea><br />
+                <input id="tree-plugin-button-import-html" type="button" value="Import" />
+
+            </div>
+
+        </td>
+    </tr>
+    </table>
+
+    <script type="text/javascript">
+    var tree = new DynamicTreeBuilder("tree");
+    tree.init();
+    DynamicTreePlugins.call(tree);
+    </script>
+    <script type="text/javascript" src="actions.js"></script>
+
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/help.html
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/help.html	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/help.html	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,52 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <title>About</title>
+    <style type="text/css">
+    body { margin: 1em; padding: 0; background: #F1EFE2; color: #000000; font-family: georgia, tahoma, verdana; font-size: 11px; cursor: default; }
+    h1 { font-size: 13px; font-weight: bold; margin: 0; }
+    h2 { font-size: 12px; font-weight: bold; margin: 1em 0; }
+    .hr { font-size: 0px; border-width: 1px; border-color: #aca899; border-style: solid none none none; margin-top: 2px; margin-bottom: 2px; }
+    p { margin: 1em 0; }
+    b { color: #909090; }
+    a { color: #316ac5; text-decoration: none; }
+    a:hover { color: #316ac5; text-decoration: underline; }
+    #contents div { margin-left: 2em; padding-top: 1px; }
+    dl { margin: 1em 0; }
+    dt { font-size: 11px; color: #666666; font-weight: bold; margin: 1em 0; }
+    dd { margin: 1em 0 1em 2em; }
+    i {}
+    </style>
+</head>
+<body>
+
+    <h1>Help</h1>
+    <div class="hr"></div>
+    <p>
+        <div id="contents">1.0 <a href="#management-1-0">DynamicTree</a>
+            <div>1.1 <a href="#dynamictree-1-1">Tree Builder</a></div>
+        </div>
+
+        <p>
+            <h2>1.0 DynamicTree<a name="dynamictree-1-0"></a></h2>
+            
+            <dl>
+                <dt>1.1 Tree Builder<a name="dynamictree-1-1"></a></dt>
+                <dd>
+                    Click on the "+" or "-" near the folder icon to expand/collapse current node.
+                    Click on the node name to select an element. To perform an action using icons below the tree, first you have to select an element.
+                    <br />
+                    Actions: <br /><br />
+                    <i>Move Up</i>, <i>Move Down</i> - move the node up or down.<br />
+                    <i>Move Left</i> - move above current node's parent.<br />
+                    <i>Move Right</i> - move inside folder that is below current node.<br />
+                    <i>Insert</i> - insert before, after or inside current node.<br />
+                    <i>Info</i> - view details, update data.<br />
+                    <i>Delete</i> - remove doc or folder (must be empty).<br />
+                </dd>
+            </dl>
+        </p>
+    </p>
+
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/delete.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/delete.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/info.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/info.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/insert.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/insert.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveDown.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveDown.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveLeft.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveLeft.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveRight.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveRight.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveUp.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/moveUp.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-branch.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-branch.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-doc.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-doc.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-folder-open.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-folder-open.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-folder.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-folder.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-leaf-end.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-leaf-end.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-leaf.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-leaf.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-end.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-end.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-open-end.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-open-end.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-open.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node-open.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree-node.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree.gif
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/images/tree.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/plugins.js
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/plugins.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/plugins.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,120 @@
+function DynamicTreePlugins() {
+    this.importFromHtml = function(html) {
+        // dirty hack for ie (automatic conversion to absolute paths problem), see also DynamicTreeBuilder.parse()
+        html = html.replace(/href=["']([^"']*)["']/g, 'href="dynamictree://dynamictree/$1"');
+        document.getElementById(this.id).innerHTML = html;
+        this.reset();
+    };
+    this.exportToHtml = function(node) {
+        var ret = "";
+        if (node) {
+            if (node.isDoc) {
+                ret += '?<div class="doc"><a href="?"??>?</a></div>\n'.format(
+                    " ".repeat(4*(node.getLevel()-1)),
+                    node.href,
+                    (node.title ? ' title="?"'.format(node.title) : ""),
+                    (node.target ? ' target="?"'.format(node.target) : ""),
+                    node.text
+                );
+            }
+            if (node.isFolder) {
+                ret += '?<div class="folder">?\n'.format(
+                    " ".repeat(4*(node.getLevel()-1)),
+                    node.text
+                );
+                for (var i = 0; i < node.childNodes.length; ++i) {
+                    ret += this.exportToHtml(node.childNodes[i]);
+                }
+                ret += '?</div>\n'.format(" ".repeat(4*(node.getLevel()-1)));
+            }
+        } else {
+            var nodes = this.tree.childNodes;
+            for (var i = 0; i < nodes.length; ++i) {
+                ret += this.exportToHtml(nodes[i]);
+            }
+        }
+        return ret;
+    };
+    this.exportToPhp = function(node) {
+        var ret = "";
+        if (node) {
+            if (node.childNodes) {
+                ret += "?'?' => array(\n".format(
+                    " ".repeat(4*node.getLevel()),
+                    node.id
+                );
+                for (var i = 0; i < node.childNodes.length; ++i) {
+                    ret += this.exportToPhp(node.childNodes[i]);
+                }
+                ret += "?)?\n".format(
+                    " ".repeat(4*node.getLevel()),
+                    node.isLast() ? "" : ","
+                );
+            } else {
+                ret += "?'?' => null?\n".format(
+                    " ".repeat(4*node.getLevel()),
+                    node.id,
+                    node.isLast() ? "" : ","
+                );
+            }
+        } else {
+            var nodes = this.tree.childNodes;
+            ret += "$tree = array(\n";
+            for (var i = 0; i < nodes.length; ++i) {
+                ret += this.exportToPhp(nodes[i]);
+            }
+            ret += ");\n\n";
+            ret += "$data = array(\n";
+            var cnt = 0, current = 0;
+            for (var p in this.allNodes) { 
+                if (!this.allNodes[p]) { continue; }
+                cnt++;
+            }
+            for (var p in this.allNodes) {
+                if (!this.allNodes[p]) { continue; }
+                current++;
+                var node = this.allNodes[p];
+                ret += "    '?' => array('parent' => '?', 'type' => '?', 'text' => '?', 'href' => '?', 'title' => '?', 'target' => '?')?\n".format(
+                    node.id,
+                    node.parentNode.id,
+                    node.isDoc ? "doc" : "folder",
+                    node.text,
+                    node.href,
+                    node.title,
+                    node.target,
+                    cnt != current ? "," : ""
+                );
+            }
+            ret += ");";
+        }
+        return ret;
+    };
+    this.exportToSql = function() {
+        var ret = "";
+        for (var p in this.allNodes) {
+            if (!this.allNodes[p]) { continue; }
+            var node = this.allNodes[p];
+            ret += 'INSERT INTO menu (id, parent, type, text, href, title, target) VALUES ("?", "?", "?", "?", "?", "?", "?");\n'.format(
+                node.id,
+                node.parentNode.id,
+                node.isDoc ? "doc" : "folder",
+                node.text,
+                node.href,
+                node.title,
+                node.target
+            );
+        }
+        return ret;
+    };
+}
+
+/* Repeat string n times */
+if (!String.prototype.repeat) {
+    String.prototype.repeat = function(n) {
+        var ret = "";
+        for (var i = 0; i < n; ++i) {
+            ret += this;
+        }
+        return ret;
+    };
+}
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/foldersAsLinks.html
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/foldersAsLinks.html	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/foldersAsLinks.html	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+    <title>DynamicTree example 1</title>
+    <link rel="stylesheet" type="text/css" href="../DynamicTree.css" />
+    <script type="text/javascript" src="../../ie5.js"></script>
+    <script type="text/javascript" src="../DynamicTree.js"></script>
+    <style type="text/css">
+    p { font-family: georgia, sans-serif; font-size: 11px; }
+    </style>
+</head>
+<body>
+
+    <p>
+        <b>Project:</b> <a href="http://gosu.pl/dhtml/mygosumenu.html">mygosuMenu</a> <br />
+        <b>Menu type:</b> #1.5 DynamicTree example 1 <br />
+        <b>Features:</b> <br />
+        - Dynamically editable in browser (see example 2) <br />
+        - Export the structure of the tree to Html, Php or Sql <br />
+        - State of the menu is saved in cookie <br />
+        - Unlimited nesting <br />
+        - Links are visible to search engines <br />
+        - Accessible for user agents with javascript disabled (see /tests/test2.html) <br />
+        - Object Oriented code, so you can create many menus on the same page <br />
+        - Free for any use (BSD license) <br />
+        <b>Compatibility:</b> Tested on: IE 5.0/5.5/6.0, Mozilla 1.4/1.7, Opera 7.11/7.23/7.52, Netscape 7.11, Firefox 0.7/0.8/0.9, Safari 1.2
+    </p>
+
+    <div class="DynamicTree">
+        <div class="top">Tree View</div>
+        <div class="wrap" id="tree">
+            <div class="folder"><a href="foldersAsLinks.html">Node 1</a>
+                <div class="folder"><a href="foldersAsLinks.html">Node 1.1</a>
+                    <div class="folder"><a href="foldersAsLinks.html">Node 1.1.1</a>
+                        <div class="doc"><a href="foldersAsLinks.html" title="Node 1.1.1.1" target="_self">Node 1.1.1.1</a></div>
+                    </div>
+                </div>
+                <div class="doc"><a href="foldersAsLinks.html">Node 1.2</a></div>
+            </div>
+            <div class="doc"><a href="foldersAsLinks.html">Node 2</a></div>
+            <div class="doc"><a href="foldersAsLinks.html">Node 3</a></div>
+            <div class="doc"><a href="foldersAsLinks.html">Node 4</a></div>
+            <div class="folder"><a href="foldersAsLinks.html">Node 5</a>
+                <div class="doc"><a href="foldersAsLinks.html">Node 5.1</a></div>
+                <div class="doc"><a href="foldersAsLinks.html">Node 5.2</a></div>
+            </div>
+        </div>
+    </div>
+
+    <script type="text/javascript">
+    var tree = new DynamicTree("tree");
+    tree.foldersAsLinks = true;
+    tree.path = '../images/';
+    tree.init();
+    </script>
+
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test1.html
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test1.html	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test1.html	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,51 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+    <title>DynamicTree Test</title>
+    <style type="text/css">
+    .DynamicTree {
+        font-family: georgia, tahoma;
+        font-size: 11px;
+        white-space: nowrap;
+        cursor: default;
+    }
+    .DynamicTree .doc img,
+    .DynamicTree .folder img { border: 0; vertical-align: -3px; }
+    * html .DynamicTree .doc img,
+    * html .DynamicTree .folder img { border: 0; vertical-align: middle; vertical-align: -4px; }
+    .DynamicTree .section { background: url(../images/tree-branch.gif) repeat-y; }
+    .DynamicTree .last { background: none; }
+    .DynamicTree .folder .folder { margin-left: 18px; }
+    .DynamicTree .doc .doc, .DynamicTree .folder .doc { margin-left: 18px; }
+    </style>
+</head>
+<body>
+
+    <div class="DynamicTree">
+        <div class="folder"><img src="../images/tree-node-open.gif" width="18" height="18" alt="" /><img src="../images/tree-folder-open.gif" width="18" height="18" alt="" />Node 1
+            <div class="section">
+                <div class="folder"><img src="../images/tree-node-open.gif" width="18" height="18" alt="" /><img src="../images/tree-folder-open.gif" width="18" height="18" alt="" />Node 1.1
+                    <div class="section">
+                        <div class="folder"><img src="../images/tree-node-open-end.gif" width="18" height="18" alt="" /><img src="../images/tree-folder-open.gif" width="18" height="18" alt="" />Node 1.1.1
+                            <div class="section last">
+                                <div class="doc"><img src="../images/tree-leaf-end.gif" width="18" height="18" alt="" /><img src="../images/tree-doc.gif" width="18" height="18" alt="" />Node 1.1.1.1</div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="doc"><img src="../images/tree-leaf-end.gif" width="18" height="18" alt="" /><img src="../images/tree-doc.gif" width="18" height="18" alt="" />Node 1.2</div>
+            </div>
+        </div>
+        <div class="doc"><img src="../images/tree-leaf.gif" width="18" height="18" alt="" /><img src="../images/tree-doc.gif" width="18" height="18" alt="" />Node 2</div>
+        <div class="doc"><img src="../images/tree-leaf.gif" width="18" height="18" alt="" /><img src="../images/tree-doc.gif" width="18" height="18" alt="" />Node 3</div>
+        <div class="doc"><img src="../images/tree-leaf.gif" width="18" height="18" alt="" /><img src="../images/tree-doc.gif" width="18" height="18" alt="" />Node 4</div>
+        <div class="folder"><img src="../images/tree-node-open-end.gif" width="18" height="18" alt="" /><img src="../images/tree-folder-open.gif" width="18" height="18" alt="" />Node 5
+            <div class="section last">
+                <div class="doc"><img src="../images/tree-leaf.gif" width="18" height="18" alt="" /><img src="../images/tree-doc.gif" width="18" height="18" alt="" />Node 5.1</div>
+                <div class="doc"><img src="../images/tree-leaf-end.gif" width="18" height="18" alt="" /><img src="../images/tree-doc.gif" width="18" height="18" alt="" />Node 5.2</div>
+            </div>
+        </div>
+    </div>
+
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test2.html
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test2.html	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/1.5/tests/test2.html	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,33 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+    <title>DynamicTree</title>
+    <link rel="stylesheet" type="text/css" href="../DynamicTree.css" />
+    <script type="text/javascript" src="../DynamicTree.js"></script>
+</head>
+<body>
+
+    This is an example of what see a user with javascript disabled. <br />
+    All links are still accessible. <br />
+    <br />
+
+    <div class="DynamicTree" id="tree1">
+        <div class="folder">Node 1
+            <div class="folder">Node 1.1
+                <div class="folder">Node 1.1.1
+                    <div class="doc"><a href="example1.html">Node 1.1.1.1</a></div>
+                </div>
+            </div>
+            <div class="doc"><a href="example1.html">Node 1.2</a></div>
+        </div>
+        <div class="doc"><a href="example1.html">Node 2</a></div>
+        <div class="doc"><a href="example1.html">Node 3</a></div>
+        <div class="doc"><a href="example1.html">Node 4</a></div>
+        <div class="folder">Node 5
+            <div class="doc"><a href="example1.html">Node 5.1</a></div>
+            <div class="doc"><a href="example1.html">Node 5.2</a></div>
+        </div>
+    </div>
+
+</body>
+</html>
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/ie5.js
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/ie5.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/ie5.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,82 @@
+// +----------------------------------------------------------------+
+// | Array functions that are missing in IE 5.0                     |
+// | Author: Cezary Tomczak [www.gosu.pl]                           |
+// | Free for any use as long as all copyright messages are intact. |
+// +----------------------------------------------------------------+
+
+// Removes the last element from an array and returns that element.
+if (!Array.prototype.pop) {
+    Array.prototype.pop = function() {
+        var last;
+        if (this.length) {
+            last = this[this.length - 1];
+            this.length -= 1;
+        }
+        return last;
+    };
+}
+
+// Adds one or more elements to the end of an array and returns the new length of the array.
+if (!Array.prototype.push) {
+    Array.prototype.push = function() {
+        for (var i = 0; i < arguments.length; ++i) {
+            this[this.length] = arguments[i];
+        }
+        return this.length;
+    };
+}
+
+// Removes the first element from an array and returns that element.
+if (!Array.prototype.shift) {
+    Array.prototype.shift = function() {
+        var first;
+        if (this.length) {
+            first = this[0];
+            for (var i = 0; i < this.length - 1; ++i) {
+                this[i] = this[i + 1];
+            }
+            this.length -= 1;
+        }
+        return first;
+    };
+}
+
+// Adds one or more elements to the front of an array and returns the new length of the array.
+if (!Array.prototype.unshift) {
+    Array.prototype.unshift = function() {
+        if (arguments.length) {
+            var i, len = arguments.length;
+            for (i = this.length + len - 1; i >= len; --i) {
+                this[i] = this[i - len];
+            }
+            for (i = 0; i < len; ++i) {
+                this[i] = arguments[i];
+            }
+        }
+        return this.length;
+    };
+}
+
+// Adds and/or removes elements from an array.
+if (!Array.prototype.splice) {
+    Array.prototype.splice = function(index, howMany) {
+        var elements = [], removed = [], i;
+        for (i = 2; i < arguments.length; ++i) {
+            elements.push(arguments[i]);
+        }
+        for (i = index; (i < index + howMany) && (i < this.length); ++i) {
+            removed.push(this[i]);
+        }
+        for (i = index + howMany; i < this.length; ++i) {
+            this[i - howMany] = this[i];
+        }
+        this.length -= removed.length;
+        for (i = this.length + elements.length - 1; i >= index + elements.length; --i) {
+            this[i] = this[i - elements.length];
+        }
+        for (i = 0; i < elements.length; ++i) {
+            this[index + i] = elements[i];
+        }
+        return removed;
+    };
+}
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/license.txt
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/license.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/license.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,29 @@
+Copyright (c) 2003,2004 Cezary Tomczak
+All rights reserved.
+
+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.
+    - Neither the name of the Cezary Tomczak nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR 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.
+
+--------------------------------------------------------------------------------
+
+For more information on the mygosuMenu project, please see http://gosu.pl/dhtml/mygosumenu.html
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/readme.txt
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/readme.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/readme.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,132 @@
+----------------
+! ABOUT
+----------------
+
+mygosuMenu is a set of simple DHTML menus
+Link: http://gosu.pl/dhtml/mygosumenu.html
+
+This software has been released under a BSD-style licence. This essentially means free for any use,
+with the one condition that the author of this software be credited in appropriate documentation.
+
+Let me know if you find any of the menus useful. If you have any suggestions feel free to email me.
+My email: cagret[at]yahoo.com
+
+You can subscribe to new releases here: 
+http://freshmeat.net/projects/mygosumenu
+
+----------------
+! MENU TYPES
+----------------
+
+#1.0 DropDownMenu1 - 1 level drop down menu (horizontal, vertical).
+#1.1 DropDownMenuX - Drop down menu with unlimited nesting (horizontal, vertical).
+#1.2 TreeMenu
+#1.3 ClickShowHideMenu
+#1.4 XulMenu - windows like menu, unlimited nesting (horizontal, vertical)
+#1.5 DynamicTree & DynamicTreeBuilder
+
+----------------
+! NOTES
+----------------
+
+Some of the menus include additional file to support IE 5.0:
+<script type="text/javascript" src="../ie5.js"></script>
+If you want to support IE 5.0 then you have to set a proper path to file ie5.js,
+if you don't wanna support this version of browser just remove that line.
+
+--
+
+When no doctype is specified, Internet Explorer runs in "quirks" mode.
+It is for backward compatibility, and many css bugs appear. If you want
+to avoid them, use a doctype, not necessary xhtml.
+
+for example:
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+or
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+
+--
+
+IE Bug #1 (nested tables):
+
+Example not working on IE:
+
+<table><tr><td><table><tr><td>
+    <table id="menu">....</table>
+    <script>.. init menu ... </script>
+</td></tr></table></td></tr></table>
+
+Example that works on IE:
+
+<table><tr><td><table><tr><td>
+    <table id="menu">....</table>
+</td></tr></table></td></tr></table>
+<script>.. init menu ... </script>
+
+Difference:
+Looks like initializing the menu on IE must be done after closing some tables.
+
+So if you are using nested tables, initialize the menu at the end of the page
+or use window.onload event:
+
+<script>
+window.onload = function() {
+    .. init menu ..
+}
+</script>
+
+----------------
+! CHANGELOG
+----------------
+
+*** 1.5.3 ***
+
+  - #1.5 DynamicTree, added an example with folders as links, see /1.5/tests/foldersAsLinks.html
+  - #1.3 ClickShowHideMenu, added an example that highlights active item, see /1.3/tests/highlightActive.html
+
+*** 1.5.2 ***
+
+  - #1.5 DynamicTreeBuilder, a bug that could affect you if you had more than 20 records in a tree when starting editing.
+
+*** 1.5.1 ***
+
+  - #1.1 menu works with selectboxes on IE6
+  - some bug fixes in #1.5 menu
+  - some updates in readmes
+
+*** 1.5.0 ***
+
+  - Added #1.5 menu, DynamicTree & DynamicTreeBuilder
+
+*** 1.4.1 ***
+
+  - Added support for IE 5.0 & IE 5.5 in #1.0 / #1.1 / #1.4 menus
+  - [js] fixed a bug that prevented #1.3 menu working on Konqueror
+  - [html] fixed a bug with positioning in example 2 of #1.0 and #1.1 menu that appeared
+    on some versions of IE6 (6.0.2600 on XP, 6.0.3790 on Windows Server 2003)
+
+*** 1.4.0 ***
+
+  - Fixed a bug in #1.0 menu that appeared on IE 5.5
+  - Added new #1.4 menu and 2 examples
+
+*** 1.3.5 ***
+  
+  - Fixed a bug in menu #1.3 that appeared on newest Mozilla 1.7 & Firefox 0.9
+  - updated /1.1/DropDownMenuX.txt
+
+*** 1.3.4 ***
+
+  - fixed a few bugs in #1.0 menu
+  - #1.1 menu has been rewritten, now it supports vertical menus, a few bugs has been fixed,
+    new features added.
+
+*** 1.3.3 ***
+
+  - #1.0 menu has been rewritten, a few bugs fixed, new features added, see /1.0/DropDownMenu1.txt for more info
+  - done some cleaning: file names etc
+
+*** 1.3.2 ***
+
+  - Added another example of #1.1 menu
+    See /1.1/menu2.html
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/mygosumenu/todo.txt
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/mygosumenu/todo.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/mygosumenu/todo.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,2 @@
+- DynamicTree different icons for nodes
+- DropDownMenuX support selectboxes on IE5.5
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/xb.js
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/xb.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/xb.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,254 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * @require geo.js
+ * @license LGPL
+ */
+
+// Obtenir un élement par son attribut 'id'
+function XBgetElementById(idOrName) {
+  if (document.getElementById) { // DOM (Gecko, IE 6+) Opera4+
+    this.properties = document.getElementById(idOrName);
+    if((this.properties!=null)
+      && (typeof this.properties.style != 'undefined')) {
+      this.style = document.getElementById(idOrName).style;
+    }
+  }
+  if (!this.properties && document.all) { // IE, Konqueror
+    this.properties = document.all[idOrName];
+  }
+  if (!this.properties && document.layers) { // NS 4+
+    this.properties = document.layers[idOrName];
+  }
+  if(!this.properties) {
+    //Elements
+    for(i=0;i<document.forms.length;i++) {
+      for(j=0;j<document.forms[i].length;j++) {
+        if(document.forms[i][j].name==idOrName) {
+          this.properties=document.forms[i][j];
+          break;
+        }
+      }
+    }
+  }
+  if(!this.properties) {
+    //Images
+    for(i=0;i<document.images.length;i++) {
+      if(document.images[i].name==idOrName) {
+        this.properties=document.images[i];
+        break;
+      }
+    }
+  }
+  if(!this.properties) {
+    //Layers
+    if(typeof document.layers !== 'undefined') {
+      for(i=0;i<document.layers.length;i++) {
+        if(document.layers[i].name==idOrName) {
+          alert(document.layers[i]);
+          this.properties=document.layers[i];
+          break;
+        }
+      }
+    }
+  }
+  if(!this.properties) {
+    //Anchors
+    for(i=0;i<document.anchors.length;i++) {
+      if(document.anchors[i].name==idOrName) {
+        this.properties=document.anchors[i];
+        break;
+      }
+    }
+  }
+  if(!this.properties) {
+      alert('Element "'+idOrName+'" not found.');
+  }
+  if(typeof this.style == "undefined") {
+    if((typeof this.properties != "undefined")
+      && (this.properties!=null)
+      && (typeof this.properties.style == "undefined")) {
+      this.style=this.properties;
+    } else {
+      if(this.properties && this.properties.style) {
+        this.style=this.properties.style;
+      }
+    }
+  }
+}
+
+
+function XBcloseWindow(wind) {
+  if(typeof wind != 'undefined' 
+      && typeof wind.closed == 'boolean' 
+      && !wind.closed) {
+    wind.close();
+  }
+}
+// Obtenir les coordonnées d'un objet
+function XBabsoluteOffset(obj) {
+  var r=new TPoint(0,0);
+  if (obj.offsetParent) {
+    while (obj.offsetParent) {
+      r.x += obj.offsetLeft;
+      r.y += obj.offsetTop;
+      obj = obj.offsetParent;
+    }
+  }
+  else if (obj.x) {
+    r.x += obj.x;
+    r.y += obj.y;
+  }
+  return r;
+}
+
+// Obtenir les coordonnées de la souris
+function XBgetAbsoluteCoords(e) {
+  if(!e) {e=window.event;}
+  var coords=new TPoint(0,0);
+  if((typeof e.pageX != 'undefined') && (typeof e.pageY != 'undefined')) {
+    coords.x = e.pageX;
+    coords.y = e.pageY;
+  } else if((typeof e.clientX != 'undefined') && (typeof e.clientY != 'undefined')) {
+    coords.x = e.clientX + document.body.scrollLeft;
+    coords.y = e.clientY + document.body.scrollTop;
+  } else {
+    alert('Error : xb.js : XBgetAbsoluteCoords()');
+  }
+  return(coords);
+}    
+
+// Appliquer un effet de transparence
+function XBsetOpacity(obj,p100,newColor) {
+  if (obj.style.opacity || (obj.style.opacity=='')) { //CSS 3
+    obj.style.opacity= (p100/100);
+  } else if (obj.style.MozOpacity || (obj.style.MozOpacity=='')) { //Gecko
+    obj.style.MozOpacity= (p100/100);
+  } else if (obj.filters && obj.filters.alpha) {//IE
+    // ! vous devez mettre "filter:alpha(opacity=100)" dans le style
+    obj.filters.alpha.opacity=p100;
+  } else {
+    return;
+  }
+  if(newColor) {
+    obj.style.backgroundColor=newColor;
+  }
+}
+
+
+function XBGetFrameSize(theFrame) {
+  var size=new TPoint(0,0);
+  if(!theFrame) {
+    theFrame=self;
+  }
+  if (theFrame.innerHeight){// All but IE
+    size.x = theFrame.innerWidth;
+    size.y = theFrame.innerHeight;
+  } else if (theFrame.document.documentElement
+        && theFrame.document.documentElement.clientHeight){// IE 6 Strict Mode
+    size.x = theFrame.document.documentElement.clientWidth;
+    size.y = theFrame.document.documentElement.clientHeight;
+  } else if (theFrame.document.body){//other IE
+    size.x = theFrame.document.body.clientWidth;
+    size.y = theFrame.document.body.clientHeight;
+  }
+  return size;
+}
+
+
+ function firstSiblingOfType(obj0,type) {
+  var obj=obj0;
+  while( (obj !== null)
+      && ( (typeof obj != 'object')
+        || (typeof obj.tagName == 'undefined')
+        || (String(obj.tagName).toLowerCase()!=String(type).toLowerCase()))) {
+    obj=obj.nextSibling;
+  } 
+  return obj;
+ }
+ 
+ function firstPreviousSiblingOfType(obj0,type) {
+  var obj=obj0;
+  while ((typeof obj != 'object')
+      || (typeof obj.tagName == 'undefined')
+      || (String(obj.tagName).toLowerCase()!=String(type).toLowerCase())) {
+    obj=obj.previousSibling;
+  } 
+  return obj;
+ }
+
+  /**
+   * set a Cookie
+   * @param string sName Name of the cookie
+   * @param mixed mValue Value of the cookie
+   * @param date dExpire Expiration date of the cookie (optional)
+   */
+  function setCookie(sName, mValue, dExpire) {
+     document.cookie = sName + "=" + escape(mValue)
+     + ((dExpire == null) ? "" : ("; expires=" + dExpire.toGMTString()));
+  }
+  
+  /**
+   * get a Cookie
+   * @param string sName Name of the cookie
+   * @return mixed Value of the cookie
+   */
+  function getCookie(sName) {
+   var search = sName + "=";
+   if (document.cookie.length > 0) { // if there are any cookies
+      var offset = document.cookie.indexOf(search) ;
+      if (offset != -1) { // if cookie exists 
+         offset += search.length ;
+         // set index of beginning of value
+         var end = document.cookie.indexOf(";", offset) ;
+         // set index of end of cookie value
+         if (end == -1) 
+            end = document.cookie.length;
+         return unescape(document.cookie.substring(offset, end));
+      } 
+   }
+  }
+
+  function XBParentFrame(el) {
+    if(el) {
+      if(el.tagName && el.tagName.toLowerCase()=='frame') {
+        return el;
+      } else {
+        if(el.parentWindow) {
+          return el.parentWindow;
+        } else if(el.defaultView) {
+          return el.defaultView;
+        } else {
+          return XBParentFrame(el.parentNode);
+        }
+      }
+    } else {
+      return null;
+    }
+  }
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/contrib/xbgeo.js
===================================================================
--- packages/musmap/branches/upstream/current/js/contrib/xbgeo.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/contrib/xbgeo.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,487 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/*
+ * @license LGPL
+ * TPoint
+ * TRect
+ * setElementRect
+ */
+
+/* =========================================================================== */
+/**
+ * Classe TPoint
+ * @constructor TPoint(x,y)
+ * @method homothety(sourceRect,targetRect):TPoint
+ * @var x
+ * @var y
+ * @var unit=[pixel,...]
+ * @var reference=[screen,...]
+ */
+function TPoint(x,y) {
+  this.x=Number(x);
+  this.y=Number(y);
+}
+
+function TPoint_w() {
+  return this.x;
+}
+TPoint.prototype.w=TPoint_w;
+
+function TPoint_h() {
+  return this.y;
+}
+TPoint.prototype.h=TPoint_h;
+
+function TPoint_homothety(sourceRect,targetRect) {
+  return(new TPoint(
+    Number(targetRect.x1)+(targetRect.x2-targetRect.x1)
+        *((this.x-sourceRect.x1)/(sourceRect.x2-sourceRect.x1)),
+    Number(targetRect.y1)+(targetRect.y2-targetRect.y1)
+        *((this.y-sourceRect.y1)/(sourceRect.y2-sourceRect.y1))))
+}
+TPoint.prototype.homothety=TPoint_homothety;
+
+function TPoint_substract(subPoint) {
+  return(new TPoint(this.x-subPoint.x,this.y-subPoint.y));
+}
+TPoint.prototype.substract=TPoint_substract;
+
+function TPoint_add(addPoint) {
+  return(new TPoint(this.x+addPoint.x,this.y+addPoint.y));
+}
+TPoint.prototype.add=TPoint_add;
+
+function TPoint_alert() {
+  var prefix='';
+  alert(
+    prefix+'[x]='+this.x
+    +prefix+'[y]='+this.y)
+}
+TPoint.prototype.alert=TPoint_alert;
+
+/* =========================================================================== */
+/**
+ * Classe TRect
+ * @constructor TRect(x1,x2,y1,y2)
+ * @method pointMin():TPoint
+ * @method pointMax():TPoint
+ * @method centerPoint(sourceRect,targetRect):TPoint
+ * @method homothety(sourceRect,targetRect):TPoint
+ * @method diagonalLength():float
+ * @var x1
+ * @var y1
+ * @var x2
+ * @var y2
+ */
+function TRect(x1,x2,y1,y2,chk) {
+  if(chk) {
+    this.x1=Number(Math.min(x1,x2));
+    this.x2=Number(Math.max(x1,x2));
+    this.y1=Number(Math.min(y1,y2));
+    this.y2=Number(Math.max(y1,y2));
+  } else {
+    this.x1=Number(x1);
+    this.x2=Number(x2);
+    this.y1=Number(y1);
+    this.y2=Number(y2);
+  }
+}
+
+function new_TRect(x1,x2,y1,y2,chk) {
+  return new TRect(x1,x2,y1,y2,chk);
+}
+
+function TRect_check() {
+  tmp_min=Math.min(this.x1,this.x2);
+  tmp_max=Math.max(this.x1,this.x2);
+  this.x1=tmp_min;
+  this.x2=tmp_max;
+  tmp_min=Math.min(this.y1,this.y2);
+  tmp_max=Math.max(this.y1,this.y2);
+  this.y1=tmp_min;
+  this.y2=tmp_max;
+}
+TRect.prototype.check=TRect_check;
+
+function TRect_inverty() {
+  var tmp_min=Math.min(this.x1,this.x2);
+  var tmp_max=Math.max(this.x1,this.x2);
+  this.x1=tmp_min;
+  this.x2=tmp_max;
+  tmp_min=Math.min(this.y1,this.y2);
+  tmp_max=Math.max(this.y1,this.y2);
+  this.y1=tmp_max;
+  this.y2=tmp_min;
+}
+TRect.prototype.inverty=TRect_inverty;
+
+function TRect_minX() {
+  return Math.min(this.x1,this.x2);
+}
+TRect.prototype.minX=TRect_minX;
+
+function TRect_maxX() {
+  return Math.max(this.x1,this.x2);
+}
+TRect.prototype.maxX=TRect_maxX;
+
+function TRect_minY() {
+  return Math.min(this.y1,this.y2);
+}
+TRect.prototype.minY=TRect_minY;
+
+function TRect_maxY() {
+  return Math.max(this.y1,this.y2);
+}
+TRect.prototype.maxY=TRect_maxY;
+
+
+function TRect_point1() {
+  return new TPoint(this.x1,this.y1);
+}
+TRect.prototype.point1=TRect_point1;
+
+function TRect_point2() {
+  return new TPoint(this.x2,this.y2);
+}
+TRect.prototype.point2=TRect_point2;
+
+function TRect_setPoint1(p) {
+  this.x1=p.x;
+  this.y1=p.y;
+}
+TRect.prototype.setPoint1=TRect_setPoint1;
+
+function TRect_setPoint2(p) {
+  this.x2=p.x;
+  this.y2=p.y;
+}
+TRect.prototype.setPoint2=TRect_setPoint2;
+
+function TRect_w() {
+  return Math.abs(this.x2-this.x1);
+}
+TRect.prototype.w=TRect_w;
+
+function TRect_h() {
+  return Math.abs(this.y2-this.y1);
+}
+TRect.prototype.h=TRect_h;
+
+function TRect_centerPoint() {
+  return new TPoint((this.x1+this.x2)/2,(this.y1+this.y2)/2);
+}
+TRect.prototype.centerPoint=TRect_centerPoint;
+
+function TRect_diagonalLength() {
+  return Math.sqrt(
+     Math.pow(this.x2-this.x1,2)
+    +Math.pow(this.y2-this.y1,2));
+}
+TRect.prototype.diagonalLength=TRect_diagonalLength;
+
+function TRect_homothety(sourceRect,targetRect) {
+  var p1=this.point1().homothety(sourceRect,targetRect);
+  var p2=this.point2().homothety(sourceRect,targetRect);
+  return(new TRect(p1.x,p2.x,p1.y,p2.y))
+}
+TRect.prototype.homothety=TRect_homothety;
+
+function TRect_add(addPoint) {
+  return(new TRect(this.x1+addPoint.x, this.x2+addPoint.x,
+                   this.y1+addPoint.y, this.y2+addPoint.y));
+}
+TRect.prototype.add=TRect_add;
+
+function TRect_substract(subPoint) {
+  return(new TRect(this.x1-subPoint.x,this.x2-subPoint.x,
+    this.y1-subPoint.y,this.y2-subPoint.y));
+}
+TRect.prototype.substract=TRect_substract;
+
+function TRect_urlVars(prefix) {
+  return(
+    prefix+'[minx]='+this.minX()+'&'
+    +prefix+'[maxx]='+this.maxX()+'&'
+    +prefix+'[miny]='+this.minY()+'&'
+    +prefix+'[maxy]='+this.maxY())
+}
+TRect.prototype.urlVars=TRect_urlVars;
+
+
+function TRect_toTextInputs(form,prefix) {
+  form[prefix+"[minx]"].value=this.minX();
+  form[prefix+"[maxx]"].value=this.maxX();
+  form[prefix+"[miny]"].value=this.minY();
+  form[prefix+"[maxy]"].value=this.maxY();
+}
+TRect.prototype.toTextInputs=TRect_toTextInputs;
+
+function TRect_alert() {
+  var prefix='';
+  alert(
+     prefix+'[x1]='+this.x1+' '
+    +prefix+'[x2]='+this.x2+"\n"
+    +prefix+'[y1]='+this.y1+' '
+    +prefix+'[y2]='+this.y2)
+}
+TRect.prototype.alert=TRect_alert;
+
+
+function TPolyline(canvas) {
+  //private variables
+  var selected= false;
+  //public variables
+  this.sourceExtent= new TRect(0,1,0,1);
+  this.destinationExtent= new TRect(0,2,0,2);
+  this.points= Array();
+  this.element= false;
+  this.canvas= canvas;
+  this.strokeColor= 'black';
+  this.fillColor= 'blue';
+  for(var i=1;i<arguments.length; i+=2) {
+    this.points.push(new TPoint(arguments[i],arguments[i+1]));
+  }
+  //public methods
+  this.handleEvent= function(e){
+    var polyline= this;
+    if(!polyline.select) {polyline= this.polyline;}
+    if(!e) {e=self.event;}
+    if(!e) {return;}
+    switch (e.type){
+      case "mousemove":
+        break;
+      case "mousedown":
+        break;
+      case "mouseup":
+        break;
+      case "click":
+        polyline.select();
+        break;
+    }
+  }
+  
+  this.select= function() {
+    if(this.canvas.selected) {
+      this.canvas.selected.unSelect();
+    }
+    selected= true;
+    this.canvas.selected= this;
+    this.draw();  
+  }
+  
+  this.unSelect= function() {
+    if(this.canvas.selected == this) {
+      this.canvas.selected= false;
+    }
+    selected= false;
+    this.draw();
+  }
+  
+  this.addPoint= function() {
+    this.points.push(new TPoint(arguments[0],arguments[1]));  
+    this.draw();
+  }
+  
+  this.clear= function() {
+    this.points= Array();  
+    this.draw();
+  }
+  
+  function TPolyline_drawHTML(canvas) {
+    if(this.element) {
+      this.canvas.removeChild(this.element);
+      //unset(this.element);
+    }
+    this.element= this.canvas.ownerDocument.createElement("div");
+    this.canvas.appendChild(this.element);
+    var p;
+    var coordsOnScreen;
+    
+    for(var i=0;i<this.points.length; i++) {
+      p= this.canvas.ownerDocument.createElement("div");
+      coordsOnScreen= this.points[i].homothety(this.sourceExtent, this.destinationExtent);
+      p.className = 'map-infos-point';
+      p.innerHTML = '';
+      p.style.left = (coordsOnScreen.x-1)+'px';
+      p.style.top =  (coordsOnScreen.y-1)+'px';
+      this.element.appendChild(p);
+    }
+  }
+  
+  function TPolyline_drawSVG() {
+    var point;
+    var coordsOnScreen;
+    var container;
+    if(this.element) {
+      this.canvas.lastChild.removeChild(this.element);
+      this.element= false;
+    }
+    if(!this.canvas.hasChildNodes 
+        || typeof this.canvas.lastChild.tagName=='undefined'
+        || String(this.canvas.lastChild.tagName).toLowerCase()!='svg') {
+      container= this.canvas.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "svg");
+      container.style.position= 'absolute';
+      container.style.top= '0px';
+      container.style.left= '0px';
+      container.style.cursor= '';
+      this.canvas.appendChild(container);
+    }
+    container= this.canvas.lastChild;
+    container.onmousemove= this.onmousemove;
+    container.onmousedown= this.onmousedown;
+    container.onmouseup= this.onmouseup;
+    container.onclick= this.onclick;
+    
+    this.element= this.canvas.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "polyline");
+    this.canvas.lastChild.appendChild(this.element);
+    this.element.addEventListener("mousemove",this,false);
+    this.element.addEventListener("mousedown",this,false);
+    this.element.addEventListener("mouseup",this,false);
+    this.element.addEventListener("click",this,false);
+  
+    if(this.fillColor) {
+      this.element.style.setProperty('fill',this.fillColor, null);
+    } else {
+      this.element.style.setProperty('fill', 'none', null);
+    }
+    this.element.style.setProperty('stroke',this.strokeColor, null);
+    if(selected) {
+      this.element.style.setProperty('stroke-width', 3, null);
+    }
+    var points='';
+    for(var i=0;i<this.points.length; i++) {
+      coordsOnScreen= this.points[i].homothety(this.sourceExtent, this.destinationExtent);
+      points+=  ' ' + coordsOnScreen.x+','+coordsOnScreen.y;
+    }
+    this.element.setAttribute("points", points);
+  }
+  
+  function TPolyline_drawVML() {
+    var point;
+    var coordsOnScreen;
+    var container;
+    if(this.element) {
+      this.canvas.lastChild.removeChild(this.element);
+      this.element= false;
+    }
+    if(!this.canvas.hasChildNodes()
+        || String(this.canvas.lastChild.tagName).toLowerCase()!='div') {
+      container= this.canvas.ownerDocument.createElement("div");
+      container.style.position= 'absolute';
+      container.style.top= '0px';
+      container.style.left= '0px';
+      container.style.cursor= '';
+      this.canvas.appendChild(container);
+    }
+    container= this.canvas.lastChild;
+    container.onmousemove= this.onmousemove;
+    container.onmousedown= this.onmousedown;
+    container.onmouseup= this.onmouseup;
+    container.onclick= this.onclick;
+    this.element= this.canvas.ownerDocument.createElement("vml:polyline");
+    this.element.style.behavior='url(#default#VML)';
+    this.canvas.lastChild.appendChild(this.element);
+    this.element.polyline= this;
+    this.element.onmousemove=this.handleEvent;
+    this.element.onmousedown=this.handleEvent;
+    this.element.onmouseup=this.handleEvent;
+    this.element.onclick=this.handleEvent;
+    if(this.fillColor) {
+      this.element.fillcolor=this.fillColor;
+    } else {
+      this.element.fillcolor='none';
+    }
+    this.element.strokecolor=this.strokeColor;
+    if(selected) {
+      this.element.strokeweight= '3px';
+    }
+    var points='';
+    for(var i=0;i<this.points.length; i++) {
+      coordsOnScreen= this.points[i].homothety(this.sourceExtent, this.destinationExtent);
+      points+=  ' ' + coordsOnScreen.x+'px,'+coordsOnScreen.y+'px';
+    }
+    this.element.points.value= points;
+  }
+  if(typeof this.canvas!='undefined'
+      && typeof this.canvas.ownerDocument!='undefined'
+      && typeof this.canvas.ownerDocument.implementation!='undefined'
+      && typeof this.canvas.ownerDocument.implementation.hasFeature!='undefined'
+      && self.document.implementation.hasFeature('org.w3c.dom.svg','1.0')) {
+    this.draw= TPolyline_drawSVG;
+  } else if(typeof this.canvas!='undefined'
+         && typeof this.canvas.ownerDocument!='undefined'
+         && typeof this.canvas.ownerDocument.namespaces!='undefined'
+         && typeof this.canvas.ownerDocument.namespaces.vml!='undefined') {
+    this.draw= TPolyline_drawVML;
+  } else {
+    this.draw= TPolyline_drawHTML;
+    if(top.frames) {
+      for(var i=0;i<top.frames.length; i++) {
+        if(top.frames[i]
+            && top.frames[i].document
+            && top.frames[i].document.namespaces
+            && top.frames[i].document.namespaces.vml) {
+          this.draw= TPolyline_drawVML;
+        }
+      }
+    }
+  }
+  
+  //events
+  this.onmousemove= null;
+  this.onmousedown= null;
+  this.onmouseup= null;
+  this.onclick= null;
+  
+  //init
+  this.draw();
+}
+
+/* =========================================================================== */
+/**
+ *  setElementRect(el:HTMLObject,rect:TRect):void
+ */
+function setElementRect(elt,rect) {
+  if(typeof elt.style != 'undefined') {//DOM
+    elt.style.left = rect.minX()+'px';
+    elt.style.top =  rect.minY()+'px';
+    elt.style.width= (rect.w())+'px';
+    elt.style.height=(rect.h())+'px';
+  } else {
+    elt.left = rect.minX();
+    elt.top =  rect.minY();
+    elt.width= rect.w();
+    elt.height=rect.h();
+  }
+}
+
+var nullPoint=new TPoint(-1,-1);
+var nullExtent=new TRect(-1,-1,-1,-1);
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/events.js
===================================================================
--- packages/musmap/branches/upstream/current/js/events.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/events.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,267 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/*
+ * mapMousemove(e)
+ * mapClick(e)
+ * referenceClick(e)
+ */
+ 
+  top.mapMousedown= function(e) {
+    if(!e) e=top.frames.main.event;//3rd frame
+    e.cancelBubble = true;
+    if(e.stopPropagation) e.stopPropagation();
+    if(e.preventDefault) e.preventDefault();
+    switch(top.currentToolName) {
+    case 'zoom_pan':
+      if(!top.frames.main.document.onmousemove) {
+        top.prevMouseCoords=XBgetAbsoluteCoords(e);
+        top.frames.main.document.onmousemove = top.mapMousemove;
+        top.frames.main.document.onmouseup = top.mapMouseup;
+      } else {//if dragging thenstop dragging
+        top.prevMouseCoords=false;
+        top.frames.main.document.onmousemove = null;
+        top.frames.main.document.onmouseup = null;
+      }
+      return false;
+    case 'zoom_in':
+    case 'zoom_out':
+    case 'query_mouse':
+      top.map.beginRect(e);
+      top.map.setCursor('se-resize');
+      dragging = true;
+      return false;
+    }
+    return true;
+  }
+  
+  top.mapMousemove= function(e) {
+    if(!e) e=top.frames.main.event;//3rd frame
+    e.cancelBubble = true;
+    if(e.stopPropagation) e.stopPropagation();
+    if(e.preventDefault) e.preventDefault();
+    if(    (typeof top.map == 'undefined')
+        || (typeof top.map.getMapElement() == 'undefined')
+        || (!top.map.isReady())) {
+      return true;
+    }
+    var mouseCoords=XBgetAbsoluteCoords(e);
+    if(top.prevMouseCoords) {
+      if(top.currentToolName=='zoom_pan') {
+        var t = parseInt(top.map.getMapElement().style.top);
+        var l = parseInt(top.map.getMapElement().style.left);
+        top.map.getMapElement().style.top =
+          (t
+          - top.prevMouseCoords.y
+          + mouseCoords.y)+'px';
+        top.map.getMapElement().style.left =
+          (l
+          - top.prevMouseCoords.x
+          + mouseCoords.x)+'px';
+        top.prevMouseCoords = mouseCoords;
+      }
+      return true;
+    } else {
+      if(    (typeof top.frames.layers == 'undefined')
+          || (typeof top.frames.layers.document.forms[0] == 'undefined')
+          || (typeof top.frames.layers.document.forms[0].command == 'undefined')) {
+        return true;
+      }
+      var todoValue=top.frames.layers.document.forms[0].command.value;
+      var coordsOnScreen=new TPoint(mouseCoords.x,mouseCoords.y);
+      var coordsOnMap=coordsOnScreen.homothety(top.map.getMapRect(),top.map.getMapExtent());
+      var coordsDiv=new top.frames.main.XBgetElementById('coordsdiv');
+      var powerFactor=Math.pow(10,coordsPrecision);
+      coordsDiv.properties.innerHTML=
+        "x="+Math.round(coordsOnMap.x*powerFactor)/powerFactor+'<br>'+
+        'y='+Math.round(coordsOnMap.y*powerFactor)/powerFactor;
+      if(dragging) {
+        top.map.continueRect(e);
+      }
+      return true;
+    }
+  }
+  
+
+  top.mapMouseup= function(e) {
+    top.frames.main.document.onmousemove = null;
+    top.frames.main.document.onmouseup = null;
+    top.prevMouseCoords = false;
+    if(!e) e=top.frames.main.event;//3rd frame
+    e.cancelBubble = true;
+    if(e.stopPropagation) e.stopPropagation();
+    if(e.preventDefault) e.preventDefault();
+    if(    (typeof top.map == 'undefined')
+        || (typeof top.map.getMapElement() == 'undefined')) {
+      return false;
+    }
+    switch(top.currentToolName) {
+    case 'zoom_pan':
+      if(top.map.getMapElement()) {
+        var deltaMapCoords= XBabsoluteOffset(top.map.getMapElement());
+        top.map.pan(deltaMapCoords);
+      }
+      return false;
+    case 'zoom_in':
+    case 'zoom_out':
+      top.map.setCursor(top.currentToolName);
+      if(dragging == false) {
+        return false;
+      }
+      top.map.endRect(e);
+      dragging = false;
+      if(top.currentToolName=='zoom_in') {
+        top.map.zoomIn();
+      } else {
+        top.map.zoomOut();
+      }
+      top.map.hideRect();
+      return false;
+    case 'query_mouse':
+      top.map.setCursor('help');
+      if(dragging == false) {
+        return false;
+      }
+      top.map.endRect(e);
+      dragging = false;
+      if(top.map.queryWindow)
+        XBcloseWindow(top.map.queryWindow);
+      top.map.queryMouse();
+      top.map.hideRect();
+      return false;
+    }
+    return true;
+  }
+
+  top.mapClick= function(e) {
+    var mapCoords,coordsOnMap;
+    if(!e) {e=window.event;}
+    if(!e) e=top.frames.main.event;
+    switch(top.currentToolName) {
+    case 'zoom_pan':
+    case 'zoom_in':
+    case 'zoom_out':
+    case 'query_mouse':
+      break;
+    case 'query_point':
+      if(typeof top.layerSelected != 'string') {
+        alert(l10n('Please select a layer!'));
+        return(false);
+      }
+      top.map.beginRect(e);
+      top.map.endRect(e);
+      top.map.hideRect();
+      mapCoords= XBabsoluteOffset(top.map.getMapElement());
+      coordsOnMap=top.mouseRect.point1().substract(mapCoords).homothety(top.map.getMapRect(),top.map.getMapExtent());
+      if(top.map.queryWindow)
+        XBcloseWindow(top.map.queryWindow);
+      var v0='&x='+coordsOnMap.x+'&y='+coordsOnMap.y;
+      var v1a=top.map.getMapExtent();
+      var v1b='&'+v1a.urlVars('extent');
+      var v2='&image_width='+top.map.getMapRect().w()+
+             '&image_height='+top.map.getMapRect().h();
+      top.map.queryWindow=window.open('query.php?command=query_point'+
+        v0+
+        v1b+
+        v2+
+        '&'+top.layerSelected+'&'+layersList(),'',
+        top.queryWindowOptions);
+      break;
+    case 'measure':
+      top.map.beginRect(e);
+      top.map.endRect(e);
+      coordsOnMap=top.map.getMouseRect().point1().homothety(top.map.getMapRect(),top.map.getMapExtent());
+      if(top.map.mapInfos) {
+        var d=0;
+        var powerFactor=Math.pow(10,coordsPrecision);
+        if(top.prevCoordsOnMap) {
+          var diag = new TRect(
+            top.prevCoordsOnMap.x,
+            coordsOnMap.x,
+            top.prevCoordsOnMap.y,
+            coordsOnMap.y);
+          d = diag.diagonalLength();
+        }
+        top.prevCoordsOnMap = coordsOnMap;
+        top.measureTotal = Number(top.measureTotal) + Number(d);
+        top.map.mapInfos.addHeaders('x','y',l10n('Length'),l10n('Total'));
+        top.map.mapInfos.addRow(
+          Math.round(   coordsOnMap.x*powerFactor)/powerFactor,
+          Math.round(   coordsOnMap.y*powerFactor)/powerFactor,
+          Math.round(               d*powerFactor)/powerFactor,
+          Math.round(top.measureTotal*powerFactor)/powerFactor);
+        top.map.mapInfos.addPoint(coordsOnMap);
+      }
+      break;
+    default:
+      alert('to do : "'+top.currentToolName+'"');
+    }
+    return(false);
+  }
+  
+  top.referenceClick= function(e) {
+    if(!e) e= self.event;
+    if(!e) e= self.frames.main.event;
+    var referenceCoords= XBabsoluteOffset(top.map.getOverviewElement());
+    var p= XBgetAbsoluteCoords(e);
+    p= p.substract(referenceCoords);
+    top.map.zoomRef(p);
+  }
+  
+  top.keyUp= function(e) {
+    if(!e) e=window.event;
+    switch(e.keyCode) {
+      case 27: //Esc
+        dragging=false;
+        top.map.hideRect(e);
+        break;
+      case 46: //Delete
+        break;
+      case 107: //+
+        top.selectTool('zoom_in',top.frames.tools.document.images.zoom_in);
+        break;
+      case 109: //-
+        top.selectTool('zoom_out',top.frames.tools.document.images.zoom_out);
+        break;
+      case 82: //r
+        top.selectTool('refresh',top.frames.tools.document.images.refresh);
+        break;
+      case 77: //m
+        top.selectTool('measure',top.frames.tools.document.images.measure);
+        break;
+      case 80: //p
+        top.selectTool('print',top.frames.tools.document.images.print);
+        break;
+      case 81: //q
+        top.selectTool('logout',top.frames.tools.document.images.logout);
+        break;
+      default:
+        //alert(e.keyCode);
+    }
+  }
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/explorer.js
===================================================================
--- packages/musmap/branches/upstream/current/js/explorer.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/explorer.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,339 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  top.reload=false;
+  
+  
+  function loadExplorer() {
+    if(reload) {
+      if(document.forms['explorer-actions']) {
+        setTimeout("document.forms['explorer-actions'].submit()",500);
+      } else {
+        alert(l10n('Unable to find form.'));
+      }
+    } else if ((typeof document.forms.explorer != 'undefined')
+        && (typeof document.forms.explorer.change != 'undefined')) {
+      document.forms.explorer.change.focus();
+    }
+  }
+  
+  function colorpickerWindowClose() {
+    if(top.colorpickerWindow) {
+      XBcloseWindow(top.colorpickerWindow);
+    }
+  }
+  
+  function explorerSubmit() {
+    colorpickerWindowClose();
+  }
+  
+  function colorPicker(colorSpan,colorInput) {
+    if(!top.rootDir) {
+      top.rooDir='.';
+    }
+    colorpickerWindowClose();
+    top.colorpickerWindow=window.open(top.rootDir+'/color_picker.php',
+                'color_picker',
+                'toolbar=no,personalbar=no,resizable=1,'+
+                'menubar=no,'+
+                'height=350,width=300');
+    top.colorpickerWindow.colorSpan=colorSpan;
+    top.colorpickerWindow.colorInput=colorInput;
+  }
+
+  function changeColor(colorInput,colorDisplay,colorValue) {
+    switch(typeof colorInput) {
+    case 'object' :
+      break;
+    case 'string' :
+      colorInput=document.getElementById(colorInput);
+      if(typeof colorInput == 'undefined')  {
+        alert(l10n('Error!'));
+        return;
+      }
+      break;
+    default:
+      alert(l10n('Error!'));
+      return;
+    }
+    
+    switch(typeof colorDisplay) {
+    case 'object' :
+      break;
+    case 'string' :
+      colorDisplay=document.getElementById(colorDisplay);
+      break;
+    default:
+      alert(l10n('Error!'));
+      return;
+    }
+    if(typeof colorValue == 'undefined') {
+      colorValue=colorInput.value;
+    }
+    if(colorValue.length==0 || colorValue.length==7) {
+      colorInput.value=colorValue;
+      colorDisplay.style.backgroundColor=colorValue ? colorValue : 'transparent';
+    }
+  }
+  
+  
+  function changePassword() {
+    top.passwordChangeWindow=window.open(top.rootDir+'/change_password.php',
+                'change_password',
+                'toolbar=no,personalbar=no,resizable=1,'+
+                'menubar=no,'+
+                'height=300,width=500');
+    return false;
+  }
+  
+  function loadCurrentExtent(prefix,suffix) {
+    if(typeof prefix =='undefined') {
+      prefix='extent[extent_';
+    }
+    if(typeof suffix =='undefined') {
+      suffix=']';
+    }
+    if(window.opener) {
+      var currentExtent=window.opener.top.map.getMapExtent();
+      document.forms.explorer[prefix+'minx'+suffix].value=
+        currentExtent.minX();
+      document.forms.explorer[prefix+'maxx'+suffix].value=
+        currentExtent.maxX();
+      document.forms.explorer[prefix+'miny'+suffix].value=
+        currentExtent.minY();
+      document.forms.explorer[prefix+'maxy'+suffix].value=
+        currentExtent.maxY();
+    }
+  
+  }
+  
+    function setCurrentExtent(prefix,suffix) {
+    if(typeof prefix == 'undefined') {
+      prefix='extent[extent_';
+    }
+    if(typeof suffix == 'undefined') {
+      suffix=']';
+    }
+    if(window.opener) {
+      var newExtent= new window.opener.top.TRect(
+        document.forms.explorer[prefix+'minx'+suffix].value,
+        document.forms.explorer[prefix+'maxx'+suffix].value,
+        document.forms.explorer[prefix+'miny'+suffix].value,
+        document.forms.explorer[prefix+'maxy'+suffix].value);
+      window.opener.top.map.zoomExtent(newExtent);
+    }
+  
+  }
+  
+  function presentationWizard() {
+    if(top.wizardWindow) {
+      XBcloseWindow(top.wizardWindow);
+    }
+    top.wizardWindow=window.open(top.rootDir+
+      '/presentation_wizard.php?id_profile_data='+
+        document.forms.explorer['profile_data[id_profile_data]'].value,
+      'wizard',
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'menubar=no,scrollbars=yes,dependent=yes,'+
+      'height=600,width=600');
+    return false;
+  }
+
+  function profileWizard() {
+    if(top.wizardWindow) {
+      XBcloseWindow(top.wizardWindow);
+    }
+    top.wizardWindow= window.open(top.rootDir+
+      '/profile_wizard.php',
+      'wizard',
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'menubar=no,scrollbars=yes,dependent=yes,'+
+      'height=600,width=600');
+    return false;
+  }
+  
+  function getTablesWizard() {
+    if(top.getTablesWizardWindow) {
+      XBcloseWindow(top.getTablesWizardWindow);
+    }
+    top.getTablesWizardWindow=window.open(top.rootDir+
+      '/get_tables_wizard.php?id_connection='+
+        document.forms.explorer['connection[id_connection]'].value,
+      'get_tables_wizard',
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'menubar=no,scrollbars=yes,dependent=yes,'+
+      'height=600,width=600');
+    return false;
+  }
+  
+  function unloadExplorer() {
+    if(top.wizardWindow) {
+      XBcloseWindow(top.wizardWindow);
+    }
+    if(top.privilegesWindow) {
+      XBcloseWindow(top.privilegesWindow);
+    }
+  }
+  
+  function changePrivileges(nodeClass, idName, idValue, explore) {
+    if(top.privilegesWindow) {
+      XBcloseWindow(top.privilegesWindow);
+    }
+    top.privilegesWindow=window.open(top.rootDir+
+      '/privileges.php?'+
+        'node_class='+nodeClass+
+        '&id='+idName+
+        '&id_value='+idValue+
+        '&explore='+explore,
+      'privileges',
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'menubar=no,scrollbars=yes,dependent=yes,'+
+      'height=300,width=300');
+    return false;
+  }
+  
+  /**
+   *
+   * direction 'u'|'d'
+   */
+  function moveRow(row1, direction, col) {
+    if(typeof row1 == 'object') {
+      var row2, row3;
+      if(direction == 'u') {
+        row2 = row1.previousSibling;
+        row2 = firstPreviousSiblingOfType(row2, 'tr');
+        if(!row2) {
+          return false;
+        }
+      } else {
+        row2 = row1.nextSibling;
+        row2 = firstSiblingOfType(row2, 'tr');
+        if(!row2) {
+          return false;
+        }
+      }
+      var input1 = positionInput(row1, col);
+      var input2 = positionInput(row2, col);
+      if((typeof input1 == 'object') && (typeof input2 == 'object')) {
+        var inputMin = Math.min(input1.value, input2.value);
+        var inputMax = Math.max(input1.value, input2.value);
+        if(direction == 'u') {
+          input1.value = inputMin;
+          input2.value = inputMax;
+          row1.parentNode.insertBefore(row1, row2);
+          if(input1.value == input2.value) {
+            input1.value--;
+            row3 = row1.previousSibling;
+            row3 = firstPreviousSiblingOfType(row3, 'tr');
+            orderRow(row3, col, direction, input1.value)
+          }
+        } else {
+          input1.value = inputMax;
+          input2.value = inputMin;
+          row1.parentNode.insertBefore(row2, row1);
+          if(input1.value == input2.value) {
+            input1.value++;
+            row3 = row1.nextSibling;
+            row3 = firstSiblingOfType(row3, 'tr');
+            orderRow(row3, col, direction, input1.value)
+          }
+        }
+        return true;
+      }
+    } else {
+      alert(l10n('Error: can\'t move row.'));
+    }
+    return false;
+  }
+  
+  function positionInput(row, colNo) {
+    if(!row || !row.firstChild) {
+      return false;
+    }
+    var col = row.firstChild;
+    for(var i=1; i<colNo; i++) {
+      col = firstSiblingOfType(col, 'td');
+      if(!col) {
+        return false;
+      }
+      col = col.nextSibling
+    }
+    if(typeof col != 'object') {
+      return false;
+    }
+    var input = col.firstChild;
+    return firstSiblingOfType(input, 'input');
+  }
+  
+  function orderRow(row1, col, direction, prevValue) {
+    var input = positionInput(row1, col);
+    if(!input) {
+      return;
+    }
+    
+    if(direction == 'u') {
+      if(Number(prevValue)>Number(input.value)) {
+        return;
+      }
+      input.value = Number(prevValue) - 1;
+      row2 = row1.previousSibling;
+      row2 = firstPreviousSiblingOfType(row2, 'tr');
+      orderRow(row2, col, direction, input.value);
+    } else {
+      if(Number(prevValue)<Number(input.value)) {
+        return;
+      }
+      input.value = Number(prevValue) + 1;
+      row2 = row1.nextSibling;
+      row2 = firstSiblingOfType(row2, 'tr');
+      orderRow(row2, col, direction, input.value);
+    }
+  }
+  
+  
+  function showQueryResult(resultId) {
+    if(opener && opener.top && opener.top.map) {
+      opener.top.map.queryByResult(resultId);
+    }
+    return false;
+  }
+  
+  function selectChildNodesOfClass(nodeClass, checkAllBox) {
+    var f=document.forms["explorer-child-nodes"];
+    if(f) {
+      var i=0;
+      while(f[i]) {
+        if((f[i].type=="checkbox")
+            && (String(f[i].name).substring(0,nodeClass.length+12)=='child_node['+nodeClass+']')) {
+          f[i].checked= checkAllBox.checked;
+        }
+        i++;
+      }
+    }
+  }
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/l10n.php
===================================================================
--- packages/musmap/branches/upstream/current/js/l10n.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/l10n.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,67 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Gestion des utilisateurs
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package interface
+ * @since 2004-06
+ */
+  /**
+   * Startup
+   */
+  include_once('../include/pre.inc.php');
+  
+  Header('Content-type:application/x-javascript');
+?>
+function l10n(message) {
+  if(top.l10n_array[message]) {
+    if(top.debug_l10n) {
+      return '['+message+']js:'+top.l10n_array[message];
+    } else {
+      return top.l10n_array[message];
+    }
+  } else {
+    if(top.debug_l10n) {
+      alert('Not translated: '+message);
+    }
+    return message;
+  }
+}
+
+<?php
+  if(file_exists(Conf::get('musmap_root_dir').'/data/lang/'.Conf::get('client_lang').'/javascript.lang.js')) {
+    echo '//l10n for lang: '.Conf::get('client_lang')."\n";
+    include_once(Conf::get('musmap_root_dir').'/data/lang/'.Conf::get('client_lang').'/javascript.lang.js');
+  } else {
+    echo '//No l10n for lang: '.Conf::get('client_lang');
+  }
+?>

Added: packages/musmap/branches/upstream/current/js/layers.js
===================================================================
--- packages/musmap/branches/upstream/current/js/layers.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/layers.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,209 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  function collapseGroup(img,enforceValue) {
+    var groupHeader=img.parentNode.parentNode;
+    var groupContent=top.frames.layers.document.getElementById(groupHeader.id+'-content');
+    if((groupContent.style.visibility=='hidden' && !enforceValue)
+      ||(enforceValue=='show' && enforceValue)) {
+      groupContent.style.visibility='visible';
+      groupContent.style.position='static';
+      img.alt='-';
+      img.src='images/moins.gif';
+    } else {
+      groupContent.style.visibility='hidden';
+      groupContent.style.position='absolute';
+      img.alt='+';
+      img.src='images/plus.gif';
+    }
+  }
+  
+  function selectLayer(layer) {
+    top.layerSelected=layer;
+    return true;
+  }
+  
+  function selectLayergroup(group,params) {
+    if(group==-1) {
+      tableRows=params.parentNode.parentNode.parentNode.childNodes
+      for(i=2;i<tableRows.length;i++) {
+        if(String(tableRows[i].tagName).toLowerCase()=='tr') {
+          row=tableRows[i];
+          row=row.firstChild;
+          row=firstSiblingOfType(row,'td');
+          row=row.nextSibling;
+          row=firstSiblingOfType(row,'td');
+          if(!row) {
+            continue;
+          }
+          row=row.firstChild;
+          row=firstSiblingOfType(row,'input');
+          if(!row) {
+            continue;
+          }
+          if(String(row.id).substr(0,6)=='group-') {
+            selectLayergroup(row,params.checked);
+          }  else if (String(row.id).substr(0,6)=='layer-') {
+            row.checked=params.checked;
+          }
+        }
+      }
+      return;
+    }
+    row=group.parentNode.parentNode.nextSibling;
+    row=firstSiblingOfType(row,'tr');
+    row=row.firstChild;
+    row=firstSiblingOfType(row,'td');
+    row=row.nextSibling;
+    row=firstSiblingOfType(row,'td');
+    row=row.firstChild;
+    row=firstSiblingOfType(row,'table');
+    if(!row) {//No layer in the group
+      return;
+    }
+    row=row.firstChild;
+    row=firstSiblingOfType(row,'tbody');
+    row=row.firstChild;
+    row=firstSiblingOfType(row,'tr');
+    newValue=(group.checked && (typeof params == "undefined"))
+      || (params && (typeof params != "undefined"));
+    if(typeof params != "undefined") {
+      group.checked=newValue;
+    }
+    group.parentNode.parentNode.parentNode.normalize();
+    img=group.parentNode.previousSibling;
+    if(!img.tagName) {
+      img=img.previousSibling;
+    }
+    img=firstSiblingOfType(img,'td');
+    img=img.firstChild;
+    img=firstSiblingOfType(img,'img');
+    if(!newValue) {
+      collapseGroup(img,'hide');
+    } else {
+      collapseGroup(img,'show');
+    }
+    while(row) {
+      if((row.tagName=='tr') || (row.tagName=='TR')){
+        chk=row.firstChild;
+        chk=firstSiblingOfType(chk,'td');
+        chk=chk.nextSibling;
+        chk=firstSiblingOfType(chk,'td');
+        chk=chk.firstChild;
+        chk=firstSiblingOfType(chk,'input');
+        if(!chk) {
+          break;
+        } else {
+          chk.checked=newValue;
+        }
+      }
+      row=row.nextSibling;
+    }
+  }
+  
+  function setImgState(img,newSt) {
+    if(newSt=='+') {
+      img.src='images/plus.gif';
+      img.alt='+';
+    } else {
+      img.src='images/moins.gif';
+      img.alt='-';
+    }
+  }
+  
+  function collapse(collapseButton,rowType,deep) {
+    var tr=collapseButton.parentNode.parentNode;
+    tr=tr.nextSibling;
+    var tr2=firstSiblingOfType(tr,'tr');
+    var toDo=collapseButton.alt;
+    var td;
+    while(tr2) {
+      td=tr2.firstChild;
+      td=firstSiblingOfType(td,'td');
+      for(var i=0;i<deep+2;i++) {
+        td=td.nextSibling;
+        td=firstSiblingOfType(td,'td');
+      }
+      if (td.className != 't') {
+        break;
+      }
+      if(toDo=='+') {
+        tr2.style.visibility='';
+        tr2.style.position='';
+      } else {
+        tr2.style.visibility=hiddenRowVisibility;
+        tr2.style.position=hiddenRowPosition;
+      }
+      //*/
+      tr2=tr2.nextSibling;
+      tr2=firstSiblingOfType(tr2,'tr');
+    }
+    if(toDo=='+') {
+      setImgState(collapseButton,'-');
+    } else {
+      setImgState(collapseButton,'+');
+    }
+  }
+
+  function updateEyes() {
+    var minScale,maxScale,img,scales;
+    if(!document.getElementById)
+      return;
+    var scale=Number(top.map.getScale());
+    for(var i=0;i<top.frames.layers.document.forms[0].length;i++) {
+      if(String(top.frames.layers.document.forms[0].elements[i].name).substring(0,7)=='scales-') {
+        scales=String(top.frames.layers.document.forms[0].elements[i].value).split(',');
+        minScale=Number(scales[0]);
+        maxScale=Number(scales[1]);
+        img=top.frames.layers.document.getElementById('eye-'+
+          String(top.frames.layers.document.forms[0].elements[i].name).substring(7));
+        if(img) {
+          if(    ((minScale<=scale) || (minScale<=0))
+              && ((maxScale>=scale) || (maxScale<=0))) {
+            img.src='images/eye.png';
+            img.alt='';
+          } else {
+            img.src='images/eye_hidden.png';
+            img.alt='x';
+          }
+        }
+      }
+    }
+  }
+  
+var hiddenRowVisibility;
+var hiddenRowPosition;
+
+if(navigator.product=='Gecko') {
+  hiddenRowVisibility='collapse';
+  hiddenRowPosition='';
+} else {
+  hiddenRowVisibility='hidden';
+  hiddenRowPosition='absolute';
+}
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/map.class.js
===================================================================
--- packages/musmap/branches/upstream/current/js/map.class.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/map.class.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,531 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+function TMap(mapElement, overviewElement, scalebarElement, 
+    rectElement, waitingElement){
+  // ========================================= //
+  //private variables
+  /**
+   * @var HTMLImageElement
+   */
+  var _mapElement= mapElement;
+  /**
+   * @var TRect
+   */
+  var _mapExtent= null;
+  /**
+   * @var TRect
+   */
+  var _mouseRect= new TRect(NaN,NaN,NaN,NaN);
+  /**
+   * @var HTMLImageElement
+   */
+  var _overviewElement= overviewElement;
+  /**
+   * @var TRect
+   */
+  var _overviewExtent= null;
+  /**
+   * @var HTMLElement
+   */
+  var _rectElement= rectElement;
+  /**
+   * @var Number
+   */
+  var _scale= null;
+  /**
+   * @var HTMLImageElement
+   */
+  var _scalebarElement= scalebarElement;
+  /**
+   * @var HTMLElement
+   */
+  var _waitingElement=waitingElement;
+  /**
+   * @var Array
+   */
+  var _windows={};
+  /**
+   * @var Array
+   */
+  var _windowsOptions={
+    'query':
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'scrollbars,'+
+      'height=600,width=650',
+    'print':
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'menubar,'+
+      'height=500,width=600',
+    'explore':
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'menubar,scrollbars,'+
+      'height=600,width=800'
+  };
+  
+  // ========================================= //
+  //public variables
+  this.mapInfos= null;
+  this.pansize= 0.8;
+  
+  // ========================================= //
+  //private methods
+  function getNewMapRect(){
+    var mainSize=XBGetFrameSize(XBParentFrame(_mapElement));
+    return new TRect(10,mainSize.w()-10,10,mainSize.h()-10);
+  }
+  
+  function layersList() {
+    var layer;
+    var r='';
+    for(var i=0;i<top.frames.layers.document.forms.mapserv.length;i++) {
+      layer=top.frames.layers.document.forms.mapserv[i];
+      if((layer.name.substring(0,7)=="layers[") && layer.checked) {
+        r+='&'+layer.name+'='+layer.value;
+      }
+    }
+    return(r.substring(1));
+  }
+  
+  function sendParams(aParams){
+    setBusy(true);
+    sendParamsUsingForm(aParams, top.mapservForm);
+  }
+
+  function sendParamsUsingForm(aParams, oForm){
+    for(var i in aParams){
+      if((typeof aParams[i]=='object')
+          && aParams[i]
+          && (typeof aParams[i].toTextInputs == 'function')){
+        aParams[i].toTextInputs(oForm,i);
+      } else {
+        if(oForm[i]){
+          oForm[i].value=aParams[i];
+        }
+      }
+    }
+    oForm.submit();
+  }
+  
+  function sendParamsInNewWindow(aParams, sWindowName, sUrl) {
+    var completeUrl=sUrl;
+    for(var i in aParams){
+      if((typeof aParams[i]=='object')
+          && aParams[i]
+          && (typeof aParams[i].urlVars == 'function')){
+        completeUrl+='&'+aParams[i].urlVars(i);
+      } else {
+        completeUrl+='&'+i+'='+aParams[i];
+      }
+    }
+    if(_windows[sWindowName])
+      XBcloseWindow(_windows[sWindowName]);
+    _windows[sWindowName]= window.open(completeUrl,sWindowName,
+        _windowsOptions[sWindowName]);
+  }
+  
+  // ========================================= //
+  // Getters/Setters
+  
+  function setBusy(aValue){
+    if(_waitingElement){
+      _waitingElement.style.visibility= aValue ? '' : 'hidden';
+    }
+  }
+  this.setBusy= setBusy;
+  
+  this.setCursor= function(curs){
+    switch(curs){
+      case 'zoom_pan':
+        curs = 'move';
+        break;
+      case 'zoom_in':
+        curs = 'url(images/cursors/zoomin.cur), default';
+        break;
+      case 'zoom_out':
+        curs = 'url(images/cursors/zoomout.cur), default';
+        break;
+      case 'query_mouse':
+        curs = 'help';
+        break;
+      case 'measure':
+        curs = 'default';
+        break;
+      default:
+    }
+    if(typeof _mapElement !='undefined'){
+      _mapElement.style.cursor=curs;
+      _mapElement.parentNode.style.cursor=curs;
+    }
+  }
+  
+  this.getMapElement= function(){
+    return _mapElement;
+  }
+  this.getMapRect= function(){
+    return new TRect(
+      parseInt(_mapElement.style.left),
+      parseInt(_mapElement.style.left)+_mapElement.width,
+      parseInt(_mapElement.style.top),
+      parseInt(_mapElement.style.top)+_mapElement.height);
+  }
+  this.setMap= function(w, h, src){
+    _mapElement.src= src;
+    var f= function(e) {
+      _mapElement.style.top= '0px';
+      _mapElement.style.left= '0px';
+      _mapElement.width= w;
+      _mapElement.height= h;
+      var mapContainer= _mapElement.parentNode;
+      mapContainer.style.width= w+'px';
+      mapContainer.style.height= h+'px';
+    }
+    _mapElement.onload= f;
+  }
+  this.getMapExtent= function(e){
+    return _mapExtent;
+  }
+  this.setMapExtent= function(e){
+    _mapExtent= e;
+    if(this.mapInfos) {
+      this.mapInfos.updateCoords();
+    }
+  }
+  
+  this.getMouseRect= function() {
+    return _mouseRect;
+  }
+  
+  this.getOverviewElement= function(){
+    return _overviewElement;
+  }
+  this.setOverview= function(w, h, src){
+    if(src) {
+      _overviewElement.width= w;
+      _overviewElement.height= h;
+      _overviewElement.src= src;
+    } else {
+      _overviewElement.width= 1;
+      _overviewElement.height= 1;
+      _overviewElement.src= 'images/white_pixel.gif';
+    }
+  }
+  this.setOverviewExtent= function(e){
+    _overviewExtent= e;
+  }
+  
+  this.getScale= function(){
+    return _scale;
+  }
+  this.setScale= function(s){
+    _scale= Number(s);
+    _scalebarElement.title= l10n("Scale:")+" 1/"+Math.round(_scale);
+    _scalebarElement.alt="1/"+_scale;
+    if(top.toolsForm){
+      top.toolsForm.elements["scale-select"].options[0].text=Math.round(_scale);
+      top.toolsForm.elements["scale-select"].options[0].value=Math.round(_scale);
+      top.toolsForm.elements["scale-select"].options[0].selected=true;
+    }
+  }
+  
+  this.setScalebar= function(w, h, src){
+    _scalebarElement.width= w;
+    _scalebarElement.height= h;
+    _scalebarElement.src= src;
+  }
+  
+
+  // ========================================= //
+  // Public Methods
+  this.changeScale= function(s){
+    if(s.options[s.selectedIndex].value!="other"){
+      this.zoomScale(s.options[s.selectedIndex].value);
+    } else {
+      var r=prompt(l10n("Please enter scale:"),'999');
+      if(!r){
+        s.selectedIndex=0;
+        return false;
+      }
+      this.zoomScale(r);
+    }
+    return true;
+  }
+  
+  this.closeAllWindows= function(){
+    for(var w in _windows) {
+      XBcloseWindow(_windows[w]);
+    }
+  }
+  
+  this.isReady= function() {
+    return _mapElement && _mapExtent
+      && _overviewElement && _overviewExtent
+      && _rectElement && _scale
+      && _scalebarElement && _waitingElement
+      && this.mapInfos;
+  }
+  
+  this.pan= function(direction){
+    var dx=0;
+    var dy=0;
+    var mapRect= this.getMapRect();
+    if(direction == 'nw'){
+      dx= -this.pansize/2;
+      dy= -this.pansize/2;
+    } else if(direction == 'n'){
+      dy= -this.pansize;
+    } else if(direction == 'ne'){
+      dx= +this.pansize/2;
+      dy= -this.pansize/2;
+    } else if(direction == 'w'){
+      dx= -this.pansize;
+    } else if(direction == 'e'){
+      dx=  this.pansize;
+    } else if(direction == 'sw'){
+      dx= -this.pansize/2;
+      dy=  this.pansize/2;
+    } else if(direction == 's'){
+      dy=  this.pansize;
+    } else if(direction == 'se'){
+      dx=  this.pansize/2;
+      dy=  this.pansize/2;
+    } else {//direction is TPoint
+      dx= -direction.x/mapRect.w();
+      dy= -direction.y/mapRect.h();
+    }
+    var newRect = new TRect(dx*mapRect.w(),(1+dx)*mapRect.w(),
+      dy*mapRect.h(),(1+dy)*mapRect.h());
+    var oldRect= new TRect(0, mapRect.w(), 0, mapRect.h());
+    this.zoomExtent(newRect.homothety(oldRect,this.getMapExtent()));
+  }
+  
+  this.print= function(){
+    var aParams={};
+    aParams['extent']= _mapExtent;
+    sendParamsInNewWindow(aParams, 'print',
+      'print.php?'+layersList());
+  }
+  
+  this.queryByForm= function(selectObj){
+    if(selectObj.options[selectObj.selectedIndex].value=='-') {
+      return true;
+    }
+    var r=getNewMapRect();
+    var aParams={};
+    aParams['command']= 'query_form';
+    aParams['extent']= _mapExtent;
+    aParams['form']= selectObj.options[selectObj.selectedIndex].value;
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    selectObj.selectedIndex=0;
+    sendParamsInNewWindow(aParams, 'query',
+      'query_form.php?'+layersList());
+    return false;
+  }
+  
+  this.queryByResult= function(resultId) {
+    var r=getNewMapRect();
+    var aParams={};
+    aParams['command']= 'query_result';
+    aParams['extent']= _mapExtent;
+    aParams['id_query_result']= resultId;
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    sendParamsInNewWindow(aParams, 'query',
+      'query.php?'+layersList());
+  }
+
+  this.queryMouse= function(){
+    if((_mouseRect.w()>2) && (_mouseRect.h()>2)){
+      this.queryRect(_mouseRect.homothety(this.getMapRect(),this.getMapExtent()));
+    } else {
+      this.queryPoint(_mouseRect.point1().homothety(this.getMapRect(),this.getMapExtent()));
+    }
+  }
+  
+  this.queryPoint= function(p) {
+    if(typeof top.layerSelected !='string') {
+      alert(l10n('Please select a layer!'));
+      return;
+    }
+    var r=getNewMapRect();
+    var aParams={};
+    aParams['command']= 'query_point';
+    aParams['extent']= _mapExtent;
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    aParams['x']= p.x;
+    aParams['y']= p.y;
+    sendParamsInNewWindow(aParams, 'query',
+      'query.php?'+top.layerSelected+'&'+layersList());
+  }
+  
+  this.queryRect= function(box) {
+    if(typeof top.layerSelected !='string') {
+      alert(l10n('Please select a layer!'));
+      return;
+    }
+    var r=getNewMapRect();
+    var aParams={};
+    aParams['command']= 'query_rect';
+    aParams['extent']= _mapExtent;
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    aParams['minx']= box.minX();
+    aParams['maxx']= box.maxX();
+    aParams['miny']= box.minY();
+    aParams['maxy']= box.maxY();
+    sendParamsInNewWindow(aParams, 'query',
+      'query.php?'+top.layerSelected+'&'+layersList());
+  }
+  
+  this.zoomBox= function(box){
+    this.zoomExtent(box.homothety(this.getMapRect(),this.getMapExtent()));
+  }
+  
+  this.zoomExtent= function(extent){
+    var r=getNewMapRect();
+    var aParams={};
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    aParams['extent']= extent;
+    aParams['command']= 'zoom_extent';
+    sendParams(aParams);
+  }
+  
+  this.zoomIn= function(){
+    this.zoomInOut('+');
+  }
+  
+  this.zoomInOut= function(inOrOut){
+    if((_mouseRect.w()>2) && (_mouseRect.h()>2)){
+      this.zoomBox(_mouseRect);
+    } else {
+      var r=getNewMapRect();
+      var aParams={};
+      aParams['command']= inOrOut=='+' ? 'zoom_in' : 'zoom_out';
+      aParams['extent']= _mapExtent;
+      aParams['image_width']= r.w();
+      aParams['image_height']= r.h();
+      aParams['mouse_rect']= _mouseRect;
+      aParams['zoom_factor']= top.toolsForm['zoom_factor'].value;
+      sendParams(aParams);
+    }
+  }
+  
+  this.zoomInit= function(){
+    var r=getNewMapRect();
+    var aParams={};
+    aParams['command']= 'zoom_init';
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    sendParams(aParams);
+  }
+  this.zoomOut= function(){
+    this.zoomInOut('-');
+  }
+  
+  this.zoomRef= function(p) {
+    var r=getNewMapRect();
+    var aParams={};
+    _mouseRect.x1= p.x;
+    _mouseRect.y1= p.y;
+    _mouseRect.x2= _overviewElement.width;
+    _mouseRect.y2= _overviewElement.height;
+    aParams['command']= 'zoom_ref';
+    aParams['extent']= _mapExtent;
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    aParams['mouse_rect']= _mouseRect;
+    aParams['scale']= this.getScale();
+    sendParams(aParams);
+  }
+  
+  this.zoomRefresh= function(){
+    this.zoomExtent(_mapExtent);
+  }
+
+  this.zoomScale= function(scale){
+    var r=getNewMapRect();
+    var aParams={};
+    _mouseRect.x1= r.w()/2;
+    _mouseRect.y1= r.h()/2;
+    _mouseRect.x2= r.w()/2;
+    _mouseRect.y2= r.h()/2;
+    aParams['command']= 'zoom_scale';
+    aParams['extent']= _mapExtent;
+    aParams['image_width']= r.w();
+    aParams['image_height']= r.h();
+    aParams['mouse_rect']= _mouseRect;
+    aParams['scale']= scale;
+    sendParams(aParams);
+  }
+  // ========================================= //
+  // Rect Public Methods
+  this.drawRect= function(){
+    if(_rectElement){
+      setElementRect(_rectElement,_mouseRect);
+    }
+  }
+  this.beginRect= function(e){
+    _mouseRect.setPoint1(XBgetAbsoluteCoords(e));
+    _mouseRect.setPoint2(_mouseRect.point1());
+    this.drawRect();
+    this.showRect();
+  }
+  
+  this.continueRect= function(e){
+    _mouseRect.setPoint2(XBgetAbsoluteCoords(e));
+    this.drawRect();
+  }
+  
+  this.endRect= function(e){
+    _mouseRect.setPoint2(XBgetAbsoluteCoords(e));
+    this.drawRect();
+  }
+  
+  this.showRect= function(e){
+    if(_rectElement){
+      _rectElement.style.visibility='inherit';
+    }
+  }
+  
+  this.hideRect= function(e){
+    if(_rectElement){
+      _rectElement.style.visibility='hidden';
+    }
+  }
+
+  
+  // ========================================= //
+  // Init
+  this.mapInfos = new TMapInfos(this);
+
+}
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/mapinfos.js
===================================================================
--- packages/musmap/branches/upstream/current/js/mapinfos.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/mapinfos.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,101 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+function TMapInfos(map){
+  this.map= map;
+  this.hasHeaders=false;
+  this.tableElement=top.frames.main.document.getElementById('map-infos');
+  this.polyline= new TPolyline(map.getMapElement().parentNode);
+  this.polyline.fillColor='';
+  this.polyline.strokeColor='red';
+  this.polyline.onmousedown= top.mapMousedown;
+  this.polyline.onmousemove= top.mapMousemove;
+  this.polyline.onmouseup= top.mapMouseup;
+  this.polyline.onclick= top.mapClick;
+  this.updateCoords();
+}
+
+function TMapInfos_clear() {
+  var i;
+  for(i=this.tableElement.rows.length-1; i>=0; i--) {
+    this.tableElement.deleteRow(i)
+  }
+  this.hasHeaders = false;
+  this.polyline.clear();
+}
+TMapInfos.prototype.clear=TMapInfos_clear;
+
+function TMapInfos_addPoint(coordOnMap) {
+  this.polyline.sourceExtent= this.map.getMapExtent();
+  this.polyline.destinationExtent= this.map.getMapRect();
+  
+  this.polyline.addPoint(coordOnMap.x, coordOnMap.y);
+}
+TMapInfos.prototype.addPoint=TMapInfos_addPoint;
+
+function TMapInfos_updateCoords() {
+  var mapCoords=XBabsoluteOffset(this.map.getMapElement());
+  this.polyline.sourceExtent= this.map.getMapExtent();
+  this.polyline.destinationExtent= this.map.getMapRect().add(mapCoords);
+  this.polyline.draw();
+}
+TMapInfos.prototype.updateCoords=TMapInfos_updateCoords;
+
+function TMapInfos_addRow() {
+  var cell,txt;
+  var newRow = this.tableElement.insertRow(-1);
+  for(var i=0;i<arguments.length;i++) {
+    cell = newRow.insertCell(-1);
+    cell.className = 'map-infos-cell';
+    //IE bug require innerHTML
+    //txt = document.createTextNode(arguments[i]);
+    //cell.appendChild(txt);
+    cell.innerHTML = arguments[i];
+  }
+}
+TMapInfos.prototype.addRow=TMapInfos_addRow;
+
+function TMapInfos_addHeaders() {
+  if(this.hasHeaders) {
+    return;
+  }
+  var cell,txtNode;
+  var newRow = this.tableElement.insertRow(0);
+  for(var i=0;i<arguments.length;i++) {
+    cell = newRow.insertCell(-1);
+    cell.className = 'map-infos-header';
+    //IE bug require innerHTML
+    //txtNode = document.createTextNode(arguments[i]);
+    //cell.appendChild(txtNode);
+    cell.innerHTML = arguments[i];
+  }
+  this.hasHeaders = true;
+}
+TMapInfos.prototype.addHeaders=TMapInfos_addHeaders;
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/presentation_wizard.js
===================================================================
--- packages/musmap/branches/upstream/current/js/presentation_wizard.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/presentation_wizard.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,353 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+  function loadPresentationWizard() {
+    if(document.forms[0]) {
+      fillColumnList();
+      if((document.forms[0].operation.selectedIndex==0)
+          || (document.forms[0].operation.selectedIndex==1)) {
+        changeOperation(document.forms[0].operation);
+        /*
+        if(document.forms[0].classes_created.value) {
+          document.getElementById('classes').className="";
+          document.getElementById('style').className="";
+          document.getElementById('default-style').className="";
+          document.getElementById('submit').className="";
+        }
+        //*/
+      }
+      var opt;
+      for(var sColorScheme in aColorSchemes) {
+        opt= document.createElement('option');
+        opt.value= sColorScheme;
+        opt.innerHTML= sColorScheme;
+        document.forms[0].color_scheme.appendChild(opt);
+      }
+      changeColorScheme(document.forms[0].color_scheme);
+      document.forms[0].operation.selectedIndex=-1;
+    } else {
+      if(window.opener)
+        window.opener.location.reload();
+    }
+  }
+  /**
+   *
+   */
+  function changeColorScheme(sel) {
+    var colorsCont= document.getElementById('colors');
+    var span;
+    for(var i= colorsCont.childNodes.length-1;i>=0;i--) {
+      colorsCont.removeChild(colorsCont.childNodes[i]);
+    }
+    for(var colNo in aColorSchemes[sel.value]) {
+      span= document.createElement('span');
+      span.innerHTML= '_';
+      span.title= aColorSchemes[sel.value][colNo];
+      span.style.background= aColorSchemes[sel.value][colNo];
+      colorsCont.appendChild(span);
+    }
+    colors= aColorSchemes[sel.value];
+  }
+  
+  /**
+   * Fill the column list (<select ...)
+   * Use the dataColumns array set in presentation_wizard.php
+   */
+  function fillColumnList() {
+    var columnsList= document.forms[0]["id_data_column"];
+    var opt, dc;
+    for(dc in dataColumns) {
+      opt=document.createElement('option');
+      opt.value=dataColumns[dc][0];
+      opt.innerHTML=dataColumns[dc][2];
+      columnsList.appendChild(opt);
+    }
+  }
+  
+  /**
+   * Event: occurs when '<select name=data_column changes
+   * Display field infos
+   */
+  function changeDataColumn(sel) {
+    var opt;
+    document.forms[0].data_column_infos.value=
+      dataColumns[sel.value][1] +
+      ' ('+dataColumns[sel.value][4]+')';
+  }
+  
+  /**
+   * Event: occurs when '<select name=data_column is dblclicked
+   * Add selected field to expression
+   */
+  function dblclickDataColumn(sel) {
+    if(dataColumns[sel.value][4]=='C'
+        || dataColumns[sel.value][4]=='L'
+        || dataColumns[sel.value][4]=='M') {//field is string
+      document.forms[0].expression.value+="'["+dataColumns[sel.value][1]+"]'";
+    } else {//field is number
+      document.forms[0].expression.value+='['+dataColumns[sel.value][1]+']';
+    }
+  }
+  
+  
+  /**
+   * Event: occurs when '<input name=add_operator is clicked
+   * Add operator to expression
+   */
+  function addOperator(op) {
+    document.forms[0].expression.value+=op;
+  }
+  
+  /**
+   * Event: occurs when '<select name=operation is changed
+   * Shows the specific parameters
+   */
+  function changeOperation(sel) {
+    document.getElementById('params_I').className="hidden";
+    document.getElementById('params_S').className="hidden";
+    if(document.getElementById('params_'+sel.value))
+      document.getElementById('params_'+sel.value).className="";
+  }
+  
+  /**
+   * Calculate interval value
+   * @param string operator one of lin/exp/log
+   */
+  function interval(first,last,operator,perc) {
+    first=Number(first);
+    last=Number(last);
+    perc=Number(perc);
+    if(!operator) {
+      for(var i=0;i<document.forms[0].progression.length;i++) {
+        if(document.forms[0].progression[i].checked) {
+          operator=document.forms[0].progression[i].value;
+        }
+      }
+    }
+    var r;
+    switch(operator) {
+      case 'log':
+        r=Math.log(Math.exp(first)+(Math.exp(last)-Math.exp(first))*perc);
+        break;
+      case 'exp':
+        r=Math.exp(Math.log(1+first)+(Math.log(1+last)-Math.log(1+first))*perc)-1;
+        break;
+      case 'lin':
+      default:
+        r=Number(first)+(last-first)*perc;
+    }
+    return Math.round(r*(Math.pow(10,document.forms[0].precision.value)))/
+      Math.pow(10,document.forms[0].precision.value);
+  }
+  
+  
+  /**
+   * Calculate interval value
+   * @param string op one of go_I:interval/go_S:string
+   */
+  function buildClasses(op) {
+    var classesCount=0;
+    var i;
+    switch(op) {
+    case 'go_I':
+      classesCount=document.forms[0].count_I.value;
+      break;
+    case 'go_S':
+      classesCount=document.forms[0].count_S.value;
+      break;
+    }
+    document.getElementById('classes').className="";
+    var cont=document.getElementById('classes_container');
+    for(i=cont.childNodes.length-1;i>=0;i--) {
+      cont.removeChild(cont.childNodes[i]);
+    }
+    var row,cell,input,step;
+    var expr=document.forms[0].expression.value;
+    var values=document.forms[0].values.value.split(',');
+    for(i=0;i<classesCount;i++) {
+      //add a row to the container table
+      row=cont.insertRow(-1);
+      //cell 0: radio
+      cell=row.insertCell(-1);
+      input=document.createElement('input');
+      input.name="class_selected";
+      input.type="radio";
+      input.value=i;
+      input.onclick=selectClass;
+      cell.appendChild(input);
+      //cell 1: index
+      cell=row.insertCell(-1);
+      input=document.createElement('input');
+      input.name="class["+i+"][index]";
+      input.type="text";
+      input.value=i;
+      input.size=2;
+      cell.appendChild(input);
+      //cell 2: name
+      cell=row.insertCell(-1);
+      input=document.createElement('input');
+      input.name="class["+i+"][name]";
+      input.type="text";
+      switch(op) {
+      case 'go_I':
+        step=interval(document.forms[0].first.value,document.forms[0].last.value,
+          0,(i+1)/classesCount);
+        input.value=((Number(document.forms[0].last.value)>Number(document.forms[0].first.value)) ? '<' : '>')+step;
+        break;
+      case 'go_S':
+        if(typeof values[i] == 'undefined')
+          step='value'+i;
+        else 
+          step=values[i];
+        input.value=step;
+        break;
+      }
+      cell.appendChild(input);
+      //cell 3: expression
+      cell=row.insertCell(-1);
+      input=document.createElement('input');
+      input.name="class["+i+"][expression]";
+      input.type="text";
+      if(i==classesCount-1) {
+          input.value='';
+      } else {
+        switch(op) {
+        case 'go_I':
+          input.value=
+            '('+
+              expr+
+              ((Number(document.forms[0].last.value)>Number(document.forms[0].first.value)) ? 'lt' : 'gt')+
+              step+
+            ')';
+          break;
+        case 'go_S':
+          input.value='('+expr+"eq'"+step+"')";
+          break;
+        }
+      }
+      cell.appendChild(input);
+      //hidden fields
+      var fields=Array('id_symbol','style_background_color',
+        'style_color','style_outline_color','style_size',
+        'style_symbol_maxsize','style_symbol_minsize');
+      for(var field in fields){
+        input=document.createElement('input');
+        input.name="style["+i+"]["+fields[field]+"]";
+        input.type="hidden";
+        if(fields[field]=='style_color') {
+          input.value=colors[Math.round(i*(colors.length-1)/(classesCount-1))];
+        } else
+          input.value='__DEFAULT__';
+        cell.appendChild(input);
+      }
+    }
+    document.getElementById('style').className="";
+    document.getElementById('default-style').className="";
+    document.getElementById('submit').className="";
+    document.forms[0].classes_created.value=1;
+  }
+  
+  function storeCurrentClass() {
+    var field;
+    var input;
+    if(document.forms[0].elements.current_style_index.value) {
+      for(var inputNo=0;inputNo<document.forms[0].elements.length;inputNo++) {
+        input=document.forms[0].elements[inputNo];
+        if(typeof input.name == 'string') {
+          if(String(input.name).indexOf('style['+
+              document.forms[0].elements.current_style_index.value+']')==0) {
+            field=String(input.name).substr(String(input.name).indexOf(']')+1);
+            if(document.forms[0].elements['style_not_default'+field].checked) {
+              input.value=document.forms[0].elements['current_style'+field].value;
+            } else {
+              input.value='__DEFAULT__';
+            }
+          }
+        }
+      }
+    }
+  }
+  
+  
+  function selectClass(e) {
+    var i;
+    if(!e) e=window.event;
+    var target;
+    if (e.target) target = e.target;
+    else if (e.srcElement) target = e.srcElement;
+    if(!target) {
+      return false;
+    }
+    //IE 5 enforce:
+    if(typeof document.forms[0].class_selected == 'undefined') {
+      for (i=0;i<document.forms[0].elements.length;i++){
+        if (document.forms[0].elements[i].name=='class_selected'){
+          document.forms[0].elements[i].checked = false;
+        }
+      }
+      target.checked=true;
+    }
+    //IE 5 enforce /
+    var input;
+    var field;
+    storeCurrentClass();
+    document.forms[0].elements.current_style_index.value = 
+      target.value;
+    for(var inputNo=0;inputNo<document.forms[0].elements.length;inputNo++) {
+      input=document.forms[0].elements[inputNo];
+      if(typeof input.name == 'string') {
+        if(String(input.name).indexOf('style['+target.value+']')==0) {
+          field=String(input.name).substr(String(input.name).indexOf(']')+1);
+          document.forms[0].elements['style_not_default'+field].checked=
+            !(input.value=='__DEFAULT__');
+          if(input.value=='__DEFAULT__') {
+            document.forms[0].elements['current_style'+field].value=
+              document.forms[0].elements['default_style'+field].value;
+          } else {
+            document.forms[0].elements['current_style'+field].value=input.value;
+          }
+          if(String(field).indexOf('color')>0) {
+            field = String(field).replace('[','-').replace(']','-');
+            changeColor(
+              document.getElementById('color-current_style'+field),
+              document.getElementById('color-span-current_style'+field));
+          }
+        } 
+      }
+    }
+    return true;
+  }
+  
+  function changeStyle(source) {
+  }
+
+  function submitClasses() {
+    storeCurrentClass();
+  }
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/js/top.js
===================================================================
--- packages/musmap/branches/upstream/current/js/top.js	                        (rev 0)
+++ packages/musmap/branches/upstream/current/js/top.js	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,198 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /*
+   * Globals
+   */
+    top.map= null;
+  //Options
+    var explorerWindowOptions =
+      'toolbar=no,personalbar=no,resizable=1,'+
+      'menubar,scrollbars,'+
+      'height=600,width=800';
+    var coordsPrecision=0;
+  // ===========================================================================
+  // Objects
+    //Forms
+    top.toolsForm   = false;
+    top.mapservForm = false;
+    //
+    top.rectObj=false;
+  //Coords relatives to frame (x,y)
+    top.prevMouseCoords = false;
+    top.prevCoordsOnMap = false;
+    top.measureTotal    = 0;
+    
+  //Others
+    top.layerSelected   = -1;
+    var dragging        = false;
+    var framesLoaded    = [];
+    top.currentToolName = false;
+    var prevTool;
+
+  function load(frameName) {
+    switch(frameName) {
+      case 'top' :
+        top.document.onkeyup=topKeyUp;
+        framesLoaded=[];
+        break;
+      case 'tools':
+        top.frames.tools.document.onkeyup=top.keyUp;
+        top.toolsForm=top.frames.tools.document.forms.tools_form;
+        break;
+      case 'layers':
+        top.frames.layers.document.onkeyup=top.keyUp;
+        top.mapservForm=top.frames.layers.document.forms.mapserv;
+        break;
+      case 'main':
+        top.frames.main.document.onkeyup=top.keyUp;
+        var mapImage=top.frames.main.document.images.map;
+        mapImage.onmousedown=top.mapMousedown;
+        mapImage.onmousemove=top.mapMousemove;
+        mapImage.onmouseup=top.mapMouseup;
+        mapImage.onclick=top.mapClick;
+        var mapStyle=mapImage.style;
+        var mapContainer= 
+          top.frames.main.document.getElementById('map-container');
+        // Scale
+        var scalebarImage=top.frames.main.document.images.scalebar;
+        // selection rectangle
+        top.rectObj = new top.frames.main.XBgetElementById('mouse-rect');
+        top.rectObj.properties.onmousedown = top.mapMousedown;
+        top.rectObj.properties.onmousemove = top.mapMousemove;
+        top.rectObj.properties.onmouseup   = top.mapMouseup;
+        top.rectObj.properties.onclick=top.mapClick;
+        if(       typeof top.rectObj.style              =='undefined') {
+          //
+        } else if(typeof top.rectObj.style.opacity      =='undefined'
+               && typeof top.rectObj.style.filter       =='undefined'
+               && typeof top.rectObj.style.MozOpacity   =='undefined'
+               && typeof top.rectObj.style.KhtmlOpacity =='undefined')
+        {
+          top.rectObj.style.background='none';
+        }
+        //Message
+        var waitingDiv=new top.frames.main.XBgetElementById('waiting');
+        // reference
+        var refImage= top.frames.main.document.images["reference"];
+        refImage.onclick= referenceClick;
+        top.map= new TMap(mapImage, refImage, scalebarImage, 
+          top.rectObj, waitingDiv);
+        top.map.setCursor('crosshair');
+        break;
+      case 'socket':
+        top.frames.socket.document.onkeyup=topKeyUp;
+        break;
+      default:
+        alert(l10n('Unknown frame:')+' '+frameName);
+    }
+    framesLoaded[frameName]=true;
+    if (framesLoaded['tools']
+        && framesLoaded['layers']
+        && framesLoaded['main']
+        && (frameName!='socket')) {
+      top.map.zoomRefresh();
+      selectTool("zoom_in",top.frames.tools.document.images[2])
+    }
+  }
+
+  function unload() {
+    if(top.printWindow)
+      XBcloseWindow(top.printWindow);
+    if(top.map && top.map.queryWindow)
+      XBcloseWindow(top.map.queryWindow);
+    if(top.explorerWindow)
+      XBcloseWindow(top.explorerWindow);
+    if(top.map)
+      top.map.closeAllWindows();
+  }
+
+
+  function selectTool(toolName,image) {
+    dragging=false;
+    if(top.map)
+      top.map.hideRect();
+    switch(toolName) {
+      case 'zoom_init':
+        top.map.zoomInit();
+        return false;
+        //break;
+      case 'zoom_pan':
+      case 'zoom_in':
+      case 'zoom_out':
+      case 'query_mouse':
+        top.map.setCursor(toolName);
+        break;
+      case 'measure':
+        top.map.setCursor(toolName);
+        if(top.map.mapInfos && prevTool && prevTool==image) {
+          top.prevCoordsOnMap=false;
+          top.measureTotal = 0;
+          top.map.mapInfos.clear();
+        }
+        break;
+      case 'refresh':
+        top.map.zoomRefresh();
+        return false;
+        //break;
+      case 'print':
+        top.map.print();
+        return false;
+        //break;
+      case 'logout':
+        top.unload();
+        top.location.href="./?logout=1";
+        return false;
+        //break;
+      default:
+        alert(l10n('Tool not implemented:')+' '+toolName);
+        return false;
+    }
+    if(prevTool) {
+      prevTool.className="tool";
+    }
+    prevTool=image;
+    top.currentToolName=toolName
+    prevTool.className="active-tool";
+    return true;
+  }
+
+function changeProfile() {
+  if(top.frames.tools.document.forms[0].CHANGE_id_profile.value=='explore-profiles') {
+    top.frames.tools.document.forms[0].CHANGE_id_profile.value=top.frames.tools.document.forms[0].CURRENT_id_profile.value;
+    if(top.explorerWindow)
+      XBcloseWindow(top.explorerWindow);
+    top.explorerWindow=window.open('profiles_explorer.php', '', explorerWindowOptions);
+} else if(top.frames.tools.document.forms[0].CHANGE_id_profile.value=='reload-toolbar') {
+  top.frames.tools.location.reload(true);
+} else {
+    top.unload();
+    top.frames.tools.document.forms[0].submit();
+  }
+}
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/layers.php
===================================================================
--- packages/musmap/branches/upstream/current/layers.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/layers.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,94 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Légende
+ * @package interface
+ */
+
+  $INPUT=$_GET;
+  
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  LibMisc::DeleteTemporaryFiles();
+
+// Carte
+  $user= & new t_user();
+  $profiles= & new t_profiles_list(NULL);
+  $map->activate_layers(0);
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title>Legend</title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript">
+  <!--
+  function zoomToLayer() {
+    document.forms.mapserv.command.value="zoom_layer";
+    return true;
+  }
+  // -->
+  </script>
+</head>
+
+<body onload="top.load('layers');">
+  <form name="mapserv" id="mapserv" action="socket.php" target="socket">
+    <p><a href="javascript:document.location.reload();">
+      <?php echo html_l10n('Reload legend');?>
+    </a></p>
+    <p>
+      <input type="submit" value="Zoom to layer" onclick="zoomToLayer();">
+    </p>
+    <?php
+      $map->print_legend();
+    ?>
+    <input type="hidden" name="command" value="zoom_init">
+    <input type="hidden" name="extent[minx]">
+    <input type="hidden" name="extent[maxy]">
+    <input type="hidden" name="extent[maxx]">
+    <input type="hidden" name="extent[miny]">
+    <input type="hidden" name="mouse_rect[minx]">
+    <input type="hidden" name="mouse_rect[miny]">
+    <input type="hidden" name="mouse_rect[maxx]">
+    <input type="hidden" name="mouse_rect[maxy]">
+    <input type="hidden" name="zoom_factor">
+    <input type="hidden" name="scale">
+    <input type="hidden" name="image_width">
+    <input type="hidden" name="image_height">
+  </form>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/log/.htaccess
===================================================================
--- packages/musmap/branches/upstream/current/log/.htaccess	                        (rev 0)
+++ packages/musmap/branches/upstream/current/log/.htaccess	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from All

Added: packages/musmap/branches/upstream/current/log/musmap.sql
===================================================================

Added: packages/musmap/branches/upstream/current/log/remove.txt
===================================================================
--- packages/musmap/branches/upstream/current/log/remove.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/log/remove.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1 @@
+You can safely remove this file

Added: packages/musmap/branches/upstream/current/main.php
===================================================================
--- packages/musmap/branches/upstream/current/main.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/main.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,90 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Mise en page de l'impression
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  $user= & new t_user();
+
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html
+  xmlns="http://www.w3.org/TR/REC-html40"
+  xmlns:vml="urn:schemas-microsoft-com:vml"
+  lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title>Main</title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xb.js">
+  </script>
+  <style type="text/css">
+  <!--
+  #mouse-rect {
+    /* Gecko,Konqueror -- */
+    -moz-opacity: 0.3;
+    -khtml-opacity: 0.3;
+  }
+  -->
+  </style>
+  <!--[if IE]>
+  <style type="text/css">
+    /* IE */
+  #mouse-rect {
+    filter:alpha(opacity=30);
+  }
+  </style>
+  <![endif]-->
+</head>
+<body onload="top.load('main');" class="nomargin" id="main">
+  <noscript>
+    <p><?php echo html_l10n('Javascript should be enabled!');?></p>
+  </noscript>
+  <div id="map-container">
+    <img id="map" name="map" src="images/white_pixel.gif" border="0" alt="">
+  </div>
+  <a name="mouse-rect" href="javascript:void(0);" id="mouse-rect"></a>
+  <div id="scalebardiv">
+    <img id="scalebar"  name="scalebar" src="images/white_pixel.gif"
+      alt="<?php echo html_l10n('Scale')?>"
+      title="<?php echo html_l10n('Scale')?>"
+      width="150" height="17">
+  </div>
+  <div id="coordsdiv"><br></div>
+  <table id="map-infos"></table>
+  <img src="images/white_pixel.gif" id="reference" 
+    title="<?php echo html_l10n('Overview');?>" name="reference" border="0" class="nomargin">
+  <div id="waiting"><?php echo html_l10n('Please wait...');?></div>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/map.css
===================================================================
--- packages/musmap/branches/upstream/current/map.css	                        (rev 0)
+++ packages/musmap/branches/upstream/current/map.css	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,464 @@
+/*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/* =========================================
+ * General
+ */
+
+* {
+  font-family : Verdana, Arial, Helvetica, sans-serif;
+}
+
+/* overwrite the above rule */
+pre {
+  font-family : monospace;
+}
+
+
+/* avoid image border (quirks) */
+img {
+    border :none 0px;
+}
+
+/* usefull classes */
+.nomargin {
+    margin:0px;
+    padding:0px;
+}
+
+.hidden {
+   position:absolute;
+   visibility:hidden;
+}
+
+
+.color-input {
+  font-family : monospace;
+}
+
+/* =========================================
+ * MESSAGES
+ */
+
+fieldset.message {
+  padding: 4px;
+  margin: 5px;
+}
+
+fieldset.message legend {
+  font-weight: bold;
+}
+
+fieldset.error {
+  border: 1px solid red;
+}
+
+fieldset.error legend {
+  color:red;
+}
+
+fieldset.warning {
+  border: 1px solid orange;
+}
+
+fieldset.warning legend {
+  color: orange;
+}
+
+fieldset.information {
+  border: 1px solid blue;
+}
+
+fieldset.information legend {
+  color: blue;
+}
+
+/* =========================================
+ * TOOLS
+ */
+/* the body */
+#toolbar {
+		padding: 1px;
+  background-color:#ccccff;
+  font-size: 0.8em;
+}
+
+#tools_form {
+  padding:0px;
+  margin:0px;
+}
+img.tool {
+    background-color: #e5e5e5;
+    border:1px outset white;
+    vertical-align:bottom;
+}
+
+img.active-tool {
+    background-color: #ccccff;
+    border:1px inset blue;
+    vertical-align:bottom;
+}
+
+.tools-group {
+    padding:2px;
+    background-color: #e5e5e5;
+}
+
+
+/* =========================================
+ * LAYERS
+ */
+
+table#layers {
+    font-size:0.6em;
+    width:100%;
+}
+
+table.all {
+    font-size:0.8em;
+    width:100%;
+    border-spacing:0px;
+    border-collapse:collapse;
+}
+
+.layers-group {
+    margin:0pt;
+    margin-top:0.5em;
+    padding:0em;
+}
+
+td.collapse {
+    text-align: center;
+}
+
+/* =========================================
+ * MAIN
+ */
+ 
+
+/* (Please wait ...) */
+DIV#waiting {
+  padding: 2pt;
+  font-size:10pt;
+  background: #CC0000;
+  position: absolute;
+  text-align:center;
+  color: #FFFFFF;
+  top: 0px;
+  right: 0px;
+  font-weight:bold
+}
+
+/* Selection rectangle */
+#mouse-rect {
+    margin:0px;
+    padding:0px;
+    position : absolute;
+    border : red 1px solid;
+    background-color:blue;
+    visibility:hidden;
+    font-size:1px;
+    opacity: 0.3;
+    /* Browsers specific quirks are in main.php */
+}
+
+#reference {
+  cursor : crosshair;
+  position: absolute;
+  bottom: 14px;
+  left:0px;
+}
+
+/* Carte */
+
+#map-container {
+    overflow:hidden;
+    width:600px;
+    height:600px;
+}
+
+#map {
+  position: relative;
+  top: 0px;
+  left: 0px;
+}
+
+/* Echelle */
+#scalebardiv {
+    position:absolute;
+    bottom: 0px;
+    left: 0px;
+}
+
+#coordsdiv {
+    position:absolute;
+    top:0px;
+    left:0px;
+    font-size:9px;
+    background: white;
+    padding:2px;
+    text-align: right;
+}
+
+#map-infos {
+    position:absolute;
+    bottom:0px;
+    right:15px;
+    font-size:9px;
+    background-color:white;
+    padding:2px;
+    border-spacing: 0px;
+}
+
+.map-infos-cell {
+  border:1px solid gray;
+}
+
+.map-infos-header {
+  font-weight: bold;
+  text-align: center;
+}
+
+.map-infos-point {
+  position: absolute;
+  padding:0px;
+  border: 1px solid red;
+  color: red;
+  font-weight: bold;
+  text-align: center;
+  vertical-align: middle;
+  width : 3px;
+  height : 3px;
+}
+
+
+/* =========================================
+ * PRINT
+ */
+
+#print {
+  background-color : #CCCCFF;
+}
+
+table.section {
+   text-align:left;
+   width:100%;
+}
+
+/* =========================================
+ * ADMIN - SETTINGS
+ */
+.part {
+  border : 1px black solid;
+}
+
+/* =========================================
+ * Explorer
+ */
+ 
+BODY.explorer {
+  background-color : #CCCCFF;
+}
+
+.tabs {
+  list-style-type: none;
+  list-style-image: none;
+  list-style-position: outside;
+  padding: 1px;
+  margin: 3px;
+}
+
+.tab {
+  display: inline;
+  border:solid 1px #E0E0FF;
+  background-color: #E0E0FF;
+  text-align:center;
+  width:19%;
+  padding: 3px;
+  margin: 1px;
+  -moz-border-radius:4px;
+}
+
+#tab-selected {
+  background-color: #D0D0FF;
+  border:solid 1px white;
+}
+
+.tab-anchor {
+  color:black;
+  text-decoration:none;
+  width:100%;
+}
+
+
+:hover.tab-anchor {
+  color:white;
+}
+
+#explorer-core {
+}
+
+#explorer-infos {
+  float: right;
+  margin:5px;
+}
+
+#explorer-tree {
+  margin:5px;
+}
+
+.color-span {
+  border:black 1px solid;
+  cursor:pointer;
+}
+
+.child-nodes TD {
+  border-collapse:collapse;
+  border-spacing:0px;
+  text-align: center;
+}
+
+TH.child-nodes-class-header {
+  text-align:left;
+}
+TD.child-link {
+  text-align: left;
+}
+
+
+.arrow-up {
+  border: 1px solid transparent;
+}
+.arrow-down {
+  border: 1px solid transparent;
+}
+:active.arrow-up {
+  border: 1px solid white;
+}
+:active.arrow-down {
+  border: 1px solid white;
+}
+
+/* =========================================
+ * Queries
+ */
+
+BODY#query-results {
+  background-color : #C0C0FF;
+}
+
+BODY#query-form {
+  background-color : #C0C0FF;
+}
+
+TABLE.query-results {
+  border : 1px inset black;
+  background-color : #D8D8FF;
+  padding:2px;
+  margin:1px;
+  
+}
+
+TABLE.one-result {
+  border : 1px outset black;
+  background-color : #C0C0FF;
+  padding:2px;
+  margin:1px;
+}
+
+TABLE.attributes-table {
+  text-align : center;
+}
+
+TABLE.attributes-table TR {
+  background-color : #C0C0FF;
+}
+
+TABLE.attributes-table TR.columns-headers {
+  background : none;
+}
+
+TR.result-attribute {
+}
+
+TR.results-toc {
+  border : 2px solid black;
+  background-color : #E2E2FF;
+  
+}
+
+TD.column-name {
+  text-align : right;
+}
+
+TH.column-header {
+  text-align : center;
+}
+
+/* =========================================
+ * Wizard
+ */
+
+BODY.wizard {
+  background-color : #CCCCFF;
+}
+
+input.op {
+  margin:0px;
+  padding:0px;
+  font-family: monospace;
+}
+
+/* =========================================
+ * Users
+ */
+
+BODY#users {
+  background-color : #CCCCFF;
+}
+
+#users-list {
+  border:1px solid black;
+  border-collapse:collapse;
+}
+
+#users-list th {
+  padding:2px;
+}
+
+#users-list td {
+  border:1px solid white;
+  padding:2px;
+}
+
+#users-list td table {
+  width:100%;
+  border-collapse:collapse;
+}

Added: packages/musmap/branches/upstream/current/presentation_wizard.php
===================================================================
--- packages/musmap/branches/upstream/current/presentation_wizard.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/presentation_wizard.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,294 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Presentation wizard
+ * @package interface
+ * @todo Gradients and color sets
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  require_once('include/colors.inc.php');
+  $user= & new t_user();
+  if(isset($_REQUEST['id_profile'])) {
+    $profiles= & new t_profiles_list((int) $_REQUEST['id_profile']);
+  } else {
+    $profiles= & new t_profiles_list('*');
+  }
+  if(isset($_REQUEST['id_profile_data'])) {
+    $oAttrFilter1= & new TAttributeFilter('','IS A','t_profile_data');
+    $oAttrFilter2= & new TAttributeFilter('id_profile_data', '=', $_REQUEST['id_profile_data']);
+    $oAttrFilter12= & new TAttributeFilter($oAttrFilter1,'AND',$oAttrFilter2,'TAttributeFilter');
+    $profile_data = &$profiles->Items->GetWithAttributeFilterRecursive($oAttrFilter12);
+  }
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Presentation wizard');?></title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript">
+    <!--
+      top.rootDir='.';
+    //-->
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xb.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xbgeo.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/explorer.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/colors.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/presentation_wizard.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/l10n.php"></script>
+</head>
+
+<body class="wizard" onload="return loadPresentationWizard();">
+<?php
+  if($profile_data) {
+    if(isset($_POST["build_classes"])) {
+      $profile_data->DeleteChildren();
+      if($profile_data->CanWrite()) {
+        foreach($_POST['class'] AS $class_params) {
+          $class=$profile_data->add_child('class',Array(
+              'class_index'=>$class_params['index'],
+              'class_name'=>$class_params['name'],
+              'class_expression'=>$class_params['expression']
+            ));
+          $style_params=$_POST['style'][$class_params['index']];
+          foreach($style_params AS $k=>$v) {
+            if($v=='__DEFAULT__') {
+              $style_params[$k]=$_POST['default_style'][$k];
+            }
+          }
+          $style=$class->add_child('style',Array(
+              'id_symbol'             =>$style_params['id_symbol'],
+              'style_name'            =>$class_params['name'],
+              'style_background_color'=>$style_params['style_background_color'],
+              'style_color'           =>$style_params['style_color'],
+              'style_outline_color'   =>$style_params['style_outline_color'],
+              'style_size'            =>$style_params['style_size'],
+              'style_symbol_maxsize'  =>$style_params['style_symbol_maxsize'],
+              'style_symbol_minsize'  =>$style_params['style_symbol_minsize']
+            ));
+        }
+      }
+    } else { // !if(isset($_POST["build_classes"]))
+      $oConnections= & LibComponent::Load('connections');
+      $oDataSource= & $oConnections->GetSubItemByClassNameAndAttribute('data_source','id_data_source',$profile_data->Attributes->Value('id_data_source'));
+?>
+<script type="text/javascript">
+<!--
+  var dataColumns=Array();
+<?php 
+  $oColumnsEnum= & $oDataSource->Items->NewEnum();
+  $oColumnsEnum->Reset();
+  while($oDataColumn= $oColumnsEnum->Each()) {
+    if($oDataColumn->ClassName()!='data_column') {
+      continue;
+    }
+    echo '  dataColumns['.$oDataColumn->Attributes->Value('id_data_column').']='.
+      'Array('.
+        '"'.LibMisc::EscapeJS($oDataColumn->Attributes->Value('id_data_column')).'",'.
+        '"'.LibMisc::EscapeJS($oDataColumn->Attributes->Value('column_code')).'",'.
+        '"'.LibMisc::EscapeJS($oDataColumn->Attributes->Value('column_short_label')).'",'.
+        '"'.LibMisc::EscapeJS($oDataColumn->Attributes->Value('column_long_label')).'",'.
+        '"'.LibMisc::EscapeJS($oDataColumn->Attributes->Value('column_type')).'"'.
+        ')'.                  
+      "\n";
+  }
+  unset($oColumnsEnum);
+  ?>
+  
+  var aColorSchemes= {
+    'Green-yellow-red':multiGradient(16,'#00FF00','#FFFF00',0.5,'#FF0000',1),
+    'Green-red':multiGradient(16,'#00FF00','#FF0000',1)};
+  var colors= aColorSchemes['Green to red'];
+//-->
+</script>
+<form action="presentation_wizard.php" method="POST" onsubmit="submitClasses();">
+  <input name="id_profile_data" type="hidden" value="<?php 
+    echo $profile_data->Attributes->Value('id_profile_data');?>">
+  <fieldset>
+    <legend><?php echo html_l10n('Expression:');?></legend>
+    <p><?php 
+      echo $profile_data->Attributes->Value('profile_data_title').' '.
+        '('.$oDataSource->Attributes->Value('data_source_schema').'.'.
+            $oDataSource->Attributes->Value('data_source_name').')';?>
+    </p>
+    <table>
+      <tr>
+        <td><textarea name="expression" cols=40 rows=5></textarea>
+          <p>
+            <input type="button" class="op" value="+" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="-" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="*" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="/" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="=" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="&gt;" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="&lt;" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="&gt;=" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="&lt;=" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="or" onclick="addOperator(this.value)">
+            <input type="button" class="op" value="and" onclick="addOperator(this.value)">
+          </p>
+        </td>
+        <td>
+          <select name="id_data_column" size=8 onchange="changeDataColumn(this);" 
+              ondblclick="dblclickDataColumn(this);"></select><br>
+          <input name="data_column_infos" type="text" readonly>
+        </td>
+      </tr>
+      </table>
+    As
+    <select name="operation" size=2 onclick="changeOperation(this);">
+      <option value="I"><?php echo html_l10n('Intervals');?>
+      <option value="S"><?php echo html_l10n('Strings');?>
+    </select>
+  </fieldset>
+  <fieldset>
+    <legend><?php echo html_l10n('Color Scheme:');?></legend>
+    <select name="color_scheme" onclick="changeColorScheme(this);"></select>
+    <div id="colors"></div>
+  </fieldset>
+  <fieldset class="hidden" id="params_I">
+    <legend><?php echo html_l10n('Intervals:');?></legend>
+    <?php echo html_l10n('Count:');?>
+    <input type="text" name="count_I" value="5" size="2"><br>
+    <?php echo html_l10n('First value:');?>
+    <input type="text" name="first" value="0" size="10">
+    <?php echo html_l10n('Last value:');?>
+    <input type="text" name="last" value="" size="10"><br>
+    
+    <?php echo html_l10n('Precision:');?>
+    <input type="text" name="precision" value="2" size="2"><br>
+    
+    <?php echo html_l10n('Progression:');?>
+    <input type="radio" name="progression" value="lin" checked>
+      <?php echo html_l10n('Linear');?>
+    <input type="radio" name="progression" value="log">
+      <?php echo html_l10n('Logarithmic');?>
+    <input type="radio" name="progression" value="exp">
+      <?php echo html_l10n('Exponential');?><br>
+      
+    <input type="button" name="go_I" value="<?php echo html_l10n('Build classes');?>"
+      onclick="buildClasses(this.name);">
+  </fieldset>
+  <fieldset class="hidden" id="params_S">
+    <legend><?php echo html_l10n('Strings:');?></legend>
+    <?php echo html_l10n('Count:');?>
+    <input type="text" name="count_S" value="5" size="3"><br>
+    <?php echo html_l10n('Values:');?>
+    <textarea name="values" >value1,value2</textarea><br>
+    <input type="button" name="go_S" value="<?php echo html_l10n('Build classes');?>"
+      onclick="buildClasses(this.name);">
+  </fieldset>
+  <fieldset class="hidden" id="classes">
+    <legend><?php echo html_l10n('Classes:');?></legend>
+    <input type="hidden" name="classes_created" value="0">
+    <table id="classes_container">
+    </table>
+  </fieldset>
+  <fieldset class="hidden" id="style">
+    <legend><?php echo html_l10n('Style:');?></legend>
+    <input name="current_style_index" type="hidden" value="">
+    <table>
+<?php
+    $oStyle= new t_style(Array(
+        'id_symbol'=>NULL,
+        'style_background_color'=>NULL,
+        'style_color'=>NULL,
+        'style_outline_color'=>NULL,
+        'style_size'=>NULL,
+        'style_symbol_maxsize'=>NULL,
+        'style_symbol_minsize'=>NULL));
+    foreach(Array('id_symbol','style_background_color',
+        'style_color','style_outline_color','style_size',
+        'style_symbol_maxsize','style_symbol_minsize') AS $info_k) {
+      echo '<tr>';
+      echo '<td title="'.$info_k.'">';
+      echo ucfirst(translate($info_k));
+      echo '</td>'."\n";
+      echo '<td>';
+      echo '<input name="style_not_default['.$info_k.']" type="checkbox" onclick="changeStyle(this);">'."\n";
+      $oType= $oStyle->GetFieldType($info_k);
+      $oType->Prefix= 'current_style[';
+      $oType->Suffix= ']';
+      echo $oType->HTML();
+      echo '</td>'."\n";
+      echo '</tr>'."\n";
+    }
+    unset($oStyle);
+    ?>
+    </table>
+  </fieldset>
+  <fieldset class="hidden" id="default-style">
+    <legend><?php echo html_l10n('Default style:');?></legend>
+    <table>
+<?php
+    $oStyle= new t_style(Array(
+        'id_symbol'=>0,
+        'style_background_color'=>'',
+        'style_color'=>'',
+        'style_outline_color'=>'',
+        'style_size'=>1,
+        'style_symbol_maxsize'=>0,
+        'style_symbol_minsize'=>0));
+    foreach(Array('id_symbol','style_background_color',
+        'style_color','style_outline_color','style_size',
+        'style_symbol_maxsize','style_symbol_minsize') AS $info_k) {
+      echo '<tr>';
+      echo '<td title="'.$info_k.'">';
+      echo ucfirst(translate($info_k));
+      echo '</td>';
+      echo '<td>';
+      $oType= $oStyle->GetFieldType($info_k);
+      $oType->Prefix= 'default_style[';
+      $oType->Suffix= ']';
+      echo $oType->HTML();
+      echo '</td>';
+      echo '</tr>'."\n";
+    }
+    ?>
+    </table>
+  </fieldset>
+  <fieldset class="hidden" id="submit">
+    <input type="submit" name="build_classes" value="<?php echo html_l10n('Send');?>">
+  </fieldset>
+</form>
+<?php
+  } // if(isset($_POST["build_classes"])) //else
+} // if($profile_data)
+?>
+<input type="button" value="<?php echo html_l10n('Close');?>" onclick="window.close();">
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/print/default.css
===================================================================
--- packages/musmap/branches/upstream/current/print/default.css	                        (rev 0)
+++ packages/musmap/branches/upstream/current/print/default.css	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,57 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+BODY {
+}
+
+#container {
+   width:100%;
+}
+
+#map-container {
+   text-align:center;
+}
+
+#legend-container {
+   vertical-align:top;
+}
+
+table#layers {
+    font-family:sans-serif;
+    font-size:0.6em;
+}
+
+.layers-group {
+   font-size: 1.2em;
+   font-variant: small-caps;
+}
+
+TD {
+}
\ No newline at end of file

Added: packages/musmap/branches/upstream/current/print.php
===================================================================
--- packages/musmap/branches/upstream/current/print.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/print.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,224 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Mise en page de l'impression
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  /**
+   * Les variables sont passées par la méthode GET
+   */
+  $INPUT=$_GET;
+
+  /*
+   * Utilisateur et descendance
+   */
+  $user= & new t_user();
+  $profiles= & LibComponent::Load('profiles');
+  $map->check_extent_input();
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Page setup');?></title>
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+  <link rel="stylesheet" type="text/css" href="map.css">
+<script type="text/javascript">
+  <!--
+    function typeChanged() {
+      if(
+          String(document.forms[0].type
+            .options[document.forms[0].type.selectedIndex].value).substr(0,4)
+          == 'map_') {
+        document.getElementById('advanced').style.visibility='hidden';
+      } else {
+        document.getElementById('advanced').style.visibility='';
+      }
+    }
+  -->
+</script>
+</head>
+
+<body id="print">
+  <form action="print_execute.php" method="POST" target="_blank">
+    <table width="100%" class="section">
+      <tr>
+        <th><?php echo html_l10n('Output type');?></th>
+        <td>
+          <select name="type" onchange="javacript:typeChanged();">
+<?php
+  //Web images
+  foreach($mapserver_output_formats AS $mapserver_output_format) {
+    if(in_array($mapserver_output_format, Array('PNG','JPEG','GIF'))) {
+      echo '<option value="web_'.strtolower($mapserver_output_format).'">'.
+        htmlentities(sprintf(l10n('HTML page (map in %s)'),$mapserver_output_format)).
+        '</option>'."\n";
+    }
+    if(in_array($mapserver_output_format, Array('PNG','JPEG','GIF','PDF','SWF','WBMP','SVG'))) {
+      echo '<option value="map_'.strtolower($mapserver_output_format).'">'.
+        htmlentities(sprintf(l10n('Map only in %s'),$mapserver_output_format)).
+        '</option>'."\n";
+    }
+  }
+?>
+        </select></td>
+        <td><input type="submit" value="<?php echo html_l10n('OK');?>"></td>
+      </tr>
+    </table>
+    
+    <table width="100%" class="section">
+      <tr>
+        <th><?php echo html_l10n('Page format');?></th>
+        <td><select name="format">
+          <option value="A4">
+            A4
+          </option>
+          <option value="A3">
+            A3
+          </option>
+          <option value="A5">
+            A5
+          </option>
+        </select></td>
+        <th><?php echo html_l10n('Force scale');?></th>
+        <td>1 / <input name="scale" type="text" size="6" value=""></td>
+      </tr>
+    </table>
+
+    <fieldset id="advanced">
+      <legend><?php echo html_l10n('Options');?></legend>
+      <table width="100%" class="section">
+        <tbody>
+          <tr>
+            <th><?php echo html_l10n('Resolution');?></th>
+            <td colspan="3">
+            <select name="resolution">
+              <option value="72">
+                <?php printf(html_l10n('Screen (%d dpi)'),72);?>
+              </option>
+              <option value="144">
+                <?php printf(html_l10n('Poor (%d dpi)'),144);?>
+              </option>
+              <option value="288" selected>
+                <?php printf(html_l10n('Print (%d dpi)'),288);?>
+              </option>
+              <option value="576">
+                <?php printf(html_l10n('High quality (%d dpi)'),576);?>
+              </option>
+            </select>
+            </td>
+          </tr>
+          <tr>
+            <th><?php echo html_l10n('Style');?></th>
+            <td colspan="3"><select name="style">
+              <option value="print/default.css">
+                <?php echo html_l10n('Default');?>
+              </option>
+            </select></td>
+          </tr>
+        </tbody>
+        
+        <tbody>
+          <tr>
+            <th colspan="3"><?php echo html_l10n('Header and footer');?></th>
+          </tr>
+          <tr>
+            <td><input type="text" name="text[top_left]" value=""></td>
+            <td><input type="text" name="text[top_center]" 
+              value="<b><?php echo $map->ms_map->name;?></b>">
+            </td>
+            <td><input type="text" name="text[top_right]" 
+              value="<?php  echo strftime("%d/%d/%Y  %H:%M");?>"></td>
+          </tr>
+          <tr>
+            <td><?php echo html_l10n('Left');?></td>
+            <td><?php echo html_l10n('Center');?></td>
+            <td><?php echo html_l10n('Right');?></td>
+          </tr>
+          <tr>
+            <td><input type="text" name="text[bottom_left]" value=""></td>
+            <td><input type="text" name="text[bottom_center]" value=""></td>
+            <td><input type="text" name="text[bottom_right]" value=""></td>
+          </tr>
+        </tbody>
+        
+        <tbody>
+          <tr>
+            <th colspan="3"><?php echo html_l10n('Display');?></th>
+          </tr>
+          <tr>
+            <td><label><input type="checkbox" name="show[reference]" checked>
+              <?php echo html_l10n('Reference map');?>
+            </label></td>
+            <td><label><input type="checkbox" name="show[legend]" checked>
+              <?php echo html_l10n('Legend');?>
+            </label></td>
+            <td><label><input type="checkbox" name="show[map]" checked>
+              <?php echo html_l10n('Map');?>
+            </label></td>
+          </tr>
+          <tr>
+            <td><label><input type="checkbox" name="show[scalebar]"
+            checked><?php echo html_l10n('Graphic scale');?></label></td>
+            <td><label><input type="checkbox" name="show[scale]"
+            checked><?php echo html_l10n('Text scale');?></label></td>
+            <td> </td>
+          </tr>
+        </tbody>
+      </table>
+    </fieldset>
+    <input type="hidden" name="extent[minx]" 
+      value="<?php echo $INPUT['extent']['minx'];?>">
+    <input type="hidden" name="extent[maxy]" 
+      value="<?php echo $INPUT['extent']['maxy'];?>">
+    <input type="hidden" name="extent[maxx]" 
+      value="<?php echo $INPUT['extent']['maxx'];?>">
+    <input type="hidden" name="extent[miny]" 
+      value="<?php echo $INPUT['extent']['miny'];?>">
+    <?php
+    if(isset($INPUT['layers']) && gettype($INPUT['layers'])=='array') {
+      foreach($INPUT['layers'] AS $layer=>$layer_status) {
+        ?>
+    <input type="hidden" name="layers[<?php echo $layer;?>]" 
+      value="<?php echo $layer_status;?>">
+        <?php
+      }
+    }
+    ?>
+  </form>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/print_execute.php
===================================================================
--- packages/musmap/branches/upstream/current/print_execute.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/print_execute.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,236 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Prévisualisation de l'impression
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  /**
+   * Les variables sont passées par la méthode POST
+   */
+  $INPUT=$_POST;
+  
+  /*
+   * Utilisateur et descendance
+   */
+  $user= & new t_user();
+  $profiles= & LibComponent::Load('profiles');
+  $map->check_extent_input();
+  if(substr($INPUT['type'],0,4)=='web_') {
+    $map->ms_map->set('resolution',$INPUT['resolution']);
+    switch($INPUT['format']) {
+    case 'A3' :
+      $width=1200;
+      $height=800;
+      break;
+    case 'A5' :
+      $width=500;
+      $height=400;
+      break;
+    case 'A4' :
+    default :
+      $width=500;
+      $height=800;
+      break;
+    }
+    $map->ms_map->set('height',$height*($map->ms_map->resolution)/72);
+    $map->ms_map->set('width',$width*($map->ms_map->resolution)/72);
+  } elseif(substr($INPUT['type'],0,4)=='map_') {
+    //21 cm   = 595.275591 px
+    //29.7 cm = 841.889764 px
+    switch($INPUT['format']) {
+    case 'A5' :
+      $width=580;
+      $height=400;
+      break;
+    case 'A3' :
+      $width=1160;
+      $height=830;
+      break;
+    case 'A4' :
+    default :
+      $width=580;
+      $height=830;
+      break;
+    }
+    $map->ms_map->set('height',$height);
+    $map->ms_map->set('width',$width);
+  }
+  
+  if(in_array(strtoupper(substr($INPUT['type'],4)),$mapserver_output_formats)) {
+    $map->ms_map->selectOutputFormat(strtoupper(substr($INPUT['type'],4)));
+  } else {
+   add_error(
+    sprintf(l10n('Unknown format : "%s"'),$INPUT['type']));
+  }
+  /**
+   * Etendue
+   */
+  $map->ms_map->setextent(
+    $map->current_extent->minx, 
+    $map->current_extent->miny,
+    $map->current_extent->maxx, 
+    $map->current_extent->maxy);
+  
+  if(!empty($INPUT['scale']) && is_numeric($INPUT['scale'])) {
+    $pt=ms_newPointObj();
+    $pt->setxy(50,50);
+    $map->ms_map->zoomscale($INPUT['scale'],$pt,100,100,$map->ms_map->extent);
+  }
+  $map->activate_layers($map->ms_map->scale);
+  if($INPUT['type'] == 'map_swf') {
+    for($i = 0; $i< $map->ms_map->numlayers;$i++) {
+      $ms_layer = $map->ms_map->getlayer($i);
+      for($j=0;$j<$ms_layer->numclasses;$j++) {
+        $ms_class = $ms_layer->getClass($j);
+        if(!empty($ms_class->label) && !empty($ms_class->label->font)) {
+          $ms_class->label->set('font','vera-fdb');
+        }
+      }
+    }
+  }
+  $map->create_images(true, substr($INPUT['type'],0,4)=='map_');
+  if(substr($INPUT['type'],0,4)=='map_') {
+    Header('Location: '.$map->map_url);
+    exit;
+  } elseif (in_array($INPUT['type'],
+      Array('web_png','web_jpeg','web_gif','web_wbmp'))) {
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Print preview');?></title>
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+  <link rel="stylesheet" type="text/css" href="<?php echo $INPUT['style'];?>">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+</head>
+
+<body onload="window.print();">
+  <table id="container">
+    <thead>
+      <tr>
+        <td style="text-align:left;">
+        <?php echo !empty($INPUT['text']['top_left'])
+          ? $INPUT['text']['top_left'] : '&nbsp;';?></td>
+        <td style="text-align:center;">
+        <?php echo !empty($INPUT['text']['top_center'])
+          ? $INPUT['text']['top_center'] : '&nbsp;';?></td>
+        <td style="text-align:right;">
+        <?php echo !empty($INPUT['text']['top_right'])
+          ? $INPUT['text']['top_right'] : '&nbsp;';?></td>
+      </tr>
+    </thead>
+
+    <tfoot>
+      <tr>
+        <td style="text-align:left;">
+        <?php echo !empty($INPUT['text']['bottom_left'])
+          ? $INPUT['text']['bottom_left'] : '&nbsp;';?></td>
+        <td style="text-align:center;">
+        <?php echo !empty($INPUT['text']['bottom_center'])
+          ? $INPUT['text']['bottom_center'] : '&nbsp;';?></td>
+        <td style="text-align:right;">
+        <?php echo !empty($INPUT['text']['bottom_right']) 
+        ? $INPUT['text']['bottom_right'] : '&nbsp;';?></td>
+      </tr>
+
+      <tr>
+        <td colspan="3" style="text-align:right;">&nbsp;</td>
+      </tr>
+    </tfoot>
+
+    <tbody>
+      <tr>
+        <td colspan="2" id="map-container">
+          <?php
+            if(!empty($INPUT['show']['map'])) {
+              ?>
+                <img src="<?php echo $map->map_url;?>" id="map"
+                  width="<?php echo $width;?>" height="<?php echo $height;?>"
+                  name="map" alt="[map]">
+              <?php
+            } else {
+              ?>
+                &nbsp;
+              <?php
+            }
+              ?>
+        </td>
+        <td id="legend-container" rowspan="2">
+          <?php
+           if(!empty($INPUT['show']['legend'])) {
+               $map->print_legend('print');
+           } else {
+              ?> 
+                &nbsp;
+              <?php
+           }
+           ?></td>
+      </tr>
+
+      <tr>
+        <td colspan="2" id="scalebar-container">
+          <?php
+            if(!empty($INPUT['show']['scalebar'])) {
+              ?>
+                <img src="<?php echo $map->scalebar_url;?>"
+                  id="scalebar" title="<?php echo $map->ms_map->scale;?>"
+                  name="scalebar" alt="[scalebar]">
+              <?php
+            } else {
+              ?>
+              &nbsp;
+              <?php
+            }
+            if(!empty($INPUT['show']['scale'])) {
+              ?>
+                <span id="scale">1/<?php 
+                  echo round($map->ms_map->scale,2);?></span>
+              <?php
+            } else {
+              ?>
+              &nbsp;
+              <?php
+            }
+            ?>
+        </td>
+      </tr>
+    </tbody>
+  </table>
+  <?php
+  }
+  ?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/privileges.php
===================================================================
--- packages/musmap/branches/upstream/current/privileges.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/privileges.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,161 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Privileges
+ * @package interface
+ */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  if(!isset($_GET['explore'])) {
+    $_GET['explore']='user';
+  }
+  $user=new t_user();
+  switch($_GET['explore']) {
+    case 'profiles_list':
+      $oRoot= & new t_profiles_list('*');
+      break;
+    case 'extents_list':
+      $oRoot= & LibComponent::Load('extents');
+      break;
+    case 'map_references_list':
+      $oRoot= & LibComponent::Load('map_references');
+      break;
+    case 'query_results_list':
+      $oRoot= & LibComponent::Load('query_results');
+      break;
+    case 'query_forms_list':
+      $oRoot= & LibComponent::Load('query_forms');
+      break;
+    case 'connections_list':
+      $oRoot= & LibComponent::Load('connections');
+      break;
+    case 'projections_list':
+      $oRoot= & LibComponent::Load('projections');
+      break;
+    case 'symbols_list':
+      if(!isset($map)) {
+        $map = new TMap(Conf::get('blank_map_path'));
+      }
+      //$profiles= LibComponent::Load('profiles');
+      $oRoot= & LibComponent::Load('symbols');
+      break;
+    case 'user':
+    default:
+  }
+  
+  if(!empty($_GET['node_class'])
+      && !empty($_GET['id'])
+      && !empty($_GET['id_value'])) {
+    $oAttrFilter1= & new TAttributeFilter('','IS A','t_'.$_GET['node_class']);
+    $oAttrFilter2= & new TAttributeFilter( $_GET['id'], '=', $_GET['id_value']);
+    $oAttrFilter12= & new TAttributeFilter($oAttrFilter1,'AND',$oAttrFilter2,'TAttributeFilter');
+    //echo $oAttrFilter12->BuildSQLQuery($db);
+    $obj = &$oRoot->Items->GetWithAttributeFilterRecursive($oAttrFilter12);
+  } else {
+    $obj = NULL;
+  }
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Privileges');?></title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+</head>
+
+<body class="privileges">
+<?php
+if($obj) {
+  if(isset($_GET['go'])) {
+    if($obj->change_privileges(
+      (int) $_GET['owner_id'],
+      (int) $_GET['reader_group_id'],
+      (int) $_GET['writer_group_id']
+    )) {
+      echo '<script type="text/javascript" language="JavaScript">'."\n";
+      echo '  <!--'."\n";
+      echo '    if(self.opener){'."\n";
+      echo '      self.opener.location.reload();'."\n";
+      echo '    }'."\n";
+      echo '    self.close();'."\n";
+      echo '  //-->'."\n";
+      echo '</script>'."\n";
+    }
+  }
+  echo '<form method="GET" action="privileges.php">'."\n";
+  echo '<table>'."\n";
+  echo '<tr><th>'.
+    ucfirst(translate($obj->FieldPrefix().'_owner_id')).
+    '</th><td>'."\n";
+  t_component::print_html_select('users','id_user','user_name',
+        $obj->Attributes->Value($obj->FieldPrefix().'_owner_id'), 
+        'owner_id','user_name',
+        NULL,true);
+  echo '</td></tr>'."\n";
+  echo '<tr><th>'.
+    ucfirst(translate($obj->FieldPrefix().'_reader_group_id')).
+    '</th><td>'."\n";
+  t_component::print_html_select('groups','id_group','group_name',
+        $obj->Attributes->Value($obj->FieldPrefix().'_reader_group_id'), 
+        'reader_group_id','group_name',
+        NULL,true);
+  echo '</td></tr>'."\n";
+  echo '<tr><th>'.
+    ucfirst(translate($obj->FieldPrefix().'_writer_group_id')).
+    '</th><td>'."\n";
+  t_component::print_html_select('groups','id_group','group_name',
+        $obj->Attributes->Value($obj->FieldPrefix().'_writer_group_id'), 
+        'writer_group_id','group_name',
+        NULL,true);
+  echo '</td></tr>'."\n";
+  echo '<tr><td colspan="2" style="text-align: center">'."\n";
+  echo '<input type="submit" name="go" value="'.html_l10n('OK').'">';
+  echo '</td></tr>'."\n";
+  echo '</table>'."\n";
+  echo '<input type="hidden" name="explore" '.
+    'value="'.htmlentities($_GET['explore']).'">'."\n";
+  echo '<input type="hidden" name="node_class" '.
+    'value="'.htmlentities($_GET['node_class']).'">'."\n";
+  echo '<input type="hidden" name="id" '.
+    'value="'.htmlentities($_GET['id']).'">'."\n";
+  echo '<input type="hidden" name="id_value" '.
+    'value="'.htmlentities($_GET['id_value']).'">'."\n";
+  echo '</form>'."\n";
+} else {
+  add_error(l10n('Object not found.'));
+}
+?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/profile_wizard.php
===================================================================
--- packages/musmap/branches/upstream/current/profile_wizard.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/profile_wizard.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,204 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Automatic profile creation
+   * from metadata (tables)
+   * @package interface
+   */
+
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  require_once('include/colors.inc.php');
+  
+  $user=new t_user();
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+  <head>
+    <title><?php echo html_l10n('Create a new profile');?></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+    <link rel="stylesheet" type="text/css" href="map.css">
+  </head>
+  <body>
+<?php
+  //======================================================
+$oConnections= & LibComponent::Load('connections');
+if(!isset($_POST['go'])) {
+  ?>
+  <form action="profile_wizard.php" method="POST">
+  <table>
+  <tr>
+    <td>
+    <?php echo ucfirst(translate('profile_name'));?>:
+    </td>
+    <td>
+    <input type="text" name="profile_name" value="<?php echo html_l10n('Untitled');?>">
+    </td>
+  </tr>
+  <tr>
+    <td>
+    <?php echo ucfirst(translate('data_source'));?>:
+    </td>
+    <td>
+<?php
+      echo '      <select multiple name="id_data_source[]">'."\n";
+      $oEnum= $oConnections->Items->NewEnum();
+      while($oConnection= $oEnum->Each()) {
+        echo '        <optgroup label="'.$oConnection->Attributes->Value('connection_name').'">'."\n";
+        $oDataSourcesEnum= $oConnection->Items->NewEnum();
+        while($oDataSource= $oDataSourcesEnum->Each()) {
+          echo '          <option value="'.$oDataSource->Attributes->Value('id_data_source').'">'.
+	    $oDataSource->Attributes->Value('data_source_name')."\n";
+	}
+	unset($oDataSourcesEnum);
+	echo '        </optgroup>'."\n";
+	
+      }
+      unset($oEnum);
+      echo '      </select>'."\n";
+?>
+    </td>
+  </tr>
+  <?php
+  echo '<tr><td>'.
+    ucfirst(translate('profile_reader_group_id')).
+  '</th><td>'."\n";
+  t_component::print_html_select('groups','id_group','group_name',
+    NULL,
+    'reader_group_id','group_name',
+    NULL,true);
+  echo '</td></tr>'."\n";
+  echo '<tr><td>'.
+    ucfirst(translate('profile_writer_group_id')).
+    '</td><td>'."\n";
+  t_component::print_html_select('groups','id_group','group_name',
+   NULL,
+   'writer_group_id','group_name',
+   NULL,true);
+  echo '</td></tr>'."\n";
+  ?>									    
+  <tr>
+    <td colspan="2">
+    <input type="submit" name="go" value="<?php echo html_l10n('OK');?>">
+    </td>
+  </tr>
+  </table>
+  </form>
+  <?php
+} else {
+  $sProfileName= isset($_POST['profile_name']) 
+    ? (string) $_POST['profile_name']
+    : l10n('Untitled');
+  $_POST['id_data_source'] = isset($_POST['id_data_source']) && is_array($_POST['id_data_source'])
+    ? $_POST['id_data_source']
+    : Array();
+  $qExistingProfile= $db->query('SELECT * FROM profiles '.
+    'WHERE profile_name LIKE '.$db->Quote($sProfileName.'%'));
+  if($db->FetchAssoc($qExistingProfile)) {
+    $sProfileName= $sProfileName.' '.time();
+  }
+  $db->FreeResult($qExistingProfile);
+  //transaction for profile and children
+  $oProfiles= & LibComponent::Load('profiles', 'none');
+  $oProfile= & $oProfiles->add_child('profile', 
+    Array(
+      'profile_owner_id'=>  $user->IdValue(),
+      'profile_reader_group_id'=>(int) $_POST['reader_group_id'],
+      'profile_writer_group_id'=>(int) $_POST['writer_group_id'],
+      'id_map_reference'=>  0,
+      'profile_name'=>      $sProfileName,
+      'profile_is_public'=> 1));
+  if(!$oProfile) {
+    Warning(l10n('Error!').' '.l10n('Unable to create profile.'));
+    exit;
+  }
+  $oConnectionsEnum= $oConnections->Items->NewEnum();
+  while($oConnection= $oConnectionsEnum->Each()) {
+    $oDataSourcesEnum= $oConnection->Items->NewEnum();
+    while($oDataSource= $oDataSourcesEnum->Each()) {
+      $visible= false;
+      if(!in_array($oDataSource->Attributes->Value('id_data_source'), $_POST['id_data_source'])) {
+        continue;
+      }
+      $aProfileDataAttributes= Array(
+          'id_data_source'=> $oDataSource->Attributes->Value('id_data_source'),
+          'profile_data_owner_id'=> $user->IdValue(),
+          'profile_data_reader_group_id'=> (int) $_POST['reader_group_id'],
+          'profile_data_writer_group_id'=> (int) $_POST['writer_group_id'],
+          'profile_data_title'=> $oDataSource->Attributes->Value('data_source_label'),
+          'profile_data_index'=>0,
+          'profile_data_visible'=>($visible ? 1 : 0)
+        );
+    
+      if(in_array($oDataSource->Attributes->Value('data_source_type'),Array('S','P','L','A','R','I'))) {
+        $aProfileDataAttributes= array_merge($aProfileDataAttributes, Array(
+            'layer_group'=>$oDataSource->Attributes->Value('data_source_label'),
+            'layer_type'=>$oDataSource->Attributes->Value('data_source_type')
+          ));
+      }
+      if(in_array($oDataSource->Attributes->Value('data_source_type'),Array('R','I'))) {
+        $aProfileDataAttributes= array_merge($aProfileDataAttributes, Array(
+            //'raster_offsite'=>''
+          ));
+      }
+      $oProfileData= & $oProfile->add_child('profile_data',
+        $aProfileDataAttributes);
+      if(!$oProfileData) {
+        continue;
+      }
+      if(in_array($oDataSource->Attributes->Value('data_source_type'),Array('S','P','L','A'))) {
+        $oClass= & $oProfileData->add_child('class',
+          Array('class_name'=>$oDataSource->Attributes->Value('data_source_label')));
+        if(!$oClass) {
+          continue;
+        }
+        $oStyle= & $oClass->add_child('style', Array(
+          'id_symbol'=>0,
+          'style_name'=>$oDataSource->Attributes->Value('data_source_label'),
+          'style_background_color'=>'',
+          'style_color'=>$oDataSource->Attributes->Value('data_source_type')=='P' ? LibColor::random_color() : '',
+          'style_outline_color'=>LibColor::random_color(),
+          'style_size'=>1
+          ));
+        if(!$oStyle) {
+          continue;
+        }
+      }
+    }
+    unset($oDataSourcesEnum);
+  }
+  unset($oConnectionsEnum);
+  Information(sprintf(l10n('Profile "%s" successfully created.'),$sProfileName));
+}
+?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/profiles_explorer.php
===================================================================
--- packages/musmap/branches/upstream/current/profiles_explorer.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/profiles_explorer.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,138 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Explorateur de profils
+ * @package interface
+ */
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+
+  $INPUT=$_REQUEST;
+  if(!isset($_GET['explore'])) {
+    $_GET['explore']='profiles_list';
+  }
+  $user=new t_user();
+  switch($_GET['explore']) {
+    case 'user':
+      $obj = & $user;
+      break;
+    case 'extents_list':
+      $obj= & LibComponent::Load('extents');
+      break;
+    case 'map_references_list':
+      $obj= & LibComponent::Load('map_references');
+      break;
+    case 'query_forms_list':
+      $obj= & LibComponent::Load('query_forms');
+      break;
+    case 'query_results_list':
+      $obj= & LibComponent::Load('query_results');
+      break;
+    case 'profiles_list':
+    default:
+      $_GET['explore']= 'profiles_list';
+      if(isset($_POST['id_profile'])) {
+        $obj= & new t_profiles_list($_POST['id_profile']);
+      } elseif(isset($_GET['id_profile'])) {
+        $obj= & new t_profiles_list($_GET['id_profile']);
+      } else {
+        $obj= & new t_profiles_list('*');
+      }
+  }
+//-----
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Explorer');?></title>
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript">
+    <!--
+      top.rootDir='.';
+    //-->
+  </script>
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xb.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/contrib/xbgeo.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/explorer.js"></script>
+  <script type="text/javascript" language="JavaScript" src="js/l10n.php"></script>
+  <style type="text/css">
+    .tab {width:15%}
+  </style>
+  <!-- mygosuMenu -->
+    <link rel="stylesheet" type="text/css" href="js/contrib/mygosumenu/1.5/DynamicTree.css">
+    <script type="text/javascript" src="js/contrib/mygosumenu/ie5.js"></script>
+    <script type="text/javascript" src="js/contrib/mygosumenu/1.5/DynamicTree.js"></script>
+    <style type="text/css">
+    #tree-plugin, #tree-plugin-button-import-html { display: none; }
+    #tree-plugin-textarea { white-space: nowrap; }
+    </style>
+  <!-- /mygosuMenu -->
+</head>
+
+<body onload="loadExplorer();"  onunload="unloadExplorer();" class="explorer">
+<h4 class="hidden"><?php echo html_l10n('Objects:');?></h4>
+<ul class="tabs">
+  <li class="tab" <?php echo $_GET['explore']=='user' ? ' id="tab-selected"':'';?>>
+    <a href="profiles_explorer.php?explore=user" class="tab-anchor">
+      <?php echo htmlentities(ucfirst(translate('user')));?></a>
+  </li>
+  <li class="tab" <?php echo $_GET['explore']=='profiles_list' ? ' id="tab-selected"':'';?>>
+    <a href="profiles_explorer.php?explore=profiles_list" class="tab-anchor">
+      <?php echo htmlentities(ucfirst(translate('profiles_list')));?></a>
+  </li>
+  <li class="tab" <?php echo $_GET['explore']=='extents_list' ? ' id="tab-selected"':'';?>>
+    <a href="profiles_explorer.php?explore=extents_list" class="tab-anchor">
+      <?php echo htmlentities(ucfirst(translate('extents_list')));?></a>
+  </li>
+  <li class="tab" <?php echo $_GET['explore']=='map_references_list' ? ' id="tab-selected"':'';?>>
+    <a href="profiles_explorer.php?explore=map_references_list" class="tab-anchor">
+      <?php echo htmlentities(ucfirst(translate('map_references_list')));?></a>
+  </li>
+  <li class="tab" <?php echo $_GET['explore']=='query_results_list' ? ' id="tab-selected"':'';?>>
+    <a href="profiles_explorer.php?explore=query_results_list" class="tab-anchor">
+      <?php echo htmlentities(ucfirst(translate('query_results_list')));?></a>
+  </li>
+  <li class="tab" <?php echo $_GET['explore']=='query_forms_list' ? ' id="tab-selected"':'';?>>
+    <a href="profiles_explorer.php?explore=query_forms_list" class="tab-anchor">
+      <?php echo htmlentities(ucfirst(translate('query_forms_list')));?></a>
+  </li>
+</ul>
+<?php
+  $obj->explore();
+  ?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/query.php
===================================================================
--- packages/musmap/branches/upstream/current/query.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/query.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,213 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Résultat des requètes
+ * @package interface
+ */
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  $INPUT=$_REQUEST;
+  $user=new t_user();
+  $oProfiles= & LibComponent::Load('profiles');
+  /**
+   * Vérification des données utilisateur
+   */
+  $map->check_input();
+  /**
+   * Préparation de la requète (calcul de l'échelle)
+   */
+  $map->ms_map->preparequery();
+  /**
+   * Activation des couches
+   */
+  $map->activate_layers();
+  
+  $map->do_command();
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo html_l10n('Query results');?></title>
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO_8859-1">
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+<script type="text/javascript" language="JavaScript">
+  <!--
+  var imageUrl='';
+  var mapWidth, mapHeight;
+  var referenceUrl='';
+  var overviewWidth, overviewHeight, overviewExtent;
+  var scalebarUrl='';
+  var mapExtent=new Array();
+  var mapScale=10000;
+  
+  
+  function queryByAttributes(idDataSource, itemName,itemValue,itemType) {
+    document.forms[0].command.value='query_attributes';
+    document.forms[0].id_data_source.value=idDataSource;
+    document.forms[0].order_by_item.value='';
+    document.forms[0]['item'].value=itemName;
+    document.forms[0]['string'].value=itemValue;
+    document.forms[0]['type'].value=itemType;
+    document.getElementById('waiting').style.visibility='visible';
+    document.forms[0].submit();
+  }
+  
+  function orderBy(idDataSource,attributeCode) {
+    //document.forms[0].id_profile_data.value='';
+    document.forms[0].order_by_id_data_source.value = idDataSource;
+    document.forms[0].order_by_item.value =            attributeCode;
+    document.getElementById('waiting').style.visibility='visible';
+    document.forms[0].submit();
+  }
+  
+  
+  function updateMapImage() {
+    document.getElementById('waiting').style.visibility='hidden';
+    if(window.opener && imageUrl) {
+      window.opener.top.map.setBusy(true);
+      window.opener.top.map.setScale(mapScale);
+      window.opener.top.map.setMap(mapWidth, mapHeight, imageUrl);
+      window.opener.top.map.setMapExtent(
+        window.opener.top.new_TRect(
+          mapExtent[0],
+          mapExtent[1],
+          mapExtent[3],
+          mapExtent[2]));
+      window.opener.top.map.setOverviewExtent(overviewExtent);
+      window.opener.top.map.setOverview(overviewWidth,overviewHeight,
+        referenceUrl);
+      window.opener.top.map.setScalebar(
+        150, 17, scalebarUrl);
+      window.opener.top.map.setBusy(false);
+      window.opener.top.updateEyes();
+    }
+  }
+  //-->
+</script>
+</head>
+
+<body onload="updateMapImage();" id="query-results">
+  <div id="waiting"><?php echo html_l10n('Please wait...');?></div>
+  <?php
+  switch($INPUT['command']) {
+    case 'query_point':
+      echo '<b>'.html_l10n('Query on point:').'</b><br>'."\n";
+      echo '('.round($INPUT['x']).', '.
+               round($INPUT['y']).')<br>'."\n";
+      break;
+    case 'query_rect':
+      echo '<b>'.html_l10n('Query on rectangle:').'</b><br>'."\n";
+      echo '(('.round($INPUT['minx']).', '.
+                round($INPUT['miny']).'), '.
+            '('.round($INPUT['maxx']).', '.
+               round($INPUT['maxy']).'))<br>'."\n";
+      break;
+    case 'query_form':
+      break;
+  }
+  $map->drawn=true;
+  foreach($map->query_results AS $query_result) {
+    if($query_result===false) {
+      continue;
+    }
+    if($query_result[0]->IsRaster()
+        || $query_result[0]->IsShape()) {
+      $map->drawn=false;
+      break;
+    }
+  }
+  $map->create_images(false);
+  //$map->print_query();
+  $map->print_attribute_tables();
+  flush();
+  if($map->map_img) {
+    $map->map_url = $map->map_img->saveWebImage();
+    $map->map_img->free();
+  }
+?>
+<script type="text/javascript" language="JavaScript">
+  <!--
+  imageUrl='<?php echo $map->map_url ; ?>';
+  mapWidth= <?php echo $map->ms_map->width;?>;
+  mapHeight= <?php echo $map->ms_map->height;?>;
+  referenceUrl='<?php echo $map->ref_url ; ?>';
+  overviewWidth= <?php echo $map->ms_map->reference->width;?>;
+  overviewHeight= <?php echo $map->ms_map->reference->height;?>;
+  overviewExtent=window.opener.top.new_TRect(
+    <?php echo $map->ms_map->reference->extent->minx;?>,
+    <?php echo $map->ms_map->reference->extent->maxx;?>,
+    <?php echo $map->ms_map->reference->extent->maxy;?>,
+    <?php echo $map->ms_map->reference->extent->miny;?>);
+  scalebarUrl='<?php echo $map->scalebar_url ; ?>';
+  mapExtent[0]=<?php echo $map->ms_map->extent->minx ; ?>;
+  mapExtent[1]=<?php echo $map->ms_map->extent->maxx ; ?>;
+  mapExtent[2]=<?php echo $map->ms_map->extent->miny ; ?>;
+  mapExtent[3]=<?php echo $map->ms_map->extent->maxy ; ?>;
+  mapScale=<?php echo $map->ms_map->scale ; ?>;
+  //-->
+</script>
+<form name="form" method="GET" action="query.php" id="form">
+  <input type="hidden" name="command" value="<?php echo !empty($INPUT['command']) ? $INPUT['command'] : '';?>">
+  <input type="hidden" name="id_data_source" value="<?php echo !empty($INPUT['id_data_source']) ? $INPUT['id_data_source'] : '';?>">
+  <input type="hidden" name="item" value="<?php echo !empty($INPUT['item']) ? $INPUT['item'] : '';?>">
+  <input type="hidden" name="string" value="<?php echo !empty($INPUT['string']) ? $INPUT['string'] : '';?>">
+  <input type="hidden" name="type" value="<?php echo empty($INPUT['type']) ? 'C' : $INPUT['type'];?>">
+  <input type="hidden" name="id_profile_data" value="<?php echo !empty($INPUT['id_profile_data']) ? $INPUT['id_profile_data'] : '';?>">
+  <input type="hidden" name="order_by_id_data_source" value="">
+  <input type="hidden" name="order_by_item" value="">
+  <input type="hidden" name="id_query_result" value="<?php echo !empty($INPUT['id_query_result']) ? $INPUT['id_query_result'] : '';?>">
+  <input type="hidden" name="x" value="<?php echo !empty($INPUT['x']) ? $INPUT['x'] : '';?>">
+  <input type="hidden" name="y" value="<?php echo !empty($INPUT['y']) ? $INPUT['y'] : '';?>">
+  <input type="hidden" name="minx" value="<?php echo !empty($INPUT['minx']) ? $INPUT['minx'] : '';?>">
+  <input type="hidden" name="maxy" value="<?php echo !empty($INPUT['maxy']) ? $INPUT['maxy'] : '';?>">
+  <input type="hidden" name="maxx" value="<?php echo !empty($INPUT['maxx']) ? $INPUT['maxx'] : '';?>">
+  <input type="hidden" name="miny" value="<?php echo !empty($INPUT['miny']) ? $INPUT['miny'] : '';?>">
+  <input type="hidden" name="extent[minx]" value="<?php echo $INPUT['extent']['minx'];?>">
+  <input type="hidden" name="extent[maxy]" value="<?php echo $INPUT['extent']['maxy'];?>">
+  <input type="hidden" name="extent[maxx]" value="<?php echo $INPUT['extent']['maxx'];?>">
+  <input type="hidden" name="extent[miny]" value="<?php echo $INPUT['extent']['miny'];?>">
+  <input type="hidden" name="image_height" value="<?php echo $INPUT['image_height'];?>">
+  <input type="hidden" name="image_width" value="<?php echo $INPUT['image_width'];?>">
+<?php
+    if(isset($INPUT['layers']) && gettype($INPUT['layers'])=='array') {
+      foreach($INPUT['layers'] AS $layer=>$layer_status) {
+        echo '  <input type="hidden" name="layers['.$layer.']" '.
+            'value="'.$layer_status.'">'."\n";
+      }
+    }
+?>
+</form>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/query_form.php
===================================================================
--- packages/musmap/branches/upstream/current/query_form.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/query_form.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,122 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/**
+ * Requète par formaulaire
+ *
+ * @author Mathieu Parent
+ * @copyright 2004-06, Mathieu PARENT
+ * @package interface
+ * @since 2004-06
+ */
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  $user=new t_user();
+  $profiles= & LibComponent::Load('profiles');
+
+  $INPUT=$_GET;
+  if(!isset($INPUT['form'])) $INPUT['form'] = NULL;
+  
+  $oQueryForms= & LibComponent::load('query_forms');
+  $query_form= $oQueryForms->GetSubItemByClassNameAndAttribute(
+    'query_form','id_query_form',$INPUT['form']);
+
+if($query_form) {
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title><?php echo htmlentities($query_form->Attributes->Value('query_form_title'));?></title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+<script language="javascript" type="text/javascript">
+<!--
+  var event_load,event_submit;
+  function load_form() {
+    document.getElementById('waiting').style.visibility='hidden';
+    if(event_load) {
+      event_load();
+    }
+  }
+  
+  function submit_form(formObj) {
+    document.getElementById('waiting').style.visibility='';
+    if(event_submit) {
+      if(event_submit(formObj)) {
+        return true;
+      } else {
+        document.getElementById('waiting').style.visibility='hidden';
+        return false
+      }
+    }
+    return true;
+  }
+//-->
+</script><?php
+  echo $query_form->Attributes->Value('query_form_header');
+?>
+</head>
+
+<body onload="load_form();" id="query-form">
+  <form name="form" method="POST" action="query.php"
+    onsubmit="return(submit_form(this));" id="form">
+    <?php
+  echo $query_form->Attributes->Value('query_form_form');
+    ?>
+    <input type="hidden" name="command" value="query_form">
+    <input type="hidden" name="extent[minx]" value="<?php echo $INPUT['extent']['minx'];?>">
+    <input type="hidden" name="extent[maxy]" value="<?php echo $INPUT['extent']['maxy'];?>">
+    <input type="hidden" name="extent[maxx]" value="<?php echo $INPUT['extent']['maxx'];?>">
+    <input type="hidden" name="extent[miny]" value="<?php echo $INPUT['extent']['miny'];?>">
+    <input type="hidden" name="image_height" value="<?php echo $INPUT['image_height'];?>">
+    <input type="hidden" name="image_width" value="<?php echo $INPUT['image_width'];?>">
+    <input type="hidden" name="form" value="<?php echo $INPUT['form'];?>"> 
+    <?php
+    if(isset($INPUT['layers']) && gettype($INPUT['layers'])=='array') {
+      foreach($INPUT['layers'] AS $layer=>$layer_status) {
+        ?> <input type="hidden" name="layers[<?php echo $layer;?>]"
+        value="<?php echo $layer_status;?>"> <?php
+      }
+    }
+    ?>
+  </form>
+
+  <div id="waiting"><?php echo html_l10n('Please wait...');?></div>
+
+  <?php
+} else {
+  add_error(l10n('Error!'));
+}
+?>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/socket.php
===================================================================
--- packages/musmap/branches/upstream/current/socket.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/socket.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,131 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Socket d'envoi/réception des données par le client
+   * <p>
+   * En effet, seule cette page est rechargée à
+   * chaque changement de zoom. Les images sont changées
+   * via javascript
+   * </p>
+   * @package interface
+   */
+  
+  //this page is hidden
+  define('MUSMAP_IS_HIDDEN',true);
+  
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  $user=new t_user();
+  $profiles= & new t_profiles_list(NULL);
+  /**
+   * Les variables sont passées par la méthode GET
+   */
+  $INPUT=$_GET;
+
+  /**
+   * Vérification des données utilisateur
+   */
+  $map->check_input();
+  
+  /**
+   * Exécution de la commande (zoom, ...)
+   */
+  $map->do_command();
+  
+  /**
+   * Préparation de la requète (calcul de l'échelle)
+   */
+  $map->ms_map->preparequery();
+  
+  /**
+   * Activation des couches (suivant l'échelle)
+   */
+  $map->activate_layers($map->ms_map->scale);
+
+  /**
+   * Création des images
+   */
+  $map->create_images();
+
+  /**
+   * Code HTML
+   */
+  ?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title>Socket</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+  <script type="text/javascript" language="JavaScript"
+    src="js/contrib/xbgeo.js">
+  </script>
+  <script type="text/javascript">
+  <!--
+    function loadSocket() {
+      top.map.setBusy(true);
+      top.map.setScale(<?php echo $map->ms_map->scale;?>);
+      top.map.setMap(
+        <?php echo $map->ms_map->width;?>,
+        <?php echo $map->ms_map->height;?>,
+        "<?php echo $map->map_url;?>");
+      top.map.setMapExtent(new TRect(
+          <?php echo $map->ms_map->extent->minx;?>,
+          <?php echo $map->ms_map->extent->maxx;?>,
+          <?php echo $map->ms_map->extent->maxy;?>,
+          <?php echo $map->ms_map->extent->miny;?>));
+      top.map.setOverviewExtent(new TRect(
+          <?php echo $map->ms_map->reference->extent->minx;?>,
+          <?php echo $map->ms_map->reference->extent->maxx;?>,
+          <?php echo $map->ms_map->reference->extent->maxy;?>,
+          <?php echo $map->ms_map->reference->extent->miny;?>));
+      top.map.setOverview(
+        <?php echo $map->ms_map->reference->width;?>,
+        <?php echo $map->ms_map->reference->height;?>,
+        "<?php echo $map->ref_url;?>");
+      top.map.setScalebar(
+        150,
+        17,
+        "<?php echo $map->scalebar_url;?>");
+      top.map.setBusy(false);
+      top.updateEyes();
+    }
+  -->
+  </script>
+</head>
+
+<body onload="loadSocket();">
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/srvtmp/.htaccess
===================================================================
--- packages/musmap/branches/upstream/current/srvtmp/.htaccess	                        (rev 0)
+++ packages/musmap/branches/upstream/current/srvtmp/.htaccess	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from All

Added: packages/musmap/branches/upstream/current/srvtmp/remove.txt
===================================================================
--- packages/musmap/branches/upstream/current/srvtmp/remove.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/srvtmp/remove.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1 @@
+You can safely remove this file

Added: packages/musmap/branches/upstream/current/tools.php
===================================================================
--- packages/musmap/branches/upstream/current/tools.php	                        (rev 0)
+++ packages/musmap/branches/upstream/current/tools.php	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1,144 @@
+<?php /*
+ +----------------------------------------------------------------------+
+ | MUSMAP : Un Simple Moyen d'Afficher des Plans                        |
+ | Interface PHP pour MapServer (http://mapserver.gis.umn.edu/)         |
+ | http://sourceforge.net/projects/musmap                               |
+ +----------------------------------------------------------------------+
+ | Author : Mathieu Parent                                              |
+ | Copyright (c) 2004-2005 Mathieu PARENT                               |
+ | (c) 06/2004                                                          |
+ |                                                                      |
+ +----------------------------------------------------------------------+
+*/
+/*
+This file is part of Musmap.
+
+    Musmap 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.
+    
+    Musmap 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 Musmap; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+  /**
+   * Barre d'outils
+   * @package interface
+   */
+   
+  /**
+   * Startup
+   */
+  require_once('include/pre.inc.php');
+  
+  $user=new t_user();
+  $oProfiles= & LibComponent::Load('profiles');
+  $oCurrentProfile= $oProfiles->GetItemByClassNameAndAttribute('profile',
+    'id_profile',
+    $user->Attributes->Value('session_id_profile'));
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="<?php echo Conf::get('client_lang');?>">
+<head>
+  <title>Tools</title>
+  <link rel="stylesheet" type="text/css" href="map.css">
+  <meta http-equiv="Content-Script-Type" content="text/javascript">
+</head>
+
+<body class="nomargin" onload="top.load('tools');" id="toolbar">
+  <form name="tools_form" action="./" target="_top" id="tools_form">
+    <span class="tools-group">
+      <img name="zoom_init" alt="Initial" src="images/tool/zoominit.gif" 
+          title="<?php echo html_l10n('Zoom init');?>"
+          onclick="return(top.selectTool('zoom_init',this));"
+          class="tool">
+      <img name="zoom_pan" alt="Pan" src="images/tool/pan.gif" title="Pan" class="tool"
+        onclick="return(top.selectTool('zoom_pan',this));">
+      <img name="zoom_in" alt="+" src="images/tool/zoomin.gif"
+        title="<?php echo html_l10n('Zoom in (+)');?>" class="tool"
+        onclick="return(top.selectTool('zoom_in',this));">
+      <img name="zoom_out" alt="-" src="images/tool/zoomout.gif" 
+        title="<?php echo html_l10n('Zoom out (-)');?>" class="tool"
+        onclick="return(top.selectTool('zoom_out',this));">
+      <input type="text" name="zoom_factor" value="2" size="1" 
+        title="<?php echo html_l10n('Zoom factor');?>">
+      <select onchange="return(top.map.changeScale(this));" 
+          name="scale-select" title="<?php echo html_l10n('Scale');?>">
+        <option value="-">&nbsp;</option>
+        <option value="-" disabled>-</option>
+<?php
+        $scales=file('include/conf/scales.txt');
+        foreach($scales AS $scale) {
+          $scale=(float) $scale;
+          echo '        <option value="'.$scale.'">'.$scale.'</option>'."\n";
+        }
+        ?>
+        <option value="-" disabled>-</option>
+        <option value="other">
+          <?php echo html_l10n('Other...');?></option>
+      </select>
+      <img name="refresh" alt="<?php echo html_l10n('Refresh'); ?>" 
+          src="images/tool/refresh.gif"
+          title="<?php echo html_l10n('Refresh (R)'); ?>" class="tool"
+          onclick= "return(top.selectTool('refresh',this));">
+    </span>
+    &nbsp;
+    <span class="tools-group">
+      <img name="query_mouse" alt="Info"src="images/tool/querypoint.gif"
+        title="<?php echo html_l10n('Query by point/rectangle'); ?>" class="tool"
+        onclick="return(top.selectTool('query_mouse',this));">
+      <select onchange="return(top.map.queryByForm(this));" name="query-select">
+        <option value="-"><?php echo html_l10n('Queries...'); ?></option>
+<?php
+      if($oCurrentProfile) {
+        $oQueryForms= & LibComponent::Load('query_forms');
+        $oQueryFormsEnum= & $oQueryForms->Items->NewEnum();
+        $oQueryFormsEnum->Reset();
+        while($oQueryForm= & $oQueryFormsEnum->Each()) {
+          $oProfileData = & $oCurrentProfile->GetItemByClassNameAndAttribute('profile_data',
+            'id_data_source', $oQueryForm->Attributes->Value('id_data_source'));
+          if($oProfileData) {
+            echo '        <option value="'.$oQueryForm->IdValue().'">'.
+              $oQueryForm->Attributes->Value('query_form_menu_title').
+              '</option>'."\n";
+          }
+        }
+        unset($oQueryFormsEnum);
+	unset($oQueryForms);
+      }
+      ?>
+      </select>
+      <img name="measure" alt="<?php echo html_l10n('Measure');?>" src="images/tool/measure.gif"
+        title="<?php echo html_l10n('Measure (M)');?>" class="tool"
+        onclick="return(top.selectTool('measure',this));">
+    </span>
+    &nbsp;
+    <span class="tools-group">
+      <img name="print" alt="<?php echo html_l10n('Print');?>" src="images/tool/print.gif" 
+          title="<?php echo html_l10n('Print (P)');?>" class="tool" 
+          onclick="return(top.selectTool('print',this));">
+    </span>
+    &nbsp;
+    <span class="tools-group"><?php echo html_l10n('Profile');?> <?php
+        t_profiles_list::print_profiles_list('CHANGE_id_profile',
+          $user->Session->Attributes->Value('id_profile'),
+          'onchange="top.changeProfile();"',true);
+        //Param 4 is for profile explorer
+    ?> 
+      <input type="hidden" name="CURRENT_id_profile" 
+          value="<?php echo $user->Attributes->Value('session_id_profile');?>">
+      <img name="logout" alt="logout" src="images/tool/logout.gif" 
+          title="<?php echo html_l10n('Log out (Q)');?>" class="tool" 
+        onclick="return(top.selectTool('logout',this));">
+    </span>  
+  </form>
+</body>
+</html>

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250821.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250821.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508210.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508210.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508211.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508211.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508212.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508212.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508213.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508213.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508214.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508214.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508215.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508215.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508216.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508216.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508217.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508217.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508218.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508218.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508219.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508219.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250822.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250822.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508220.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508220.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508221.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508221.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508222.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508222.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508223.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508223.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508224.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508224.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508225.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508225.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508226.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508226.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508227.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508227.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508228.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508228.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508229.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508229.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250823.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250823.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508230.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508230.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508231.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508231.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508232.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508232.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508233.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508233.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508234.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508234.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508235.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508235.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508236.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508236.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508237.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508237.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508238.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508238.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508239.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508239.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250824.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250824.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508240.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508240.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508241.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508241.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508242.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508242.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508243.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508243.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508244.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508244.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508245.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508245.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508246.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508246.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508247.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508247.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373585972508248.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373585972508248.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250825.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250825.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250826.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250826.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250827.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250827.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250828.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250828.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/1137358597250829.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/1137358597250829.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586003191.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586003191.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586003192.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586003192.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586173191.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586173191.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586173192.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586173192.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586263191.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586263191.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586263192.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586263192.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586333191.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586333191.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/11373586333192.png
===================================================================
(Binary files differ)


Property changes on: packages/musmap/branches/upstream/current/webtmp/11373586333192.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: packages/musmap/branches/upstream/current/webtmp/remove.txt
===================================================================
--- packages/musmap/branches/upstream/current/webtmp/remove.txt	                        (rev 0)
+++ packages/musmap/branches/upstream/current/webtmp/remove.txt	2007-06-23 22:17:08 UTC (rev 910)
@@ -0,0 +1 @@
+You can safely remove this file




More information about the Pkg-grass-devel mailing list