[Mapbender-commits] r8809 - in trunk/mapbender: conf http/classes http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Apr 1 07:34:09 PDT 2014


Author: armin11
Date: 2014-04-01 07:34:09 -0700 (Tue, 01 Apr 2014)
New Revision: 8809

Modified:
   trunk/mapbender/conf/mapbender.conf-dist
   trunk/mapbender/http/classes/class_wms_owsproxy_log.php
   trunk/mapbender/http/plugins/mb_owsproxy_log_csv.js
   trunk/mapbender/http/plugins/mb_owsproxy_log_csv.php
Log:
Bugfixes for owsproxy_log, define LIMIT for LOG export in mapbender.conf

Modified: trunk/mapbender/conf/mapbender.conf-dist
===================================================================
--- trunk/mapbender/conf/mapbender.conf-dist	2014-04-01 07:15:51 UTC (rev 8808)
+++ trunk/mapbender/conf/mapbender.conf-dist	2014-04-01 14:34:09 UTC (rev 8809)
@@ -69,6 +69,9 @@
 #define("OWSPROXY_SESSION_GRABBING_WHITELIST", "localhost,127.0.0.1");
 #Parameter to steer if owsproxy support mapbender hq printing for mapserver with duplicated mapfiles named _4.map
 define("OWSPROXY_SUPPORT_HQ_PRINTING", false);
+# LIMIT for count of rows, that maybe exported at once from owsproxy_log module
+#define("OWS_LOG_EXPORT_LIMIT_CSV", 1000);
+define("OWS_LOG_EXPORT_LIMIT", 1000);
 #
 # --------------------------------------------
 # Definitions for HTTP Authentication

Modified: trunk/mapbender/http/classes/class_wms_owsproxy_log.php
===================================================================
--- trunk/mapbender/http/classes/class_wms_owsproxy_log.php	2014-04-01 07:15:51 UTC (rev 8808)
+++ trunk/mapbender/http/classes/class_wms_owsproxy_log.php	2014-04-01 14:34:09 UTC (rev 8809)
@@ -25,7 +25,7 @@
     private static $SEPARATOR_VALUE = "\t";
     private static $SEPARATOR_ROW = "\n";
     
-    private static $LIMIT_INT = 1000;
+    private static $LIMIT_INT = OWS_LOG_EXPORT_LIMIT;
     
     private static $LIMIT_SQL = " ORDER BY m.log_id DESC LIMIT ";
     
@@ -204,7 +204,7 @@
                     ." (m.fkey_wms_id = w.wms_id AND w.wms_owner=$4"
                     ." AND m.fkey_wms_id = $1 AND  m.proxy_log_timestamp >= $2"
                     ." AND m.proxy_log_timestamp <= $3)".$join
-                    ." GROUP BY ".$selectColumns
+                    ." GROUP BY m.log_id, ".$selectColumns
 		    . WmsOwsLogCsv::$LIMIT_SQL . WmsOwsLogCsv::$LIMIT_INT;
             
             $result = db_prep_query($sql,$v,$t);
@@ -230,7 +230,7 @@
                     ." (m.fkey_wms_id = w.wms_id AND w.wms_owner=$4"
                     ." AND m.fkey_mb_user_id = $1 AND m.proxy_log_timestamp >= $2"
                     ." AND m.proxy_log_timestamp <= $3".$whereWms.")".$join
-                    ." GROUP BY ".$selectColumns
+                    ." GROUP BY m.log_id, ".$selectColumns
 		    . WmsOwsLogCsv::$LIMIT_SQL . WmsOwsLogCsv::$LIMIT_INT;
             $result = db_prep_query($sql,$v,$t);
             $this->readResult($result);
@@ -312,17 +312,17 @@
         $offsetPrice = null;
         $sumPixel = 0;
         $sumPrice = 0;
+        if ($result != false) {
+            $num_fields = pg_num_fields($result);
+            for ( $i = 0; $i < $num_fields; $i++ ){
+                $field_name = pg_field_name($result , $i);
+                $this->resultHeader[] = $field_name;
 
-        $num_fields = pg_num_fields($result);
-        for ( $i = 0; $i < $num_fields; $i++ ){
-            $field_name = pg_field_name($result , $i);
-            $this->resultHeader[] = $field_name;
-
-            // keep offsets of prixel and price row
-            if($field_name === "pixel")        $offsetPixel = $i;
-            else if($field_name === "price")   $offsetPrice = $i;
+                // keep offsets of prixel and price row
+                if($field_name === "pixel")        $offsetPixel = $i;
+                else if($field_name === "price")   $offsetPrice = $i;
+            }
         }
-
         $i = 0;
         while($row = db_fetch_row($result)){
             foreach( $row as $key=>$value){

Modified: trunk/mapbender/http/plugins/mb_owsproxy_log_csv.js
===================================================================
--- trunk/mapbender/http/plugins/mb_owsproxy_log_csv.js	2014-04-01 07:15:51 UTC (rev 8808)
+++ trunk/mapbender/http/plugins/mb_owsproxy_log_csv.js	2014-04-01 14:34:09 UTC (rev 8809)
@@ -149,7 +149,9 @@
             type: "post",
             dataType: "json",
             data: parameter,
+            async: false,
             success: function(data){
+                //alert(data.header);
                 lastRequestData = null;
                 if(data.error != "") {
                     alert(data.error);

Modified: trunk/mapbender/http/plugins/mb_owsproxy_log_csv.php
===================================================================
--- trunk/mapbender/http/plugins/mb_owsproxy_log_csv.php	2014-04-01 07:15:51 UTC (rev 8808)
+++ trunk/mapbender/http/plugins/mb_owsproxy_log_csv.php	2014-04-01 14:34:09 UTC (rev 8809)
@@ -2,6 +2,7 @@
 
 require_once dirname(__FILE__) . "/../../core/globalSettings.php";
 
+$LIMIT_INT = OWS_LOG_EXPORT_LIMIT;
 
 if(isset($_REQUEST['userGuiId'])) {
     $id = (integer)$_REQUEST['userGuiId'];
@@ -31,12 +32,11 @@
     $t = array('i');
     $users = array();
     $wmses = array();
-    $sql = "SELECT w.wms_id,w.wms_title,u.mb_user_id,u.mb_user_name,m.log_id"
+    $sql = "SELECT DISTINCT u.mb_user_id, w.wms_id,w.wms_title,u.mb_user_name"
             ." FROM mb_proxy_log AS m INNER JOIN wms AS w ON"
             ." (m.fkey_wms_id = w.wms_id AND w.wms_owner=$1)"
             ." INNER JOIN mb_user u ON(m.fkey_mb_user_id = u.mb_user_id)"
-	    ." ORDER BY m.log_id DESC LIMIT 1000";
-
+	    ." ORDER BY u.mb_user_name ASC, u.mb_user_id ";
     $result = db_prep_query($sql,$v,$t);
     while($row = db_fetch_assoc($result)){
         $users[$row['mb_user_id']] = $row['mb_user_name'];
@@ -181,4 +181,4 @@
         die ("Der 'serviceType'".$serviceType." ist nicht unterstuetzt.");
     }
 }
-?>
\ No newline at end of file
+?>



More information about the Mapbender_commits mailing list