Przeglądaj źródła

Merge branch 'master' of ssh://biuro.biall-net.pl:2222/plabudda/se

Mariusz Muszyński 9 lat temu
rodzic
commit
52928e4503

+ 0 - 329
SE/dev/php-cli/biale_plamy-find_ways.php

@@ -1,329 +0,0 @@
-<?php
-$_SERVER['SERVER_NAME'] = 'biuro.biall-net.pl';
-
-
-//when used in /Library/Server/Web/Data/Sites/bzyk-biale-plamy-php-temp/SE/dev on biuro.biall-net.pl
-if( file_exists ( "../../se-lib/bootstrap.php"))
-require("../../se-lib/bootstrap.php");
-//when used in  in native SE
-else require("../../../../SE-production-git/SE/se-lib/bootstrap.php");
-
-Lib::loadClass("Vendor_Geophp");
-
-
-
-function init_sh_check() {
-    //check if run from bash
-    if(isset($_SERVER["argv"])) {
-        if(@$_SERVER["argv"][1]=='--help') {
-            echo "
-                Options are:
-                php ".$_SERVER["argv"][0]." --check   - control if we have needed tables/data
-                
-                .EOF
-            ";
-        } else if(@$_SERVER["argv"][1]=='--check') { 
-            check();
-        } else echo " bad option, try:
-            php ".$_SERVER["argv"][0]." --help
-            
-            .EOF
-            ";
-    } else {
-        echo "<br> this script could be run from bash e.g. php biale_plamy.php --help <br>" ;
-        check();
-    }
-}
-
-
-
-function check() {
-	echo "<br>\n i run check()";
-    //todo to set arguments to rebuild tables etc:
-    $check_tbls=array('Rozdzielcza_test_bzyk_drogi','Rozdzielcza_test_bzyk_joins','Rozdzielcza_test_bzyk_przylacza_HIST',
-                    'Rozdzielcza_test_bzyk_przylacza','Rozdzielcza_test_bzyk_punkty_adresowe','Rozdzielcza_test_bzyk_ways');
-
-    //$tables =  DB::getPDO()->list_tables();
-    foreach($check_tbls as $tbl) {
-        $query = "select ID from ".$tbl." limit 1 ";
-        echo "<br>\nresult chk for tbl:".$tbl." ;";
-        
-        try{
-            $result = DB::getPDO()->fetchall($query);
-        } catch(Exception $exception) {
-            // return $exception;
-            echo "<br>\n jest blad z tbl:".$tbl." i get sample table structure with data from ../sql/".$tbl.".sql  - it should be manually replaced by correct/newer!";
-            $sql = file_get_contents('../sql/'.$tbl.'.sql');
-            
-            try{
-                $result = DB::getPDO()->fetchall($sql);
-            } catch(Exception $exception2) {
-                echo "<br>\n jest blad dump dla tbl:".$tbl;
-            }
-        } 
-        //	print_r($exception);
-        print_r($result);
-    }
-}
-
-init_sh_check();   
-
-$ways2joins = unserialize(file_get_contents('/tmp/save_ways2joins.txt'));
-$joins2ways = unserialize(file_get_contents('/tmp/save_joins2ways.txt'));
-$points2joins = unserialize(file_get_contents('/tmp/save_points2joins.txt'));
-$joins_asText = unserialize(file_get_contents('/tmp/save_joins_asText.txt'));
-$ways_asText = unserialize(file_get_contents('/tmp/save_ways_asText.txt'));
-$points_asText = unserialize(file_get_contents('/tmp/save_points_asText.txt'));
-
-$edge_joins=simplexml_load_file("edge_joins.xml");
-$edge_joins->registerXPathNamespace('bp', 'https://procesy5.pl/biale_plamy-schema.xsd');
-
-//print_r($edge_joins);
-foreach($edge_joins->children() as $child)  {
- // echo "\n<br>";
-	   //$attrs=$child->attributes("ID_Way");
-
-	   foreach($child->attributes() as $a=>$b) {
-		   //	echo "#87Child";print_r($b[0]);
-		   $ID_Way=$b[0];
-	   }
-	  //echo $child->getName() . ": " . " ID_Way: ".$ID_Way. " : ";
-	
-	   $id_j=0; 
-	   settype($ID_Way, "integer");
-	   //$ID_Way=var_dump($ID_Way);
-	   
-	 //  echo "#88Child:"; print_r($ID_Way);
-	   //$edge_joins_path['ID_Way'][$attrs['ID_Way']]=array();
-	   foreach($child->children('https://procesy5.pl/biale_plamy-schema.xsd') as $edge_joins_xml)  {
-		   $id_j++;
-		   $attrs_join=$edge_joins_xml->attributes();
-		   //echo " #93 ID_Join ".$attrs_join["Joins"]." ";
-		   $Join=$attrs_join["Joins"][0];
-		   settype($Join, "integer");
-		   $edge_joins_path[$ID_Way][$id_j]=$attrs_join["Joins"][0];
-	   }
-}
-
-//print_r($edge_joins_path);
-
-
-
-function joins2lineString($joins_keys) {
-	global $joins_asText;
-	if ($joins_keys) {
-		foreach ($joins_keys as $join_key) {
-			$points[] = Vendor_Geophp::load($joins_asText[$join_key], 'wkt');
-		}
-		return new LineString($points);
-	} else return null;
-}
-
-function findWay($joinA, $joinB, $path = array()) {
-	global $ways2joins, $joins2ways, $points2joins, $ways_asText, $points_asText;
-	if ($joinA == $joinB) {
-		$joinsPath = array($joinB);
-		foreach (array_reverse($path) as $way_key) {
-			array_unshift($joinsPath, $ways2joins[$way_key][1 - array_search($joinsPath[0], $ways2joins[$way_key])]);
-		}
-		return $joinsPath;
-	} else {
-		$subPaths = array();
-		foreach ($joins2ways[$joinA] as $way_key) {
-			if (!in_array($way_key, $path)) {
-				$new_join = $ways2joins[$way_key][1 - array_search($joinA,  $ways2joins[$way_key])];
-				if ($subPath = findWay($new_join, $joinB, array_merge($path,array($way_key)))) $subPaths[] = $subPath;
-			}
-		}
-		if ($subPaths) {
-			if (count($subPaths) == 1) return $subPaths[0];
-			else {
-				$shortestKey = 0;
-				foreach ($subPaths as $key => $subPath) {
-					$distance_cur = 0;
-					foreach ($subPath as $way_key) {
-						$way = Vendor_Geophp::load($ways_asText[$way_key], 'wkt');
-						if ($way) $distance_cur += Vendor_Geophp::load($ways_asText[$way_key], 'wkt')->length();
-						else $distance_cur += 999;
-					}
-					if (!$shortestKey || ($shortestKey && $distance_cur < $distance)) {
-						$shortestKey = $key;
-						$distance = $distance_cur;
-					}
-				}
-				return $subPaths[$key];
-			}
-		}
-		else {
-			return null;
-		}
-	}
-}
-
-function findJoinInDB($id) {
-	global $joins_asText;
-	$join = DB::getPDO()->fetchValue("select astext(the_geom) from Rozdzielcza_test_bzyk_joins where ID='{$id}'");
-	if ($join) {
-		$join = Vendor_Geophp::load($join, 'wkt')->asText();
-		$key = array_search($join, $joins_asText);
-		if ($key) return $key;
-		else return null;
-	} else return null;
-}
-
-
-
-function array_to_xml( $data, &$xml_data ) {
-    foreach( $data as $key => $value ) {
-        $key_="";
-        
-        if( is_numeric($key) ){
-            $key_ = 'item';
-        }
-        
-        if( is_array($value) ) {
-            $subnode = $xml_data->addChild($key_);
-			$subnode->addAttribute('id', $key);
-            array_to_xml($value, $subnode);
-        } else {
-	       // $test_expl=explode(" ", $value);
-					//preg_match('/[a-zA-Z]/', $value[0])
-	        //if($key_=="" and !isset($test_expl[1])  )  $key_=htmlspecialchars("$value");
-	        //czy nie jest jeden element array
-	        if($key_=="" and  count($data[$key]==1)) {
-		   		 $subnode=$xml_data->addChild("$key",htmlspecialchars("$value"));
-		    } else  
-            $subnode=$xml_data->addChild("$key_",htmlspecialchars("$value"));
-            if( is_numeric($key) ){
-	            $subnode->addAttribute('id', $key);
-	        }
-        }
-     }
-}
-
-#echo joins2lineString($res = findWay(100,110))->asText();
-#echo joins2lineString($res = findWay(25690,20134))->asText();
-#$path = joins2lineString(findWay(25690,23039));
-
-
-
-//$path = joins2lineString(findWay(findJoinInDB(49),findJoinInDB(50)));
-
-
-//generujemy path do $edge_joins_filled_paths
- DB::getPDO()->query("truncate table Rozdzielcza_test_bzyk_paths");
-
-unset($ID_Way);
-
-$edge_joins_filled_paths=array();
-foreach($edge_joins_path as $ID_Way=>$Joins_arr) {
-	settype($ID_Way, "integer");
-	$edge_joins_filled_paths[$ID_Way]['tried']=1;
-	if(isset($Joins_arr[1]) and isset($Joins_arr[2]))  {
-			   $pkt_A=$Joins_arr[1];$pkt_B=$Joins_arr[2];
-			   settype($pkt_A, "integer"); settype($pkt_B, "integer");
-
-		echo "\n<br> Generuje dla ID_Way:".$ID_Way." i joins ".$pkt_A." , ".$pkt_B." ";
-		unset($res);unset($path);
-		$res = findWay($pkt_A,$pkt_B);
-		$path = joins2lineString($res)->asText();
-		//   joins2lineString(findWay(389,404));
-		settype($path, "string");
-		$edge_joins_filled_paths[$ID_Way]['asText'] = $path;
-			$distance = 0;
-				foreach ($res as $way_key) {
-					if(isset($ways_asText[$way_key]))
-					$distance += Vendor_Geophp::load($ways_asText[$way_key], 'wkt')->greatCircleLength();
-				}
-		$edge_joins_filled_paths[$ID_Way]['distance'] = $distance;
-		//joins2lineString(findWay($Joins_arr[1],$Joins_arr[2]));
-		//joins2lineString($res = findWay($joinAB['A'],$joinAB['B']))->asText();
-		$sql_insert_path="insert into Rozdzielcza_test_bzyk_paths (the_geom,ID_Way, A_RECORD_CREATE_DATE )
-		     values (ST_GeomFromText('".$edge_joins_filled_paths[$ID_Way]['asText']."'),'".$ID_Way."' , now()   )   ";
-		    echo "#216Query path ins:: ".$sql_insert_path." , distance:".$distance." ";
-		    if(strlen($edge_joins_filled_paths[$ID_Way]['asText'])>2)
-		      DB::getPDO()->query($sql_insert_path);
-		    else echo "#296 path nie wygenerowalo sie !! dla ".$ID_Way." i pkt ".$pkt_A." , ".$pkt_B." \n";
-
-	} else echo "\n#220 droga nie ma koncow ID_Way::".$ID_Way;
-}
-
-
-echo "<br>\n edge_joins_filled_paths:";
-print_r($edge_joins_filled_paths);
-
-
-//save
- 	unset($xml_data);
-
-file_put_contents('edge_joins_filled_paths.txt',serialize($edge_joins_filled_paths));
- 	ob_start();print_r($edge_joins_filled_paths); $contents = ob_get_contents();ob_end_clean();  
- 	file_put_contents('edge_joins_filled_paths_print_r.txt',$contents);
- 	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><edge_joins_filled_paths></edge_joins_filled_paths>');
- 	array_to_xml($edge_joins_filled_paths,$xml_data);
- 	print $xml_data->asXML("edge_joins_filled_paths.xml");
- 	unset($xml_data);
-  
-
-
-//test
- 	$timeStart = microtime();
- 	$res = findWay(389,404);
- 	$path=joins2lineString($res)->asText();
-	$timeEnd = microtime();
-		
-		if ($path) {
-			echo $path."\n";
-		} else echo "Brak drogi";
-		
-		list($usecStart, $secStart) = explode(" ", $timeStart);
-		list($usecEnd, $secEnd) = explode(" ", $timeEnd);
-		$diff = $secEnd - $secStart + $usecEnd - $usecStart;
-		echo "\n\nCzas liczenia: ".$diff." s\n";
-		
-		  	
-		$distance = 0;
-		foreach ($res as $way_key) {
-			$distance += Vendor_Geophp::load($ways_asText[$way_key], 'wkt')->greatCircleLength();
-		}
-		print_r($res);
-		echo "Distance: ".$distance."m\n";
-//eof test
-echo "\n<br>test2";
-
-
-
-
-//test
- 	$timeStart = microtime();
- 	$res = findWay(389,404);
- 	$path=joins2lineString($res)->asText();
-	$timeEnd = microtime();
-		
-		if ($path) {
-			
-						echo $path."\n";
-		} else echo "Brak drogi";
-		
-		list($usecStart, $secStart) = explode(" ", $timeStart);
-		list($usecEnd, $secEnd) = explode(" ", $timeEnd);
-		$diff = $secEnd - $secStart + $usecEnd - $usecStart;
-		echo "\n\nCzas liczenia: ".$diff." s\n";
-		
-		  	
-		$distance = 0;
-		foreach ($res as $way_key) {
-			$distance += Vendor_Geophp::load($ways_asText[$way_key], 'wkt')->greatCircleLength();
-		}
-		print_r($res);
-		echo "Distance: ".$distance."m\n";
-//eof test
-
-
-
-//$distance = 0;
-//foreach ($res as $way_key) {
-//	$distance += Vendor_Geophp::load($ways_asText[$way_key], 'wkt')->greatCircleLength();
-//}
-//print_r($res);
-//echo "Distance: ".$distance."m\n";

