From 1b8ff46ccfd821484616ccb18b4efe5d70d19c60 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Fri, 17 Jan 2025 01:56:29 -0500 Subject: [PATCH] begin work on fixing tasks --- .../lib/mocha/oms/HttpOmsClient.inc.php | 15 ++++++++++++- .../ui/renderers/html/HTMLRenderer2.inc.php | 22 ++++++++++++++++--- .../mocha-php/ui/pages/SearchPage.phpx.php | 5 +++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/mocha-php/src/mocha-php/lib/mocha/oms/HttpOmsClient.inc.php b/mocha-php/src/mocha-php/lib/mocha/oms/HttpOmsClient.inc.php index 8850e5b..0f673ca 100644 --- a/mocha-php/src/mocha-php/lib/mocha/oms/HttpOmsClient.inc.php +++ b/mocha-php/src/mocha-php/lib/mocha/oms/HttpOmsClient.inc.php @@ -356,8 +356,21 @@ return $json; } - public function getResponse($element) + public function getResponse($element, InstanceReference|null $relatedInstance = null) // , array|null $workData = null) { + if ($relatedInstance !== null) + { + $workDataPost = array("relatedInstance" => $relatedInstance->InstanceKey); + /* + $workDataPost = array(); + foreach ($workData as $key => $value) + { + $workDataPost[UUID::parse($key)->__toString()] = strval($value); + } + */ + $json = $this->curl_request_json("/tenants/" . $this->getTenantName() . "/instances/" . $element->InstanceKey . "/element", HttpRequestMethod::POST, $workDataPost); + return $json; + } $json = $this->curl_request_json("/tenants/" . $this->getTenantName() . "/instances/" . $element->InstanceKey . "/element"); return $json; } diff --git a/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer2.inc.php b/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer2.inc.php index f5295cc..227d4a3 100644 --- a/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer2.inc.php +++ b/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer2.inc.php @@ -4,6 +4,7 @@ use Mocha\Core\InstanceKey; use Mocha\Core\InstanceReference; + use Mocha\Core\KnownInstanceGuids; use Mocha\Core\OmsContext; use Mocha\UI\Controls\InstanceBrowser; use Phast\System; @@ -112,18 +113,33 @@ { if ($_SERVER["REQUEST_METHOD"] == "POST") { - } else { - $json = $this->OMS->getResponse(element: $task); + // FIXME: pass in work data parms as array e.g. + //? getResponse($task, array( RELATED_INSTANCE => $relatedInstance )) + $workData = null; + /* + if ($relatedInstance !== null) + { + $workData = array + ( + KnownInstanceGuids::WorkSet__TaskRelatedInstance => $relatedInstance->GlobalIdentifier + ); + } + */ + $json = $this->OMS->getResponse($task, $relatedInstance); if ($json["result"] == "success") { $title = $json["value"]["title"]["label"]; $this->renderResponse($json["value"]); } + else + + { + print_r($json); + } } - echo ("renderTask: " . $task->InstanceKey); return; } diff --git a/mocha-php/src/mocha-php/ui/pages/SearchPage.phpx.php b/mocha-php/src/mocha-php/ui/pages/SearchPage.phpx.php index c1af73c..f80e0a5 100644 --- a/mocha-php/src/mocha-php/ui/pages/SearchPage.phpx.php +++ b/mocha-php/src/mocha-php/ui/pages/SearchPage.phpx.php @@ -186,6 +186,11 @@ $viewTask = $results[$i]->DefaultTask; // $oms->getRelatedInstance($instClass, KnownRelationshipGuids::Class__has_default__Task); # $uri = "/" . $oms->getTenantName() . "/d/inst/" . $inst->InstanceKey->__toString() . ".htmld"; $uri = $results[$i]->DefaultTaskUrl; + + if ($inst->InstanceKey->ClassIndex == 2997) + { + $uri = "/" . $oms->getTenantName() . "/d/task/" . $inst->InstanceKey->__toString() . ".htmld"; + } # if ($inst->ParentClass->InstanceKey->InstanceIndex == 2997) { # $uri = "/" . $oms->getTenantName() . "/d/task/" . $inst->InstanceKey->__toString() . ".htmld";