Piotr Labudda пре 9 година
родитељ
комит
c2f74decd9
2 измењених фајлова са 25 додато и 6 уклоњено
  1. 2 2
      SE/se-lib/Route/Ant.php
  2. 23 4
      SE/se-lib/Route/UrlAction/Ant.php

+ 2 - 2
SE/se-lib/Route/Ant.php

@@ -35,7 +35,7 @@ class Route_Ant extends RouteBase {
 
       UI::startTag('ul');
       foreach ($taskList as $path => $label) {
-        $link = "index.php?_route=Ant&_task=ant&path={$ditaPath}";
+        $link = "index.php?_route=Ant&_task=ant&path={$path}";
         echo UI::h('li', [], [
           UI::h('a', ['href'=>$link], "Uruchom '{$label}'")
         ]);
@@ -56,7 +56,7 @@ class Route_Ant extends RouteBase {
       $taskList = $this->getAntToolList();
       if (!array_key_exists($path, $taskList)) throw new Exception("Ant path not exists! '{$path}'");
 
-      $cmd = "cd {$this->pathTools}/{$path} && {$this->antBin} 2>&1";// wymaga java jdk
+      $cmd = "cd {$this->pathTools}{$path} && {$this->antBin} 2>&1";// wymaga java jdk
       V::exec($cmd, $out, $ret);
     } catch (Exception $e) {
       UI::alert('danger', $e->getMessage());

+ 23 - 4
SE/se-lib/Route/UrlAction/Ant.php

@@ -3,23 +3,24 @@
 Lib::loadClass('RouteBase');
 Lib::loadClass('UI');
 Lib::loadClass('DBG');
-Lib::loadClass('Router');
+Lib::loadClass('Route_Ant');
 
-class Route_UrlAction_Ant extends RouteBase {// @doc @see Route_Ant
+class Route_UrlAction_Ant extends Route_Ant {// @doc @see Route_Ant
 
   public function defaultAction() {
     UI::gora();
     UI::tag('h1', [], 'Ant');
     try {
-      $taskList = Router::getRoute('Ant')->getAntUrlActionList();
+      $taskList = $this->getAntUrlActionList();
       DBG::nicePrint($taskList, 'ant-url_action');
 
       $featureID = V::get('featureID', '', $_GET);
       $namespace = V::get('namespace', '', $_GET);
+      // TODO: validate missing ...
 
       UI::startTag('ul');
       foreach ($taskList as $path => $label) {
-        $link = "index.php?_route=UrlAction_Ant&_task=ant&path={$ditaPath}";
+        $link = "index.php?_route=UrlAction_Ant&_task=ant&path={$path}&namespace={$namespace}&featureID={$featureID}";
         echo UI::h('li', [], [
           UI::h('a', ['href'=>$link], "Uruchom '{$label}'")
         ]);
@@ -35,7 +36,25 @@ class Route_UrlAction_Ant extends RouteBase {// @doc @see Route_Ant
   public function antAction() {
     UI::gora();
     try {
+      echo UI::h('h1', [], "Ant action");
+      $path = V::get('path', '', $_GET);
+      if (!$path) throw new Exception("Missing Ant path!");
+      $featureID = V::get('featureID', '', $_GET);
+      $namespace = V::get('namespace', '', $_GET);
+      // TODO: validate missing ...
+      DBG::nicePrint($path, '$path');
+      DBG::nicePrint($featureID, '$featureID');
+      DBG::nicePrint($namespace, '$namespace');
+
+      $taskList = $this->getAntUrlActionList();
+      if (!array_key_exists($path, $taskList)) throw new Exception("Ant path not exists! '{$path}'");
+
+      echo UI::h('hr');
 
+      $cmd = "cd {$this->pathTools}{$path} && {$this->antBin} 2>&1";// wymaga java jdk
+      DBG::nicePrint(str_replace(APP_PATH_ROOT, 'SE', $cmd), 'command');
+      V::exec($cmd, $out, $ret);
+      DBG::nicePrint($out, 'output');
     } catch (Exception $e) {
       UI::alert('danger', $e->getMessage());
       DBG::log($e);