+ 0 - 361
SE/dev/php-cli/biale_plamy-generate_data.php

@@ -1,361 +0,0 @@
-<?php
-	
-	ini_set('display_errors', 'On');
-error_reporting(E_ALL);
-
-
-$_SERVER['SERVER_NAME'] = 'biuro.biall-net.pl';
-//when used in /Library/Server/Web/Data/Sites/bzyk-biale-plamy-php-temp/SE/dev on biuro.biall-net.pl
-if( file_exists ( "../../se-lib/bootstrap.php"))
-require("../../se-lib/bootstrap.php");
-//when used in  in native SE
-else require("../../../../SE-production-git/SE/se-lib/bootstrap.php");
-
-Lib::loadClass("Vendor_Geophp");
-
-
-
-function init_sh_check() {
-    //check if run from bash
-    if(isset($_SERVER["argv"])) {
-        if(@$_SERVER["argv"][1]=='--help') {
-            echo "
-                Options are:
-                php ".$_SERVER["argv"][0]." --check   - control if we have needed tables/data
-                
-                .EOF
-            ";
-        } else if(@$_SERVER["argv"][1]=='--check') { 
-            check();
-        } else echo " bad option, try:
-            php ".$_SERVER["argv"][0]." --help
-            
-            .EOF
-            ";
-    } else {
-        echo "<br> this script could be run from bash e.g. php biale_plamy.php --help <br>" ;
-        check();
-    }
-}
-
-
-
-function check() {
-	echo "<br>\n i run check()";
-    //todo to set arguments to rebuild tables etc:
-    $check_tbls=array('Rozdzielcza_test_bzyk_drogi','Rozdzielcza_test_bzyk_joins','Rozdzielcza_test_bzyk_przylacza_HIST',
-                    'Rozdzielcza_test_bzyk_przylacza','Rozdzielcza_test_bzyk_punkty_adresowe','Rozdzielcza_test_bzyk_ways');
-
-    //$tables =  DB::getPDO()->list_tables();
-    foreach($check_tbls as $tbl) {
-        $query = "select ID from ".$tbl." limit 1 ";
-        echo "<br>\nresult chk for tbl:".$tbl." ;";
-        
-        try{
-            $result = DB::getPDO()->fetchall($query);
-        } catch(Exception $exception) {
-            // return $exception;
-            echo "<br>\n jest blad z tbl:".$tbl." i get sample table structure with data from ../sql/".$tbl.".sql  - it should be manually replaced by correct/newer!";
-            $sql = file_get_contents('../sql/'.$tbl.'.sql');
-            
-            try{
-                $result = DB::getPDO()->fetchall($sql);
-            } catch(Exception $exception2) {
-                echo "<br>\n jest blad dump dla tbl:".$tbl;
-            }
-        } 
-        //	print_r($exception);
-        print_r($result);
-    }
-}
-
-init_sh_check();   
-
-$query = "select astext(the_geom) as multiway ,ID as ID_Way from Rozdzielcza_test_bzyk_drogi where numpoints(the_geom)>1";
-$result = DB::getPDO()->fetchall($query);
-$joins_asText = array();
-foreach ($result as $row) {
-	$multiway = Vendor_Geophp::load($row['multiway'], 'wkt');
-//echo $multiway->length();
-	for ($i = 1; $i < $n = $multiway->numPoints(); $i++) {
-		$way = new LineString(array($multiway->pointN($i), $multiway->pointN($i+1)));
-		$ways_asText[] = $way->asText();
-		$ways_2ID_Way[]=$row['ID_Way'];
-		if (!in_array($multiway->pointN($i)->asText(), $joins_asText)) $joins_asText[] = $multiway->pointN($i)->asText();
-	}
-	if (!in_array($multiway->pointN($n)->asText(), $joins_asText)) $joins_asText[] = $multiway->pointN($n)->asText();
-}
-
-$query = "select ID, astext(the_geom) as point, astext(the_geom_nearest_way) as way, astext(the_geom_xpoint) as xpoint, ID_Way from Rozdzielcza_test_bzyk_punkty_adresowe";
-$result = DB::getPDO()->fetchall($query);
-$xpoints = array();
-foreach ($result as $row) {
-        $points[$row['ID']] = Vendor_Geophp::load($row['point'], 'wkt');
-        $points2ID_Way[$row['ID']] = $row['ID_Way'] ;
-	$points_asText[$row['ID']] = $points[$row['ID']]->asText();
-        $xpoint = Vendor_Geophp::load($row['xpoint'], 'wkt');
-     //blad dziwny sqix
-     if($xpoints) {
-		if (!($key = array_search($xpoint->asText(), $xpoints))) $key = array_push($xpoints, $xpoint->asText())-1;
-			$xpoints2points[$key][] = $row['ID'];
-			$points2xpoints[$row['ID']] = $key;
-		
-		        $way = Vendor_Geophp::load($row['way'], 'wkt');
-		}
-		//errory sieje z die
-	if($xpoint) {
-		if (!(in_array($xpoint->asText(), $joins_asText))) {
-			if (@!in_array($key, $ways2cut[array_search($way->asText(), $ways_asText)])) {
-				$ways2cut[array_search($way->asText(), $ways_asText)][] = array('key'=>$key,'ID_Way'=>$row['ID_Way']);
-			} else echo ".";
-		};
-	}
-}
-
-function pointsDistance($a, $b) {
-	$line = new LineString(array($a, $b));
-	return $line->length();
-}
-
-foreach ($ways2cut as $way_key => $xpoint_keys) {
-	$distances = array();
-	//$xpoint_keys=$value_arr['key'];
-	$way = Vendor_Geophp::load($ways_asText[$way_key], 'wkt');
-	foreach ($xpoint_keys as $xpoint_key_arr) {
-	
-	if($joins_asText   ) {
-		$xpoint_key=$xpoint_key_arr['key'];
-		$ID_Way=$xpoint_key_arr['ID_Way'];
-		if($xpoints[$xpoint_key]) //error sypie
-		$xpoint = Vendor_Geophp::load($xpoints[$xpoint_key], 'wkt');
-		if($xpoint) { ///sypie errorem
-			$key = array_push($joins_asText, $xpoint->asText())-1; //blad
-			foreach ($xpoints2points[$xpoint_key] as $point_key) {
-				$points2joins[$point_key] = $key;
-			}
-		}
-		$distances[$xpoint_key] = pointsDistance($way->startPoint(), $xpoint);
-	}
-	}
-	asort($distances);
-
-	$sub_xpoints = array();
-	foreach (array_keys($distances) as $xpoint_key) {
-		if($xpoints[$xpoint_key]) // if sypie errorami
-		$sub_xpoints[] = Vendor_Geophp::load($xpoints[$xpoint_key]);
-	}
-
-	$startPoint = $way->startPoint();
-	$endPoint = $way->endPoint();
-	if($sub_xpoints[0] and $startPoint) { // sypie erorrami
-		$way = new LineString(array($startPoint, $sub_xpoints[0]));
-		$ways_asText[$way_key] = $way->asText();
-		$ways_2ID_Way[$way_key]=$ID_Way;
-	}
-	
-	for ($i = 0; $i < $n = count($sub_xpoints) - 1; $i++) {
-		$way = new LineString(array($sub_xpoints[$i], $sub_xpoints[$i+1]));
-		$ways_asText[] = $way->asText();
-		$ways_2ID_Way[]=$ID_Way;
-	}
-	if($sub_xpoints[$n] and $endPoint) {
-		$way = new LineString(array($sub_xpoints[$n], $endPoint));
-		$ways_asText[] = $way->asText();
-		$ways_2ID_Way[]=$ID_Way;
-	}
-}
-
-foreach (array_keys($ways_asText) as $way_key) {
-	$way = Vendor_Geophp::load($ways_asText[$way_key], 'wkt');
-	$ways_lenghts[$way_key] = $way->length();
-	for ($i = 1; $i <= 2; $i++) {
-		$join = $way->pointN($i)->asText();
-		$join_key = array_search($join, $joins_asText);
-//if (!$join_key) echo ".";
-		$ways2joins[$way_key][] = $join_key;
-		$joins2ways[$join_key][] = $way_key;
-	}
-}
-/*
-// $val=array(A=>asd,B=>cos) ---
-// <xml>
-//  <A>cos</A>
-	<B>cos></B>
-   </xml>
-   array(0=asd,1=asd)
-   <xml>
-    <item id=0>asd</>
-    <item id=2>asd</>
-   
-   array(A=>asd,B=>array(0=>asd,1=>asd))
-   <xml>
-     <A>asd</>
-     <B><item id=0>asd</>
-        <item id=1>asd</>
-
-// $pozA[1]=dupa
-// $pozA[2]=jasiu
-*/
-// function defination to convert array to xml
-function array_to_xml( $data, &$xml_data ) {
-    foreach( $data as $key => $value ) {
-        $key_="";
-        
-        if( is_numeric($key) ){
-            $key_ = 'item';
-        }
-        
-        if( is_array($value) ) {
-            $subnode = $xml_data->addChild($key_);
-			$subnode->addAttribute('id', $key);
-            array_to_xml($value, $subnode);
-        } else {
-            $subnode=$xml_data->addChild("$key_",htmlspecialchars("$value"));
-            if( is_numeric($key) ){
-	            $subnode->addAttribute('id', $key);
-	        }
-        }
-     }
-}
-
-
-
-
-
-
-file_put_contents('points2ID_Way.txt',serialize($points2ID_Way));
-//for better debug to see variables in editor i make also print_r 
- 	ob_start();print_r($points2ID_Way); $contents = ob_get_contents();ob_end_clean();  
- 	file_put_contents('points2ID_Way_print_r.txt',$contents);
- 
- 	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><points2ID_Way></points2ID_Way>');
- 	array_to_xml($points2ID_Way,$xml_data);
- 	print $xml_data->asXML("points2ID_Way.xml");
- 	unset($xml_data);
-  
-  
-  
-
-file_put_contents('ways_2ID_Way.txt',serialize($ways_2ID_Way));
-//for better debug to see variables in editor i make also print_r 
- 	ob_start();print_r($ways_2ID_Way); $contents = ob_get_contents();ob_end_clean();  
- 	file_put_contents('ways_2ID_Way_print_r.txt',$contents);
- 
- 	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><ways_2ID_Way></ways_2ID_Way>');
- 	array_to_xml($ways_2ID_Way,$xml_data);
- 	print $xml_data->asXML("ways_2ID_Way.xml");
- 	unset($xml_data);
-  
-
-
-
-
-
-
-
-file_put_contents('ways2joins.txt',serialize($ways2joins));
-//for better debug to see variables in editor i make also print_r 
- 	ob_start();print_r($ways2joins); $contents = ob_get_contents();ob_end_clean();  
- 	file_put_contents('ways2joins_print_r.txt',$contents);
- 
- 	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><ways2joins></ways2joins>');
- 	array_to_xml($ways2joins,$xml_data);
- 	print $xml_data->asXML("ways2joins.xml");
- 	unset($xml_data);
-  
-  
-  
-  
-
-file_put_contents('joins2ways.txt',serialize($joins2ways));
- 	ob_start();print_r($joins2ways); $contents = ob_get_contents();ob_end_clean();  
- 	file_put_contents('joins2ways_print_r.txt',$contents);
- 	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><joins2ways></joins2ways>');
- 	array_to_xml($joins2ways,$xml_data);
- 	print $xml_data->asXML("joins2ways.xml");
- 	unset($xml_data);
-  
- 	
-
-file_put_contents('points2joins.txt',serialize($points2joins));
-	ob_start();print_r($points2joins); $contents = ob_get_contents();ob_end_clean();  
-	file_put_contents('points2joins_print_r.txt',$contents);
-	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><points2joins></points2joins>');
- 	array_to_xml($points2joins,$xml_data);
- 	print $xml_data->asXML("points2joins.xml");
- 	unset($xml_data);
-
-file_put_contents('joins_asText.txt',serialize($joins_asText));
-	ob_start();print_r($joins_asText); $contents = ob_get_contents();ob_end_clean();  
-	file_put_contents('joins_asText_print_r.txt',$contents);
-	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><joins_asText></joins_asText>');
- 	array_to_xml($joins_asText,$xml_data);
- 	print $xml_data->asXML("joins_asText.xml");
- 	unset($xml_data);
-
-
-file_put_contents('ways_asText.txt',serialize($ways_asText));
-	ob_start();print_r($ways_asText); $contents = ob_get_contents();ob_end_clean();  
-	file_put_contents('ways_asText_print_r.txt',$contents);
-	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><ways_asText></ways_asText>');
- 	array_to_xml($ways_asText,$xml_data);
- 	print $xml_data->asXML("ways_asText.xml");
- 	unset($xml_data);
-
-
-file_put_contents('points_asText.txt',serialize($points_asText));
-	ob_start();print_r($points_asText); $contents = ob_get_contents();ob_end_clean();  
-	file_put_contents('points_asText_print_r.txt',$contents);
-	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><points_asText></points_asText>');
- 	array_to_xml($points_asText,$xml_data);
- 	print $xml_data->asXML("points_asText.xml");
- 	unset($xml_data);
-
-
-
-/*
-function findWay($join_key, $point_key, $path = array()) {
-	global $ways2joins, $joins2ways, $points2joins, $ways_asText, $joins2ways, $points, $points2xpoints, $xpoints2joins, $ways_lengths, $res;
-//echo implode('->',$path)."\n\n";
-	if ($join_key == $points2joins[$point_key]) $res[] = $path;
-	else {
-		foreach ($joins2ways[$join_key] as $way_key) {
-			if (!in_array($way_key, $path)) {
-//				$joins = $ways2joins[$way_key];
-//				$back_join_subkey = array_search($join_key, $joins);
-//				$new_join_subkey = 1 - $back_join_subkey;
-//				$new_join = $joins[$new_join_subkey];
-				$new_join = $ways2joins[$way_key][1 - array_search($join_key,  $ways2joins[$way_key])];
-				findWay($new_join, $point_key, array_merge($path,array($way_key)));
-			}
-		}
-	}
-}
-*/
-//print_r($ways2joins);
-//for ($i = 0; $i < count($points); $i++) {
-//	if (isset($res)) unset($res);
-//	findWay(2000, $i);
-//	print_r($res);
-//}
-//print_r($ways);
-
-echo "ways count: ".count($ways_asText)."\n";
-
-
-$db = DB::getDB();
-$db->query("truncate table Rozdzielcza_test_bzyk_ways");
-$db->query("truncate table Rozdzielcza_test_bzyk_joins");
-
-
-foreach ($ways_asText as $way) {
-	$query = "insert into Rozdzielcza_test_bzyk_ways (the_geom) values (linefromtext('".$way."'))";
-	$db->query($query);
-	//echo $query."\n";
-}
-
-foreach ($joins_asText as $join) {
-	$query = "insert into Rozdzielcza_test_bzyk_joins (the_geom) values (pointfromtext('".$join."'))";
-	$db->query($query);
-}
-

