|
@@ -17,12 +17,12 @@ class Route_UrlAction_Ant extends Route_Ant {// @doc @see Route_Ant
|
|
|
DBG::nicePrint($taskList, 'ant-url_action');
|
|
DBG::nicePrint($taskList, 'ant-url_action');
|
|
|
|
|
|
|
|
$featureID = V::get('featureID', '', $_GET);
|
|
$featureID = V::get('featureID', '', $_GET);
|
|
|
- $namespace = V::get('namespace', '', $_GET);
|
|
|
|
|
|
|
+ $typeName = V::get('typeName', '', $_GET);
|
|
|
// TODO: validate missing ...
|
|
// TODO: validate missing ...
|
|
|
|
|
|
|
|
UI::startTag('ul');
|
|
UI::startTag('ul');
|
|
|
foreach ($taskList as $path => $label) {
|
|
foreach ($taskList as $path => $label) {
|
|
|
- $link = "index.php?_route=UrlAction_Ant&_task=ant&path={$path}&namespace={$namespace}&featureID={$featureID}";
|
|
|
|
|
|
|
+ $link = "index.php?_route=UrlAction_Ant&_task=ant&path={$path}&typeName={$typeName}&featureID={$featureID}";
|
|
|
echo UI::h('li', [], [
|
|
echo UI::h('li', [], [
|
|
|
UI::h('a', ['href'=>$link], "Uruchom '{$label}'")
|
|
UI::h('a', ['href'=>$link], "Uruchom '{$label}'")
|
|
|
]);
|
|
]);
|
|
@@ -35,6 +35,16 @@ class Route_UrlAction_Ant extends Route_Ant {// @doc @see Route_Ant
|
|
|
UI::dol();
|
|
UI::dol();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function outputAction() {// index.php?_route=UrlAction_Ant&_task=output & path={$path} & file={$file}";
|
|
|
|
|
+ $path = V::get('path', '', $_GET);
|
|
|
|
|
+ if (!$path) throw new Exception("Missing Ant path!");
|
|
|
|
|
+ $file = V::get('file', '', $_GET);
|
|
|
|
|
+ if (!$file) throw new Exception("Missing Ant file!");
|
|
|
|
|
+ // TODO: allow auth by token?
|
|
|
|
|
+
|
|
|
|
|
+ throw new Exception("TODO: return output file '$file' from ant task '{$path}'");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function antAction() {
|
|
public function antAction() {
|
|
|
UI::gora();
|
|
UI::gora();
|
|
|
try {
|
|
try {
|
|
@@ -42,26 +52,26 @@ class Route_UrlAction_Ant extends Route_Ant {// @doc @see Route_Ant
|
|
|
$path = V::get('path', '', $_GET);
|
|
$path = V::get('path', '', $_GET);
|
|
|
if (!$path) throw new Exception("Missing Ant path!");
|
|
if (!$path) throw new Exception("Missing Ant path!");
|
|
|
$featureID = V::get('featureID', '', $_GET);
|
|
$featureID = V::get('featureID', '', $_GET);
|
|
|
- $namespace = V::get('namespace', '', $_GET);
|
|
|
|
|
-
|
|
|
|
|
- $namespace_dot = explode(':', $namespace);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $typeName = V::get('typeName', '', $_GET);
|
|
|
|
|
+ $typeName_dot = explode(':', $typeName);// TODO: get wfs prefix from typeName
|
|
|
|
|
|
|
|
// TODO: validate missing ...
|
|
// TODO: validate missing ...
|
|
|
DBG::nicePrint($path, '$path');
|
|
DBG::nicePrint($path, '$path');
|
|
|
DBG::nicePrint($featureID, '$featureID');
|
|
DBG::nicePrint($featureID, '$featureID');
|
|
|
- DBG::nicePrint($namespace, '$namespace');
|
|
|
|
|
|
|
+ DBG::nicePrint($typeName, '$typeName');
|
|
|
|
|
|
|
|
$taskList = $this->getAntUrlActionList();
|
|
$taskList = $this->getAntUrlActionList();
|
|
|
if (!array_key_exists($path, $taskList)) throw new Exception("Ant path not exists! '{$path}'");
|
|
if (!array_key_exists($path, $taskList)) throw new Exception("Ant path not exists! '{$path}'");
|
|
|
|
|
|
|
|
echo UI::h('hr');
|
|
echo UI::h('hr');
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// $testUrl = Request::getPathUri() . "wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:TEST_PERMS&SRSNAME=EPSG:3003&featureID=TEST_PERMS.63";
|
|
|
|
|
- $testUrl = Request::getPathUri() . "wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=".$namespace."&SRSNAME=EPSG:3003&featureID=".$namespace_dot[1].".".$featureID ;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $webRootUrl = Request::getPathUri() . "schema/ant-url_action/{$path}";// TODO: security - only for test
|
|
|
|
|
+ $outputFunctionUrl = Request::getPathUri() . "index.php?_route=UrlAction_Ant&_task=output&path={$path}&file=";
|
|
|
|
|
+ DBG::nicePrint($webRootUrl, '$webRootUrl');
|
|
|
|
|
+ DBG::nicePrint($outputFunctionUrl, '$outputFunctionUrl');
|
|
|
|
|
+ $testUrl = Request::getPathUri() . "wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=".$typeName."&SRSNAME=EPSG:3003&featureID=".$typeName_dot[1].".".$featureID ;
|
|
|
$cryptedPass = base64_encode(User::getLogin() . ":" . Crypt::decrypt($_SESSION['ADM_PASS_HASH']));
|
|
$cryptedPass = base64_encode(User::getLogin() . ":" . Crypt::decrypt($_SESSION['ADM_PASS_HASH']));
|
|
|
- $cmd = "cd {$this->pathUrlActions}{$path} && {$this->antBin} -S -Durl='{$testUrl}' -DpasswordBase64Basic='{$cryptedPass}' 2>&1";
|
|
|
|
|
|
|
+ $cmd = "cd {$this->pathUrlActions}{$path} && {$this->antBin} -S -DoutputFunctionUrl='{$outputFunctionUrl}' -DwebRootUrl='{$webRootUrl}' -Durl='{$testUrl}' -DpasswordBase64Basic='{$cryptedPass}' 2>&1";
|
|
|
DBG::nicePrint(str_replace(APP_PATH_ROOT, 'SE', $cmd), 'command');
|
|
DBG::nicePrint(str_replace(APP_PATH_ROOT, 'SE', $cmd), 'command');
|
|
|
V::exec($cmd, $out, $ret);
|
|
V::exec($cmd, $out, $ret);
|
|
|
DBG::nicePrint($out, 'output');
|
|
DBG::nicePrint($out, 'output');
|