whatever
This commit is contained in:
parent
70a9255d1e
commit
62f717eda5
@ -146,7 +146,7 @@
|
|||||||
$retval = array();
|
$retval = array();
|
||||||
foreach ($ary as $inst)
|
foreach ($ary as $inst)
|
||||||
{
|
{
|
||||||
$retval[] = new InstanceReference(null, InstanceKey::parse($inst["iid"]), UUID::parse($inst["globalIdentifier"]));
|
$retval[] = new InstanceReference(null, InstanceKey::parse($inst["iid"]), UUID::parse($inst["globalIdentifier"]), $inst["text"]);
|
||||||
}
|
}
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
@ -360,8 +360,18 @@
|
|||||||
|
|
||||||
public function getResponse($element, InstanceReference|null $relatedInstance = null) // , array|null $workData = null)
|
public function getResponse($element, InstanceReference|null $relatedInstance = null) // , array|null $workData = null)
|
||||||
{
|
{
|
||||||
|
$url = "/tenants/" . $this->getTenantName() . "/instances/" . $element->InstanceKey . "/element";
|
||||||
|
echo ("getResponse (' " . $url . " ');<br />");
|
||||||
|
|
||||||
if ($relatedInstance !== null)
|
if ($relatedInstance !== null)
|
||||||
{
|
{
|
||||||
|
// related instance is passed in by:
|
||||||
|
// UI Task.has Related Menu Item
|
||||||
|
// -> Related Menu Item.uses object of Class
|
||||||
|
//
|
||||||
|
// the parm for that class type is then set to the value of the relatedInstance URL parm
|
||||||
|
// or as WD calls, an Instance Set
|
||||||
|
|
||||||
$workDataPost = array("relatedInstance" => $relatedInstance->InstanceKey);
|
$workDataPost = array("relatedInstance" => $relatedInstance->InstanceKey);
|
||||||
/*
|
/*
|
||||||
$workDataPost = array();
|
$workDataPost = array();
|
||||||
@ -370,10 +380,10 @@
|
|||||||
$workDataPost[UUID::parse($key)->__toString()] = strval($value);
|
$workDataPost[UUID::parse($key)->__toString()] = strval($value);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$json = $this->curl_request_json("/tenants/" . $this->getTenantName() . "/instances/" . $element->InstanceKey . "/element", HttpRequestMethod::POST, $workDataPost);
|
$json = $this->curl_request_json($url, HttpRequestMethod::POST, $workDataPost);
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
$json = $this->curl_request_json("/tenants/" . $this->getTenantName() . "/instances/" . $element->InstanceKey . "/element");
|
$json = $this->curl_request_json($url);
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +420,12 @@
|
|||||||
|
|
||||||
public function processElement(InstanceReference $element, array $values) : array
|
public function processElement(InstanceReference $element, array $values) : array
|
||||||
{
|
{
|
||||||
$result = $this->curl_request_json("/tenants/" . $this->getTenantName() . "/instances/" . $element->GlobalIdentifier . "/element", HttpRequestMethod::POST, $values);
|
$url = "/tenants/" . $this->getTenantName() . "/instances/" . $element->GlobalIdentifier . "/element";
|
||||||
|
echo ("<br /><br />POST " . $url . "<br />Values:<br />");
|
||||||
|
echo ("<br /><br />");
|
||||||
|
print_r($values);
|
||||||
|
echo ("<br /><br />");
|
||||||
|
$result = $this->curl_request_json($url, HttpRequestMethod::POST, $values);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,8 @@
|
|||||||
*/
|
*/
|
||||||
public $Context;
|
public $Context;
|
||||||
|
|
||||||
|
public $CodeBehindFileName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run in debug mode (prints log to screen and then dies at end).
|
* Run in debug mode (prints log to screen and then dies at end).
|
||||||
*/
|
*/
|
||||||
@ -2277,6 +2279,7 @@ EOF
|
|||||||
|
|
||||||
$this->_stopwatch->stop();
|
$this->_stopwatch->stop();
|
||||||
$this->logRequestSuccess($this->_stopwatch->getElapsedTime());
|
$this->logRequestSuccess($this->_stopwatch->getElapsedTime());
|
||||||
|
echo ("<!-- code behind: " . $this->CodeBehindFileName . " -->");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderInitialElement(InstanceReference $element)
|
public function renderInitialElement(InstanceReference $element)
|
||||||
|
|||||||
@ -25,8 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
$oms = mocha_get_oms();
|
$oms = mocha_get_oms();
|
||||||
|
|
||||||
echo ("postbakc!");
|
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
foreach ($_POST as $key => $value)
|
foreach ($_POST as $key => $value)
|
||||||
{
|
{
|
||||||
@ -40,11 +38,15 @@
|
|||||||
$array = $this->OMS->processElement($element, $values);
|
$array = $this->OMS->processElement($element, $values);
|
||||||
if ($array["result"] === "failure")
|
if ($array["result"] === "failure")
|
||||||
{
|
{
|
||||||
|
echo ("failed at processElement");
|
||||||
|
print_r($array);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//*** DO NOT DELETE, WE STILL USE THIS FOR LOGIN ***//
|
||||||
if (is_callable($this->ProcessPostbackFunction))
|
if (is_callable($this->ProcessPostbackFunction))
|
||||||
{
|
{
|
||||||
|
echo ("calling user function");
|
||||||
// call user-defined ProcessPostbackFunction
|
// call user-defined ProcessPostbackFunction
|
||||||
return call_user_func($this->ProcessPostbackFunction, $this, $element, $array);
|
return call_user_func($this->ProcessPostbackFunction, $this, $element, $array);
|
||||||
}
|
}
|
||||||
@ -53,6 +55,8 @@
|
|||||||
$dummy = [ ];
|
$dummy = [ ];
|
||||||
if (!$this->processRelatedPostback($dummy, $element))
|
if (!$this->processRelatedPostback($dummy, $element))
|
||||||
{
|
{
|
||||||
|
echo ("failed at processRelatedPostback");
|
||||||
|
print_r($array);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,6 +70,14 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($array["result"] == "success" && $array["type"] == "redirect")
|
||||||
|
{
|
||||||
|
System::Redirect($array["destinationUrl"]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
print_r($array); die();
|
||||||
|
|
||||||
if (isset($_POST["ReturnToURL"]))
|
if (isset($_POST["ReturnToURL"]))
|
||||||
{
|
{
|
||||||
System::Redirect($_POST["ReturnToURL"]);
|
System::Redirect($_POST["ReturnToURL"]);
|
||||||
@ -80,7 +92,7 @@
|
|||||||
$this->renderResponse($json["value"]);
|
$this->renderResponse($json["value"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderResponse(array $json)
|
public function renderResponse(array $json, $subtitle = null)
|
||||||
{
|
{
|
||||||
$title = "";
|
$title = "";
|
||||||
if (array_key_exists("title", $json))
|
if (array_key_exists("title", $json))
|
||||||
@ -99,7 +111,7 @@
|
|||||||
|
|
||||||
if (!array_key_exists("visible", $json["title"]) || $json["title"]["visible"] === true)
|
if (!array_key_exists("visible", $json["title"]) || $json["title"]["visible"] === true)
|
||||||
{
|
{
|
||||||
$this->renderPageHeader($title, null);
|
$this->renderPageHeader($title, $subtitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->renderBeginContent();
|
$this->renderBeginContent();
|
||||||
@ -120,8 +132,8 @@
|
|||||||
{
|
{
|
||||||
// FIXME: pass in work data parms as array e.g.
|
// FIXME: pass in work data parms as array e.g.
|
||||||
//? getResponse($task, array( RELATED_INSTANCE => $relatedInstance ))
|
//? getResponse($task, array( RELATED_INSTANCE => $relatedInstance ))
|
||||||
$workData = null;
|
|
||||||
/*
|
/*
|
||||||
|
$workData = null;
|
||||||
if ($relatedInstance !== null)
|
if ($relatedInstance !== null)
|
||||||
{
|
{
|
||||||
$workData = array
|
$workData = array
|
||||||
@ -131,10 +143,11 @@
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$json = $this->OMS->getResponse($task, $relatedInstance);
|
$json = $this->OMS->getResponse($task, $relatedInstance);
|
||||||
|
// print_r($json);
|
||||||
if ($json["result"] == "success") {
|
if ($json["result"] == "success") {
|
||||||
$title = $json["value"]["title"]["label"];
|
$title = $json["value"]["title"]["label"];
|
||||||
|
|
||||||
$this->renderResponse($json["value"]);
|
$this->renderResponse($json["value"], $relatedInstance);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -359,6 +372,18 @@
|
|||||||
echo (" />");
|
echo (" />");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($json["widget"] == "checkbox")
|
||||||
|
{
|
||||||
|
if ($json["enabled"] === false)
|
||||||
|
{
|
||||||
|
echo ("<span data-ecid=\"" . $json["ecid"] . "\">" . $json["value"] . "</span>");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo ("<input id=\"ec_" . $fqecid . "\" name=\"ec_" . $fqecid . "\" type=\"checkbox\" value=\"" . $json["value"] . "\"");
|
||||||
|
echo (" />");
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ($json["widget"] == "obscuredText")
|
else if ($json["widget"] == "obscuredText")
|
||||||
{
|
{
|
||||||
echo ("<input id=\"ec_" . $fqecid . "\" name=\"ec_" . $fqecid . "\" type=\"password\" value=\"" . $json["value"] . "\" />");
|
echo ("<input id=\"ec_" . $fqecid . "\" name=\"ec_" . $fqecid . "\" type=\"password\" value=\"" . $json["value"] . "\" />");
|
||||||
@ -366,6 +391,7 @@
|
|||||||
else if ($json["widget"] == "monikerList")
|
else if ($json["widget"] == "monikerList")
|
||||||
{
|
{
|
||||||
$adw = new InstanceBrowser();
|
$adw = new InstanceBrowser();
|
||||||
|
$adw->Name = "ec_" . $fqecid;
|
||||||
$adw->Attributes[] = new WebControlAttribute("data-ecid", $json["ecid"]);
|
$adw->Attributes[] = new WebControlAttribute("data-ecid", $json["ecid"]);
|
||||||
if (isset($json["enabled"]) && $json["enabled"] == false)
|
if (isset($json["enabled"]) && $json["enabled"] == false)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
// $renderer = new HTMLRenderer($context);
|
// $renderer = new HTMLRenderer($context);
|
||||||
$renderer = new HTMLRenderer2($context);
|
$renderer = new HTMLRenderer2($context);
|
||||||
|
$renderer->CodeBehindFileName = "HomePage";
|
||||||
$renderer->IsPostback = $this->Page->IsPostback;
|
$renderer->IsPostback = $this->Page->IsPostback;
|
||||||
if ($this->Page->IsPostback)
|
if ($this->Page->IsPostback)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,14 +40,19 @@
|
|||||||
{
|
{
|
||||||
$htmlRenderer = new HTMLRenderer($ctx);
|
$htmlRenderer = new HTMLRenderer($ctx);
|
||||||
}
|
}
|
||||||
|
$htmlRenderer->CodeBehindFileName = "InstancePage";
|
||||||
|
|
||||||
$instkey = InstanceKey::parse($this->Page->GetPathVariableValue("instid"));
|
$instkey = InstanceKey::parse($this->Page->GetPathVariableValue("instid"));
|
||||||
|
|
||||||
$castkey = InstanceKey::parse($this->Page->GetPathVariableValue("castinstid"));
|
$castkey = InstanceKey::parse($this->Page->GetPathVariableValue("castinstid"));
|
||||||
|
|
||||||
|
echo ("@ getInstanceByKey<br />");
|
||||||
$inst = $oms->getInstanceByKey($instkey);
|
$inst = $oms->getInstanceByKey($instkey);
|
||||||
|
|
||||||
|
echo ("@ getResponse<br />");
|
||||||
$json = $oms->getResponse($inst, $inst);
|
$json = $oms->getResponse($inst, $inst);
|
||||||
// print_r($json);
|
echo ("@ renderResponse<br />");
|
||||||
|
print_r($json);
|
||||||
$htmlRenderer->renderResponse($json["value"]);
|
$htmlRenderer->renderResponse($json["value"]);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -130,23 +130,24 @@
|
|||||||
{
|
{
|
||||||
echo (" - instance: '" . $this->zqGetClassName($ir) . "'\n");
|
echo (" - instance: '" . $this->zqGetClassName($ir) . "'\n");
|
||||||
}
|
}
|
||||||
|
echo (" name: '" . $ir->Text . "'");
|
||||||
|
|
||||||
//$attrs = $oms->getRelatedInstances($ir, KnownRelationshipGuids::Class__has__Attribute);
|
//$attrs = $oms->getRelatedInstances($ir, KnownRelationshipGuids::Class__has__Attribute);
|
||||||
$attrs = $oms->getAttributes($ir);
|
$attrs = $oms->getAttributes($ir);
|
||||||
if (count($attrs) > 0)
|
if (count($attrs) > 0)
|
||||||
{
|
{
|
||||||
echo (" - attributes:\n");
|
echo (" attributes:\n");
|
||||||
foreach ($attrs as $attr)
|
foreach ($attrs as $attr)
|
||||||
{
|
{
|
||||||
echo (" - instance: '" . $attr->GlobalIdentifier . "'\n");
|
echo (" - instance: '" . $attr->GlobalIdentifier . "'\n");
|
||||||
echo (" - value: '" . $oms->getAttributeValue($ir, $attr) . "'\n");
|
echo (" value: '" . $oms->getAttributeValue($ir, $attr) . "'\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$rels = $oms->getRelationships($ir);
|
$rels = $oms->getRelationships($ir);
|
||||||
if (count($rels) > 0)
|
if (count($rels) > 0)
|
||||||
{
|
{
|
||||||
echo (" - relationships:\n");
|
echo (" relationships:\n");
|
||||||
foreach ($rels as $rel)
|
foreach ($rels as $rel)
|
||||||
{
|
{
|
||||||
$gid = $rel->GlobalIdentifier->__toString();
|
$gid = $rel->GlobalIdentifier->__toString();
|
||||||
@ -168,7 +169,7 @@
|
|||||||
$iid = "&" . $this->EntityDefinitions2[$targ->GlobalIdentifier->__toStringFormat(false, "", "")] . ";";
|
$iid = "&" . $this->EntityDefinitions2[$targ->GlobalIdentifier->__toStringFormat(false, "", "")] . ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo (" = instance: '" . $iid . "'\n");
|
echo (" - instance: '" . $iid . "'\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,13 +178,13 @@
|
|||||||
$defaultTask = $oms->getRelatedInstance($ir, KnownRelationshipGuids::Class__has_default__Task);
|
$defaultTask = $oms->getRelatedInstance($ir, KnownRelationshipGuids::Class__has_default__Task);
|
||||||
if ($defaultTask !== null)
|
if ($defaultTask !== null)
|
||||||
{
|
{
|
||||||
echo (" - defaultTask: '" . $defaultTask->GlobalIdentifier . "'\n");
|
echo (" defaultTask: '" . $defaultTask->GlobalIdentifier . "'\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$relTasks = $oms->getRelatedINstances($ir, KnownRelationshipGuids::Class__has_related__Task);
|
$relTasks = $oms->getRelatedINstances($ir, KnownRelationshipGuids::Class__has_related__Task);
|
||||||
if (count($relTasks) > 0)
|
if (count($relTasks) > 0)
|
||||||
{
|
{
|
||||||
echo (" - relatedTasks:\n");
|
echo (" relatedTasks:\n");
|
||||||
foreach ($relTasks as $relTask)
|
foreach ($relTasks as $relTask)
|
||||||
{
|
{
|
||||||
echo (" - instance: '" . $relTask->GlobalIdentifier . "'\n");
|
echo (" - instance: '" . $relTask->GlobalIdentifier . "'\n");
|
||||||
@ -203,7 +204,7 @@
|
|||||||
$ct = count($instances);
|
$ct = count($instances);
|
||||||
for ($i = 0; $i < $ct; $i++)
|
for ($i = 0; $i < $ct; $i++)
|
||||||
{
|
{
|
||||||
print("{ \"name\": \"mocha:inst" . $i . "\", \"title\": \"" . $oms->getInstanceText($instances[$i]) . "\", \"type\": \"class\", \"instanceId\": \"" . $instances[$i]->InstanceKey . "\" }");
|
print("{ \"name\": \"mocha:inst" . $i . "\", \"title\": \"" . $instances[$i]->Text . "\", \"type\": \"class\", \"instanceId\": \"" . $instances[$i]->InstanceKey . "\" }");
|
||||||
if ($i < $ct - 1)
|
if ($i < $ct - 1)
|
||||||
{
|
{
|
||||||
print(", ");
|
print(", ");
|
||||||
@ -212,7 +213,7 @@
|
|||||||
|
|
||||||
print("] }");
|
print("] }");
|
||||||
print("] }");
|
print("] }");
|
||||||
return;
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,16 +39,21 @@
|
|||||||
|
|
||||||
$taskRenderer = new HTMLRenderer($context);
|
$taskRenderer = new HTMLRenderer($context);
|
||||||
$taskRenderer->TargetInstance = $instance;
|
$taskRenderer->TargetInstance = $instance;
|
||||||
$taskRenderer->IsPostback = $this->Page->IsPostback;
|
|
||||||
if ($this->Page->IsPostback)
|
|
||||||
{
|
|
||||||
$taskRenderer->processPostback(element: $initiatingElement);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$context = new OmsContext();
|
$context = new OmsContext();
|
||||||
$taskRenderer = new HTMLRenderer2($context);
|
$taskRenderer = new HTMLRenderer2($context);
|
||||||
|
$taskRenderer->CodeBehindFileName = "RelatedTaskPage";
|
||||||
|
$taskRenderer->IsPostback = $this->Page->IsPostback;
|
||||||
|
if ($this->Page->IsPostback)
|
||||||
|
{
|
||||||
|
$initiatingElement = $oms->getRelatedInstance($relatedTaskInstance, KnownRelationshipGuids::Task__has_initiating__Element);
|
||||||
|
$taskRenderer->processPostback(element: $initiatingElement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$taskRenderer->renderTask($relatedTaskInstance, $instance);
|
$taskRenderer->renderTask($relatedTaskInstance, $instance);
|
||||||
|
}
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
$initiatingElement = $oms->getRelatedInstance($taskInstance, KnownRelationshipGuids::Task__has_initiating__Element);
|
$initiatingElement = $oms->getRelatedInstance($taskInstance, KnownRelationshipGuids::Task__has_initiating__Element);
|
||||||
|
|
||||||
$context = new OmsContext();
|
$context = new OmsContext();
|
||||||
if ($_GET["legacy"] == "1")
|
if (isset($_GET["legacy"]) && $_GET["legacy"] == "1")
|
||||||
{
|
{
|
||||||
$taskRenderer = new HTMLRenderer($context);
|
$taskRenderer = new HTMLRenderer($context);
|
||||||
}
|
}
|
||||||
@ -37,11 +37,15 @@
|
|||||||
}
|
}
|
||||||
//$taskRenderer->TargetInstance = $instance;
|
//$taskRenderer->TargetInstance = $instance;
|
||||||
$taskRenderer->IsPostback = $this->Page->IsPostback;
|
$taskRenderer->IsPostback = $this->Page->IsPostback;
|
||||||
|
$taskRenderer->CodeBehindFileName = "TaskPage";
|
||||||
if ($this->Page->IsPostback)
|
if ($this->Page->IsPostback)
|
||||||
{
|
{
|
||||||
$taskRenderer->processPostback(element: $initiatingElement);
|
$taskRenderer->processPostback(element: $initiatingElement);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$taskRenderer->renderTask($taskInstance);
|
$taskRenderer->renderTask($taskInstance);
|
||||||
|
}
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
phast
2
phast
@ -1 +1 @@
|
|||||||
Subproject commit 2374310056c7ea727839cfea04f7bdf2df34760b
|
Subproject commit ac7561660f08060b4685e10f08e7dd6ab84f96f2
|
||||||
Loading…
x
Reference in New Issue
Block a user