+ 2 - 1
SE/dev/php-cli/biale_plamy-prepare_sql_data.php

@@ -13,7 +13,7 @@ Lib::loadClass("Vendor_Geophp");
 
 
 $db = DB::getDB();
-$sql="create temporary table Rozdzielcza_test_bzyk_punkty_adresowe_temp select * from Rozdzielcza_test_bzyk_punkty_adresowe;
+/*$sql="create temporary table Rozdzielcza_test_bzyk_punkty_adresowe_temp select * from Rozdzielcza_test_bzyk_punkty_adresowe;
 
 -- 1 Dorobiona funkcja do pokazywania ID_Way
 update Rozdzielcza_test_bzyk_punkty_adresowe_temp t1 set t1.the_geom_nearest_way=test_find_nearest_way(t1.ID);
@@ -35,6 +35,7 @@ insert into Rozdzielcza_test_bzyk_przylacza (the_geom,ID_Way) select
  linefromtext(concat('linestring(',x(the_geom),' ',y(the_geom),',',x(the_geom_xpoint),' ',y(the_geom_xpoint),')')) , 
  ID from Rozdzielcza_test_bzyk_punkty_adresowe;
  ";
+ */
 
  $result = DB::getPDO()->fetchall($sql);
  

+ 0 - 198
SE/dev/php-cli/biale_plamy.php

@@ -1,198 +0,0 @@
-<?php
-$_SERVER['SERVER_NAME'] = 'biuro.biall-net.pl';
-require("../../se-lib/bootstrap.php");
-Lib::loadClass("Vendor_Geophp");
-
-
- 
-function init_sh_check() {
-    //check if run from bash
-    if(isset($_SERVER["argv"])) {
-        if(@$_SERVER["argv"][1]=='--help') {
-            echo "
-                Options are:
-                php ".$_SERVER["argv"][0]." --check   - control if we have needed tables/data
-                
-                .EOF
-            ";
-        } else if(@$_SERVER["argv"][1]=='--check') { 
-            check();
-        } else echo " bad option, try:
-            php ".$_SERVER["argv"][0]." --help
-            
-            .EOF
-            ";
-    } else {
-        echo "<br> this script could be run from bash e.g. php biale_plamy.php --help <br>" ;
-        check();
-    }
-}
-
-
-
-function check() {
-	echo "<br>\n i run check()";
-    //todo to set arguments to rebuild tables etc:
-    $check_tbls=array('Rozdzielcza_test_bzyk_drogi','Rozdzielcza_test_bzyk_joins',
-                    'Rozdzielcza_test_bzyk_przylacza','Rozdzielcza_test_bzyk_punkty_adresowe','Rozdzielcza_test_bzyk_ways',
-                    'Rozdzielcza_test_bzyk_joins_HIST','Rozdzielcza_test_bzyk_przylacza_HIST',
-                    'Rozdzielcza_test_bzyk_przylacza_HIST','Rozdzielcza_test_bzyk_punkty_adresowe_HIST','Rozdzielcza_test_bzyk_ways_HIST');
-
-    //$tables =  DB::getPDO()->list_tables();
-    foreach($check_tbls as $tbl) {
-        $query = "select ID from ".$tbl." limit 1 ";
-        echo "<br>\nresult chk for tbl:".$tbl." ;";
-        
-        try{
-            $result = DB::getPDO()->fetchall($query);
-        } catch(Exception $exception) {
-            // return $exception;
-            echo "<br>\n Ajest blad z tbl:".$tbl." i get sample table structure with data from ../sql/".$tbl.".sql  - it should be manually replaced by correct/newer!";
-            $sql = file_get_contents('../sql/'.$tbl.'.sql');
-            
-            echo "<br> w get som content ".strlen($sql) ;
-			unset($result);
-             //return $exception;
-            try{
-                $result2 = DB::getPDO()->fetchall('select 1+1;');
-                //mam blad dziwny na mac pro :  Call to a member function fetchall() on null??? dpiero za drugim razem?
-            } catch(Exception $exception2) {
-                echo "<br>\n jest blad dump dla tbl:".$tbl;
-            }
-        } 
-        //	print_r($exception);
-        echo "<br> 64";
-        print_r($result2);
-    }
-}
-
-init_sh_check();   
-
-$query = "select astext(the_geom) as multiway from Rozdzielcza_test_bzyk_drogi where numpoints(the_geom)>1";
-$result = DB::getPDO()->fetchall($query);
-$joins_asText = array();
-foreach ($result as $row) {
-	$multiway = Vendor_Geophp::load($row['multiway'], 'wkt');
-//echo $multiway->length();
-	for ($i = 1; $i < $n = $multiway->numPoints(); $i++) {
-		$way = new LineString(array($multiway->pointN($i), $multiway->pointN($i+1)));
-		$ways_asText[] = $way->asText();
-		if (!in_array($multiway->pointN($i)->asText(), $joins_asText)) $joins_asText[] = $multiway->pointN($i)->asText();
-	}
-	if (!in_array($multiway->pointN($n)->asText(), $joins_asText)) $joins_asText[] = $multiway->pointN($n)->asText();
-}
-
-$query = "select ID, astext(the_geom) as point, astext(the_geom_nearest_way) as way, astext(the_geom_xpoint) as xpoint from Rozdzielcza_test_bzyk_punkty_adresowe limit 100";
-$result = DB::getPDO()->fetchall($query);
-$xpoints = array();
-foreach ($result as $row) {
-        $points[$row['ID']] = Vendor_Geophp::load($row['point'], 'wkt');
-
-        $xpoint = Vendor_Geophp::load($row['xpoint'], 'wkt');
-	if (!($key = array_search($xpoint->asText(), $xpoints))) $key = array_push($xpoints, $xpoint->asText())-1;
-	$xpoints2points[$key][] = $row['ID'];
-	$points2xpoints[$row['ID']] = $key;
-
-        $way = Vendor_Geophp::load($row['way'], 'wkt');
-
-	if (!(in_array($xpoint->asText(), $joins_asText))) {
-		if (@!in_array($key, $ways2cut[array_search($way->asText(), $ways_asText)])) {
-			$ways2cut[array_search($way->asText(), $ways_asText)][] = $key;
-		} else echo ".";
-	};
-}
-
-function pointsDistance($a, $b) {
-	$line = new LineString(array($a, $b));
-	return $line->length();
-}
-
-foreach ($ways2cut as $way_key => $xpoint_keys) {
-	$distances = array();
-	$way = Vendor_Geophp::load($ways_asText[$way_key], 'wkt');
-	foreach ($xpoint_keys as $xpoint_key) {
-		$xpoint = Vendor_Geophp::load($xpoints[$xpoint_key], 'wkt');
-		$key = array_push($joins_asText, $xpoint->asText())-1;
-		foreach ($xpoints2points[$xpoint_key] as $point_key) {
-			$points2joins[$point_key] = $key;
-		}
-		$distances[$xpoint_key] = pointsDistance($way->startPoint(), $xpoint);
-	}
-	asort($distances);
-
-	$sub_xpoints = array();
-	foreach (array_keys($distances) as $xpoint_key) {
-		$sub_xpoints[] = Vendor_Geophp::load($xpoints[$xpoint_key]);
-	}
-
-	$startPoint = $way->startPoint();
-	$endPoint = $way->endPoint();
-	$way = new LineString(array($startPoint, $sub_xpoints[0]));
-	$ways_asText[$way_key] = $way->asText();
-	for ($i = 0; $i < $n = count($sub_xpoints) - 1; $i++) {
-		$way = new LineString(array($sub_xpoints[$i], $sub_xpoints[$i+1]));
-		$ways_asText[] = $way->asText();
-	}
-	$way = new LineString(array($sub_xpoints[$n], $endPoint));
-	$ways_asText[] = $way->asText();
-}
-echo "\n";
-foreach (array_keys($ways_asText) as $way_key) {
-	$way = Vendor_Geophp::load($ways_asText[$way_key], 'wkt');
-	$ways_lenghts[$way_key] = $way->length();
-	for ($i = 1; $i <= 2; $i++) {
-		$join = $way->pointN($i)->asText();
-		$join_key = array_search($join, $joins_asText);
-//if (!$join_key) echo ".";
-		$ways2joins[$way_key][] = $join_key;
-		$joins2ways[$join_key][] = $way_key;
-	}
-}
-
-
-function findWay($join_key, $point_key, $path = array()) {
-	global $ways2joins, $joins2ways, $points2joins, $ways_asText, $joins2ways, $points, $points2xpoints, $xpoints2joins, $ways_lengths, $res;
-//echo implode('->',$path)."\n\n";
-	if ($join_key == $points2joins[$point_key]) $res[] = $path;
-	else {
-		foreach ($joins2ways[$join_key] as $way_key) {
-			if (!in_array($way_key, $path)) {
-//				$joins = $ways2joins[$way_key];
-//				$back_join_subkey = array_search($join_key, $joins);
-//				$new_join_subkey = 1 - $back_join_subkey;
-//				$new_join = $joins[$new_join_subkey];
-				$new_join = $ways2joins[$way_key][1 - array_search($join_key,  $ways2joins[$way_key])];
-				findWay($new_join, $point_key, array_merge($path,array($way_key)));
-			}
-		}
-	}
-}
-
-//print_r($ways2joins);
-for ($i = 0; $i < count($points); $i++) {
-//	$res = array();
-	if (isset($res)) unset($res);
-	findWay(2000, $i);
-	print_r($res);
-}
-//print_r($ways);
-
-echo "ways count: ".count($ways_asText)."\n";
-
-/*
-$db = DB::getDB();
-$db->query("truncate table Rozdzielcza_test_bzyk_ways");
-$db->query("truncate table Rozdzielcza_test_bzyk_joins");
-
-
-foreach ($ways_asText as $way) {
-	$query = "insert into Rozdzielcza_test_bzyk_ways (the_geom) values (linefromtext('".$way."'))";
-	$db->query($query);
-	//echo $query."\n";
-}
-
-foreach ($joins_asText as $join) {
-	$query = "insert into Rozdzielcza_test_bzyk_joins (the_geom) values (pointfromtext('".$join."'))";
-	$db->query($query);
-}
-*/

