[Mapbender-commits] r2842 - branches/nimix_dev/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Aug 18 09:59:57 EDT 2008
Author: nimix
Date: 2008-08-18 09:59:57 -0400 (Mon, 18 Aug 2008)
New Revision: 2842
Added:
branches/nimix_dev/http/php/mod_editApplication.php
branches/nimix_dev/http/php/mod_editApplication_server.php
branches/nimix_dev/http/php/mod_loadwmc_server.php
branches/nimix_dev/http/php/mod_savewmc_server.php
Removed:
branches/nimix_dev/http/php/database-mysql.php
branches/nimix_dev/http/php/database-pgsql.php
branches/nimix_dev/http/php/mb_listWMCs.php
branches/nimix_dev/http/php/mod_createJSObjFromDB.php
branches/nimix_dev/http/php/mod_insertWmcIntoDb.php
Modified:
branches/nimix_dev/http/php/mb_listGUIs.php
branches/nimix_dev/http/php/mb_validateSession.php
branches/nimix_dev/http/php/mod_WMSpreferences.php
branches/nimix_dev/http/php/mod_addWmsFromFeatureInfo.php
branches/nimix_dev/http/php/mod_createJSObjFromDBByWMS.php
branches/nimix_dev/http/php/mod_editElements.php
branches/nimix_dev/http/php/mod_gazetteerMetadata.php
branches/nimix_dev/http/php/mod_map1.php
branches/nimix_dev/http/php/mod_mapOV.php
branches/nimix_dev/http/php/mod_treefolderClient.php
branches/nimix_dev/http/php/mod_wfs.php
branches/nimix_dev/http/php/mod_wfs_conf.php
branches/nimix_dev/http/php/mod_wfs_edit.php
branches/nimix_dev/http/php/mod_wfs_gazetteer_server.php
branches/nimix_dev/http/php/mod_zoomCoords_en.php
branches/nimix_dev/http/php/system.php
Log:
merge
Deleted: branches/nimix_dev/http/php/database-mysql.php
===================================================================
--- branches/nimix_dev/http/php/database-mysql.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/database-mysql.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -1,409 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/database-mysql.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/**
- * \file
- * \brief MySQL database connection/querying layer
- *
- * MySQL database connection/querying layer
- *
- * example:
- * \code
- * include_once(dirname(__FILE__)."/afwphp/database-mysql.php");
- * $sys_dbhost=...
- * $sys_dbuser=...
- * $sys_dbpasswd=...
- * $sys_dbname=...
- *
- * db_connect();
- * ...
- * $rs = db_query("select * from table");
- * while($row = db_fetch_array($rs));
- * ...
- * \endcode
- */
-
-/**
- * System-wide database type
- *
- * @var constant $sys_database_type
- */
-$sys_database_type='mysql';
-
-/**
- * Connect to the database
- *
- * Notice the global vars that must be set up
- * Notice the global vars $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname that must be set up
- * in other functions in this library
- */
-include_once(dirname(__FILE__)."/../../http/classes/class_mb_exception.php");
-include_once(dirname(__FILE__)."/../../http/classes/class_checkInput.php");
-function db_escapestring($unescaped_string){
- return @mysql_escape_string($unescaped_string);
-}
-function db_escape_string($unescaped_string){
- return @mysql_escape_string($unescaped_string);
-}
-
-
-function db_connect($DBSERVER="",$OWNER="",$PW="") {
- global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,
- $conn,$conn_update,$sys_db_use_replication,$sys_dbreadhost;
-
-
- if ($DBSERVER)
- $sys_dbhost = $DBSERVER;
- if ($OWNER)
- $sys_dbuser = $OWNER;
- if ($PW)
- $sys_dbpasswd = $PW;
- if (PORT!=''){
- $sys_dbport = ':'.PORT;
- }
- else{
- $sys_dbport = '';
- }
-
- if ($sys_db_use_replication) {
- //
- // if configured for replication, $conn is the read-only host
- // we do not connect to update server until needed
- //
- $conn = @mysql_pconnect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
- $conn_update=@mysql_pconnect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
- } else {
- $conn = @mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd);
- #echo "@mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd)";
- }
- if ($sys_dbname)
- @mysql_select_db($sys_dbname);
- return $conn;
-}
-
-function db_select_db($DB,$con="") {
- global $conn,$sys_dbname;
- $sys_dbname = $DB;
- $_con = $con ? $con : $conn;
- $ret = @mysql_select_db($sys_dbname,$_con);
- if ($ret){
- return true;
- }
- else {
- return false;
- }
-// echo "$ret=@mysql_select_db($sys_dbname,$_con);";
-}
-
-/**
- * Query the database
- *
- * @param $qstring (string) SQL statement
- * @param $limit (int) How many rows do you want returned
- * @param $offset (int) Of matching rows, return only rows starting here
- */
-function db_query($qstring,$limit='-1',$offset=0) {
- global $QUERY_COUNT,$sys_db_use_replication,$sys_db_is_dirty,$DB,
- $sys_dbname,$conn,$conn_update,$sys_dbhost,$sys_dbuser,$sys_dbpasswd;
-
- $QUERY_COUNT++;
- if(!$sys_dbname && $DB)
- $sys_dbname = $DB;
- db_select_db($sys_dbname,$conn);
-
- if ($limit > 0) {
- if (!$offset || $offset < 0) {
- $offset=0;
- }
- $qstring=$qstring." LIMIT $offset,$limit";
- }
-// if ($GLOBALS['IS_DEBUG'])
- $GLOBALS['G_DEBUGQUERY'] .= $qstring . "<P><BR>\n";
-
- //
- //are we configured to try to use replication?
- //
- if ($sys_db_use_replication) {
- //
- //if we haven't yet done an insert/update,
- //read from the read-only db
- //
- if (!$sys_db_is_dirty && mb_eregi("^( )*(select)",$qstring)) {
- if ($QUERY_COUNT%3==0) {
- // 1/3rd of read queries go to master for now
- return @mysql_db_query($sys_dbname,$qstring,$conn_update);
- } else {
- return @mysql_db_query($sys_dbname,$qstring,$conn);
- }
- } else {
- //must be an update/insert/delete query - go to master server
- $sys_db_is_dirty=true;
- return @mysql_db_query($sys_dbname,$qstring,$conn_update);
- }
- } else {
- $ret = @mysql_db_query($sys_dbname,$qstring,$conn);
-// echo "@mysql_db_query($sys_dbname,$qstring,$conn); ret=$ret<br>";
- if(!$ret){
- $e = new mb_exception("db_query($qstring)=$ret db_error=".db_error());
- }
- return $ret;
- }
- //echo "SQL__".$qstring;
-}
-/**
- * prepare and query the database
- *
- * @param $qstring (string) SQL statement
- * @param $params (array string params)
- * @param $types (array string types)
- */
-function db_prep_query($qstring, $params, $types){
- $ci = new checkInput($qstring,$params,$types);
- $params = $ci->v;
- for ($i=0; $i<count($params); $i++){
- $needle = "$".strval($i+1);
- $tmp = '';
- if($params[$i] !== NULL){
- if($types[$i] == 's'){ $tmp .= "'"; }
- $tmp .= $params[$i];
- if($types[$i] == 's'){ $tmp .= "'"; }
- }
- else{
- $tmp .= "NULL";
- }
- $posa = mb_strpos($qstring, $needle);
- $posb = mb_strlen($needle);
- $qstring = mb_substr($qstring,0,$posa).$tmp.mb_substr($qstring,($posa + $posb));
- }
- $r = db_query($qstring);
- return $r;
-}
-/**
- * Begin a transaction
- *
- * Begin a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_begin() {
- return db_query("BEGIN WORK");
-}
-
-/**
- * Commit a transaction
- *
- * Commit a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_commit() {
- return db_query("COMMIT");
-}
-
-/**
- * Roll back a transaction
- *
- * Rollback a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_rollback() {
- $str = db_error();
- db_query("ROLLBACK");
- die('sql error: ' . $str . " ROLLBACK performed....");
-}
-
-/**
- * Returns the number of rows in this result set
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_numrows($qhandle) {
- // return only if qhandle exists, otherwise 0
- if ($qhandle) {
- return @mysql_numrows($qhandle);
- } else {
- return 0;
- }
-}
-/**
- * Returns the number of rows in this result set
- *
- * @param $qhandle (string) Query result set handle
- * php 3,4,5
- */
-function db_num_rows($qhandle) {
- // return only if qhandle exists, otherwise 0
- if ($qhandle) {
- return @mysql_num_rows($qhandle);
- } else {
- return 0;
- }
-}
-
-/**
- * Frees a database result properly
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_free_result($qhandle) {
- return @mysql_free_result($qhandle);
-}
-
-/**
- * Reset a result set.
- *
- * Reset is useful for db_fetch_array sometimes you need to start over
- *
- * @param $qhandle (string) Query result set handle
- * @param $row (int) Row number
- */
-function db_reset_result($qhandle,$row=0) {
- return mysql_data_seek($qhandle,$row);
-}
-
-/**
- * Returns a field from a result set
- *
- * @param $qhandle (string) Query result set handle
- * @param $row (int) Row number
- * @param $field (string) Field name
- */
-function db_result($qhandle,$row,$field) {
- return @mysql_result($qhandle,$row,$field);
-}
-
-/**
- * Returns the number of fields in this result set
- *
- * @param $lhandle (string) Query result set handle
- */
-function db_numfields($lhandle) {
- return @mysql_numfields($lhandle);
-}
-
-/**
- * Returns the number of fields in this result set
- *
- * @param $lhandle (string) Query result set handle
- * php 3,4,5
- */
-function db_num_fields($lhandle) {
- return @mysql_num_fields($lhandle);
-}
-
-/**
- * Returns the number of rows changed in the last query
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-function db_fieldname($lhandle,$fnumber) {
- return @mysql_fieldname($lhandle,$fnumber);
-}
-
-/**
- * Returns the number of rows changed in the last query
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_affected_rows($qhandle) {
- return @mysql_affected_rows();
-}
-
-/**
- * Fetch an array
- *
- * Returns an associative array from
- * the current row of this database result
- * Use db_reset_result to seek a particular row
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_fetch_array($qhandle) {
- return @mysql_fetch_array($qhandle);
-}
-
-/**
- * fetch a row into an array
- *
- * @param $qhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-function db_fetch_row($qhandle,$fnumber=0) {
- return @mysql_fetch_row($qhandle);
-}
-
-/**
- * Returns the last primary key from an insert
- *
- * @param $qhandle (string) Query result set handle
- * @param $table_name (string) Is the name of the table you inserted into
- * @param $pkey_field_name (string) Is the field name of the primary key
- */
-function db_insertid($qhandle="",$table_name="",$pkey_field_name="") {
- return @mysql_insert_id();
-}
-
-function db_insert_id($qhandle="",$table_name="",$pkey_field_name="") {
- return @mysql_insert_id();
-}
-
-/**
- * Returns the last error from the database
- */
-function db_error() {
- return @mysql_error();
-}
-
-/**
- * Get the flags associated with the specified field in a result
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- *
- * Examples: "not_null", "primary_key", "unique_key", "multiple_key",
- * "blob", "unsigned", "zerofill","binary", "enum",
- * "auto_increment", "timestamp"
- */
-
-function db_field_flags($lhandle,$fnumber) {
- return @mysql_field_flags($lhandle,$fnumber);
-}
-
-/**
- * Get the type of the specified field
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-
-function db_field_type($lhandle,$fnumber) {
- return @mysql_field_type($lhandle,$fnumber);
-}
-
-/**
- * Get the length of the specified field
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-
-function db_field_len($lhandle,$fnumber) {
- return @mysql_field_len($lhandle,$fnumber);
-}
-
-?>
\ No newline at end of file
Deleted: branches/nimix_dev/http/php/database-pgsql.php
===================================================================
--- branches/nimix_dev/http/php/database-pgsql.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/database-pgsql.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -1,436 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/database-pgsql.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/**
- * \file
- * \brief MySQL database connection/querying layer
- *
- * MySQL database connection/querying layer
- *
- * example:
- * \code
- * include_once(dirname(__FILE__)."/afwphp/database-mysql.php");
- * $sys_dbhost=...
- * $sys_dbuser=...
- * $sys_dbpasswd=...
- * $sys_dbname=...
- *
- * db_connect();
- * ...
- * $rs = db_query("select * from table");
- * while($row = db_fetch_array($rs));
- * ...
- * \endcode
- */
-
-/**
- * System-wide database type
- *
- * @var constant $sys_database_type
- */
-$sys_database_type='pgsql';
-
-/**
- * Connect to the database
- *
- * Notice the global vars that must be set up
- * Notice the global vars $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname that must be set up
- * in other functions in this library
- */
-include_once(dirname(__FILE__)."/../../http/classes/class_mb_exception.php");
-include_once(dirname(__FILE__)."/../../http/classes/class_checkInput.php");
-function db_escape_string($unescaped_string){
- return @pg_escape_string(stripslashes($unescaped_string));
-}
-$DB = DB;
-
-
-function db_connect($DBSERVER="",$OWNER="",$PW="") {
- global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug;
- global $conn,$conn_update,$DB;
-
-
- $db_debug=0;
- if ($DBSERVER)
- $sys_dbhost = $DBSERVER;
- if ($OWNER)
- $sys_dbuser = $OWNER;
- if ($PW && $PW != null)
- $sys_dbpasswd = $PW;
-
- $sys_dbport = PORT;
-
- if($GLOBALS['DB'])
- $sys_dbname = $DB;
-
- $connstring = "";
- if ($sys_dbuser)
- $connstring.=" user=$sys_dbuser";
- if ($sys_dbname)
- $connstring.=" dbname=$sys_dbname";
- if ($sys_dbhost)
- $connstring.=" host=$sys_dbhost";
- if ($sys_dbport)
- $connstring.=" port=$sys_dbport";
- if ($sys_dbpasswd)
- $connstring.=" password=$sys_dbpasswd";
-
- if ($db_debug)
- echo $connstring." ";
-
- $conn = pg_connect($connstring);
-
- #if(isset($sys_db_clientencoding) && $sys_db_clientencoding > "")
- #{
- #pg_set_client_encoding ( $conn, $sys_db_clientencoding);
- #}
- #return $conn;
- if ($db_debug)
- echo "conn=".$conn;
-#echo $connstring;
-#if(!$conn)
-#{echo "FEHLER in Connection";
-#pg_error($conn);}
-
- return $conn;
-}
-
-function db_select_db($DB,$con="") {
- global $conn,$sys_dbname;
-# $sys_dbname = DB;
-# $_con = $con ? $con : $conn;
-# $ret = @mysql_select_db($sys_dbname,$_con);
-// echo "$ret=@mysql_select_db($sys_dbname,$_con);";
-}
-
-/**
- * Query the database
- *
- * @param $qstring (string) SQL statement
- * @param $limit (int) How many rows do you want returned
- * @param $offset (int) Of matching rows, return only rows starting here
- */
-function db_query($qstring) {
- global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug,
- $conn,$conn_update,$QUERY_COUNT,$DBSERVER,$OWNER,$PW,$DB;
- $QUERY_COUNT++;
- $ret = pg_exec($qstring);
-// $e = new mb_exception("not ps: ".$_SERVER['SCRIPT_FILENAME']." : ".$qstring);
- if(!$ret){
- $e = new mb_exception("db_query($qstring)=$ret db_error=".db_error());
- }
- return $ret;
-}
-/**
- * prepare and query the database
- *
- * @param $qstring (string) SQL statement
- * @param $params (array params as strings)
- * @param $types (array types as strings)
- */
-function db_prep_query($qstring, $params, $types){
- $ci = new checkInput($qstring,$params,$types);
- $params = $ci->v;
- if(PREPAREDSTATEMENTS == false){
- for ($i=0; $i<count($params); $i++){
- $needle = "$".strval($i+1);
- $tmp = '';
- if($params[$i] !== NULL){
- if($types[$i] == 's'){ $tmp .= "'"; }
- $tmp .= $params[$i];
- if($types[$i] == 's'){ $tmp .= "'"; }
- }
- else{
- $tmp .= "NULL";
- }
- $posa = mb_strpos($qstring, $needle);
- $posb = mb_strlen($needle);
- $qstring = mb_substr($qstring,0,$posa).$tmp.mb_substr($qstring,($posa + $posb));
- }
- $r = db_query($qstring);
- if(!$r){
- $e = new mb_exception("Error while executing sql statement in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$qstring.", Error: ".db_error());
- }
- }
- else{
- $result = pg_prepare("", $qstring);
- if(!$result){
- $e = new mb_exception("Error while preparing statement in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$qstring.", Error: ".db_error());
- }
- $r = pg_execute("", $params);
- if(!$r){
- $e = new mb_exception("Error while executing prepared statement in ".$_SERVER['SCRIPT_FILENAME'].": Sql: ".$qstring.", Error: ".db_error());
- }
- }
- return $r;
-}
-/**
- * Begin a transaction
- *
- * Begin a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_begin() {
- return db_query("BEGIN WORK");
-}
-
-/**
- * Commit a transaction
- *
- * Commit a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_commit() {
- return db_query("COMMIT");
-}
-
-/**
- * Roll back a transaction
- *
- * Rollback a transaction for databases that support them
- * may cause unexpected behavior in databases that don't
- */
-function db_rollback() {
- $str = db_error();
- db_query("ROLLBACK");
- die('sql error: ' . $str . " ROLLBACK performed....");
-}
-
-/**
- * Returns the number of rows in this result set
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_numrows($qhandle) {
- // return only if qhandle exists, otherwise 0
- if ($qhandle) {
- return @pg_numrows($qhandle);
- } else {
- return 0;
- }
-}
-/**
- * Returns the number of rows in this result set
- *
- * @param $qhandle (string) Query result set handle
- * php > 4.2
- */
-function db_num_rows($qhandle) {
- // return only if qhandle exists, otherwise 0
- if ($qhandle) {
- return @pg_num_rows($qhandle);
- } else {
- return 0;
- }
-}
-
-/**
- * Frees a database result properly
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_free_result($qhandle) {
- return @pg_freeresult($qhandle);
-}
-
-/**
- * Reset a result set.
- *
- * Reset is useful for db_fetch_array sometimes you need to start over
- *
- * @param $qhandle (string) Query result set handle
- * @param $row (int) Row number
- */
-function db_reset_result($qhandle,$row=0) {
-#dummy
- return 0;#mysql_data_seek($qhandle,$row);
-
-}
-
-/**
- * Returns a field from a result set
- *
- * @param $qhandle (string) Query result set handle
- * @param $row (int) Row number
- * @param $field (string) Field name
- */
-function db_result($qhandle,$row,$field) {
- return @pg_result($qhandle,$row,$field);
-}
-
-/**
- * Returns the number of fields in this result set
- *
- * @param $lhandle (string) Query result set handle
- */
-function db_numfields($lhandle) {
- return @pg_numfields($lhandle);
-}
-
-/**
- * Returns the number of fields in this result set
- *
- * @param $lhandle (string) Query result set handle
- * php >4.2
- */
-function db_num_fields($lhandle) {
- return @pg_num_fields($lhandle);
-}
-
-/**
- * Returns the number of rows changed in the last query
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-function db_fieldname($lhandle,$fnumber) {
- return @pg_fieldname($lhandle,$fnumber);
-}
-
-/**
- * Returns the number of rows changed in the last query
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_affected_rows($qhandle) {
-
- return @pg_cmdtuples($qhandle);
-}
-
-/**
- * Fetch an array
- *
- * Returns an associative array from
- * the current row of this database result
- * Use db_reset_result to seek a particular row
- *
- * @param $qhandle (string) Query result set handle
- */
-function db_fetch_array($qhandle) {
- return @pg_fetch_array($qhandle);
-}
-
-function db_fetch_all($qhandle){
- return @pg_fetch_all($qhandle);
-}
-/**
- * fetch a row into an array
- *
- * @param $qhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-function db_fetch_row($qhandle,$fnumber=0) {
- return pg_fetch_row($qhandle);
-}
-
-/**
- * Returns the last primary key from an insert
- *
- * @param $qhandle (string) Query result set handle
- * @param $table_name (string) Is the name of the table you inserted into
- * @param $pkey_field_name (string) Is the field name of the primary key
- */
-function db_insertid($qhandle="",$table_name="",$pkey_field_name="") {
- $res=db_query("SELECT max($pkey_field_name) AS id FROM $table_name");
- if ($res && db_numrows($res) > 0) {
- return @db_result($res,0,'id');
- } else {
- return 0;
- }
-}
-
-
-
-
-function db_insert_id($qhandle="",$table_name="",$pkey_field_name="") {
- global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug,
- $conn,$conn_update,$QUERY_COUNT,$DBSERVER,$OWNER,$PW,$DB;
- /*
- $oid =pg_last_oid($qhandle);
- echo $oid;
-
- $res=db_query("SELECT ".$pkey_field_name." FROM ".$table_name." WHERE oid =".$oid );
- if ($res && db_numrows($res) > 0) {
- return @db_result($res,0,0);
- } else {
- return 0;
- }*/
- $res=db_query("SELECT max($pkey_field_name) AS id FROM $table_name");
- if ($res && db_numrows($res) > 0) {
- return db_result($res,0,'id');
- } else {
- return 0;
- }
-}
-
-function db_last_oid()
- {
- global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname,$db_debug,
- $conn,$conn_update,$QUERY_COUNT;
- global $DBSERVER,$OWNER,$PW,$DB ;
- return pg_getlastoid($conn);
- }
-
-
-/**
- * Returns the last error from the database
- */
-function db_error() {
- return @pg_last_error();
-}
-
-/**
- * Get the flags associated with the specified field in a result
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- *
- * Examples: "not_null", "primary_key", "unique_key", "multiple_key",
- * "blob", "unsigned", "zerofill","binary", "enum",
- * "auto_increment", "timestamp"
- */
-
-function db_field_flags($lhandle,$fnumber) {
- print "db_field_flags() isn't implemented";
-
-}
-
-/**
- * Get the type of the specified field
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-
-function db_field_type($lhandle,$fnumber) {
- return @pg_fieldtype($lhandle,$fnumber);
-}
-
-/**
- * Get the length of the specified field
- *
- * @param $lhandle (string) Query result set handle
- * @param $fnumber (int) Column number
- */
-
-function db_field_len($lhandle,$fnumber) {
- return @pg_fieldlen($lhandle,$fnumber);
-}
-
-?>
\ No newline at end of file
Modified: branches/nimix_dev/http/php/mb_listGUIs.php
===================================================================
--- branches/nimix_dev/http/php/mb_listGUIs.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mb_listGUIs.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -36,7 +36,7 @@
}
$sql_list_guis .= ") ORDER BY gui_name";
$res_list_guis = db_prep_query($sql_list_guis,$v,$t);
- if ($_SESSION["mb_user_name"] != "test" && $_SESSION["mb_user_name"] != "demo") {
+ if ($_SESSION["mb_user_name"] != "test" && $_SESSION["mb_user_name"] != "demo" && $_SESSION["mb_user_name"] != "guest") {
echo "<a href=\"../php/mod_editSelf.php?".SID."\" class='list_guis' target=_blank>Change personal settings</a>";
}
echo "</td><td align = 'right'>";
Deleted: branches/nimix_dev/http/php/mb_listWMCs.php
===================================================================
--- branches/nimix_dev/http/php/mb_listWMCs.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mb_listWMCs.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -1,201 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mb_listWMCs.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../classes/class_administration.php");
-require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
-
-$gui_id = $_SESSION["mb_user_gui"];
-$user_id = $_SESSION["mb_user_id"];
-
-$action = $_GET["action"];
-$wmcId = $_GET["wmc_id"];
-
-$delWmcId = $_POST["del_wmc_id"];
-$clientFilename = $_FILES['local_wmc_filename']['tmp_name'];
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="expires" content="0">
- <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;?>">
- <title>Select web map contect document from list</title>
- </head>
- <body>
- <form name='delete_wmc' action='<?php echo $self; ?>' method='POST'>
- <input type='hidden' id='delete_wmc' name='del_wmc_id' value ='' >
- </form>
-
-<?php
-function mb_listWMCs($wmcIdArray, $form_target){
- $display = "<h2 style='font-family: Arial, Helvetica, sans-serif; color: #808080;background-color: White;'><font align='left' color='#000000'>load WMC from list</font></h2>";
- $display .= "<table width='90%' style='font-family: Arial, Helvetica, sans-serif;font-size : 12px;color: #808080;' border='1' cellpadding='3' rules='rows'><tr style='background-color:#F0F0F0;' width='80px'><td ><b>WMC name</b></td><td><b>last update</b></td><td colspan=5></td></tr>";
-
- if (count($wmcIdArray) > 0) {
- $v = array();
- $t = array();
-
- $wmcIdList = "";
- for ($i = 0; $i < count($wmcIdArray); $i++){
- if ($i > 0){
- $wmcIdList .= ",";
- }
- $wmcIdList .= "$".($i+1);
- array_push($v, $wmcIdArray[$i]);
- array_push($t, 's');
- }
- $sql_list_wmcs = "SELECT DISTINCT wmc_id, wmc_title, wmc_timestamp FROM mb_user_wmc ";
- $sql_list_wmcs .= "WHERE wmc_id IN (" . $wmcIdList . ") ";
- $sql_list_wmcs .= "ORDER BY wmc_timestamp DESC";
-
- $res_list_wmcs = db_prep_query($sql_list_wmcs, $v, $t);
- while($row = db_fetch_array($res_list_wmcs)){
- $this_id = $row["wmc_id"];
- $this_title = $row["wmc_title"];
- $this_timestamp = date("M d Y H:i:s", $row["wmc_timestamp"]);
-
- $display .= "<tr onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
- $display .= "<td>".$this_title."</td>";
- $display .= "<td>".$this_timestamp. "</td>";
- $display .= "<td><a href=\"" . $form_target . "&action=load&wmc_id=".$this_id."\"><img src=\"../img/button_gray/wmc_load.png\" title=\"load this WMC\" border=0></a></td>";
- $display .= "<td><a href=\"" . $form_target . "&action=merge&wmc_id=".$this_id."\"><img src=\"../img/button_gray/wmc_merge.png\" title=\"merge WMC\" border=0></a></td>";
- $display .= "<td><a href=\"" . $form_target . "&action=append&wmc_id=".$this_id."\"><img src=\"../img/button_gray/wmc_append.png\" title=\"append WMC\" border=0></a></td>";
- $display .= "<td><a href='../javascripts/mod_displayWmc.php?wmc_id=".$this_id."' target = '_blank'><img src=\"../img/button_gray/wmc_xml.png\" title=\"display WMC XML\" border=0></a></td>";
- $display .= "<td><a href=\"" . $form_target . "&action=delete&wmc_id=".$this_id."\"><img src=\"../img/button_gray/del.png\" title=\"delete this WMC\" border=0></a></td>";
- $display .= "</tr>";
- }
- }
- else{
- $display .= "<tr><td>There are no WMCs availiable</td></tr>";
- }
- $display .= "</table>";
-
- return $display;
-}
-
-function getTarget($gui_id) {
- $sql = "SELECT e_requires, e_target FROM gui_element WHERE e_id = 'loadwmc' AND fkey_gui_id = $1";
- $v = array($gui_id);
- $t = array("s");
- $res = db_prep_query($sql, $v, $t);
- $cnt = 0;
- while($row = db_fetch_array($res)){
- $e_target = $row["e_target"];
- $e_require = $row["e_requires"];
- $cnt++;
- }
- if ($cnt > 1) {
- $e = new mb_exception("listWMCs: e_id 'loadwmc' not unique in GUI '" . $gui_id . "'!");
- }
-
- $targetArray = explode(",", $e_target);
- if (in_array('mapframe1', $targetArray)) {
- return 'mapframe1';
- }
- else {
- return trim($targetArray[0]);
- }
-}
-
-function loadFile($filename) {
- $handle = fopen($filename, "r");
- $cnt = 0;
- while (!feof($handle)) {
- $buffer .= fgets($handle, 4096);
- }
- fclose ($handle);
- return $buffer;
-}
-
-$admin = new administration();
-$wmcIdArray = $admin->getWmcByOwner($user_id);
-
-// wmc is being deleted
-if (!empty($delWmcId)) {
- $result = $admin->deleteWmc($delWmcId, $user_id);
- if (!$result) {
- echo "<script language='javascript'>";
- echo "alert('WMC could not be deleted!');";
- echo "</script>";
- }
-}
-// wmc is being loaded from file
-elseif ($clientFilename) {
- $serverFilename = "../tmp/wmc" . time() . ".xml";
- copy($clientFilename, $serverFilename);
-
- $wmc = new wmc();
- $wmc->createObjFromWMC_xml(loadFile($serverFilename));
-
- $mytarget = getTarget($gui_id);
- $js = $wmc->createJsObjFromWMC("window.opener.", $mytarget, "load");
- echo "<script language='javascript'>";
- echo $js;
- if ($wmc->getTitle()) {
- $title = "'" . $wmc->getTitle() . "' ";
- }
- echo "alert(\"WMC " . $title . ": load successful.\");\n";
- echo "window.close();";
- echo "</script>";
-}
-
-// load a WMC from file
-?>
-<h2 style='font-family: Arial, Helvetica, sans-serif; color: #808080;background-color: White;'><font align='left' color='#000000'>load WMC from file</font></h2>
-<form enctype="multipart/form-data" action="<?php echo $self;?>" method=POST target="_self">
-<input type='file' name='local_wmc_filename'>
-<input type='submit' value='load'>
-</form>
-<?php
-
-// load a WMC from list
-echo mb_listWMCs($wmcIdArray, $self);
-
-if ($wmcId && in_array($wmcId, $wmcIdArray)){
- if ($action == "delete") {
- echo "<script language='javascript'>";
- echo "value = confirm('Do you really want to delete this document?');";
- echo "if (value == true) {";
- echo "document.delete_wmc.del_wmc_id.value = '" . $wmcId . "';";
- echo "document.delete_wmc.submit();";
- echo "}";
- echo "</script>";
- }
- else if ($action == "append" || $action == "merge" || $action == "load") {
- $mytarget = getTarget($gui_id);
-
- $wmc = new wmc();
- $wmc->createObjFromWMC_id($wmcId);
- $js = $wmc->createJsObjFromWMC("window.opener.", $mytarget, $action);
-
- echo "<script language='javascript'>";
- echo $js;
- if ($wmc->getTitle()) {
- $title = "'" . $wmc->getTitle() . "' ";
- }
- echo "alert(\"WMC " . $title . ": " . $action . " successful.\");\n";
- echo "window.close();";
- echo "</script>";
- }
-}
-?>
-</body>
-</html>
\ No newline at end of file
Modified: branches/nimix_dev/http/php/mb_validateSession.php
===================================================================
--- branches/nimix_dev/http/php/mb_validateSession.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mb_validateSession.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -17,18 +17,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-session_start();
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/../php/system.php");
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
-//
-// establish database connection
-//
-$con = db_connect($DBSERVER, $OWNER, $PW);
-db_select_db(DB, $con);
-
$e = new mb_notice("mb_validateSession.php: checking file " . $_SERVER["PHP_SELF"]);
//
@@ -49,12 +40,12 @@
if (!$gui_id) {
$e = new mb_notice("gui id not set");
if ($_REQUEST["guiID"]) {
- $e = new mb_notice("gui id set to guiID");
$gui_id = $_REQUEST["guiID"];
+ $e = new mb_notice("gui id set to guiID: " . $gui_id);
}
elseif ($_REQUEST["gui_id"]) {
- $e = new mb_notice("gui id set to gui_id");
$gui_id = $_REQUEST["gui_id"];
+ $e = new mb_notice("gui id set to gui_id: " . $gui_id);
}
else {
$e = new mb_notice("mb_validateSession.php: gui_id not set in script: " . $_SERVER["PHP_SELF"]);
Modified: branches/nimix_dev/http/php/mod_WMSpreferences.php
===================================================================
--- branches/nimix_dev/http/php/mod_WMSpreferences.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_WMSpreferences.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -106,6 +106,27 @@
var ind = window.opener.getMapObjIndexByName(mod_WMSpreferences_target1);
var my = window.opener.mb_mapObj[ind];
+ function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
+ if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
+ upper = mb_mapObj[mapObj_ind].wms[indexA];
+ mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
+ mb_mapObj[mapObj_ind].wms[indexB] = upper;
+ var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
+ var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
+ var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
+ mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
+ mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
+ mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
+ mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
+ mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
+ mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
// Opacity version
Modified: branches/nimix_dev/http/php/mod_addWmsFromFeatureInfo.php
===================================================================
--- branches/nimix_dev/http/php/mod_addWmsFromFeatureInfo.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_addWmsFromFeatureInfo.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -23,6 +23,56 @@
echo "var mod_target = '".$e_target[0]."';";
?>
+function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
+ if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
+ upper = mb_mapObj[mapObj_ind].wms[indexA];
+ mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
+ mb_mapObj[mapObj_ind].wms[indexB] = upper;
+ var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
+ var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
+ var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
+ mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
+ mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
+ mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
+ mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
+ mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
+ mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+
+function mb_wmsMoveByIndex(mapObj_ind, fromIndex, toIndex) {
+ if (fromIndex != toIndex && fromIndex >= 0 && fromIndex < mb_mapObj[mapObj_ind].wms.length && toIndex >= 0 && toIndex < mb_mapObj[mapObj_ind].wms.length) {
+ var changed = false;
+ var i;
+ var result;
+ if (fromIndex > toIndex) {
+ for (i = fromIndex; i > toIndex ; i--) {
+ result = mb_swapWmsByIndex(mapObj_ind, i-1, i);
+ if (result === true) {
+ changed = true;
+ }
+ }
+ }
+ else {
+ for (i = fromIndex; i < toIndex ; i++) {
+ result = mb_swapWmsByIndex(mapObj_ind, i, i+1);
+ if (result === true) {
+ changed = true;
+ }
+ }
+ }
+ return changed;
+ }
+ else {
+ return false;
+ }
+}
+
function addWmsFromFeatureInfo(pointer_name, version) {
mb_registerloadWmsSubFunctions("addWmsFromInfo_pos()");
var mywms = pointer_name;
@@ -55,5 +105,4 @@
mb_wmsMoveByIndex(getMapObjIndexByName(mod_target), mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1, mod_addWmsFromFeatureInfo_position-1);
}
eventAfterLoadWMS.unregister("addWmsFromInfo_pos()");
-// mb_removeFunctionFromArray("mb_loadWmsSubFunctions", "addWmsFromInfo_pos()");
}
\ No newline at end of file
Deleted: branches/nimix_dev/http/php/mod_createJSObjFromDB.php
===================================================================
--- branches/nimix_dev/http/php/mod_createJSObjFromDB.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_createJSObjFromDB.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -1,33 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mod_createJSObjectFromDB.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_wms.php");
-
-$sql = "SELECT fkey_wms_id FROM gui_wms WHERE fkey_gui_id = $1 ORDER BY gui_wms_position";
-$v = array($_SESSION["mb_user_gui"]);
-$t = array('s');
-$res = db_prep_query($sql,$v,$t);
-
-while($row = db_fetch_array($res)){
- $mywms = new wms();
- $mywms->createObjFromDB($_SESSION["mb_user_gui"],$row["fkey_wms_id"]);
- $mywms->createJsObjFromWMS();
-}
-?>
\ No newline at end of file
Modified: branches/nimix_dev/http/php/mod_createJSObjFromDBByWMS.php
===================================================================
--- branches/nimix_dev/http/php/mod_createJSObjFromDBByWMS.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_createJSObjFromDBByWMS.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -39,7 +39,12 @@
$admin = new administration();
if ($admin->getWmsPermission($wms_id, $user_id)) {
$mywms = new wms();
- $mywms->createObjFromDB($gui_id, $wms_id);
+ if(isset($gui_id) && $gui_id!='undefined'){
+ $mywms->createObjFromDB($gui_id, $wms_id);
+ }
+ else{
+ $mywms->createObjFromDBNoGui($wms_id);
+ }
$mywms->createJsObjFromWMS(true);
echo "parent.mod_addWMS_refresh();";
}
Copied: branches/nimix_dev/http/php/mod_editApplication.php (from rev 2653, trunk/mapbender/http/php/mod_editApplication.php)
===================================================================
--- branches/nimix_dev/http/php/mod_editApplication.php (rev 0)
+++ branches/nimix_dev/http/php/mod_editApplication.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -0,0 +1,252 @@
+<?php
+# $Id: mod_editElements.php 2413 2008-04-23 16:21:04Z christoph $
+# http://www.mapbender.org/index.php/mod_editElements.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_user.php");
+
+$editApplicationId = $_REQUEST["editApplicationId"];
+
+$user = new User($_SESSION["mb_user_id"]);
+$myApplicationArray = $user->getApplicationsByPermission(false);
+if (!in_array($editApplicationId, $myApplicationArray)) {
+ die("You are not allowed to edit the application '" . $editApplicationId . "'");
+}
+?>
+<html>
+<head>
+<style type="text/css">
+.ui-selecting {
+ border-width:thin;
+ border-style:solid;
+ border-color:red;
+ background-color:transparent;
+ font-size:9px;
+}
+.ui-selected {
+ border-width:thin;
+ border-style:solid;
+ border-color:red;
+ background-color:transparent;
+ font-size:9px;
+}
+.ui-draggable {
+}
+.div-border {
+ border-width:thin;
+ border-style:solid;
+ border-color:black;
+ background-color:transparent;
+ font-size:9px;
+}
+</style>
+<link rel='stylesheet' type='text/css' href='../css/popup.css'>
+<script type='text/javascript' src='../extensions/jquery-1.2.6.min.js'></script>
+<script type='text/javascript' src='../extensions/jquery-ui-personalized-1.5.min.js'></script>
+<script type='text/javascript' src='../extensions/jqjson.js'></script>
+<script type='text/javascript' src='../javascripts/popup.js'></script>
+<script language="JavaScript" type="text/javascript">
+<?php
+ include("../../lib/event.js");
+ include("../../lib/buttonNew.js");
+ include("../../lib/draggableButton.js");
+ include("../../lib/selectableButton.js");
+ include("../../lib/resizableButton.js");
+ include("../../lib/alignButton.js");
+ include("../../lib/saveButton.js");
+
+ echo "var editApplicationId = '" . $editApplicationId . "';";
+?>
+
+$(function() {
+ //
+ // create the toolbox
+ //
+ var controlPopup;
+ controlPopup = new mb_popup({
+ left:300,
+ top:300,
+ width:180,
+ height:80,
+ html:"<div id='controls'></div>",
+ title:"Toolbox"
+ });
+ var toolbox = new ButtonGroup("controls");
+
+ //
+ // add tools to the toolbox
+ //
+
+ // select tool
+ var selectButton = new Button(Selectable.buttonParameters);
+ toolbox.add(selectButton);
+
+ // drag tool
+ var dragButton = new Button(Draggable.buttonParameters);
+ toolbox.add(dragButton);
+
+ // resize tool
+ var resizeButton = new Button(Resizable.buttonParameters);
+ toolbox.add(resizeButton);
+
+ // save tool
+ var saveButton = new Button(Save.buttonParameters);
+ toolbox.add(saveButton);
+
+ //align top
+ alignTopButton = new Button(Align.top.buttonParameters);
+ toolbox.add(alignTopButton);
+
+ //align left
+ alignLeftButton = new Button(Align.left.buttonParameters);
+ toolbox.add(alignLeftButton);
+
+ //align bottom
+ alignBottomButton = new Button(Align.bottom.buttonParameters);
+ toolbox.add(alignBottomButton);
+
+ //align right
+ alignRightButton = new Button(Align.right.buttonParameters);
+ toolbox.add(alignRightButton);
+
+ //
+ // add functionality to the buttons
+ //
+
+ selectButton.registerPush(Selectable.makeSelectable);
+ selectButton.registerRelease(Selectable.removeSelection);
+
+ dragButton.registerPush(Draggable.makeDraggable);
+ dragButton.registerStop(Draggable.removeDraggable);
+
+ resizeButton.registerPush(Selectable.removeSelection);
+ resizeButton.registerPush(Resizable.makeResizable);
+ resizeButton.registerStop(Resizable.removeResizable);
+
+ saveButton.registerPush(function () {
+ Save.updateDatabase(saveButton.triggerStop);
+ });
+
+ alignTopButton.registerPush(Align.top.align);
+ alignLeftButton.registerPush(Align.left.align);
+ alignBottomButton.registerPush(Align.bottom.align);
+ alignRightButton.registerPush(Align.right.align);
+
+ //
+ // display the toolbox
+ //
+ controlPopup.show();
+
+});
+
+</script>
+</head>
+<?php
+$pattern = "/sessionID/";
+
+$sql = "SELECT fkey_gui_id,e_id,e_pos,e_public,e_comment,gettext($1, e_title) as e_title, e_element,";
+$sql .= "e_src,e_attributes,e_left,e_top,e_width,e_height,e_z_index,e_more_styles,";
+$sql .= "e_content,e_closetag,e_js_file,e_mb_mod,e_target,e_requires,e_url FROM gui_element WHERE ";
+$sql .= "e_public = 1 AND fkey_gui_id = $2 ORDER BY e_pos";
+$v = array($_SESSION["mb_lang"], $editApplicationId);
+$t = array('s', 's');
+$res = db_prep_query($sql,$v,$t);
+$i = 0;
+while(db_fetch_row($res)){
+ $replacement = $urlParameters."&elementID=".db_result($res,$i,"e_id");
+ if (db_result($res,$i,"e_element") == "body" ) {
+ echo "<".db_result($res,$i,"e_element")." ";
+ echo "' ><div class='collection'>";
+ }
+ else {
+ if (db_result($res,$i,"e_left") && db_result($res,$i,"e_top")) {
+ //
+ // open tag
+ //
+ if (db_result($res,$i,"e_closetag") != "iframe" && db_result($res,$i,"e_closetag") != "form" ) {
+ echo "<".db_result($res,$i,"e_element")." ";
+ }
+ else {
+ echo "<div ";
+ }
+ echo " class='div-border' ";
+
+ //
+ // style
+ //
+ echo " style = '";
+ if(db_result($res,$i,"e_left") != "" && db_result($res,$i,"e_top") != ""){
+ echo "position:absolute;";
+ echo "left:".db_result($res,$i,"e_left").";";
+ echo "top:".db_result($res,$i,"e_top").";";
+ }
+ if(db_result($res,$i,"e_width") != "" && db_result($res,$i,"e_height") != ""){
+ echo "width:".db_result($res,$i,"e_width").";";
+ echo "height:".db_result($res,$i,"e_height").";";
+ }
+ echo "' ";
+
+ //
+ // attributes
+ //
+ if(db_result($res,$i,"e_id") != ""){
+ echo " id='".db_result($res,$i,"e_id")."' ";
+ echo " name='".db_result($res,$i,"e_id")."' ";
+ }
+ if (db_result($res,$i,"e_closetag") == "select" ) {
+ echo " disabled ";
+ }
+ if(db_result($res,$i,"e_title") != ""){
+ echo " title='".db_result($res,$i,"e_title")."' ";
+ }
+ if(db_result($res,$i,"e_src") != "" && db_result($res,$i,"e_closetag") != "iframe" ){
+ if(db_result($res,$i,"e_closetag") == "iframe" && db_result($res,$i,"e_id") != 'loadData'){
+ echo " src = '".preg_replace($pattern,$replacement,db_result($res,$i,"e_src"));
+ if(mb_strpos(db_result($res,$i,"e_src"), "?")) {
+ echo "&";
+ }
+ else {
+ echo "?";
+ }
+ echo "e_id_css=".db_result($res,$i,"e_id")."&e_id=".db_result($res,$i,"e_id") .
+ "&e_target=".db_result($res,$i,"e_target").
+ "&" . $urlParameters . "'";
+ }
+ else{
+ echo " src = '".preg_replace($pattern,$replacement,db_result($res,$i,"e_src"))."'";
+ }
+ }
+ echo "' >";
+
+ if (db_result($res,$i,"e_closetag") == "iframe" || db_result($res,$i,"e_closetag") == "div") {
+ echo db_result($res,$i,"e_id");
+ }
+ if (db_result($res,$i,"e_closetag") != "iframe" && db_result($res,$i,"e_closetag") != "form" ) {
+ echo "</".db_result($res,$i,"e_element").">";
+ }
+ else {
+ echo "</div>";
+ }
+ }
+ }
+ $i++;
+}
+?>
+</div></body>
+</html>
\ No newline at end of file
Copied: branches/nimix_dev/http/php/mod_editApplication_server.php (from rev 2653, trunk/mapbender/http/php/mod_editApplication_server.php)
===================================================================
--- branches/nimix_dev/http/php/mod_editApplication_server.php (rev 0)
+++ branches/nimix_dev/http/php/mod_editApplication_server.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -0,0 +1,58 @@
+<?php
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+
+/**
+ * encodes and delivers the data
+ *
+ * @param object the un-encoded object
+ */
+function sendOutput($out){
+ global $json;
+ $output = $json->encode($out);
+ header("Content-Type: text/x-json");
+ echo $output;
+}
+
+
+$json = new Mapbender_JSON();
+$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
+$resultObj = array();
+
+$e = new mb_exception("command: " . $queryObj->command);
+
+$userId = $_SESSION[mb_user_id];
+
+switch($queryObj->command){
+
+ // gets available WMCs
+ case 'update':
+ $elementArray = $queryObj->parameters->data;
+ for ($i = 0; $i < count($elementArray); $i++) {
+ $currentElement = $elementArray[$i];
+ $id = $currentElement->id;
+ $top = $currentElement->top;
+ $left = $currentElement->left;
+ $width = $currentElement->width;
+ $height = $currentElement->height;
+ $app = $queryObj->parameters->applicationId;
+ $sql = "UPDATE gui_element SET e_left = $1, e_top = $2, " .
+ "e_width = $3, e_height = $4 " .
+ "WHERE e_id = $5 AND fkey_gui_id = $6";
+ $v = array($left, $top, $width, $height, $id, $app);
+ $t = array("i", "i", "i", "i", "s", "s");
+ $res = db_prep_query($sql, $v, $t);
+ $e = new mb_notice("updating element '" . $id . "'");
+ }
+ $resultObj["success"] = "Elements have been updated in the database.";
+ break;
+
+
+ // Invalid command
+ default:
+ $resultObj["error"] = "no action specified...";
+}
+
+sendOutput($resultObj);
+?>
\ No newline at end of file
Modified: branches/nimix_dev/http/php/mod_editElements.php
===================================================================
--- branches/nimix_dev/http/php/mod_editElements.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_editElements.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -466,6 +466,12 @@
echo "<input type='button' class='' name='' value='delete' onclick='thisDelete()'> \n";
echo "<input type='button' class='' name='' value='show' onclick='thisShow()'> \n";
echo "<input type='button' class='' name='' value='sql' onclick='thisExport()'> \n";
+ echo "<input type='button' class='' name='' value='arrange' " .
+ "onclick='window.open(\"mod_editApplication.php?" . SID . "&" .
+ "guiID=" . $_SESSION["mb_user_gui"] . "&" .
+ "editApplicationId=" . $guiList1 . "\", " .
+ "\"edit application\", " .
+ "\"width=500,height=500,dependent\");'> \n";
echo "</div>\n";
echo "<input type='hidden' name='guiList1' value='".$guiList1."' >\n";
echo "<input type='hidden' name='guiId' value='".$guiId."' >\n";
Modified: branches/nimix_dev/http/php/mod_gazetteerMetadata.php
===================================================================
--- branches/nimix_dev/http/php/mod_gazetteerMetadata.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_gazetteerMetadata.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -99,7 +99,7 @@
}
else{
document.getElementById("resultDivTag").innerHTML = "<table><tr><td><img src='../img/indicator_wheel.gif'></td><td>Searching...</td></tr></table>";
- parent.mb_ajax_json("mod_gazetteerMetadata_search.php", {"search":document.form1.search.value}, function(jsonObj, status){
+ parent.mb_ajax_json("../php/mod_gazetteerMetadata_search.php", {"search":document.form1.search.value}, function(jsonObj, status){
document.getElementById("resultDivTag").innerHTML = displayTable(jsonObj);
});
return false;
@@ -236,4 +236,4 @@
</form>
<div id='resultDivTag' class='result'></div>
</body>
-</html>
\ No newline at end of file
+</html>
Deleted: branches/nimix_dev/http/php/mod_insertWmcIntoDb.php
===================================================================
--- branches/nimix_dev/http/php/mod_insertWmcIntoDb.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_insertWmcIntoDb.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -1,63 +0,0 @@
-<?php
-#$Id: mod_insertWmcIntoDb.php 1198 2007-10-18 14:37:52Z baudson $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-require_once(dirname(__FILE__)."/../classes/class_wmc.php");
-require_once(dirname(__FILE__)."/../extensions/JSON.php");
-
-$json = new Services_JSON();
-$mapObject = $json->decode(stripslashes($_POST["mapObject"]));
-$user_id = $_SESSION["mb_user_id"];
-$save_in_session = $_POST["saveInSession"];
-$generalTitle = $_POST["generalTitle"];
-
-$extensionData = $json->decode(stripslashes($_POST["extensionData"]));
-
-$wmc = new wmc();
-$wmc->createWMCFromObj($mapObject, $user_id, $generalTitle, $extensionData);
-
-if ($save_in_session) {
- $_SESSION["mb_wmc"] = $wmc->xml;
- $_SESSION["epsg"] = $mapObject->epsg;
- $_SESSION["previous_gui"] = $_SESSION["mb_user_gui"];
- $e = new mb_notice("mod_insertWMCIntoDB: save WMC in session succeeded.");
-}
-else {
- if ($user_id && $wmc->wmc_id) {
- $sql = "INSERT INTO mb_user_wmc VALUES ($1, $2, $3, $4, $5)";
- $v = array($wmc->wmc_id, $user_id, $wmc->xml, $generalTitle, time());
- $t = array("s", "i", "s", "s", "s");
-
- $res = db_prep_query($sql, $v, $t);
- if (db_error()) {
- $errMsg = "Error while saving WMC document '" . $generalTitle . "': " . db_error();
- echo $errMsg;
- $e = new mb_exception("mod_insertWMCIntoDB: " . $errMsg);
- }
- else {
- echo "WMC document '" . $generalTitle . "' has been saved.";
- $e = new mb_notice("mod_insertWMCIntoDB: WMC '" . $generalTitle . "' saved successfully.");
- }
- }
- else {
- $e = new mb_exception("mod_insertWMCIntoDB: missing parameters (user_id: ".$user_id.", wmc_id: ".$wmc->wmc_id."))");
- }
-}
-?>
\ No newline at end of file
Copied: branches/nimix_dev/http/php/mod_loadwmc_server.php (from rev 2653, trunk/mapbender/http/php/mod_loadwmc_server.php)
===================================================================
--- branches/nimix_dev/http/php/mod_loadwmc_server.php (rev 0)
+++ branches/nimix_dev/http/php/mod_loadwmc_server.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -0,0 +1,174 @@
+<?php
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+
+/**
+ * encodes and delivers the data
+ *
+ * @param object the un-encoded object
+ */
+function sendOutput($out){
+ global $json;
+ $output = $json->encode($out);
+ header("Content-Type: text/x-json");
+ echo $output;
+}
+
+/**
+ * Get all available WMC documents from the database
+ *
+ * @return mixed[] an array of wmcs
+ * (wmc = assoc. array of "id", "title", "timestamp")
+ */
+function getWmc(){
+ global $con;
+ global $userId;
+
+ $wmcArray = array();
+
+ // get WMC ids
+ $currentUser = new User($userId);
+ $wmcIdArray = $currentUser->getWmcByOwner();
+
+ // get WMC data
+ $v = array();
+ $t = array();
+ $wmcIdList = "";
+
+ for ($i = 0; $i < count($wmcIdArray); $i++) {
+ if ($i > 0) {
+ $wmcIdList .= ",";
+ }
+ $wmcIdList .= "$".($i+1);
+ array_push($v, $wmcIdArray[$i]);
+ array_push($t, 's');
+ }
+
+ $sql = "SELECT DISTINCT wmc_id, wmc_title, wmc_timestamp " .
+ "FROM mb_user_wmc WHERE wmc_id IN (" . $wmcIdList . ") " .
+ "ORDER BY wmc_timestamp DESC";
+
+ $res = db_prep_query($sql, $v, $t);
+ while($row = db_fetch_array($res)){
+ $currentResult = array();
+ $currentResult["id"] = $row["wmc_id"];
+ $currentResult["title"] = $row["wmc_title"];
+ $currentResult["timestamp"] = date("M d Y H:i:s", $row["wmc_timestamp"]);
+ array_push($wmcArray, $currentResult);
+ }
+ return $wmcArray;
+}
+
+$json = new Mapbender_JSON();
+$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
+$resultObj = array();
+
+$e = new mb_exception("command: " . $queryObj->command);
+
+$wmc = new wmc();
+$userId = $_SESSION[mb_user_id];
+
+switch($queryObj->command){
+
+ // gets available WMCs
+ case 'getWmc':
+ $resultObj["wmc"] = getWmc();
+ break;
+
+ // gets XML document of a WMC
+ case 'getWmcDocument':
+ $wmcId = $queryObj->parameters->id;
+ $doc = $wmc->getDocument($wmcId);
+ if (!$doc) {
+ $resultObj["error"] = "The WMC document could not be found.";
+ }
+ else {
+ $resultObj["wmc"] = array("document" => $doc);
+ }
+ break;
+
+ // deletes a WMC
+ case 'deleteWmc':
+ $wmcId = $queryObj->parameters->id;
+ if ($wmc->delete($wmcId)) {
+ $resultObj["success"] = "WMC has been deleted from the database.";
+ }
+ else {
+ $resultObj["error"] = "WMC could not be deleted.";
+ }
+ break;
+
+ // loads a WMC (returns array of JS code)
+ case 'loadWmc':
+ $wmcId = $queryObj->parameters->id;
+ $wmc->createFromDb($wmcId);
+ $jsArray = $wmc->toJavaScript();
+ if ($jsArray) {
+ $resultObj["javascript"] = $jsArray;
+ }
+ else {
+ $resultObj["error"] = "WMC could not be loaded.";
+ }
+ break;
+
+ // merges data with WMC and loads it (returns array of JS code)
+ case 'mergeWmc':
+ $params = $queryObj->parameters;
+
+ // generate a WMC for the current client state
+ $currentWmc = new wmc();
+ $currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
+
+ // get the desired WMC from the database
+ $wmcId = $queryObj->parameters->id;
+ $wmcXml = wmc::getDocument($wmcId);
+
+ // merge the two WMCs
+ $currentWmc->merge($wmcXml);
+
+ // load the merged WMC
+ $jsArray = $currentWmc->toJavaScript();
+
+ if (is_array($jsArray) && count($jsArray) > 0) {
+ $resultObj["javascript"] = $jsArray;
+ }
+ else {
+ $resultObj["error"] = "WMC could not be loaded.";
+ }
+ break;
+
+ // appends a WMC (returns JS code)
+ case 'appendWmc':
+ $params = $queryObj->parameters;
+ // generate a WMC for the current client state
+ $currentWmc = new wmc();
+ $currentWmc->createFromJs($params->mapObject, $params->generalTitle, $params->extensionData);
+
+ // get the desired WMC from the database
+ $wmcId = $queryObj->parameters->id;
+ $wmcXml = wmc::getDocument($wmcId);
+
+ // merge the two WMCs
+ $currentWmc->append($wmcXml);
+
+ // load the merged WMC
+ $jsArray = $currentWmc->toJavaScript();
+
+ if (is_array($jsArray) && count($jsArray) > 0) {
+ $resultObj["javascript"] = $jsArray;
+ }
+ else {
+ $resultObj["error"] = "WMC could not be appended.";
+ }
+ break;
+
+
+ // Invalid command
+ default:
+ $resultObj["error"] = "no action specified...";
+}
+
+sendOutput($resultObj);
+?>
\ No newline at end of file
Modified: branches/nimix_dev/http/php/mod_map1.php
===================================================================
--- branches/nimix_dev/http/php/mod_map1.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_map1.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -48,17 +48,74 @@
echo "var mod_map1_height = '".$e_height."';\n";
echo "</script>\n";
?>
+<!--
+<script type='text/javascript' src='../extensions/jquery-1.2.6.min.js'></script>
+<script type='text/javascript' src='../extensions/jquery.mousewheel.min.js'></script>
+<script type='text/javascript' src='../extensions/jqjson.js'></script>
+-->
<script type="text/javascript">
<!--
+var mapTimeout;
+var sum_delta = 0;
+var lastTimestamp;
+var lastScrollPositionX;
+var lastScrollPositionY;
+
function init () {
+
parent.eventInitMap.register(function init_mod_map1(){
parent.mb_registerMapObj('mapframe1', 'maps', null,mod_map1_width, mod_map1_height);
- document.getElementById("maps").style.width = mod_map1_width;
- document.getElementById("maps").style.height = mod_map1_height;
+
+ parent.$(document, window.frames['mapframe1']).mousewheel(function (event, delta) {
+ if (sum_delta == 0) {
+ mapTimeout = setTimeout(function () {
+ lastScrollPositionX=event.pageX;
+ lastScrollPositionY=event.pageY;
+ mousewheelZoom();
+ },
+ 100);
+ }
+ sum_delta = sum_delta + (delta);
+ var currentTime = new Date();
+ lastTimestamp = currentTime.getTime();
+
+ return false;
+ });
});
}
+function mousewheelZoom () {
+ var currentTime = new Date();
+
+ if (currentTime.getTime() - lastTimestamp > 200) {
+
+ var ind = parent.getMapObjIndexByName('mapframe1');
+ var pos = parent.makeClickPos2RealWorldPos("mapframe1", lastScrollPositionX, lastScrollPositionY);
+
+ if (sum_delta > 0) {
+ parent.zoom("mapframe1", true, Math.pow(parent.mapbender.zoomMousewheel, sum_delta), pos[0],pos[1]);
+ }
+ else {
+ parent.zoom("mapframe1", false, Math.pow(parent.mapbender.zoomMousewheel, -sum_delta), pos[0], pos[1]);
+ }
+
+ var newPosX = parent.parent.mb_mapObj[ind].width - lastScrollPositionX;
+ var newPosY = parent.parent.mb_mapObj[ind].height - lastScrollPositionY;
+
+ var posAfterZoom = parent.makeClickPos2RealWorldPos("mapframe1", newPosX, newPosY);
+ parent.zoom('mapframe1', false, 1.0, posAfterZoom[0], posAfterZoom[1]);
+
+ sum_delta = 0;
+ clearTimeout(mapTimeout);
+ }
+ else {
+ mapTimeout = setTimeout(function () {
+ mousewheelZoom(sum_delta);
+ },
+ 100);
+ }
+}
// -->
</script>
</head>
Modified: branches/nimix_dev/http/php/mod_mapOV.php
===================================================================
--- branches/nimix_dev/http/php/mod_mapOV.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_mapOV.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -68,12 +68,12 @@
document.onmousedown = parent.mod_box_start;
document.onmouseup = mod_ov_getExtent;
document.onmousemove = parent.mod_box_run;
- document.getElementById("maps").style.width = mod_overview_width;
- document.getElementById("maps").style.height = mod_overview_height;
var ind = parent.getMapObjIndexByName('overview');
var ov_extent = parent.mb_mapObj[ind].getExtentInfos();
- parent.mb_setWmcExtensionData({"ov_minx":ov_extent.minx,"ov_miny":ov_extent.miny,"ov_maxx":ov_extent.maxx,"ov_maxy":ov_extent.maxy});
+// parent.mb_setWmcExtensionData({"ov_minx":ov_extent.minx,"ov_miny":ov_extent.miny,"ov_maxx":ov_extent.maxx,"ov_maxy":ov_extent.maxy});
+
+ parent.mb_mapObj[ind].isOverview = true;
});
}
function mod_ov_setHandler(e){
Copied: branches/nimix_dev/http/php/mod_savewmc_server.php (from rev 2653, trunk/mapbender/http/php/mod_savewmc_server.php)
===================================================================
--- branches/nimix_dev/http/php/mod_savewmc_server.php (rev 0)
+++ branches/nimix_dev/http/php/mod_savewmc_server.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -0,0 +1,50 @@
+<?php
+#$Id: mod_insertWmcIntoDb.php 1198 2007-10-18 14:37:52Z baudson $
+#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_wmc.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+
+$json = new Mapbender_JSON();
+
+// get data from POST and SESSION
+$mapObject = $json->decode(stripslashes($_POST["mapObject"]));
+$userId = $_SESSION["mb_user_id"];
+$saveInSession = $_POST["saveInSession"];
+$generalTitle = $_POST["generalTitle"];
+$extensionData = $json->decode(stripslashes($_POST["extensionData"]));
+
+// create WMC object
+$wmc = new wmc();
+$wmc->createFromJs($mapObject, $generalTitle, $extensionData);
+
+if ($saveInSession) {
+ // store XML in session
+ $_SESSION["mb_wmc"] = $wmc->xml;
+ $_SESSION["epsg"] = $mapObject->epsg;
+ $_SESSION["previous_gui"] = $_SESSION["mb_user_gui"];
+ $e = new mb_notice("mod_insertWMCIntoDB: save WMC in session succeeded.");
+}
+else {
+ // insert WMC into database
+ $result = $wmc->insert();
+ echo $result["message"];
+}
+?>
\ No newline at end of file
Modified: branches/nimix_dev/http/php/mod_treefolderClient.php
===================================================================
--- branches/nimix_dev/http/php/mod_treefolderClient.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_treefolderClient.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -204,12 +204,22 @@
cBox[ind]['layer'] = array_layer;
}
}
+function mb_getLayerObjByName(fname,wms_id,layer_name){
+ var ind = parent.getMapObjIndexByName(fname);
+ var wmsInd = parent.getWMSIndexById(fname,wms_id);
+ var t = parent.mb_mapObj[ind].wms[wmsInd];
+ for(var i=0; i < t.objLayer.length; i++){
+ if(t.objLayer[i].layer_name == layer_name){
+ return t.objLayer[i];
+ }
+ }
+}
function checkLayer(){
var checkit;
for(var i=0; i<cBox.length; i++){
checkit = true;
for(var j=0; j<cBox[i]['wms'].length;j++){
- var obj = parent.mb_getLayerObjByName(treetarget,cBox[i]['wms'][j],cBox[i]['layer'][j]);
+ var obj = mb_getLayerObjByName(treetarget,cBox[i]['wms'][j],cBox[i]['layer'][j]);
if(obj){
if(obj.gui_layer_visible == '0' || obj.gui_layer_visible == 0){
checkit = false;
Modified: branches/nimix_dev/http/php/mod_wfs.php
===================================================================
--- branches/nimix_dev/http/php/mod_wfs.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_wfs.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -67,7 +67,7 @@
</script>
<?php
echo "<script language='JavaScript' type='text/javascript'>";
-if(isset($_REQUEST['id'])){
+if(isset($_REQUEST['id']) && $_REQUEST['id']!=""){
$wfs = mb_split(",",$_REQUEST['id']);
$con = db_connect($DBSERVER,$OWNER,$PW);
Modified: branches/nimix_dev/http/php/mod_wfs_conf.php
===================================================================
--- branches/nimix_dev/http/php/mod_wfs_conf.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_wfs_conf.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -65,6 +65,32 @@
}
}
+function controlOperators(checkVal,operatorField,valType){
+ var opSelect = document.getElementById(operatorField);
+ removeChildNodes(opSelect);
+ option1 = new Option("-----","0");
+ opSelect.options[opSelect.length] = option1;
+ if(checkVal==true){
+ opSelect.disabled = '';
+ option2 = new Option("%...%","bothside");
+ opSelect.options[opSelect.length] = option2;
+ option3 = new Option("...%","rightside");
+ opSelect.options[opSelect.length] = option3;
+ option4 = new Option("equal","equal");
+ opSelect.options[opSelect.length] = option4;
+ option5 = new Option(">","greater_than");
+ opSelect.options[opSelect.length] = option5;
+ option6 = new Option("<","less_than");
+ opSelect.options[opSelect.length] = option6;
+ option7 = new Option(">=","greater_equal_than");
+ opSelect.options[opSelect.length] = option7;
+ option8 = new Option("<=","less_equal_than");
+ opSelect.options[opSelect.length] = option8;
+ }
+ else{
+ opSelect.disabled = 'disabled';
+ }
+}
</script>
</head>
@@ -72,9 +98,9 @@
<br>
<b>WFS Configuration</b>
<br>
-<form method='POST' onsubmit='return validate()'>
+<form method='POST' action='<?php echo $self;?>'onsubmit='return validate()'>
<br>
-<a href="mod_wfs_edit.php">edit WFS Configuration</a><br><br>
+<a href="mod_wfs_edit.php?<?php echo $urlParameters;?>">edit WFS Configuration</a><br><br>
Select WFS:
<?php
$aWFS = new wfs_conf();
@@ -95,67 +121,81 @@
db_select_db($DB,$con);
- $sql = "INSERT INTO wfs_conf (wfs_conf_abstract,wfs_conf_description,fkey_wfs_id,fkey_featuretype_id,g_label,g_label_id,g_button,g_button_id,g_style,g_buffer,g_res_style,g_use_wzgraphics) VALUES(";
- $sql .= "'".$_REQUEST["wfs_conf_abstract"]."',";
- $sql .= "'".$_REQUEST["wfs_conf_description"]."',";
- $sql .= "'".$_REQUEST["wfs"]."',";
- $sql .= "'".$_REQUEST["featuretype"]."',";
- $sql .= "'".$_REQUEST["g_label"]."',";
- $sql .= "'".$_REQUEST["g_label_id"]."',";
- $sql .= "'".$_REQUEST["g_button"]."',";
- $sql .= "'".$_REQUEST["g_button_id"]."',";
- $sql .= "'".$_REQUEST["g_style"]."',";
- $sql .= "'".$_REQUEST["g_buffer"]."',";
- $sql .= "'".$_REQUEST["g_res_style"]."',";
+ $sql = "INSERT INTO wfs_conf (";
+ $sql .= "wfs_conf_abstract, fkey_wfs_id, ";
+ $sql .= "fkey_featuretype_id, g_label, g_label_id, g_button, ";
+ $sql .= "g_button_id, g_style, g_buffer, g_res_style, g_use_wzgraphics";
+ $sql .= ") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, ";
if(!empty($_REQUEST["g_use_wzgraphics"])){
$sql .= "'1'";
- }else{$sql .= "'0'";}
+ }
+ else {
+ $sql .= "'0'";
+ }
$sql .= "); ";
- $res = db_query($sql);
+ $v = array($_REQUEST["wfs_conf_abstract"], $_REQUEST["wfs"], $_REQUEST["featuretype"], $_REQUEST["g_label"], $_REQUEST["g_label_id"], $_REQUEST["g_button"], $_REQUEST["g_button_id"], $_REQUEST["g_style"], $_REQUEST["g_buffer"], $_REQUEST["g_res_style"]);
+ $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s");
+ $res = db_prep_query($sql, $v, $t);
+
$wfsID = db_insert_id($con,'wfs_conf','wfs_conf_id');
for($i=0; $i<$_REQUEST["num"]; $i++){
- $sql = "INSERT INTO wfs_conf_element (fkey_wfs_conf_id,f_id,f_search,f_pos,f_style_id,f_toupper,f_label,f_label_id,f_show,f_respos,f_edit,f_form_element_html,f_mandatory,f_auth_varname,f_show_detail) VALUES(";
- $sql .= "'".$wfsID."',";
- $sql .= "'".$_REQUEST["f_id".$i]."',";
- if(!empty($_REQUEST["f_search".$i])){
- $sql .= "'1',";
- }else{$sql .= "'0',";}
- $sql .= "'".$_REQUEST["f_pos".$i]."',";
- $sql .= "'".$_REQUEST["f_style_id".$i]."',";
- if(!empty($_REQUEST["f_toupper".$i])){
- $sql .= "'1',";
- }else{$sql .= "'0',";}
- $sql .= "'".$_REQUEST["f_label".$i]."',";
- $sql .= "'".$_REQUEST["f_label_id".$i]."',";
- if(!empty($_REQUEST["f_show".$i])){
- $sql .= "'1',";
- }else{$sql .= "'0',";}
- $sql .= "'".$_REQUEST["f_respos".$i]."'";
- $sql .= ",";
- if(!empty($_REQUEST["f_edit".$i])){
- $sql .= "'1',";
- }else{$sql .= "'0',";}
- $sql .= "'".$_REQUEST["f_form_element_html".$i]."',";
- if(!empty($_REQUEST["f_mandatory".$i])){
+ $sql = "INSERT INTO wfs_conf_element (fkey_wfs_conf_id,f_id,f_search,f_pos,f_min_input,f_style_id,f_toupper,f_label,f_label_id,f_show,f_respos,f_edit,f_form_element_html,f_mandatory,f_auth_varname,f_show_detail,f_detailpos,f_operator) VALUES(";
+ $sql .= "$1, $2, ";
+ if (!empty($_REQUEST["f_search".$i])) {
$sql .= "'1'";
- }else{$sql .= "'0'";}
- $sql .= ", ";
- $sql .= "'".$_REQUEST["f_auth_varname".$i];
- $sql .= "'";
- $sql .= ", ";
- if(!empty($_REQUEST["f_show_detail".$i])){
- $sql .= "'1'";
- }else{$sql .= "'0'";}
- $sql .= "); ";
+ }
+ else {
+ $sql .= "'0'";
+ }
+ $sql .= ", $3, $4, $5, ";
+ if (!empty($_REQUEST["f_toupper".$i])) {
+ $sql .= "'1'";
+ }
+ else {
+ $sql .= "'0'";
+ }
+ $sql .= ",$6, $7, ";
+ if (!empty($_REQUEST["f_show".$i])) {
+ $sql .= "'1'";
+ }
+ else {
+ $sql .= "'0'";
+ }
+ $sql .= ", $8, ";
+ if (!empty($_REQUEST["f_edit".$i])) {
+ $sql .= "'1'";
+ }
+ else {
+ $sql .= "'0'";
+ }
+ $sql .= ",$9, ";
+ if (!empty($_REQUEST["f_mandatory".$i])) {
+ $sql .= "'1'";
+ }
+ else {
+ $sql .= "'0'";
+ }
+ $sql .= ",$10,";
+ if(!empty($_REQUEST["f_show_detail".$i])){
+ $sql .= "'1'";
+ }
+ else {
+ $sql .= "'0'";
+ }
+ $sql .= ",$11,$12";
+ $sql .= "); ";
- $res = db_query($sql);
+ $v = array($wfsID, $_REQUEST["f_id".$i], $_REQUEST["f_pos".$i], $_REQUEST["f_min_input".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i], $_REQUEST["f_detailpos".$i], $_REQUEST["f_operator".$i]);
+ $t = array("i", "s", "s", "i", "s", "s", "s", "i", "s", "s", "i", "s");
+ $res = db_prep_query($sql, $v, $t);
}
if (isset($_REQUEST["f_geom"])) {
- $sql = "UPDATE wfs_conf_element SET ";
- $sql .= "f_geom = 1";
- $sql .= " WHERE fkey_wfs_conf_id = ".$wfsID." AND f_id = ".$_REQUEST["f_geom"].";";
- $res = db_query($sql);
+ $sql = "UPDATE wfs_conf_element SET f_geom = 1 ";
+ $sql .= "WHERE fkey_wfs_conf_id = $1 AND f_id = $2;";
+ $v = array($wfsID, $_REQUEST["f_geom"]);
+ $t = array("i", "i");
+ $res = db_prep_query($sql, $v, $t);
}
echo "<script language='javascript'>";
echo "document.location.href = 'mod_wfs_edit.php?gaz=".$wfsID."';";
@@ -233,8 +273,7 @@
/* set featuretype options */
echo "<table>";
- echo "<tr><td>Title:</td><td><input type='text' name='wfs_conf_abstract'></td></tr>" ;
- echo "<tr><td>Description:</td><td><input type='text' name='wfs_conf_description'></td></tr>" ;
+ echo "<tr><td>Abstract:</td><td><input type='text' name='wfs_conf_abstract'></td></tr>" ;
echo "<tr><td>Label:</td><td><input type='text' name='g_label'></td></tr>" ;
echo "<tr><td>Label_id:</td><td><input type='text' name='g_label_id'></td></tr>" ;
echo "<tr><td>Button:</td><td><input type='text' name='g_button'></td></tr>" ;
@@ -255,17 +294,20 @@
echo "<td>" . toImage('geom') . "</td>";
echo "<td>" . toImage('search') . "</td>";
echo "<td>" . toImage('pos') . "</td>";
+ echo "<td>" . toImage('minimum_input') . "</td>";
echo "<td>" . toImage('style_id') . "</td>";
echo "<td>" . toImage('upper') . "</td>";
echo "<td>" . toImage('label') . "</td>";
echo "<td>" . toImage('label_id') . "</td>";
echo "<td>" . toImage('show') . "</td>";
+ echo "<td>" . toImage('position') . "</td>";
echo "<td>" . toImage('show_detail') . "</td>";
- echo "<td>" . toImage('position') . "</td>";
+ echo "<td>" . toImage('detail_position') . "</td>";
echo "<td>" . toImage('mandatory') . "</td>";
echo "<td>" . toImage('edit') . "</td>";
echo "<td>" . toImage('html') . "</td>";
echo "<td>" . toImage('auth') . "</td>";
+ echo "<td>" . toImage('operator') . "</td>";
echo "</tr>";
@@ -274,19 +316,31 @@
echo "<td>".$aWFS->elements->element_id[$i]."<input type='hidden' name='f_id".$i."' value='".$aWFS->elements->element_id[$i]."'></td>";
echo "<td>".$aWFS->elements->element_name[$i]."<br><div style='font-size:10'>".$aWFS->elements->element_type[$i]."</div></td>";
echo "<td><input name='f_geom' type='radio' value='".$aWFS->elements->element_id[$i]."'></td>";
- echo "<td><input name='f_search".$i."' type='checkbox'></td>";
+ echo "<td><input name='f_search".$i."' type='checkbox' onclick='controlOperators(document.forms[0].f_search".$i.".checked,\"f_operator".$i."\",\"".$aWFS->elements->element_type[$i]."\");'></td>";
echo "<td><input name='f_pos".$i."' type='text' size='1' value='0'></td>";
+ echo "<td><select name='f_min_input".$i."' id='f_min_input".$i."'>";
+ echo "<option value='0'>-----</option>";
+ echo "<option value='1'>1</option>";
+ echo "<option value='2'>2</option>";
+ echo "<option value='3'>3</option>";
+ echo "<option value='4'>4</option>";
+ echo "<option value='5'>5</option>";
+ echo "</select></td>";
echo "<td><input name='f_style_id".$i."' type='text' size='2' value='0'></td>";
echo "<td><input name='f_toupper".$i."' type='checkbox'></td>";
echo "<td><input name='f_label".$i."' type='text' size='4'></td>";
echo "<td><input name='f_label_id".$i."' type='text' size='2' value='0'></td>";
echo "<td><input name='f_show".$i."' type='checkbox'></td>";
+ echo "<td><input name='f_respos".$i."' type='text' size='1' value='0'></td>";
echo "<td><input name='f_show_detail".$i."' type='checkbox'></td>";
- echo "<td><input name='f_respos".$i."' type='text' size='1' value='0'></td>";
+ echo "<td><input name='f_detailpos".$i."' type='text' size='1' value='0'></td>";
echo "<td><input name='f_mandatory".$i."' type='checkbox'></td>";
echo "<td><input name='f_edit".$i."' type='checkbox'></td>";
echo "<td><textarea name='f_form_element_html".$i."' cols='15' rows='1'></textarea></td>";
echo "<td><input name='f_auth_varname".$i."' type='text' size='8' value=''></td>";
+ echo "<td><select name='f_operator".$i."' id='f_operator".$i."' disabled>";
+ echo "<option value='0'>-----</option>";
+ echo "</select></td>";
echo "</tr>";
}
echo "</table>";
Modified: branches/nimix_dev/http/php/mod_wfs_edit.php
===================================================================
--- branches/nimix_dev/http/php/mod_wfs_edit.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_wfs_edit.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -40,18 +40,6 @@
function validate(){
return true;
}
-function openwindow(Adresse) {
- Fenster1 = window.open(Adresse, "GeoPortal Rheinland-Pfalz - Metadaten", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
- Fenster1.focus();
-}
-
-function removeChildNodes(node) {
- while (node.childNodes.length > 0) {
- var childNode = node.firstChild;
- node.removeChild(childNode);
- }
-}
-
</script>
</head>
@@ -59,100 +47,98 @@
<br>
<b>WFS Configuration</b>
<br><br>
-<form name='form1' method='POST' onsubmit='return validate()'>
-<a href="mod_wfs_conf.php">new Configuration</a><br><br>
+<form name='form1' action='<?php echo $self;?>' method='POST' onsubmit='return validate()'>
+<a href="mod_wfs_conf.php?<?php echo $urlParameters;?>">new Configuration</a><br><br>
Select WFS Configuration:<br><br>
<?php
/* save wfs_conf properties */
-$con = db_connect($DBSERVER,$OWNER,$PW);
-db_select_db($DB,$con);
if(isset($_REQUEST["save"])){
$sql = "UPDATE wfs_conf SET ";
- $sql .= "wfs_conf_abstract = '".$_REQUEST["wfs_conf_abstract"]."',";
- $sql .= "wfs_conf_description = '".$_REQUEST["wfs_conf_description"]."',";
- $sql .= "g_label = '".$_REQUEST["g_label"]."',";
- $sql .= "g_label_id = '".$_REQUEST["g_label_id"]."',";
- $sql .= "g_button = '".$_REQUEST["g_button"]."',";
- $sql .= "g_button_id = '".$_REQUEST["g_button_id"]."',";
- $sql .= "g_style = '".$_REQUEST["g_style"]."',";
- $sql .= "g_buffer = '".$_REQUEST["g_buffer"]."',";
- $sql .= "g_res_style = '".$_REQUEST["g_res_style"]."',";
- $sql .= "g_use_wzgraphics = ";
- if(!empty($_REQUEST["g_use_wzgraphics"])){
- $sql .= '1';
- }else{$sql .= '0';}
- $sql .= " WHERE wfs_conf_id = ".$_REQUEST["gaz"].";";
+ $sql .= "wfs_conf_abstract = $1, g_label = $2, ";
+ $sql .= "g_label_id = $3, g_button = $4, g_button_id = $5, g_style = $6, ";
+ $sql .= "g_buffer = $7, g_res_style = $8, g_use_wzgraphics = ";
+ if (!empty($_REQUEST["g_use_wzgraphics"])) {
+ $sql .= "1";
+ }
+ else {
+ $sql .= "0";
+ }
+ $sql .= " WHERE wfs_conf_id = $9;";
- $res = db_query($sql);
+ $v = array($_REQUEST["wfs_conf_abstract"], $_REQUEST["g_label"], $_REQUEST["g_label_id"], $_REQUEST["g_button"], $_REQUEST["g_button_id"], $_REQUEST["g_style"], $_REQUEST["g_buffer"], $_REQUEST["g_res_style"], $_REQUEST["gaz"]);
+ $t = array("s", "s", "s", "s", "s", "s", "s", "i", "s");
+ $res = db_prep_query($sql, $v, $t);
if (isset($_REQUEST["f_geom"])) {
- $sql = "UPDATE wfs_conf_element SET ";
- $sql .= "f_geom = 1";
- $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." AND f_id = ".$_REQUEST["f_geom"].";";
- $res = db_query($sql);
+ $sql = "UPDATE wfs_conf_element SET f_geom = 1 ";
+ $sql .= "WHERE fkey_wfs_conf_id = $1 AND f_id = $2;";
+ $v = array($_REQUEST["gaz"], $_REQUEST["f_geom"]);
+ $t = array("i", "s");
+ $res = db_prep_query($sql, $v, $t);
- $sql = "UPDATE wfs_conf_element SET ";
- $sql .= "f_geom = 0";
- $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." AND f_id <> ".$_REQUEST["f_geom"].";";
- $res = db_query($sql);
+ $sql = "UPDATE wfs_conf_element SET f_geom = 0 ";
+ $sql .= "WHERE fkey_wfs_conf_id = $1 AND f_id <> $2;";
+ $v = array($_REQUEST["gaz"], $_REQUEST["f_geom"]);
+ $t = array("i", "s");
+ $res = db_prep_query($sql, $v, $t);
}
else {
- $sql = "UPDATE wfs_conf_element SET ";
- $sql .= "f_geom = 0";
- $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"].";";
- $res = db_query($sql);
+ $sql = "UPDATE wfs_conf_element SET f_geom = 0 ";
+ $sql .= "WHERE fkey_wfs_conf_id = $1;";
+ $v = array($_REQUEST["gaz"]);
+ $t = array("i");
+ $res = db_prep_query($sql, $v, $t);
}
for($i=0; $i<$_REQUEST["num"]; $i++){
- $sql = "UPDATE wfs_conf_element SET ";
- $sql .= "f_search = '";
- if(!empty($_REQUEST["f_search".$i])){
- $sql .= '1';
- }else{$sql .= '0';}
- $sql .= "',";
- $sql .= "f_pos = '".$_REQUEST["f_pos".$i]."',";
- $sql .= "f_style_id = '".$_REQUEST["f_style_id".$i]."',";
+ $sql = "UPDATE wfs_conf_element SET f_search = '";
+ if (!empty($_REQUEST["f_search".$i])) {
+ $sql .= "1";
+ }
+ else {
+ $sql .= "0";
+ }
+ $sql .= "', f_pos = $1, f_style_id = $2,";
$sql .= "f_toupper = '" ;
- if(!empty($_REQUEST["f_toupper".$i])){
- $sql .= '1';
- }else{$sql .= '0';}
- $sql .= "',";
- $sql .= "f_label = '".$_REQUEST["f_label".$i]."',";
- $sql .= "f_label_id = '".$_REQUEST["f_label_id".$i]."',";
+ if (!empty($_REQUEST["f_toupper".$i])) {
+ $sql .= "1";
+ }
+ else {
+ $sql .= "0";
+ }
+ $sql .= "',f_label = $3, f_label_id = $4,";
$sql .= "f_show = '";
- if(!empty($_REQUEST["f_show".$i])){
- $sql .= '1';
- }else{$sql .= '0';}
- $sql .= "',";
- $sql .= "f_respos = '".$_REQUEST["f_respos".$i]."' ";
- $sql .= ",";
+ if (!empty($_REQUEST["f_show".$i])) {
+ $sql .= "1";
+ }
+ else {
+ $sql .= "0";
+ }
+ $sql .= "',f_respos = $5,";
$sql .= "f_edit = '";
- if(!empty($_REQUEST["f_edit".$i])){
- $sql .= '1';
- }else{$sql .= '0';}
- $sql .= "',";
- $sql .= "f_form_element_html = '".$_REQUEST["f_form_element_html".$i];
- $sql .= "',";
+ if (!empty($_REQUEST["f_edit".$i])) {
+ $sql .= "1";
+ }
+ else {
+ $sql .= "0";
+ }
+ $sql .= "', f_form_element_html = $6,";
$sql .= "f_mandatory = '";
- if(!empty($_REQUEST["f_mandatory".$i])){
+ if (!empty($_REQUEST["f_mandatory".$i])) {
$sql .= "1";
- }else{$sql .= "0";}
- $sql .= "'";
- $sql .= ", ";
- $sql .= "f_auth_varname = '".$_REQUEST["f_auth_varname".$i];
- $sql .= "'";
- $sql .= ", ";
- $sql .= "f_show_detail = '";
- if(!empty($_REQUEST["f_show_detail".$i])){
- $sql .= '1';
- }else{$sql .= '0';}
- $sql .= "'";
- $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." AND f_id = ".$_REQUEST["f_id".$i].";";
-
- $res = db_query($sql);
+ }
+ else {
+ $sql .= "0";
+ }
+ $sql .= "', f_auth_varname = $7";
+ $sql .= " WHERE fkey_wfs_conf_id = $8 AND f_id = $9;";
+
+ $v = array($_REQUEST["f_pos".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i], $_REQUEST["gaz"], $_REQUEST["f_id".$i]);
+ $t = array("s", "s", "s", "s", "s", "s", "s", "i", "s");
+ $res = db_prep_query($sql, $v, $t);
}
}
@@ -160,10 +146,8 @@
/* select wfs */
-$sql = "SELECT * FROM wfs_conf, wfs WHERE wfs.wfs_owner = $1 AND wfs_conf.fkey_wfs_id = wfs.wfs_id";
-$v = array($_SESSION['mb_user_id']);
-$t = array('i');
-$res = db_prep_query($sql,$v,$t);
+$sql = "SELECT * FROM wfs_conf";
+$res = db_query($sql);
echo "<select size='10' name='gaz' onchange='submit()'>";
$cnt = 0;
while($row = db_fetch_array($res)){
@@ -189,15 +173,15 @@
}
/* configure elements */
-if(isset($_REQUEST["gaz"])){
- $sql = "SELECT * FROM wfs_conf WHERE wfs_conf_id = ".$_REQUEST["gaz"];
- $res = db_query($sql);
+if (isset($_REQUEST["gaz"])) {
+ $sql = "SELECT * FROM wfs_conf WHERE wfs_conf_id = $1";
+ $v = array($_REQUEST["gaz"]);
+ $t = array("i");
+ $res = db_prep_query($sql, $v, $t);
if($row = db_fetch_array($res)){
echo "<table>";
- #echo "<tr><td><a onclick='openwindow(this.href); return false' target='_blank' href='../x_geoportal/mod_featuretypeMetadata.php?wfs_conf_id=".$row["wfs_conf_id"]."'>Link zum WFS</a></td></tr>";
echo "<tr><td>GazetterID:</td><td>".$row["wfs_conf_id"]."</td></tr>" ;
- echo "<tr><td>Title:</td><td><input type='text' name='wfs_conf_abstract' value='".$row["wfs_conf_abstract"]."'></td></tr>" ;
- echo "<tr><td>Description:</td><td><input type='text' name='wfs_conf_description' value='".$row["wfs_conf_description"]."'></td></tr>" ;
+ echo "<tr><td>Abstract:</td><td><input type='text' name='wfs_conf_abstract' value='".$row["wfs_conf_abstract"]."'></td></tr>" ;
echo "<tr><td>Label:</td><td><input type='text' name='g_label' value='".$row["g_label"]."'></td></tr>" ;
echo "<tr><td>Label_id:</td><td><input type='text' name='g_label_id' value='".$row["g_label_id"]."'></td></tr>" ;
echo "<tr><td>Button:</td><td><input type='text' name='g_button' value='".$row["g_button"]."'></td></tr>" ;
@@ -205,18 +189,19 @@
echo "<tr><td>Style:</td><td><textarea cols=50 rows=5 name='g_style'>".$row["g_style"]."</textarea></td></tr>" ;
echo "<tr><td>Buffer:</td><td><input type='text' size='4' name='g_buffer' value='".$row["g_buffer"]."'></td></tr>" ;
echo "<tr><td>ResultStyle:</td><td><textarea cols=50 rows=5 name='g_res_style'>".$row["g_res_style"]."</textarea></td></tr>" ;
-// echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'";
-// if($row["g_use_wzgraphics"] == 1){ echo " checked"; }
-// echo "></td></tr>";
+ echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'";
+ if($row["g_use_wzgraphics"] == 1){ echo " checked"; }
+ echo "></td></tr>";
echo "</table>";
}
/* set element options */
$sql = "SELECT * FROM wfs_conf_element ";
$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
- $sql .= "WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." ORDER BY f_id";
-
- $res = db_query($sql);
+ $sql .= "WHERE fkey_wfs_conf_id = $1 ORDER BY f_id";
+ $v = array($_REQUEST["gaz"]);
+ $t = array("i");
+ $res = db_prep_query($sql, $v, $t);
echo "<table border='1'>";
echo "<tr valign = bottom>";
@@ -230,13 +215,10 @@
echo "<td>" . toImage('label') . "</td>";
echo "<td>" . toImage('label_id') . "</td>";
echo "<td>" . toImage('show') . "</td>";
- echo "<td>" . toImage('show_detail') . "</td>";
echo "<td>" . toImage('position') . "</td>";
echo "<td>" . toImage('mandatory') . "</td>";
echo "<td>" . toImage('edit') . "</td>";
echo "<td>" . toImage('html') . "</td>";
- echo "<td>" . toImage('auth') . "</td>";
-
echo "</tr>";
$cnt = 0;
while($row = db_fetch_array($res)){
@@ -263,9 +245,6 @@
echo "<td><input name='f_show".$cnt."' type='checkbox'";
if($row["f_show"] == 1){ echo " checked"; }
echo "></td>";
- echo "<td><input name='f_show_detail".$cnt."' type='checkbox'";
- if($row["f_show_detail"] == 1){ echo " checked"; }
- echo "></td>";
echo "<td><input name='f_respos".$cnt."' type='text' size='1' value='".$row["f_respos"]."'></td>";
echo "<td><input name='f_mandatory".$cnt."' type='checkbox'";
if($row["f_mandatory"] == 1){ echo " checked"; }
@@ -274,7 +253,6 @@
if($row["f_edit"] == 1){ echo " checked"; }
echo "></td>";
echo "<td><textarea name='f_form_element_html".$cnt."' cols='15' rows='1' >".$row["f_form_element_html"]."</textarea></td>";
- echo "<td><input name='f_auth_varname".$cnt."' type='text' size='8' value='".$row["f_auth_varname"]."'></td>";
echo "</tr>";
$cnt++;
}
Modified: branches/nimix_dev/http/php/mod_wfs_gazetteer_server.php
===================================================================
--- branches/nimix_dev/http/php/mod_wfs_gazetteer_server.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_wfs_gazetteer_server.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -144,22 +144,10 @@
$req = urldecode($url).urlencode($admin->char_decode(stripslashes($filter)));
$mygml = new gml2();
- $mygml->parsegml($req);
+ $mygml->parseFile($req);
- // generates JavaScript code that will add a geometry array containing
- // all the result geometries and their attributes (wfs_conf_elements)
-
- $js = "";
- if ($mygml->getMemberCount() > 0) {
- $js .= $mygml->exportGeometriesToJS(true);
-
- for ($i = 0; $i < $mygml->getMemberCount(); $i++) {
- for ($j = 0; $j < count($col); $j++){
- $js .= "geom.get(".$i.").e.setElement('".$j."', '".$mygml->getValueBySeparatedKey($i, $col[$j]) . "');\n";
- }
- }
- }
- echo $js;
+ header("Content-type:application/x-json; charset=utf-8");
+ echo $mygml->toGeoJSON();
}
else {
echo "please enter a valid command.";
Modified: branches/nimix_dev/http/php/mod_zoomCoords_en.php
===================================================================
--- branches/nimix_dev/http/php/mod_zoomCoords_en.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/mod_zoomCoords_en.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -81,7 +81,7 @@
<?php
echo '<script type="text/javascript">';
-echo "var mod_zoomCoords_target = '".$e_target[0]."';";
+echo "var mod_zoomCoords_target = '".$e_target."';";
echo "var target = mod_zoomCoords_target.split(',');";
@@ -104,14 +104,14 @@
var valid = true;
/* if(parseFloat(coordx) < 5.88 || parseFloat(coordx) > 15){
- alert("Eingabe unzul�ssig!");
+ alert("Eingabe unzulässig!");
document.form1.X.select();
document.form1.X.focus();
valid = false;
return false;
}
if(parseFloat(coordy) < 46.62 || parseFloat(coordy) > 55.71){
- alert("Eingabe unzul�ssig!");
+ alert("Eingabe unzulässig!");
document.form1.Y.select();
document.form1.Y.focus();
valid = false;
@@ -128,20 +128,21 @@
}
function highlight(x, y){
-
- x=x.replace(",",".");
- y=y.replace(",",".");
-
- document.form1.X.value=x;
- document.form1.Y.value=y;
-
- if (isNaN(x)==true || isNaN(y)==true){
-
- }
- else{
- parent.mb_showHighlight(target[0],x,y);
- parent.mb_showHighlight(target[1],x,y);
- }
+ if(x!='' && y!=''){
+ x=x.replace(",",".");
+ y=y.replace(",",".");
+
+ document.form1.X.value=x;
+ document.form1.Y.value=y;
+
+ if (isNaN(x)==true || isNaN(y)==true){
+
+ }
+ else{
+ parent.mb_showHighlight(target[0],x,y);
+ parent.mb_showHighlight(target[1],x,y);
+ }
+ }
}
function hideHighlight(){
@@ -171,7 +172,7 @@
echo "<span class='labely'>Y-Coordinate:</span>";
echo "<input class='textx' type='text' name='X'>";
echo "<input class='texty' type='text' name='Y'>";
- echo "<input class='send' type='button' value='ok' onclick='zoomCoordinate();' onmouseover='highlight(document.form1.X.value, document.form1.Y.value)' onmouseout='hideHighlight(document.form1.X.value, document.form1.Y.value)' >";
+ echo "<input class='send' type='button' value='ok' onclick='zoomCoordinate();' onmouseover='highlight(document.form1.X.value, document.form1.Y.value)' onmouseout='if(document.form1.X.value !=\"\" && document.form1.Y.value !=\"\"){hideHighlight(document.form1.X.value, document.form1.Y.value);}' >";
?>
</form>
Modified: branches/nimix_dev/http/php/system.php
===================================================================
--- branches/nimix_dev/http/php/system.php 2008-08-18 13:57:32 UTC (rev 2841)
+++ branches/nimix_dev/http/php/system.php 2008-08-18 13:59:57 UTC (rev 2842)
@@ -28,8 +28,10 @@
#
define("MB_RESOLUTION", "28.35");
define("MB_FEATURE_COUNT", "100");
-
+define("MB_SECURITY_PROXY", "http://wms1.ccgis.de/mapbender/tools/security_proxy.php?mb_ows_security_proxy=");
#
# available log levels
#
-define("LOG_LEVEL_LIST", "off,error,warning,notice,all");
\ No newline at end of file
+define("LOG_LEVEL_LIST", "off,error,warning,notice,all");
+
+define("ZOOM_MOUSEWHEEL", "1.1");
\ No newline at end of file
More information about the Mapbender_commits
mailing list