let's keep slowly making progress
This commit is contained in:
parent
f81697dd1e
commit
b137f1aa13
@ -406,6 +406,24 @@
|
||||
return [ ];
|
||||
}
|
||||
|
||||
public function getGlobal(UUID $inst, $defaultValue = null)
|
||||
{
|
||||
$json = $this->curl_request_json("/globals/" . $inst->__toString(), HttpRequestMethod::GET);
|
||||
if ($json["result"] == "success")
|
||||
{
|
||||
return $json["value"];
|
||||
}
|
||||
return $defaultValue;
|
||||
}
|
||||
|
||||
public function setGlobal(UUID $inst, mixed $value)
|
||||
{
|
||||
$this->curl_request_json("/globals/" . $inst->__toString(), HttpRequestMethod::POST, array
|
||||
(
|
||||
"value" => $value
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -920,7 +920,7 @@ EOF
|
||||
return true;
|
||||
}
|
||||
|
||||
private function processRelatedPostback(array &$parentElementContents, InstanceReference $element)
|
||||
protected function processRelatedPostback(array &$parentElementContents, InstanceReference $element)
|
||||
{
|
||||
/**
|
||||
* @var \Mocha\Core\Oms
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
|
||||
public function renderInitialElement($element)
|
||||
{
|
||||
$json = $this->OMS->getResponse($element);
|
||||
$json = $this->OMS->getResponse(element: $element);
|
||||
$this->renderResponse($json["value"]);
|
||||
}
|
||||
|
||||
@ -89,6 +89,16 @@
|
||||
}
|
||||
|
||||
$this->renderBeginPage($title);
|
||||
|
||||
echo ("<!-- ");
|
||||
print_r($json);
|
||||
echo (" -->");
|
||||
|
||||
if (!array_key_exists("visible", $json["title"]) || $json["title"]["visible"] === true)
|
||||
{
|
||||
$this->renderPageHeader($title, null);
|
||||
}
|
||||
|
||||
$this->renderBeginContent();
|
||||
|
||||
$this->renderFragment($json);
|
||||
@ -98,8 +108,65 @@
|
||||
$this->renderEndPage();
|
||||
}
|
||||
|
||||
public function renderTask(InstanceReference $task, ?InstanceReference $relatedInstance = null)
|
||||
{
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$json = $this->OMS->getResponse(element: $task);
|
||||
if ($json["result"] == "success") {
|
||||
$title = $json["value"]["title"]["label"];
|
||||
|
||||
$this->renderResponse($json["value"]);
|
||||
}
|
||||
}
|
||||
echo ("renderTask: " . $task->InstanceKey);
|
||||
return;
|
||||
}
|
||||
|
||||
private function renderTabContainer(array $json)
|
||||
{
|
||||
echo ("<div class=\"uwt-tabcontainer\">");
|
||||
echo ("<ul class=\"uwt-tabcontainer-tabs\">");
|
||||
$i = 0;
|
||||
foreach ($json["children"] as $c)
|
||||
{
|
||||
echo ("<li class=\"uwt-tabcontainer-tab uwt-visible");
|
||||
if ($i == 0)
|
||||
{
|
||||
echo (" uwt-selected");
|
||||
}
|
||||
echo ("\"><a href=\"#\">" . $c["label"] . "</a></li>");
|
||||
$i++;
|
||||
}
|
||||
echo ("</ul>");
|
||||
echo ("<div class=\"uwt-tabcontainer-tabpages\">");
|
||||
$i = 0;
|
||||
foreach ($json["children"] as $c)
|
||||
{
|
||||
echo ("<div class=\"uwt-tabpage uwt-visible");
|
||||
if ($i == 0)
|
||||
{
|
||||
echo (" uwt-selected");
|
||||
}
|
||||
echo ("\">");
|
||||
$this->renderFragment($c);
|
||||
echo ("</div>");
|
||||
$i++;
|
||||
}
|
||||
echo ("</div>");
|
||||
echo ("</div>");
|
||||
}
|
||||
|
||||
public function renderFragment(array $json, $fqecidPrefix = "")
|
||||
{
|
||||
echo ("<!-- ");
|
||||
print_r($json);
|
||||
echo (" -->");
|
||||
|
||||
// echo ("renderFragment:<br/>"); print_r($json);
|
||||
//print_r($json); die();
|
||||
$fqecid = $fqecidPrefix . $json["ecid"];
|
||||
@ -114,9 +181,24 @@
|
||||
{
|
||||
$this->renderFragment($json["body"]);
|
||||
}
|
||||
else if ($json["widget"] == "tabContainer")
|
||||
{
|
||||
$this->renderTabContainer($json);
|
||||
}
|
||||
else if ($json["widget"] == "grid")
|
||||
{
|
||||
echo ("<table class=\"uwt-listview mcx-element\" data-ecid=\"" . $json["ecid"] . "\" data-instance-id=\"" . $json["iid"] . "\">");
|
||||
echo ("<caption>");
|
||||
|
||||
echo ("<div class=\"uwt-toolbar uwt-listview-controlbox\">");
|
||||
echo ("<a class=\"uwt-button\" href=\"#\" title=\"Download\"><i class=\"fa fa-download\"></i></a>");
|
||||
echo ("<a class=\"uwt-button uwt-toggle\" href=\"#\" title=\"Filter\"><i class=\"fa fa-filter\"></i></a>");
|
||||
echo ("<a class=\"uwt-button uwt-toggle\" href=\"#\" title=\"Chart\"><i class=\"fa fa-line-chart\"></i></a>");
|
||||
echo ("<a class=\"uwt-button uwt-toggle\" href=\"#\" title=\"Columns\"><i class=\"fa fa-columns\"></i></a>");
|
||||
echo ("<a class=\"uwt-button uwt-toggle\" href=\"#\" title=\"Expand\"><i class=\"fa fa-expand\"></i></a>");
|
||||
echo ("</div>");
|
||||
|
||||
echo ("</caption>");
|
||||
echo ("<thead>");
|
||||
echo ("<tr>");
|
||||
foreach ($json["columns"] as $col)
|
||||
@ -181,9 +263,23 @@
|
||||
}
|
||||
else if ($json["widget"] == "fieldSet")
|
||||
{
|
||||
echo ("<div class=\"uwt-formview mcx-element\" data-instance-id=\"" . $json["iid"] . "\" data-ecid=\"" . $fqecid . "\">");
|
||||
$emitFieldset = false;
|
||||
foreach ($json["children"] as $child)
|
||||
{
|
||||
if ($child["widget"] == "commandButton")
|
||||
{
|
||||
echo ("<button>" . $child["label"] . "</button>");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$emitFieldset)
|
||||
{
|
||||
echo ("<div class=\"uwt-formview mcx-element\" data-instance-id=\"" . $json["iid"] . "\" data-ecid=\"" . $fqecid . "\">");
|
||||
}
|
||||
$emitFieldset = true;
|
||||
}
|
||||
|
||||
// $fqecidChild = $fqecidPrefix . $child["ecid"];
|
||||
$fqecidChild = $child["ecid"];
|
||||
|
||||
@ -224,8 +320,11 @@
|
||||
echo ("</div>");
|
||||
echo ("</div>");
|
||||
}
|
||||
|
||||
if ($emitFieldset) {
|
||||
echo ("</div>");
|
||||
}
|
||||
}
|
||||
else if ($json["widget"] == "text")
|
||||
{
|
||||
if ($json["enabled"] === false)
|
||||
|
||||
@ -83,3 +83,22 @@ div.uwt-alert
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.uwt-alert-mini
|
||||
{
|
||||
position: fixed !important;
|
||||
bottom: 0px;
|
||||
display: block;
|
||||
width: 400px !important;
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
background: #111;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
left: 0px;
|
||||
&> div.uwt-title
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@
|
||||
use Phast\RenderingEventArgs;
|
||||
use Phast\RenderMode;
|
||||
use Phast\System;
|
||||
use Phast\UUID;
|
||||
use Phast\WebPage;
|
||||
|
||||
class BlankMasterPage extends WebPage
|
||||
@ -40,6 +41,8 @@
|
||||
{
|
||||
// echo($page->FileName);
|
||||
$_SESSION["login_return"] = $path;
|
||||
$oms->setGlobal(UUID::parse("{6daaa721-db70-43ad-b373-6a8038e69d2e}"), "/" . implode("/", $path));
|
||||
|
||||
System::RedirectToLoginPage(true);
|
||||
$e->Cancel = true;
|
||||
}
|
||||
|
||||
@ -46,6 +46,11 @@
|
||||
$castkey = InstanceKey::parse($this->Page->GetPathVariableValue("castinstid"));
|
||||
|
||||
$inst = $oms->getInstanceByKey($instkey);
|
||||
$json = $oms->getResponse($inst);
|
||||
print_r($json);
|
||||
$htmlRenderer->renderResponse($json["value"]);
|
||||
return;
|
||||
|
||||
if ($inst === null)
|
||||
{
|
||||
$htmlRenderer->renderBeginPage("Error");
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
use Mocha\Core\KnownRelationshipGuids;
|
||||
use Mocha\Core\OmsContext;
|
||||
use Mocha\UI\Renderers\HTML\HTMLRenderer;
|
||||
use Mocha\UI\Renderers\HTML\HTMLRenderer2;
|
||||
use Phast\RenderingEventArgs;
|
||||
use Phast\WebPage;
|
||||
|
||||
@ -27,6 +28,8 @@
|
||||
|
||||
$instance = $oms->getInstanceByKey($instanceKey);
|
||||
$relatedTaskInstance = $oms->getInstanceByKey($relatedTaskKey);
|
||||
|
||||
/*
|
||||
$initiatingElement = $oms->getRelatedInstance($relatedTaskInstance, KnownRelationshipGuids::Task__has_initiating__Element);
|
||||
|
||||
$context = new OmsContext();
|
||||
@ -41,6 +44,10 @@
|
||||
{
|
||||
$taskRenderer->processPostback(element: $initiatingElement);
|
||||
}
|
||||
*/
|
||||
|
||||
$context = new OmsContext();
|
||||
$taskRenderer = new HTMLRenderer2($context);
|
||||
$taskRenderer->renderTask($relatedTaskInstance, $instance);
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -184,7 +184,12 @@
|
||||
{
|
||||
$inst = $results[$i];
|
||||
$viewTask = $results[$i]->DefaultTask; // $oms->getRelatedInstance($instClass, KnownRelationshipGuids::Class__has_default__Task);
|
||||
$uri = "/" . $oms->getTenantName() . "/d/inst/" . $inst->InstanceKey->__toString() . ".htmld";
|
||||
# $uri = "/" . $oms->getTenantName() . "/d/inst/" . $inst->InstanceKey->__toString() . ".htmld";
|
||||
$uri = $results[$i]->DefaultTaskUrl;
|
||||
# if ($inst->ParentClass->InstanceKey->InstanceIndex == 2997)
|
||||
{
|
||||
# $uri = "/" . $oms->getTenantName() . "/d/task/" . $inst->InstanceKey->__toString() . ".htmld";
|
||||
}
|
||||
/*
|
||||
if ($oms->is_a($inst, KnownClassGuids::Task))
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user