+ 0 - 164
SE/dev/php-cli/biale_plamy_class_findWay.php

@@ -1,164 +0,0 @@
-<?php
-
-require("biale_plamy_class.php");
-
-
-	$test = new bialePlamy(array("pointsTable"=>"Rozdzielcza_test2_bzyk_punkty_adresowe", "origWaysTable"=>"Rozdzielcza_test2_bzyk_drogi"));
-	//$test->enableShowProgress();
-	$test->loadCache();
-	
-	
-function array_to_xml( $data, &$xml_data ) {
-    foreach( $data as $key => $value ) {
-        $key_="";
-        
-        if( is_numeric($key) ){
-            $key_ = 'item';
-        }
-        
-        if( is_array($value) ) {
-            $subnode = $xml_data->addChild($key_);
-			$subnode->addAttribute('id', $key);
-            array_to_xml($value, $subnode);
-        } else {
-	       // $test_expl=explode(" ", $value);
-					//preg_match('/[a-zA-Z]/', $value[0])
-	        //if($key_=="" and !isset($test_expl[1])  )  $key_=htmlspecialchars("$value");
-	        //czy nie jest jeden element array
-	        if($key_=="" and  count($data[$key]==1)) {
-		   		 $subnode=$xml_data->addChild("$key",htmlspecialchars("$value"));
-		    } else  
-            $subnode=$xml_data->addChild("$key_",htmlspecialchars("$value"));
-            if( is_numeric($key) ){
-	            $subnode->addAttribute('id', $key);
-	        }
-        }
-     }
-}
-
-	
-	
-	
-	
-$ways2joins = unserialize(file_get_contents('/tmp/save_ways2joins.txt'));
-$joins2ways = unserialize(file_get_contents('/tmp/save_joins2ways.txt'));
-$points2joins = unserialize(file_get_contents('/tmp/save_points2joins.txt'));
-$joins_asText = unserialize(file_get_contents('/tmp/save_joins_asText.txt'));
-$ways_asText = unserialize(file_get_contents('/tmp/save_ways_asText.txt'));
-$points_asText = unserialize(file_get_contents('/tmp/save_points_asText.txt'));
-
-$edge_joins=simplexml_load_file("edge_joins.xml");
-$edge_joins->registerXPathNamespace('bp', 'https://procesy5.pl/biale_plamy-schema.xsd');
-
-//print_r($edge_joins);
-foreach($edge_joins->children() as $child)  {
- // echo "\n<br>";
-	   //$attrs=$child->attributes("ID_Way");
-
-	   foreach($child->attributes() as $a=>$b) {
-		   //	echo "#87Child";print_r($b[0]);
-		   $ID_Way=$b[0];
-	   }
-	  //echo $child->getName() . ": " . " ID_Way: ".$ID_Way. " : ";
-	
-	   $id_j=0; 
-	   settype($ID_Way, "integer");
-	   //$ID_Way=var_dump($ID_Way);
-	   
-	 //  echo "#88Child:"; print_r($ID_Way);
-	   //$edge_joins_path['ID_Way'][$attrs['ID_Way']]=array();
-	   foreach($child->children('https://procesy5.pl/biale_plamy-schema.xsd') as $edge_joins_xml)  {
-		   $id_j++;
-		   $attrs_join=$edge_joins_xml->attributes();
-		   //echo " #93 ID_Join ".$attrs_join["Joins"]." ";
-		   $Join=$attrs_join["Joins"][0];
-		   settype($Join, "integer");
-		   $edge_joins_path[$ID_Way][$id_j]=$attrs_join["Joins"][0];
-	   }
-}
-
-	
-	
-	
-	
-	/////////
-	
-	 DB::getPDO()->query("truncate table Rozdzielcza_test_bzyk_paths");
-
-unset($ID_Way);
-
-$edge_joins_filled_paths=array();
-foreach($edge_joins_path as $ID_Way=>$Joins_arr) {
-	settype($ID_Way, "integer");
-	$edge_joins_filled_paths[$ID_Way]['tried']=1;
-	if(isset($Joins_arr[1]) and isset($Joins_arr[2]))  {
-			   $pkt_A=$Joins_arr[1];$pkt_B=$Joins_arr[2];
-			   settype($pkt_A, "integer"); settype($pkt_B, "integer");
-
-		echo "\n<br> Generuje dla ID_Way:".$ID_Way." i joins ".$pkt_A." , ".$pkt_B." ";
-		unset($res);unset($path);
-		
-		
-		
-	
-			$res = $test->findWay($pkt_A, $pkt_B);
-			$lineStringObj = $test->joins2lineString($res);
-			if($lineStringObj) {
-						$path = $lineStringObj->asText();
-					
-					
-					
-					//$res = findWay($pkt_A,$pkt_B);
-					//$path = joins2lineString($res)->asText();
-					//   joins2lineString(findWay(389,404));
-					settype($path, "string");
-					$edge_joins_filled_paths[$ID_Way]['asText'] = $path;
-						$distance = 0;
-							foreach ($res as $way_key) {
-								if(isset($ways_asText[$way_key]))
-								$distance += Vendor_Geophp::load($ways_asText[$way_key], 'wkt')->greatCircleLength();
-							}
-					$edge_joins_filled_paths[$ID_Way]['distance'] = $distance;
-					//joins2lineString(findWay($Joins_arr[1],$Joins_arr[2]));
-					//joins2lineString($res = findWay($joinAB['A'],$joinAB['B']))->asText();
-					$sql_insert_path="insert into Rozdzielcza_test_bzyk_paths (the_geom,ID_Way, A_RECORD_CREATE_DATE )
-					     values (ST_GeomFromText('".$edge_joins_filled_paths[$ID_Way]['asText']."'),'".$ID_Way."' , now()   )   ";
-					    echo "#216Query path ins:: ".$sql_insert_path." , distance:".$distance." ";
-					    if(strlen($edge_joins_filled_paths[$ID_Way]['asText'])>2)
-					      DB::getPDO()->query($sql_insert_path);
-					    else echo "#296 path nie wygenerowalo sie !! dla ".$ID_Way." i pkt ".$pkt_A." , ".$pkt_B." \n";
-
-			} else { 
-				echo "ERROR 131 dla pkt: ID_WAY:".$ID_Way;
-				print_r($Joins_arr);
-			}
-
-
-	} else echo "\n#220 droga nie ma koncow ID_Way::".$ID_Way;
-}
-
-
-echo "<br>\n edge_joins_filled_paths:";
-print_r($edge_joins_filled_paths);
-
-
-//save
- 	unset($xml_data);
-
-file_put_contents('edge_joins_filled_paths.txt',serialize($edge_joins_filled_paths));
- 	ob_start();print_r($edge_joins_filled_paths); $contents = ob_get_contents();ob_end_clean();  
- 	file_put_contents('edge_joins_filled_paths_print_r.txt',$contents);
- 	$xml_data = new SimpleXMLElement('<?xml version="1.0"?><edge_joins_filled_paths></edge_joins_filled_paths>');
- 	array_to_xml($edge_joins_filled_paths,$xml_data);
- 	print $xml_data->asXML("edge_joins_filled_paths.xml");
- 	unset($xml_data);
-  
-
-
-	
-	
-	
-	
-	
-	
-	

+ 13 - 4
SE/dev/php-cli/biale_plamy_class_regenerate.php

@@ -2,7 +2,16 @@
 
 require("biale_plamy_class.php");
 
-$test = new bialePlamy(array("pointsTable"=>"Rozdzielcza_test2_bzyk_punkty_adresowe", "origWaysTable"=>"Rozdzielcza_test2_bzyk_drogi"));
+require("biale_plamy_set_from_argv.php");
+
+
+
+
+
+
+
+
+$test = new bialePlamy(array("pointsTable"=>"Rozdzielcza_".$plamy_prefix."_bzyk_punkty_adresowe", "origWaysTable"=>"Rozdzielcza_".$plamy_prefix."_bzyk_drogi"));
 //$test->enableShowProgress();
 //$test->loadCache();
 
@@ -31,6 +40,6 @@ echo "\n saveArrays complete";
 
 
 //echo $test->printArray('joins2ways');
-$test->saveWaysTable("Rozdzielcza_test2_bzyk_ways");
-$test->saveJoinsTable("Rozdzielcza_test2_bzyk_joins");
-$test->savePrzylaczaTable("Rozdzielcza_test2_bzyk_przylacza");
+$test->saveWaysTable("Rozdzielcza_".$plamy_prefix."_bzyk_ways");
+$test->saveJoinsTable("Rozdzielcza_".$plamy_prefix."_bzyk_joins");
+$test->savePrzylaczaTable("Rozdzielcza_".$plamy_prefix."_bzyk_przylacza");

+ 6 - 2
SE/dev/php-cli/biale_plamy_class_usage.php

@@ -2,7 +2,11 @@
 
 require("biale_plamy_class.php");
 
-$test = new bialePlamy(array("pointsTable"=>"Rozdzielcza_test2_bzyk_punkty_adresowe", "origWaysTable"=>"Rozdzielcza_test2_bzyk_drogi"));
+require("biale_plamy_set_from_argv.php");
+
+
+$test = new bialePlamy(array("pointsTable"=>"Rozdzielcza_".$plamy_prefix."_bzyk_punkty_adresowe",
+						     "origWaysTable"=>"Rozdzielcza_".$plamy_prefix."_bzyk_drogi"));
 $test->enableShowProgress();
 $test->loadCache("dupa");
 
@@ -23,4 +27,4 @@ $test->generateLongWays();
 //$test->saveWaysTable("Rozdzielcza_test2_bzyk_ways");
 //$test->saveJoinsTable("Rozdzielcza_test2_bzyk_joins");
 //$test->savePrzylaczaTable("Rozdzielcza_test2_bzyk_przylacza");
-$test->saveLongWaysTable("Rozdzielcza_test2_bzyk_long_ways");
+$test->saveLongWaysTable("Rozdzielcza_".$plamy_prefix."_bzyk_long_ways");

+ 4 - 2
SE/dev/php-cli/biale_plamy_joins2ways_do_paths.xsl

@@ -4,9 +4,11 @@
     exclude-result-prefixes="xs"
     xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
     version="2.0">
-   <!--<xsl:param name=""></xsl:param>-->
    
-    <xsl:variable name="ways2joins" select="doc('ways2joins.xml')"/>
+   
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    <xsl:variable name="ways2joins.xml" select="concat('ways2joins',$plamy_prefix,'.xml')"/>
+    <xsl:variable name="ways2joins" select="doc($ways2joins.xml)"/>
    
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>

+ 139 - 29
SE/dev/php-cli/build.xml

@@ -1,15 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project
     xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
+    xmlns:ogc="http://www.opengis.net/ogc"
     basedir="." name="biale_plamy-generate_data" default="default">
     
     
     <tstamp><format property="TODAY_UK" pattern="yyyy-mm-dd"/></tstamp>
    
-   
+    <property name="plamy_prefix" value="" /><!-- prefiks dla danych -->
+    <property name="pointsTable" value="Rozdzielcza_test2_bzyk_punkty_adresowe" />
+    <property name="origWaysTable" value="Rozdzielcza_test2_bzyk_drogi"/>
+    
+    <property  name="username" value="a.binder"/>
+    <property  name="pass" value="set_as_param_-Dpass=pass" />
     
     <property name="bypass_errors" value="1"/><!-- to continue transform even with errors -->
-    <property name="build.log" value="build.log"/><property name="build.log.old" value="${build.log}.old"/>
+         <property name="build.log" value="build${plamy_prefix}.log"/>
+         <property name="build.log.old" value="${build.log}.old"/>
     
     <target name="build_log_exists">
         
@@ -40,47 +47,54 @@
     <property name="logic" value="grouped"/>
     <!--<xsl:param name="logic" select="'sorted'"/>--> <!-- tutaj robi grupy ale analizyje w grupie tylko wazniejsze/bardziej oblozone wezly -->
     
+    <property name="API_address" value="biuro.biall-net.pl"/>
+    <property name="API_wfst_url" value="https://${API_address}/SE/version-git/wfs-data.php/default_db/"/>
+        <property name="API_address_cert.txt" value="${API_address}_cert.txt"/>
+        <property name="API_address_cert.cert" value="${API_address}_cert.cert"/>
+        <property name="API_address_cert.installed" value="${API_address}_cert.installed"/>
+    <property name="cacert_dir" value="${java.home}/lib/security/cacerts"/>
     <property name="mail_inform" value="a.binder@biall-net.pl"/> <!-- to inform about job complete -->
-    
-    
+    <property name="gnutls-cli" value="/opt/local/bin/gnutls-cli"/>
+    <property name="Password_for_cacerts" value="changeit"/><!-- stupid thing to not change-->
     <property name="biale_plamy_class_regenerate.php" value="biale_plamy_class_regenerate.php"/>
+    <!-- parametry dla biale_plamy_class_regenerate.php  -->
     
     <property name="ways_as_Text_z_ID_xml.xsl" value="ways_as_Text_z_ID_xml.xsl"/>
-    <property name="ways_as_Text_z_ID_xml.xml" value="ways_as_Text_z_ID_xml.xml"/>
+    <property name="ways_as_Text_z_ID_xml.xml" value="ways_as_Text_z_ID_xml${plamy_prefix}.xml"/>
     
-    <property name="biale_plamy_class_findWay.php" value="biale_plamy_class_findWay.php"/><!--<property name="biale_plamy-find_ways.php" value="biale_plamy-find_ways.php"/>-->
-        <property name="joins_asText.xml" value="joins_asText.xml"/>
-        <property name="joins2ways.xml" value="joins2ways.xml"/>
-        <property name="points2ID_Way.xml" value="points2ID_Way.xml"/>
-        <property name="ways2drogi.xml" value="ways2drogi.xml"/><!--<property name="ways_2ID_Way.xml" value="ways_2ID_Way.xml"/>-->
+    <!--<property name="biale_plamy_class_findWay.php" value="biale_plamy_class_findWay.php"/>--><!-- - uzywamy wlasnej klasy php do znalezienia drog <property name="biale_plamy-find_ways.php" value="biale_plamy-find_ways.php"/>-->
+    <property name="joins_asText.xml" value="joins_asText${plamy_prefix}.xml"/>
+    <property name="joins2ways.xml" value="joins2ways${plamy_prefix}.xml"/>
+    <property name="points2ID_Way.xml" value="points2ID_Way${plamy_prefix}.xml"/>
+    <property name="ways2drogi.xml" value="ways2drogi${plamy_prefix}.xml"/><!--<property name="ways_2ID_Way.xml" value="ways_2ID_Way.xml"/>-->
         
-            <property name="points2joins.xml" value="points2joins.xml"/>
-            <property name="ways2joins.xml" value="ways2joins.xml"/>
-             <property name="ways_asText.xml" value="ways_asText.xml"/>
+    <property name="points2joins.xml" value="points2joins${plamy_prefix}.xml"/>
+    <property name="ways2joins.xml" value="ways2joins${plamy_prefix}.xml"/>
+    <property name="ways_asText.xml" value="ways_asText${plamy_prefix}.xml"/>
     
-        <property name="waysLengths.xmll" value="waysLengths.xml"/>
+    <property name="waysLengths.xml" value="waysLengths${plamy_prefix}.xml"/>
             <property name="joins2ways_z_ID_Way.xsl" value="joins2ways_z_ID_Way.xsl"/>
-             <property name="joins2ways_z_ID_Way.xml" value="joins2ways_z_ID_Way.xml"/>
-                <property name="joins2ways_z_ID_Way_tempdir" value="joins2ways_z_ID_Way"/><!-- do trzymania tempow - nie wiadomo czy potrzebne bo duzo plikow -->
+    <property name="joins2ways_z_ID_Way.xml" value="joins2ways_z_ID_Way${plamy_prefix}.xml"/>
+    <property name="joins2ways_z_ID_Way_tempdir" value="joins2ways_z_ID_Way${plamy_prefix}"/><!-- do trzymania tempow - nie wiadomo czy potrzebne bo duzo plikow -->
             <property name="biale_plamy_joins2ways_do_paths.xsl" value="biale_plamy_joins2ways_do_paths.xsl"/>
         
             <property name="edge_joins_filled_paths_make.xsl" value="edge_joins_filled_paths_make.xsl"/>
             <property name="biale_put_xml_paths_to_mysql.php" value="biale_put_xml_paths_to_mysql.php"/>
     
-        <property name="points_asText.xml" value="points_asText.xml"/>
+    <property name="points_asText.xml" value="points_asText${plamy_prefix}.xml"/>
         
-        <property name="edge_joins.xml" value="edge_joins.xml"/>
+    <property name="edge_joins.xml" value="edge_joins${plamy_prefix}.xml"/>
         
             <property name="joins_asText_xml.xsl" value="joins_asText_xml.xsl"/>
-            <property name="joins_asText_xml.xml" value="joins_asText_xml.xml"/> 
+    <property name="joins_asText_xml.xml" value="joins_asText_xml${plamy_prefix}.xml"/> 
             <!-- sciezki -->
-            <property name="edge_joins_filled_paths.xml" value="edge_joins_filled_paths.xml"/>
-             <property name="edge_joins_filled_paths" value="edge_joins_filled_paths"/> <!-- katalog do zapisywania sciezek -->
+    <property name="edge_joins_filled_paths.xml" value="edge_joins_filled_paths${plamy_prefix}.xml"/>
+    <property name="edge_joins_filled_paths" value="edge_joins_filled_paths${plamy_prefix}"/> <!-- katalog do zapisywania sciezek -->
               
               
               
           
-            <property name="build_edge_paths_with_PE_controll_loop.xml" value="build_edge_paths_with_PE_controll_loop.xml"/>
+    <property name="build_edge_paths_with_PE_controll_loop.xml" value="build_edge_paths_with_PE_controll_loop${plamy_prefix}.xml"/>
              <property name="build_edge_paths_with_PE_controll_loop.xsl" value="build_edge_paths_with_PE_controll_loop.xsl"/>
                 <property name="edge_paths_with_PE_controll_to_PE_collection.xsl" value="edge_paths_with_PE_controll_to_PE_collection.xsl"/>
     
@@ -88,22 +102,22 @@
                 <property name="edge_paths_with_PE_controll_to_PE.xsl" value="edge_paths_with_PE_controll_to_PE.xsl"/>
     
                 <property name="edge_paths_with_PE_controll.xsl" value="edge_paths_with_PE_controll.xsl"/><!-- nowy point matrix-->   
-                <property name="edge_paths_with_PE_controll_temp" value="edge_paths_with_PE_controll_temp"/>
-                <property name="edge_paths_with_PE_controll_paths_temp" value="edge_paths_with_PE_controll_paths_temp"/><!-- do oszukania silnika aby korzystac z petli i przekazywac dane do siebie -->
-                <property name="edge_paths_with_PE_controll_temp.alias" value="edge_paths_with_PE_controll_temp.alias"/>
+    <property name="edge_paths_with_PE_controll_temp" value="edge_paths_with_PE_controll_temp${plamy_prefix}"/>
+    <property name="edge_paths_with_PE_controll_paths_temp" value="edge_paths_with_PE_controll_paths_temp${plamy_prefix}"/><!-- do oszukania silnika aby korzystac z petli i przekazywac dane do siebie -->
+    <property name="edge_paths_with_PE_controll_temp.alias" value="edge_paths_with_PE_controll_temp.alias${plamy_prefix}"/>
     
-            <property name="edge_paths_with_PE_controll.xml" value="edge_paths_with_PE_controll.xml"/>  
+    <property name="edge_paths_with_PE_controll.xml" value="edge_paths_with_PE_controll${plamy_prefix}.xml"/>  
             
-            <property name="edge_paths_with_PE.xml" value="edge_paths_with_PE.xml"/><!--     biale_plamy_from_paths_php_to_place_PE-->
+    <property name="edge_paths_with_PE.xml" value="edge_paths_with_PE${plamy_prefix}.xml"/><!--     biale_plamy_from_paths_php_to_place_PE-->
          
             <property name="biale_put_PE_to_mysql.php" value="biale_put_PE_to_mysql.php"/>
             
             <property name="cables_from_joins_to_PE.xsl" value="cables_from_joins_to_PE.xsl"/>
-            <property name="cables_from_joins_to_PE.xml" value="cables_from_joins_to_PE.xml"/><!-- xml do wygenerowania  -->
+    <property name="cables_from_joins_to_PE.xml" value="cables_from_joins_to_PE${plamy_prefix}.xml"/><!-- xml do wygenerowania  -->
         
             <property name="biale_put_Cables_to_PE.php" value="biale_put_Cables_to_PE.php"/>
     
-    
+    <property name="PE_fixings.xml" value="PE_fixings${plamy_prefix}.xml"/>
     
     <!--<include file="${build_edge_paths_with_PE_controll_loop.xml}" optional=""/>-->
     
@@ -263,6 +277,9 @@
    
    
    
+   
+   
+   
     <target name="biale_plamy_class_regenerate.php">
         <!--<antcall target="install_in_file_db_query">
             <param name="sql_query" value="select 1+1;"/>
@@ -270,6 +287,7 @@
         <record name="${build.log}" loglevel="verbose" append="true"/>
         <exec executable="php" failonerror="true" dir=".">
             <arg file="${biale_plamy_class_regenerate.php}"/>
+            <arg line="plamy_prefix=${plamy_prefix}"/>
         </exec>
         <echo message="Teraz Przelec arraya joins2ways pod katem 1-elementowych subarrayow"/>
     </target> 
@@ -541,6 +559,96 @@
         <exec executable="php" failonerror="true" dir=".">
             <arg file="${biale_put_Cables_to_PE.php}"/>
         </exec>
+    </target>
+    
+    <target name="import_ssl_certificates_to_system_check" description="Sprawdzenie czy nie zostal juz prawidlowo dodany do danego systemu certyfikat">
+        <echo>Sprawdzam czy nie ma certyfikatu - czy jest plik ${API_address_cert.installed} </echo>
+        
+        <exec command="keytool" output="${API_address_cert.installed}">
+            <arg value="-list"/>
+            <arg value="-keystore"/>
+            <arg value="${cacert_dir}"/>
+            <arg value="-storepass"/>
+            <arg value="${Password_for_cacerts}"/>
+            <arg value="-noprompt"/>
+        </exec>
+        <loadfile property="API_address_cert.installed_contents" srcfile="${API_address_cert.installed}" />
+        
+        <condition  property="API_address_cert.installed_exists_ok"  taskname="import_ssl_certificates_to_system"  else="NotInstalled"  >
+            <!--<available file="${API_address_cert.installed}" filepath="."/>-->
+            <contains string="${API_address_cert.installed_contents}" substring="${API_address}"/>
+        </condition>
+        <echo message="API_address_cert.installed_exists_ok ${API_address_cert.installed_exists_ok}  .  "/>
+    </target>
+    
+    <target name="import_ssl_certificates_to_system" depends="import_ssl_certificates_to_system_check"  unless="${API_address_cert.installed_exists_ok}" description="niezbedne jest sciagniecie certyfikatow bo nie dzialaja przy requestach WFS">
+        <echo>  bedzie wgrany certyfikat do ${java.home}/ ant home: ${ant.home}  dokl do ${cacert_dir}  </echo>
+        <delete file="${API_address_cert.txt}"/>
+        <delete file="${API_address_cert.cert}"/>
+        <delete file="${API_address_cert.installed}"/>
+        
+        <echo  message="${java.home}">   $java.home  </echo>
+        <echo  message="${sun.boot.library.path}"> $sun.boot.library.path</echo>
+        <echo  message="${java.library.path}"> $java.library.path</echo>
+        <echo message="${java.security.policy}">java.security.policy</echo>
+        
+        <exec output="${API_address_cert.txt}"  executable="${gnutls-cli}" >
+            <arg line=" --print-cert ${API_address} &lt; /dev/null "/>
+        </exec>
+        <exec  input="${API_address_cert.txt}" output="${API_address_cert.cert}" executable="openssl">
+            <arg line="x509"/>
+        </exec>
+        <exec executable="keytool">
+            <arg line="-import -v -trustcacerts -alias ${API_address} -file ${API_address}.cert -keystore ${cacert_dir} -storepass ${Password_for_cacerts} -noprompt"/>
+        </exec>
+        
+        <echoproperties destfile="${API_address_cert.installed}">
+            <propertyset><propertyref name="API_address"/></propertyset>
+        </echoproperties>
+        <!--<touch file="${API_address_cert.installed}"/>-->
+        <!--<echoproperties destfile="build.settings.xml"/>-->
+    </target>
+    
+    <target name="get_PE_fixings_from_db"   description="sciagniecie zmian PE glownie usunietych aby wyliczyc ponownie kable do innych wezlow" depends="import_ssl_certificates_to_system">
+        <!--wget -\-http-user=$usr -\-password=$passwd  
+            https://biuro.biall-net.pl/SE/version-git/api.php/xml/table/default_db/_S_ADDRESS_STREETS_distincts/items -\-no-check-certificate -O _S_ADDRESS_STREETS_distincts.xml ;-->
+        <property name="WFS_VERSION" value="&amp;VERSION=1.0.0"/>
+        <property name="TYPENAME" value="&amp;TYPENAME=p5_default_db:Rozdzielcza_test_bzyk_PE"/>  
+        <!--<property name="API_wfst_url2" value="https://onet.pl"/>-->
+        <!--<property name="OGC_Filter"> 
+            &amp;Filter=
+            &lt;ogc:Filter&gt;
+            &lt;ogc:Or&gt;
+            &lt;ogc:Not&gt;
+            &lt;ogc:PropertyIsNull&gt;
+            &lt;ogc:PropertyName&gt;the_geom&lt;/ogc:PropertyName&gt;
+            &lt;/ogc:PropertyIsNull&gt;
+            &lt;/ogc:Not&gt;
+            &lt;ogc:PropertyIsEqualTo&gt;
+            &lt;ogc:PropertyName&gt;ID&lt;/ogc:PropertyName&gt;
+            &lt;ogc:Literal&gt;2&lt;/ogc:Literal&gt;
+            &lt;/ogc:PropertyIsEqualTo&gt;
+            &lt;/ogc:Or&gt;
+            &lt;/ogc:Filter&gt;</property>-->
+        <property name="OGC_Filter" value=""/>
+            
+        <property name="URL_get_PE_fixings_from_db" value="${API_wfst_url}?SERVICE=WFS${WFS_VERSION}&amp;${TYPENAME}&amp;REQUEST=GetFeature&amp;SRSNAME=EPSG:3003${OGC_Filter}"/>
+        <!--<echo output="OGC_Filter">
+           
+        </echo>-->
+        
+        <echo message="we get data from URL: ${URL_get_PE_fixings_from_db}"></echo>
+        
+        <echoproperties destfile="${API_address_cert.installed}">
+            <propertyset><propertyref name="URL_get_PE_fixings_from_db"/></propertyset>
+        </echoproperties>
+        
+        <get dest="${PE_fixings.xml}"  username="${username_p5_admin}" password="${username_p5_admin_pass}">
+            <url  url="${URL_get_PE_fixings_from_db}"/>
+        </get>
+        
+        
+        
     </target>
    
     <!--<target name="1_install_mysql_functions">
@@ -625,6 +733,8 @@
     
     <!--<property name="biale_plamy-prepare_sql_data.php" value="biale_plamy-prepare_sql_data.php"/>-->
     
+    
+    
     <target name="mail_inform">
         
         <echo message="informujemy o kompletnej pracy"/>

+ 9 - 7
SE/dev/php-cli/build_edge_paths_with_PE_controll_loop.xsl

@@ -5,13 +5,14 @@
     exclude-result-prefixes="xs"
     version="2.0">
     
-    <xsl:param name="edge_paths_with_PE_controll_temp" select="'edge_paths_with_PE_controll_temp'"/>
-    <xsl:param name="edge_paths_with_PE_controll_temp.alias" select="'edge_paths_with_PE_controll_temp.alias'"/>
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    <xsl:param name="edge_paths_with_PE_controll_temp" select="concat('edge_paths_with_PE_controll_temp',$plamy_prefix)"/>
+    <xsl:param name="edge_paths_with_PE_controll_temp.alias" select="concat('edge_paths_with_PE_controll_temp.alias',$plamy_prefix)"/>
     <xsl:param name="edge_paths_with_PE_controll.xsl" select="'edge_paths_with_PE_controll.xsl'"/>
-    <xsl:param name="edge_paths_with_PE_controll.xml" select="'edge_paths_with_PE_controll.xml'"/>
-    <xsl:param name="edge_paths_with_PE_controll_paths_temp" select="'edge_paths_with_PE_controll_paths_temp'"/>
+    <xsl:param name="edge_paths_with_PE_controll.xml" select="concat('edge_paths_with_PE_controll.xml',$plamy_prefix)"/>
+    <xsl:param name="edge_paths_with_PE_controll_paths_temp" select="concat('edge_paths_with_PE_controll_paths_temp',$plamy_prefix)"/>
     
-    <xsl:param name="edge_joins_filled_paths" select="'edge_joins_filled_paths'"/>
+    <xsl:param name="edge_joins_filled_paths" select="concat('edge_joins_filled_paths',$plamy_prefix)"/>
     <xsl:param name="PE_Price" select="2500"/>
     <xsl:param name="Cable_Price" select="3"/>
     <xsl:param name="max_combinate_groups_elements" select="10"/> <!-- po ile wezlow mamy grupowac do wyliczania kombinacji kosztow -->
@@ -53,7 +54,7 @@
         <delete file="{$edge_paths_with_PE_controll_paths_temp}/{$edge_paths_with_PE_controll.xsl}.{@id}.xml"/>
         <xslt basedir="./" style="{$edge_paths_with_PE_controll.xsl}" 
             in="{$edge_joins_filled_paths}/{$edge_joins_filled_paths}.{@id}.xml"  destdir="./" 
-            out="{$edge_paths_with_PE_controll.xsl}.{@id}.xml" >
+            out="{$edge_paths_with_PE_controll.xsl}{$plamy_prefix}.{@id}.xml" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
                 <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="DITA_PARSE_templ"/>-->
@@ -67,9 +68,10 @@
             <param name="max_combinate_groups_elements" expression="{$max_combinate_groups_elements}"/> <!-- po ile wezlow mamy grupowac do wyliczania kombinacji kosztow -->
             <param name="logic" expression="{$logic}"/>
             <param name="edge_paths_with_PE_controll_paths_temp" expression="{$edge_paths_with_PE_controll_paths_temp}"/>
+            <param name="plamy_prefix" expression="{$plamy_prefix}"/>
             <!--<xsl:param name="logic" select="'sorted'"/>--> <!-- tutaj robi grupy ale analizyje w grupie tylko wazniejsze/bardziej oblozone wezly --> 
         </xslt>
-        <move file="{$edge_paths_with_PE_controll.xsl}.{@id}.xml" todir="{$edge_paths_with_PE_controll_paths_temp}"/>
+        <move file="{$edge_paths_with_PE_controll.xsl}{$plamy_prefix}.{@id}.xml" todir="{$edge_paths_with_PE_controll_paths_temp}"/>
     </xsl:template>
     
 </xsl:stylesheet>

+ 4 - 3
SE/dev/php-cli/cables_from_joins_to_PE.xsl

@@ -8,11 +8,12 @@
     <xsl:strip-space elements="*"/>
     
     <xsl:include href="asText.xsl"/>
+    <xsl:param name="plamy_prefix" select="'test2'"/>
     
-    <xsl:param name="edge_paths_with_PE.xml" select="'edge_paths_with_PE.xml'"/>
-    <xsl:param name="joins_asText_xml.xml" select="'joins_asText_xml.xml'"/>
+    <xsl:param name="edge_paths_with_PE.xml" select="concat('edge_paths_with_PE',$plamy_prefix,'.xml')"/>
+    <xsl:param name="joins_asText_xml.xml" select="concat('joins_asText_xml',$plamy_prefix,'.xml')"/>
     <!--<xsl:param name="edge_joins_filled_paths.xml" select="'edge_joins_filled_paths.xml'"/>-->
-    <xsl:param name="points2joins.xml" select="'points2joins.xml'"/>
+    <xsl:param name="points2joins.xml" select="concat('points2joins',$plamy_prefix,'.xml')"/>
     <xsl:param name="edge_joins_filled_paths" select="'edge_joins_filled_paths'"/>
     
     <xsl:variable name="PE_candidates_dump" select="doc($edge_paths_with_PE.xml)"/>

+ 6 - 5
SE/dev/php-cli/edge_joins_filled_paths_make.xsl

@@ -5,20 +5,21 @@
     exclude-result-prefixes="xs"
     version="2.0">
     
-    <xsl:param name="ways_as_Text_z_ID_xml.xml" select="'ways_as_Text_z_ID_xml.xml'"/>
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    <xsl:param name="ways_as_Text_z_ID_xml.xml" select="concat('ways_as_Text_z_ID_xml',$plamy_prefix,'.xml')"/>
     <xsl:variable name="ways_asText_z_ID_xml" select="doc($ways_as_Text_z_ID_xml.xml)"/>
     
-    <xsl:param name="joins_asText_xml.xml" select="'joins_asText_xml.xml'"/>
+    <xsl:param name="joins_asText_xml.xml" select="concat('joins_asText_xml',$plamy_prefix,'.xml')"/>
     <xsl:variable name="joins_asText_xml" select="doc($joins_asText_xml.xml)"/>
     
    
-    <xsl:param name="ways2joins.xml" select="'ways2joins.xml'"/>
+    <xsl:param name="ways2joins.xml" select="concat('ways2joins',$plamy_prefix,'.xml')"/>
     <xsl:variable name="ways2joins" select="doc($ways2joins.xml)"/>
     
-    <xsl:param name="joins2ways_z_ID_Way.xml" select="'joins2ways_z_ID_Way.xml'"/>
+    <xsl:param name="joins2ways_z_ID_Way.xml" select="concat('joins2ways_z_ID_Way',$plamy_prefix,'.xml')"/>
     <xsl:variable name="joins2ways_z_ID_Way" select="doc($joins2ways_z_ID_Way.xml)"/>
     
-    <xsl:param name="edge_joins_filled_paths" select="'edge_joins_filled_paths'"/> <!-- katalog do zapisywania sciezek -->
+    <xsl:param name="edge_joins_filled_paths" select="concat('edge_joins_filled_paths',$plamy_prefix)"/> <!-- katalog do zapisywania sciezek -->
     
     <xsl:param name="debug"  select="0" /> <!-- set 1 to debug -->
     

+ 2 - 1
SE/dev/php-cli/edge_paths_with_PE.xsl

@@ -7,7 +7,8 @@
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
-    <xsl:param name="joins2ways_z_ID_Way.xml" select="'joins2ways_z_ID_Way.xml'"/>
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    <xsl:param name="joins2ways_z_ID_Way.xml" select="concat('joins2ways_z_ID_Way',$plamy_prefix,'.xml')"/>
     
     <xsl:variable name="joins2ways_z_ID_Way" select="$joins2ways_z_ID_Way.xml"/>
     

+ 5 - 5
SE/dev/php-cli/edge_paths_with_PE_controll.xsl

@@ -11,7 +11,7 @@
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
-    
+    <xsl:param name="plamy_prefix" select="'test2'"/>
     <xsl:param name="PE_Price" select="2500"/>
     <xsl:param name="Cable_Price" select="3"/>
     <xsl:param name="max_combinate_groups_elements" select="8"/> <!-- po ile wezlow mamy grupowac do wyliczania kombinacji kosztow -->
@@ -22,10 +22,10 @@
     
     
     <!--<xsl:param name="edge_paths_with_PE.xml"/>-->
-    <xsl:param name="edge_paths_with_PE_controll_temp" select="'edge_paths_with_PE_controll_temp'"/> <!-- cache do przekazywani danych z petli-->
-    <xsl:param name="edge_paths_with_PE_controll_temp.alias" select="'edge_paths_with_PE_controll_temp.alias'" />
-    <xsl:param name="edge_paths_with_PE_controll_paths_temp" select="'edge_paths_with_PE_controll_paths_temp'"/> <!-- do przechowywania calych sciezek do PathCrossed-->
-    <xsl:param name="edge_joins_filled_paths" select="'edge_joins_filled_paths'"/>
+    <xsl:param name="edge_paths_with_PE_controll_temp" select="concat('edge_paths_with_PE_controll_temp',$plamy_prefix)"/> <!-- cache do przekazywani danych z petli-->
+    <xsl:param name="edge_paths_with_PE_controll_temp.alias" select="concat('edge_paths_with_PE_controll_temp.alias',$plamy_prefix)" />
+    <xsl:param name="edge_paths_with_PE_controll_paths_temp" select="concat('edge_paths_with_PE_controll_paths_temp',$plamy_prefix)"/> <!-- do przechowywania calych sciezek do PathCrossed-->
+    <xsl:param name="edge_joins_filled_paths" select="concat('edge_joins_filled_paths',$plamy_prefix)"/>
     <!-- bedziemy od najdluzszej drogi starac sie rozmiescic PE w oparciu o rozmieszczenie klientow oraz odleglosci  -->
     
     

+ 3 - 1
SE/dev/php-cli/edge_paths_with_PE_controll_to_PE_collection.xsl

@@ -7,10 +7,12 @@
     
     <xsl:include href="edge_paths_with_PE_controll_to_PE.xsl"/>
     
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
-    <xsl:param name="edge_paths_with_PE_controll_paths_temp" select="'edge_paths_with_PE_controll_paths_temp'"/> <!-- katalog z PE w plikach edge_paths_with_PE_controll.xsl.312.xml -->
+    <xsl:param name="edge_paths_with_PE_controll_paths_temp" select="concat('edge_paths_with_PE_controll_paths_temp',$plamy_prefix)"/> <!-- katalog z PE w plikach edge_paths_with_PE_controll.xsl.312.xml -->
     
     <!-- jedzie po koncach sciezek i z nich przyjmuje argument ID_Way po ktorym odpytuje sie pliki z wyloczeniami punktow -->
     

+ 6 - 3
SE/dev/php-cli/joins2ways_z_ID_Way.xsl

@@ -6,9 +6,12 @@
     version="2.0">
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
-    <xsl:param name="ways2drogi.xml"  select="'ways2drogi.xml'"/>
+    
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    
+    <xsl:param name="ways2drogi.xml"  select="concat('ways2drogi',$plamy_prefix,'.xml')"/>
     <xsl:variable name="ways2drogi" select="doc($ways2drogi.xml)"/>
-    <xsl:param name="points2joins.xml"  select="'points2joins.xml'"/>
+    <xsl:param name="points2joins.xml"  select="concat('points2joins',$plamy_prefix,'.xml')"/>
     <xsl:variable name="points2joins" select="doc($points2joins.xml)"/>
     <xsl:param name="joins2ways_z_ID_Way_tempdir" select="'joins2ways_z_ID_Way'"/>
     
@@ -65,7 +68,7 @@
         </xsl:for-each-group>
         </xsl:variable>
         <xsl:copy-of select="$items_grouped"/>
-        <!--<xsl:result-document href="{$joins2ways_z_ID_Way_tempdir}/joins2ways_z_ID_Way.{@id}.{@ID_Way}.xml">
+        <!--<xsl:result-document href="{$joins2ways_z_ID_Way_tempdir}{$plamy_prefix}/joins2ways_z_ID_Way.{@id}.{@ID_Way}.xml">
             <joins2ways_z_ID_Way>
                 <xsl:attribute name="id" select="@id"/>
                 <xsl:copy-of select="$items_grouped"/>

+ 3 - 1
SE/dev/php-cli/joins_asText_xml.xsl

@@ -7,7 +7,9 @@
     
     <xsl:import href="asText.xsl"/>
     
-    <xsl:param name="points2joins.xml"  select="'points2joins.xml'"/>
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    
+    <xsl:param name="points2joins.xml"  select="concat('points2joins',$plamy_prefix,'.xml')"/>
     <xsl:variable name="points2joins" select="doc($points2joins.xml)"/>
     
     <xsl:output indent="yes"/>

+ 4 - 2
SE/dev/php-cli/ways_as_Text_z_ID_xml.xsl

@@ -6,10 +6,12 @@
     version="2.0">
      
     <xsl:import href="asText.xsl"/>
-    <xsl:param name="ways2drogi.xml" select="'ways2drogi.xml'"/>
+    <xsl:param name="plamy_prefix" select="'test2'"/>
+    
+    <xsl:param name="ways2drogi.xml" select="concat('ways2drogi',$plamy_prefix,'.xml')"/>
     <xsl:variable name="ways2drogi" select="doc($ways2drogi.xml)"/>
     
-    <xsl:param name="waysLengths.xml" select="'waysLengths.xml'"/>
+    <xsl:param name="waysLengths.xml" select="concat('waysLengths',$plamy_prefix,'.xml')"/>
     <xsl:variable name="waysLengths" select="doc($waysLengths.xml)"/>
     
     

+ 16 - 15
SE/se-lib/Api/WfsDataServer.php

@@ -4,6 +4,7 @@ Lib::loadClass('Api_WfsServerBase');
 Lib::loadClass('Api_WfsException');
 Lib::loadClass('Api_WfsGeomTypeConverter');
 Lib::loadClass('Api_WfsNs');
+Lib::loadClass('DBG');
 
 class Api_WfsDataServer extends Api_WfsServerBase {
 
@@ -99,9 +100,9 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 	}
 
 	public function getTotalFeatures($args, $simple = true) {
-		$DBG = (V::get('DBG_GEO', '', $_GET) > 0);// TODO: Profiler
-		if($DBG){echo "typeName({$args['xsd:type']})\n";}
+		DBG::log("typeName({$args['xsd:type']})");
 		$acl = $this->getAclFromTypeName($args['xsd:type']);
+		DBG::log([ 'msg'=>"typeName({$args['xsd:type']}) - acl(".get_class($acl).")", '$acl'=>$acl ]);
 		$fldList = $this->_getFieldListFromAcl($acl);
 
 		$baseNsUri = Api_WfsNs::getBaseWfsUri();
@@ -121,7 +122,7 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 			}
 		}
 
-		if($DBG){echo "ogcFilter(" . strlen($args['ogc:filter']) . "): {$args['ogc:filter']}\n";}
+		DBG::log("ogcFilter(" . strlen($args['ogc:filter']) . "): {$args['ogc:filter']}");
 		$searchParams = array();
 		$searchParams['limit'] = $args['limit'];
 		$searchParams['limitstart'] = $args['offset'];
@@ -135,9 +136,9 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 		if (!empty($args['filterFields'])) $searchParams['cols'] = $args['filterFields'];// propertyName
 		if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
 		if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
-		if($DBG){echo 'getItems() searchParams:';print_r($searchParams);echo "\n";}
+		DBG::log([ 'msg'=>"getTotal() - searchParams", '$searchParams'=>$searchParams ]);
 		$totalItems = $acl->getTotal($searchParams);
-		if($DBG){echo 'totalItems:';print_r($totalItems);echo "\n";}
+		DBG::log([ 'msg'=>"getTotal() - total", '$totalItems'=>$totalItems ]);
 
 		$xmlWriter = new XMLWriter();
 		if (!$xmlWriter) throw new HttpException("Error no XMLWriter", 404);
@@ -159,11 +160,10 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 	}
 
 	public function getFeatures($args, $simple = true) {
-		$DBG = (V::get('DBG_GEO', '', $_GET) > 0);// TODO: Profiler
-		$DBG_DS = V::get('DBG_DS', 0, $_GET, 'int');
 		$type = $args['typeName'];
-		if($DBG){echo "typeName({$args['xsd:type']})\n";}
+		DBG::log("typeName({$args['xsd:type']})");
 		$acl = $this->getAclFromTypeName($args['xsd:type']);
+		DBG::log([ 'msg'=>"typeName({$args['xsd:type']}) - acl(".get_class($acl).")", '$acl'=>$acl ]);
 		$fldList = $this->_getFieldListFromAcl($acl);
 
 		$baseNsUri = Api_WfsNs::getBaseWfsUri();
@@ -183,7 +183,7 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 			}
 		}
 
-		if($DBG){echo "ogcFilter(" . strlen($args['ogc:filter']) . "): {$args['ogc:filter']}\n";}
+		DBG::log("ogcFilter(" . strlen($args['ogc:filter']) . "): {$args['ogc:filter']}");
 		$searchParams = array();
 		$searchParams['limit'] = $args['limit'];
 		$searchParams['limitstart'] = $args['offset'];
@@ -197,8 +197,9 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 		if (!empty($args['filterFields'])) $searchParams['cols'] = $args['filterFields'];// PropertyName
 		if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
 		if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
-		if($DBG){echo 'getItems:';print_r($searchParams);echo "\n";}
+		DBG::log([ 'msg'=>'getItems - $searchParams', '$searchParams'=>$searchParams ]);
 		$items = $acl->getItems($searchParams);
+		DBG::log([ 'msg'=>'getItems - $items', '$items'=>$items ]);
 
 		header('Content-type: application/xml; charset=utf-8');
 		$xmlWriter = new XMLWriter();
@@ -219,20 +220,20 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 		if (!$simple) $xmlWriter->writeAttribute("xmlns:{$rootWfsNs}", $rootWfsNsUri);
 		$xmlWriter->writeAttribute('xsi:schemaLocation', "{$wfsNsUri} {$featureTypeUri}");
 
-		if($DBG){echo '(geomFld: '.$geomFld.'):';print_r($acl->getFieldType($geomFld));echo "\n";}
+		DBG::log([ 'msg'=>'$geomFld - getFieldType', 'getFieldType'=>$acl->getFieldType($geomFld) ]);
 		$tblName = $acl->getName();
 		foreach ($items as $itemKey => $item) {
 			if (!is_array($item)) $item = (array)$item;
 
-			if($DBG && !empty($geomFld)){echo 'item['.$itemKey.'] ('.$geomFld.')isEmpty('.empty($item[$geomFld]).'):';print_r($item[$geomFld]);echo "\n";}
-			if($DBG_DS){echo ">>> loop({$itemKey}) item: ";print_r($item);echo "\n";}
+			if (!empty($geomFld)) DBG::log(['msg'=>"item[{$itemKey}] ({$geomFld})isEmpty(".empty($item[$geomFld])."):", '$item['.$geomFld.']'=>$item[$geomFld]]);
+			DBG::log([ 'msg'=>">>> loop({$itemKey})", '$item'=>$item ]);
 
 			$xmlWriter->startElement('gml:featureMember');
 				$xmlWriter->startElement("{$wfsNs}:{$type}");
 					$xmlWriter->writeAttribute('fid', "{$type}.{$itemKey}");
 					if (!$simple) $xmlWriter->writeAttribute("{$rootWfsNs}:web_link", Request::getPathUri() . "index.php?_route=ViewTableAjax&namespace=" . $acl->getNamespace() . "#EDIT/{$itemKey}");
 					foreach ($fldList as $idZasob => $fldName) {
-						if($DBG_DS){echo ">>> loop({$itemKey}) item({$item['ID']}) fld({$fldName}): ";var_dump($item[$fldName]);echo"\n";}
+						DBG::log([ 'msg'=>">>> loop({$itemKey}) item({$item['ID']}) fld({$fldName})", '$item'=>$item[$fldName] ]);
 						$fldType = $acl->getXsdFieldType($fldName);
 						if (!$acl->canReadObjectField($fldName, (object)$item)) continue;
 
@@ -247,7 +248,7 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 								$this->_typeConverter->createGmlFromWkt_xmlWriter($item[$fldName], $xmlWriter);
 							$xmlWriter->endElement();// {$wfsNs}:{$fldName}
 						} else if (is_array($item[$fldName])) {// TODO: by struct - REF field
-							if($DBG_DS){echo">>> TODO({$fldName}) REF item[{$itemKey}][{$fldName}]: ";print_r($item[$fldName]);echo "\n";}
+							DBG::log([ 'msg'=>">>> loop({$itemKey}) REF item[{$itemKey}][{$fldName}]", '$item'=>$item[$fldName] ]);
 							if (1 == count($item[$fldName])) {
 								$xlink = $item[$fldName][0]['xlink'];
 								$xlinkParts = explode(':', $xlink);

+ 2 - 2
SE/se-lib/Core/Database/Mysql.php

@@ -50,10 +50,10 @@ class Core_Database_Mysql extends Core_Database {
 	function query( $query, $msg = 'Query ERROR.' ) {
 		$null = null;
 		if (!$this->_conn) { return $null; }
-		DBG::_('DBG_SQL', '>4', 'sql', $query, __CLASS__, __FUNCTION__, __LINE__);
+		DBG::log($query, 'sql');
 		$res = mysql_query($query, $this->_conn);
 		if (!$res) {
-			DBG::_('DBG_SQL', '>1', 'SQL QUERY FAILED:', mysql_error($this->_conn), __CLASS__, __FUNCTION__, __LINE__);
+			DBG::log("SQL QUERY FAILED: " . mysql_error($this->_conn));
 			$this->_set_error('SQL QUERY FAILED: '.mysql_error($this->_conn));
 			return $null;
 		}

+ 3 - 1
SE/se-lib/Data_Source.php

@@ -2,6 +2,7 @@
 
 Lib::loadClass('SqlQueryWhereBuilder');
 Lib::loadClass('ParseOgcFilter');
+Lib::loadClass('DBG');
 
 /**
  * API:
@@ -657,6 +658,7 @@ class Data_Source {
 
 	public function getItems($params = array()) {
 		$primaryKeyField = $this->getPrimaryKeyField();
+		DBG::log("Data_Source::getItems - \$primaryKeyField({$primaryKeyField})");
 		$items = array();
 		$sql = new stdClass();
 		$sql->_cols = V::get('cols', null, $params);
@@ -715,7 +717,7 @@ class Data_Source {
 			{$sql->orderBy}
 			limit {$sql->limit} offset {$sql->offset}
 		";
-		DBG::_('DBG_DS', '>2', "sql", $sql, __CLASS__, __FUNCTION__, __LINE__);
+		DBG::log([ 'msg'=>"Data_Source::getItems - \$sql", '$sql'=>$sql ]);
 		$res = $this->_db->query($sql->query);
 		while ($r = $this->_db->fetch($res)) {
 			$items[$r->{$primaryKeyField}] = $r;

+ 7 - 1
SE/se-lib/Route/Debug.php

@@ -28,6 +28,12 @@ class Route_Debug extends RouteBase {
     UI::gora();
     UI::menu();
     UI::setTitle("Debug");
+    if (!empty($_POST)) {
+      UI::alert('info', "is POST - history.pushState");
+      echo UI::h('script', [], "
+        history.replaceState(null, 'Debug', window.location.href);
+      ");
+    }
     try {
       echo UI::h('h1', [], [
         "Debug ",
@@ -219,7 +225,7 @@ class Route_Debug extends RouteBase {
                 'title' => htmlspecialchars( ('sql' == $dbg['type'] && is_string($dbg['log'])) ? $dbg['log'] : var_export($dbg['log'], true) ),
                 'onClick' => "return p5DBG__showLogTrace(this, event)",
                 'style' => "cursor:pointer"
-              ], substr(htmlspecialchars(json_encode($dbg['log'])), 0, 100) . ' ...'
+              ], str_replace(array('\n', '\t'), ' ', substr(htmlspecialchars(json_encode($dbg['log'])), 0, 100)) . ' ...'
             ),
             'trace' => UI::h('div', [
                 'title' => htmlspecialchars($dbg['trace']),

+ 8 - 6
SE/se-lib/Route/UrlAction/TaskManager.php.task.css

@@ -63,9 +63,13 @@
 	float:left;
 }
 
+.delTask:hover{
+	background-color:#f5f5f5;
+}
+
 .eInput{
 	margin-left:5px;
-	width:95%;
+	width:80%;
 	float:left;
 	display:inline-block;
   min-height:20px;
@@ -80,7 +84,7 @@
 .editable{
 
 	margin-left:5px;
-	width:calc(100% - 160px);
+	width:calc(100% - 130px);
 	display:inline-block;
 	background-color:transparent;
   min-height:15px;
@@ -89,13 +93,11 @@
   outline: none;
 }
 
-.glyphicon-menu-hamburger{
+.cursorClick{
 	cursor:pointer;
 }
 
-.glyphicon-option-vertical{
-	cursor:pointer;
-}
+
 
 .check, .aCheck{
 	cursor:pointer;

+ 22 - 20
SE/se-lib/Route/UrlAction/TaskManager.php.task.js

@@ -214,20 +214,19 @@ $(document).on('dblclick', '#sortable li', function(e) {
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     version="1.0.0"
     service="WFS"
-    xmlns:p5_default_db="` + BASE_URL + `wfs/default_db/PROBLEMS"
-    xsi:schemaLocation="` + BASE_URL + `wfs/default_db/PROBLEMS` + BASE_URL + `dev-pl/se-feature-api/wfs.php/xml/wfs/default_db/PROBLEMS/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=p5_default_db:PROBLEMS&amp;SRSNAME=EPSG:4326&amp;"
+    xmlns:p5_default_db="` + BASE_WFS_URL + `/default_db/"
     xmlns:gml="http://www.opengis.net/gml">
   `;
   req += `
     <Insert xmlns="http://www.opengis.net/wfs">
-    <PROBLEMS xmlns="` + BASE_URL + `wfs/default_db/PROBLEMS">
-    <ID xmlns="` + BASE_URL + `wfs/default_db/PROBLEMS">` + $(this).data("id") + `</ID>`;
+    <PROBLEMS xmlns="` + BASE_WFS_URL + `/default_db/">
+    <ID xmlns="` + BASE_WFS_URL + `/default_db/">` + $(this).data("id") + `</ID>`;
   if (state[index]["status"] == "NORMAL") {
     state[index]["status"] = "WAITING";
-    req += '<A_STATUS xmlns="' + BASE_URL + 'wfs/default_db/PROBLEMS">WAITING</A_STATUS>';
+    req += '<A_STATUS xmlns="' + BASE_WFS_URL + '/default_db/">WAITING</A_STATUS>';
   } else if (state[index]["status"] == "WAITING") {
     state[index]["status"] = "NORMAL";
-    req += '<A_STATUS xmlns="' + BASE_URL + 'wfs/default_db/PROBLEMS">NORMAL</A_STATUS>';
+    req += '<A_STATUS xmlns="' + BASE_WFS_URL + '/default_db/">NORMAL</A_STATUS>';
   }
   req += `</PROBLEMS>
     </Insert>
@@ -822,27 +821,29 @@ function render() {
       }
     }
     result += "<li class=singleTask data-id=" + e["id"] + "  style='"+css+"'>";
-    result += "<span class='glyphicon glyphicon-option-vertical ico'></span>";
+
     if (e["percent"] == "100%") {
-      result += "<span class=check style='background-color:#333333'></span>";
+      result += "<span class=check style='background-color:#333333' data-toggle='popover' data-trigger='hover' title='' data-content='Kliknij teraz, aby zmienić status na niewykonane.' data-original-title='Zadanie wykonane'></span>";
       if (e['status'] != "OFF_HARD") {
-        result += "<span class=aCheck></span>";
+        result += "<span class=aCheck data-toggle='popover' data-trigger='hover' title='' data-content='Wykonawca oznaczył zadanie jako wykonane, ale zleceniodawca jeszcze go nie zatwierdził.' data-original-title='Wykonanie zadania niezatwierdzone.'></span>";
       } else {
-        result += "<span class=aCheck style=background-color:#2ecc71;></span>";
+        result += "<span class=aCheck style=background-color:#2ecc71; data-toggle='popover' data-trigger='hover' title='' data-content='Zleceniodawca zatwierdził wykonanie zadania. Kliknij, aby cofnąć zatwierdzenie.' data-original-title='Zadanie zatwierdzone'></span>";
       }
     } else {
-      result += "<span class=check></span>";
+      result += "<span class='glyphicon glyphicon-option-vertical ico cursorClick' style=float:left;cursor:grab; data-toggle='popover' data-trigger='hover' title='' data-content='Złap tutaj, aby zmienić pozycje tego zadania.' data-original-title='Sortowanie'></span>";
+      result += "<span class=check data-toggle='popover' data-trigger='hover' title='' data-content='Oznacz zadanie jako wykonane. Podwójne kliknięcie gdziekolwiek na zadanie spowoduje oznaczenie go jako aktualnie wykonywane.' data-original-title='Zadanie niewykonane'></span>";
     }
-    result += "<input type=text "+(e["childs"] ? "DISABLED" : "")+" class='form-control hours' value='"+e["period"]+"' style=width:40px;float:left;padding:0px;height:25px;>"
-    result += "<textarea " + (USER != e["owner"] ||  e['status'] == "OFF_HARD" ? "DISABLED" : "") + ' class="editable" style="font-size:small">' + e['desc'] + "</textarea>";
+    result += "<input type=text "+(e["childs"] ? "DISABLED" : "")+" placeholder='czas' class='form-control hours' value='"+e["period"]+"' style=width:40px;float:left;padding:0px;height:25px; data-toggle='popover' data-trigger='hover' title='' data-content='Wpisz tutaj czas, który zostanie/został przeznaczony na to zadanie i zatwierdź ENTER. ' data-original-title='Czas przeznaczony na zadanie'>"
+
+    result += "<textarea " + (USER != e["owner"] ||  e['status'] == "OFF_HARD" ? "DISABLED" : "") + ' class="editable" style="font-size:small" >' + e['desc'] + "</textarea>";
     result += `<div class="dropdown" style=display:inline;>
-      <span class="glyphicon glyphicon glyphicon-menu-hamburger" style="vertical-align: top;" data-toggle="dropdown"></span>
+      <span class="glyphicon glyphicon glyphicon-menu-hamburger cursorClick" style="vertical-align: top;" data-toggle="dropdown"></span>
       <ul class="dropdown-menu dropdown-menu-right">
       <li><a href=` + BASE_URL + `index.php?_route=UrlAction_TaskManager&ID_PROBLEM=` + e['id'] + `>Szczegóły</a></li>
       <li><p style="cursor:pointer;padding:3px 20px;" class=delTask>Usuń</p></li>
       </ul>
       </div>`;
-    result += ((e['owner'] != USER) ? " <span class='glyphicon glyphicon-user user' title='Zlecone przez inną osobę'></span>" : "") + "</li>";
+    //result += ((e['owner'] != USER) ? " <span class='glyphicon glyphicon-user user' title='Zlecone przez inną osobę'></span>" : "") + "</li>";
     if (e['percent'] == "100%") {
       resultDone += result;
     } else {
@@ -854,6 +855,7 @@ function render() {
   $("#sortable").html(resultActive);
   $("#doneList").html(resultDone);
   $('.editable').autosize();
+  $('[data-toggle="popover"]').popover();
 }
 
 function loadStats(){
@@ -878,17 +880,17 @@ function renderTaskManager() {
     loadStats();
   }
   $(".taskList").append("<div class=progress></div>");
-  $(".progress").append("<div id=accepted class='progress-bar progress-bar-success progress-bar-striped' role=progressbar style=width:9%>0%</div>");
-  $(".progress").append("<div id=completed class='progress-bar progress-bar-info progress-bar-striped' role=progressbar style=width:9%>0%</div>");
+  $(".progress").append("<div id=accepted class='progress-bar progress-bar-success progress-bar-striped' role=progressbar style=width:9% data-toggle='popover' data-trigger='hover' title='' data-content='Wskazuje na procent całości jakie stanowią zatwierdzone zadania.' data-html='true' data-original-title='% zatwierdzonych zadań' data-placement='bottom'>0%</div>");
+  $(".progress").append("<div id=completed class='progress-bar progress-bar-info progress-bar-striped' role=progressbar style=width:9% data-toggle='popover' data-trigger='hover' title='' data-content='Wskazuje na procent całości jakie stanowią wykonane zadania.' data-html='true' data-original-title='% wykonanych zadań' data-placement='bottom'>0%</div>");
   $(".taskList").append("<ul id='sortable'></ul>");
 
   // $("#sortable").append("<li><span class='glyphicon glyphicon-option-vertical ico'></span><span class=check data-step=0></span> <div class=editable contentEditable='true'>Zaprojektować podstawowy layout skryptu</div></li>");
   // $("#sortable").append("<li><span class='glyphicon glyphicon-option-vertical ico'></span><span class=check data-step=0></span> <div class=editable contentEditable='true'>Stworzyć tasklistę, dodać przesuwaunie i flagowanie</div></li>");
   // $("#sortable").append("<li><span class='glyphicon glyphicon-option-vertical ico'></span><span class=check data-step=0></span> <div class=editable contentEditable='true'>Dodać po lewej stronie formularz</div></li>");
   // $("#sortable").append("<li><span class='glyphicon glyphicon-option-vertical ico'></span><span class=check data-step=0></span> <div class=editable contentEditable='true'>Połączyć z API</div></li>");
-  $(".taskList").append('<div id="add" style="font-size:small">' +
-    '<span class="glyphicon glyphicon-plus addIco" style="padding-top:3px"></span> ' +
-    '<textarea class="eInput" style="font-size:small" id="datepicker" placeholder="Dodaj zadanie"></textarea>' +
+  $(".taskList").append('<div id="add" style="font-size:small;">' +
+    '<span class="glyphicon glyphicon-plus addIco" style="padding-top:3px;margin-left:65px;"></span> ' +
+    '<textarea class="eInput" style="font-size:small" data-toggle="popover" data-trigger="hover" title="" data-content="Wpisz treść i zatwierdź <b>ENTER</b>.<br> Użyj tagów:<br> @nazwauzytkownika -> wykonawca <br> @RRRR-MM-DD -> Termin wykonania <br> np. <br>`@janKowalski @2017-03-12 Nadać przesyłkę`" data-html="true" data-original-title="Dodaj zadanie" data-placement="top" id="datepicker" placeholder="Dodaj zadanie"></textarea>' +
     '<div class="clearfix"></div>' + '</div>');
   picker = $("<input/>", {
     type: 'text',

+ 3 - 3
SE/se-lib/TableAjax.php

@@ -1823,14 +1823,14 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
 							selected = (selectedFilter && selectedFilter == colFltr.name)? 'checked="checked"' : '',
 							input = '<input ' + selected + ' type="radio" style="margin:0"/>',
 							a = $('<a href="#" data-col_filter="' + colFltr.name + '" style="padding:0px 20px;">' + input + ' ' + colFltr.label + '</a>').appendTo(li);
-							if ('all' != colFltr && 'most_used' != colFltr) {
-								arm = $('<button data-col_filter="' + colFltr.name + '" class="pull-right btn btn-xs btn-link" style="color:red">' + '&times;' + '</a>').appendTo(a);
+							if ('all' != colFltr.name && 'most_used' != colFltr.name) {
+								arm = $('<button data-col_filter="' + colFltr.name + '" class="pull-right btn btn-xs btn-link" style="margin:0;padding:0;border:0;color:red">' + '&times;' + '</a>').appendTo(a);
 								arm.on('click', priv.modelColFilter_onClickRemoveFilter)
 							}
 				});
 
 				{// if (!selectedFilter) {// save current filter
-					var li = $('<li style="text-align:center"></li>').appendTo(ul)
+					var li = $('<li style="text-align:center; clear:both"></li>').appendTo(ul)
 					priv.modelColFilter_getSaveBtn().appendTo(li);
 				}