diff --git a/mocha-php/src/mocha-php/lib/mocha/core/KnownClassGuids.inc.php b/mocha-php/src/mocha-php/lib/mocha/core/KnownClassGuids.inc.php
index 6578ea1..3b678b2 100644
--- a/mocha-php/src/mocha-php/lib/mocha/core/KnownClassGuids.inc.php
+++ b/mocha-php/src/mocha-php/lib/mocha/core/KnownClassGuids.inc.php
@@ -50,6 +50,7 @@ class KnownClassGuids
const MethodBinding = "CB36098EB9BF4D2287FA4186EC632C89";
const ReturnAttributeMethodBinding = "30FB6BA62BBB41D2B91A709C00A07790";
const ReturnInstanceSetMethodBinding = "AADC20F97559429BAEF097E059295C76";
+ const ProcessUpdatesMethodBinding = "{a7eb8676-2e47-4981-96a7-f20158660d26}";
const Executable = "6A1F66F78EA643D1B2AF198F63B84710";
const ExecutableReturningAttribute = "50b2db7a36234be4b40d98fab89d3ff5";
@@ -151,6 +152,9 @@ class KnownClassGuids
const SelectFromInstanceSetMethod = "{130637B4-17A7-4394-8F4D-E83A79114E6C}";
const ConditionalSelectFromInstanceSetMethod = "{ffea8e52-06e5-4e95-8c40-da3ba54ce95f}";
+ const AssignRelationshipMethod = "{3791fc36-3c5c-4ba0-83f4-70c050fa33a7}";
+ const AssignAttributeMethod = "{3312A789-3B7A-4478-B329-4FF781504F9C}";
+
const BinarySwitchLayout = "{248d781d-3d2f-4377-acc4-38112cf2f9d1}";
const RotarySwitchLayout = "{ea52446a-6332-49f7-baa9-4c78bea4faab}";
}
diff --git a/mocha-php/src/mocha-php/lib/mocha/core/KnownRelationshipGuids.inc.php b/mocha-php/src/mocha-php/lib/mocha/core/KnownRelationshipGuids.inc.php
index e596875..574efee 100644
--- a/mocha-php/src/mocha-php/lib/mocha/core/KnownRelationshipGuids.inc.php
+++ b/mocha-php/src/mocha-php/lib/mocha/core/KnownRelationshipGuids.inc.php
@@ -334,6 +334,9 @@ class KnownRelationshipGuids
const Assign_Attribute_Method__uses__Executable_returning_Attribute = "{9313f96e-58af-416f-852e-ef83725057fc}";
const Assign_Attribute_Method__assigns__Attribute = "{74061875-8a27-403b-9456-02e52cfd13b2}";
+ const Assign_Relationship_Method__assigns__Relationship = "{cd689fdf-2754-458f-be1e-d4ea98c37335}";
+ const Assign_Relationship_Method__uses__Executable_returning_Instance_Set = "{e5615121-0a72-408b-8ae4-f880841e74ba}";
+
const Get_Instances_Method__returns__Work_Set = "{7d0f93b1-8c93-464e-a44d-d674f910b589}";
const Get_Instances_Method__selects_instances_of__Class = "{c0b85d90-de8c-44c2-9420-c5e724ccdf2c}";
diff --git a/mocha-php/src/mocha-php/lib/mocha/oms/Oms.inc.php b/mocha-php/src/mocha-php/lib/mocha/oms/Oms.inc.php
index 510b037..a76d72b 100644
--- a/mocha-php/src/mocha-php/lib/mocha/oms/Oms.inc.php
+++ b/mocha-php/src/mocha-php/lib/mocha/oms/Oms.inc.php
@@ -658,7 +658,8 @@
$retval = $methodImplementation->execute($this, $context, $inst, $parms); // $this->executeMethod($context, $inst, $parms);
}
else if ($instParent->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnAttributeMethodBinding))
- || ($instParent->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnInstanceSetMethodBinding))))
+ || ($instParent->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnInstanceSetMethodBinding)))
+ || ($instParent->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ProcessUpdatesMethodBinding))))
{
$methodBindingExecutesMethod = $this->getRelatedInstance($inst, KnownRelationshipGuids::Method_Binding__executes__Method);
if ($methodBindingExecutesMethod === null)
diff --git a/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/GetAttributeBySystemRoutineMethodImplementation.inc.php b/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/GetAttributeBySystemRoutineMethodImplementation.inc.php
index 476a6fb..7b5989d 100644
--- a/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/GetAttributeBySystemRoutineMethodImplementation.inc.php
+++ b/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/GetAttributeBySystemRoutineMethodImplementation.inc.php
@@ -17,6 +17,8 @@
{
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
+ echo ("");
+
$instSystemRoutine = $oms->getRelatedInstance($method, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Get_Attribute_by_System_Routine_Method__uses__System_Attribute_Routine));
$returnsWorkData = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Attribute_by_System_Routine_Method__returns__Attribute);
$singular = false; // $oms->getAttributeValue($instSystemRoutine, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Singular));
@@ -27,13 +29,25 @@
(
"Method" => $method
));
+ echo ("");
return null;
}
if ($instSystemRoutine->GlobalIdentifier->__is_equal(UUID::parse(KnownInstanceGuids::SystemAttributeRoutine_GetGlobalIdentifier)))
{
// get instance text
- $context->setWorkData($returnsWorkData, $context->getWorkData(KnownClassGuids::Instance)->GlobalIdentifier->__toString());
+ $inst = $context->getWorkData(KnownInstanceGuids::WorkSet__RelatedInstance);
+ if ($inst === null)
+ {
+ echo("");
+ }
+ else
+ {
+ $gid = $inst->GlobalIdentifier->__toStringFormat(false, "", "");
+ echo ("");
+ echo ("");
+ $context->setWorkData($returnsWorkData, $gid);
+ }
}
else if ($instSystemRoutine->GlobalIdentifier->__is_equal(UUID::parse(KnownInstanceGuids::SystemAttributeRoutine_GetInstanceText)))
{
diff --git a/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/ProcessRelatedUpdatesMethodImplementation.inc.php b/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/ProcessRelatedUpdatesMethodImplementation.inc.php
index 2c7ec03..334385a 100644
--- a/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/ProcessRelatedUpdatesMethodImplementation.inc.php
+++ b/mocha-php/src/mocha-php/lib/mocha/oop/methodImplementations/ProcessRelatedUpdatesMethodImplementation.inc.php
@@ -3,6 +3,7 @@
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
+ use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\Oms;
@@ -14,6 +15,7 @@
protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
{
+ echo("executing PRU...");
$classForPRU = $oms->getRelatedInstance($method, KnownRelationshipGuids::Process_Related_Updates_Method__processes_for__Class);
if ($classForPRU === null)
{
@@ -26,38 +28,84 @@
if ($classForPRU !== null)
{
}
-
- //!HACK!
- $instForPRU = $oms->getNthInstanceOf($classForPRU, 1);
+
+ // //!HACK!
+ // $instForPRU = $oms->getNthInstanceOf($classForPRU, 1);
+ echo ("class for PRU: " . $classForPRU->InstanceKey);
+ $instForPRU = $context->getWorkData($classForPRU);
if ($instForPRU !== null)
{
- //echo("current work data for '" . $instForPRU->GlobalIdentifier . "' = '" . $context->getWorkData($instForPRU->GlobalIdentifier->__toString()) . "'");
+ echo("current work data for '" . $classForPRU->InstanceKey . "' = '" . $instForPRU->InstanceKey . "'");
+ }
+ else
+ {
+ echo ("inst for PRU class [" . $classForPRU->InstanceKey . "] is null");
}
$instExecutablesForPUMB = $oms->getRelatedInstances($method, KnownRelationshipGuids::Process_Related_Updates_Method__uses__Executable_for_PUMB);
foreach ($instExecutablesForPUMB as $instExecutableForPUMB)
{
- if ($instExecutableForPUMB !== null)
+ echo ("pumb exec: " . $instExecutableForPUMB->GlobalIdentifier . "
");
+
+ if ($oms->is_a($instExecutableForPUMB, KnownClassGuids::AssignAttributeMethod))
{
$assignsAttribute = $oms->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__assigns__Attribute);
$usesExecutableReturningAttribute = $oms->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__uses__Executable_returning_Attribute);
//$context->setWorkData($assignsAttribute->GlobalIdentifier->__toString(), $usesExecutableReturningAttribute);
- //echo ("assigning attribute '" . $assignsAttribute->GlobalIdentifier . "' the value from executable '" . $usesExecutableReturningAttribute->GlobalIdentifier . "'");
+ echo ("assigning attribute '" . $assignsAttribute->GlobalIdentifier . "' the value from executable '" . $usesExecutableReturningAttribute->GlobalIdentifier . "'");
- $value = $context->getWorkData($usesExecutableReturningAttribute->GlobalIdentifier->__toString());
+ $value = $context->getWorkData($usesExecutableReturningAttribute);
if ($value instanceof InstanceReference)
{
- //echo ("the value from work data is ##IS#'" . $value->GlobalIdentifier . "'##");
+ echo ("the value from work data is ##IS#'" . $value->GlobalIdentifier . "'##");
}
else
{
+ echo ("the value from work data is '" . $value . "'");
$oms->setAttributeValue($instForPRU, $assignsAttribute, $value);
}
}
+ else if ($oms->is_a($instExecutableForPUMB, KnownClassGuids::AssignRelationshipMethod))
+ {
+ echo ("execute method: " . $instExecutableForPUMB->GlobalIdentifier);
+ $forClass = $oms->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Method__for__Class);
+ echo ("for class: " . $forClass->InstanceKey);
+
+ $forClassInstance = $context->getWorkData($forClass);
+
+ $assignsRelationship = $oms->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Relationship_Method__assigns__Relationship);
+ $usesExecutableReturningInstanceSet = $oms->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Relationship_Method__uses__Executable_returning_Instance_Set);
+
+ //$context->setWorkData($assignsAttribute->GlobalIdentifier->__toString(), $usesExecutableReturningAttribute);
+ //echo ("assigning attribute '" . $assignsAttribute->GlobalIdentifier . "' the value from executable '" . $usesExecutableReturningAttribute->GlobalIdentifier . "'");
+
+ echo("assigns rel: " . $assignsRelationship);
+ if ($assignsRelationship instanceof InstanceReference)
+ {
+ $value = $context->getWorkData($usesExecutableReturningInstanceSet);
+ echo ("assign val: " . $value);
+ if ($value instanceof InstanceReference)
+ {
+ echo ("assign relationship: " . $forClassInstance->InstanceKey . " . " . $assignsRelationship->InstanceKey . " = " . $value->InstanceKey);
+ }
+ else
+ {
+ //echo( "the value from work data [" . $usesExecutableReturningInstanceSet->InstanceKey . "] is '" . $value . "'");
+ }
+
+ $singular = $oms->getAttributeValue($assignsRelationship, KnownAttributeGuids::Singular, false);
+ if ($singular)
+ {
+ //!HACK! but this breaks multi instances in other places, so no good...
+ $oms->removeRelationshipInstances($forClassInstance, $assignsRelationship);
+ }
+ $oms->assignRelationship($forClassInstance, $assignsRelationship, $value);
+ }
+ }
else
{
- echo ("executable for PUMB is null");
+ echo ("unknown class for executable for PUMB");
}
}
}
diff --git a/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php b/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php
index d8c6c0a..1add386 100644
--- a/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php
+++ b/mocha-php/src/mocha-php/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php
@@ -134,6 +134,10 @@
$displayOptions = $oms->getRelatedInstances($elementContent, KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option);
$this->renderRichTextAttributeEC($parentElementContents, $elementContent, $ecInst, $value);
});
+
+ $this->registerEditor($oms->getInstanceByGlobalIdentifier(KnownClassGuids::MethodBinding), $genericViewFunc, function($oms, $parentElementContents, $elementContent, $ecInst, $value)
+ {
+ });
}
/**
@@ -168,7 +172,7 @@
return \implode('', $pieces);
}
- public function getElementContentId(array $parentElementContents, ?InstanceReference $elementContent)
+ public function getElementContentId(array $parentElementContents, ?InstanceReference $elementContent, $index = null)
{
$fullyQualifiedECID = "";
$count = count($parentElementContents);
@@ -194,8 +198,13 @@
if ($count > 0)
{
$fullyQualifiedECID = $fullyQualifiedECID . ":";
- }
- $fullyQualifiedECID .= $elementContent->InstanceKey->__toString();
+ }
+ $idx = "";
+ if (is_int($index))
+ {
+ $idx = $index . ":";
+ }
+ $fullyQualifiedECID .= $idx . $elementContent->InstanceKey->__toString();
}
return $fullyQualifiedECID;
}
@@ -264,6 +273,40 @@
$this->renderEndTag("div");
}
+ public function renderTaskStep2(&$parentElementContents, InstanceReference $usesElement)
+ {
+ /**
+ * @var MySQLDatabaseOms
+ */
+ $oms = mocha_get_oms();
+
+ $title = $oms->getInstanceText($usesElement);
+ $label = $oms->getAttributeValue($usesElement, KnownAttributeGuids::Label);
+ if ($label !== null)
+ {
+ $title = $label;
+ }
+ $workDataRelatedInstance = $this->Context->getWorkData(KnownInstanceGuids::WorkSet__RelatedInstance);
+ if ($workDataRelatedInstance !== null)
+ {
+ $this->TargetInstance = $oms->getInstanceByKey(InstanceKey::Parse($workDataRelatedInstance));
+ }
+
+ $this->renderBeginPage();
+ echo ("");
+ echo ("TargetInstance->InstanceKey . "\" />");
+ $this->renderPageHeader($title, $this->TargetInstance);
+
+ echo ("work data!");
+ print_r($this->Context->workData);
+
+ $this->renderBeginTag("div", [ ], [ "uwt-page-content" ]);
+ $this->renderElement($parentElementContents, $usesElement, [ $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular), $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ShowSubelementsVertically) ]);
+ $this->renderEndTag("div");
+ $this->renderEndForm();
+ $this->renderEndPage();
+ }
+
public function renderTask(InstanceReference $task, ?InstanceReference $relatedInstance = null)
{
/**
@@ -272,6 +315,7 @@
$oms = mocha_get_oms();
$taskName = $oms->getAttributeValue($task, KnownAttributeGuids::Name);
+ array_push($this->Context->CallStack, $task);
$this->Context->setWorkData(KnownInstanceGuids::WorkSet__TaskRelatedInstance, $relatedInstance);
$this->renderBeginPage($taskName);
@@ -297,7 +341,7 @@
$this->Context->setWorkData($riParentClass, $relatedInstance);
}
}
- echo ("");
+ echo ("");
$parentClass = $oms->getParentClass($task);
$allElementsAreReadonly = true;
@@ -407,13 +451,15 @@ EOF
$this->renderEndPage();
}
- private function updateWorkDataWithElementContents(array $parentElementContents, InstanceReference $element)
+ private function updateWorkDataWithElementContents(array $parentElementContents, InstanceReference $element, $singular = true, $i = 0)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
+ //print_r($_POST);die();
+
if ($element !== null)
{
$elementContents = $oms->getRelatedInstances($element, KnownRelationshipGuids::Element__has__Element_Content);
@@ -430,12 +476,15 @@ EOF
}
else
{
- $ecid = $this->getElementContentId($parentElementContents, $ec);
+ $ecid = $this->getElementContentId($parentElementContents, $ec, ($singular ? null : $i));
if (isset($_POST["ec_" . $ecid]))
{
$value = $_POST["ec_" . $ecid];
+ $value_str = $value;
//!FIXME: refactor out the casting of POST values to actual instances or primitive literals
- if ($oms->is_a($ecInst, KnownClassGuids::Clasz))
+ if ($oms->is_a($ecInst, KnownClassGuids::Clasz)
+ || $oms->is_a($ecInst, KnownClassGuids::WorkSet)
+ || $oms->is_a($ecInst, KnownClassGuids::Relationship))
{
if ($value == "")
{
@@ -449,10 +498,18 @@ EOF
echo ("invalid ik: " . $value);
}
$value = $oms->getInstanceByKey($ik);
+ $value_str = "`" . $ik . "`";
}
}
+
+ echo ("updateWorkDataWithElementContents: setting work data `" . $ecInst->InstanceKey . "` from EC `" . $ecid . "` to value '" . $value_str . "'
");
$this->Context->setWorkData($ecInst, $value);
}
+ else
+ {
+ echo ("updateWorkDataWithElementContents: not setting work data `" . $ecInst->InstanceKey . "` from EC `" . $ecid . "`, not present in POST
");
+
+ }
}
}
}
@@ -587,8 +644,69 @@ EOF
$pru = $oms->getRelatedInstance($element, KnownRelationshipGuids::Element__processed_by__Process_Related_Updates_Method);
if ($pru !== null)
{
- echo ("");
- $oms->execute($this->Context, $pru);
+ //? BEGIN: stolen from default implementation of PRU
+
+ //!FIXME: in a sequence task, the Initiating Element may just be a stepping stone
+ //! on the way to the next step. In this case we don't really want to save
+ //! any data, just store it in memory (work data) to be used by the next step...
+ $elementProcessedByCT = $oms->getRelatedInstance($element, KnownRelationshipGuids::Element__processed_by__Control_Transaction_Method);
+ if ($elementProcessedByCT !== null)
+ {
+ }
+
+ $relatedECs = $oms->getRelatedInstances($element, KnownRelationshipGuids::Element__has__Element_Content);
+
+ $classParent = null;
+ if (count($relatedECs) > 0)
+ {
+ $classParent = $oms->getRelatedInstance($relatedECs[0], KnownRelationshipGuids::Element_Content__has__Instance);
+ echo ("class parent : " . $classParent->InstanceKey);
+ }
+
+ if ($parentElementContent !== null)
+ {
+ $parentECFullyQualifiedECID = $this->getElementContentId($parentElementContents, null);
+ $ecid_count = "ec_" . $parentECFullyQualifiedECID . "_count";
+
+ if (isset($_POST[$ecid_count]))
+ {
+ // nonsingular
+ if ($this->DebugMode)
+ {
+ echo ("paren ec: " . $parentElementContent);
+ }
+ $subelementInstances = $this->getSubelementInstances($parentElementContent);
+ $count = $_POST[$ecid_count];
+
+ if ($count != count($subelementInstances))
+ {
+ echo ("WARN: count mismatch (got " . $count . "; expected " . count($subelementInstances) . ") - add / remove sub elements not implemented"); //die();
+ }
+
+ for ($i = 0; $i < $count; $i++)
+ {
+ $targetRelatedInstance = $subelementInstances[$i];
+ if ($i >= count($subelementInstances))
+ {
+ // we are creating a new instance of the class of the subelement (element content #0)
+ echo ("creating instance of " . $classParent->InstanceKey);
+ $targetRelatedInstance = $oms->createInstanceOf($classParent);
+ }
+ else
+ {
+ }
+ echo ("target rel inst: " . $targetRelatedInstance->InstanceKey);
+
+ $this->updateWorkDataWithElementContents($parentElementContents, $element, false, $i);
+ echo ("class parent: " . $classParent->InstanceKey . " = " . $targetRelatedInstance->InstanceKey . "
");
+ $this->Context->setWorkData($classParent, $targetRelatedInstance);
+
+ echo ("executing pru '" . $pru->GlobalIdentifier . "' for " . $element->InstanceKey);
+ $oms->execute($this->Context, $pru);
+ }
+ }
+ }
+ //? END: stolen from default implementation of PRU
return true;
}
else
@@ -605,10 +723,20 @@ EOF
}
$relatedECs = $oms->getRelatedInstances($element, KnownRelationshipGuids::Element__has__Element_Content);
+
+ $classParent = null;
+ if (count($relatedECs) > 0)
+ {
+ $classParent = $oms->getRelatedInstance($relatedECs[0], KnownRelationshipGuids::Element_Content__has__Instance);
+ echo ("class parent : " . $classParent->InstanceKey);
+ }
if ($parentElementContent !== null)
{
- $ecid_count = "ec_" . $parentElementContent->InstanceKey . "_count";
+ $parentECFullyQualifiedECID = $this->getElementContentId($parentElementContents, null);
+ $ecid_count = "ec_" . $parentECFullyQualifiedECID . "_count";
+ // $ecid_count = "ec_" . $parentElementContent->InstanceKey . "_count";
+
if (isset($_POST[$ecid_count]))
{
// nonsingular
@@ -618,16 +746,25 @@ EOF
}
$subelementInstances = $this->getSubelementInstances($parentElementContent);
$count = $_POST[$ecid_count];
-
+
if ($count != count($subelementInstances))
{
- echo ("ERR count mismatch (got " . $count . "; expected " . count($subelementInstances) . ") - add / remove sub elements not implemented"); die();
+ echo ("WARN: count mismatch (got " . $count . "; expected " . count($subelementInstances) . ") - add / remove sub elements not implemented"); //die();
}
for ($i = 0; $i < $count; $i++)
{
$targetRelatedInstance = $subelementInstances[$i];
- // echo ("target rel inst: " . $targetRelatedInstance->InstanceKey);
+ if ($i >= count($subelementInstances))
+ {
+ // we are creating a new instance of the class of the subelement (element content #0)
+ echo ("creating instance of " . $classParent->InstanceKey);
+ $targetRelatedInstance = $oms->createInstanceOf($classParent);
+ }
+ else
+ {
+ }
+ echo ("target rel inst: " . $targetRelatedInstance->InstanceKey);
array_push($parentElementContents, $i);
$relatedECCount = count($relatedECs);
@@ -657,7 +794,7 @@ EOF
if ($this->DebugMode)
{
- echo ("update EC: " . $relatedECInst->InstanceKey . " = '" . $value . "'
");
+ echo ("update EC `" . $fullyQualifiedECID . "`: " . $relatedECInst->InstanceKey . " = '" . $value . "'
");
}
$this->updateElementContentInstance($parentElementContents, $targetRelatedInstance, $relatedECInst, $value);
array_pop($parentElementContents);
@@ -787,6 +924,7 @@ EOF
$processedByControlTransaction = $oms->getRelatedInstance($element, KnownRelationshipGuids::Element__processed_by__Control_Transaction_Method);
if ($processedByControlTransaction !== null)
{
+ echo ("procesed by CT: " . $processedByControlTransaction->InstanceKey);
if ($_POST["task_step"] == "1")
{
// selection step
@@ -810,20 +948,13 @@ EOF
$ecInst0 = $oms->getRelatedInstance($usesElementContents[0], KnownRelationshipGuids::Element_Content__has__Instance);
$this->TargetInstance = $this->Context->getWorkData($ecInst0);
- $this->renderBeginPage();
- echo ("");
- echo ("TargetInstance->InstanceKey . "\" />");
- $this->renderPageHeader($oms->getInstanceText($usesElement), $this->TargetInstance);
- $this->renderBeginTag("div", [ ], [ "uwt-page-content" ]);
- $this->renderElement($parentElementContents, $usesElement, [ $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular), $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ShowSubelementsVertically) ]);
- $this->renderEndTag("div");
- $this->renderEndForm();
- $this->renderEndPage();
+ $this->renderTaskStep2($parentElementContents, $usesElement);
}
exit();
}
else if ($_POST["task_step"] == "2")
{
+ echo ("task step 2
");
// edit step
$usesBRMB = $oms->getRelatedInstance($processedByControlTransaction, KnownRelationshipGuids::Control_Transaction_Method__uses__Build_Response_Method_Binding);
$executesMethod = $oms->getRelatedInstance($usesBRMB, KnownRelationshipGuids::Method_Binding__executes__Method);
@@ -845,7 +976,7 @@ EOF
if (isset($_POST["target_inst_id"]))
{
$targetInstance = $oms->getInstanceByKey(InstanceKey::Parse($_POST["target_inst_id"]));
- $this->TargetInstance = $oms->getInstanceByKey(InstanceKey::Parse($_POST["target_inst_id"]));
+ $this->TargetInstance = $targetInstance;
}
}
}
@@ -1035,6 +1166,16 @@ EOF
// Executable returning Attribute
else if ($oms->is_a($ecInst, KnownClassGuids::ExecutableReturningAttribute))
{
+ if (!$oms->is_a($ecInst, KnownClassGuids::Attribute))
+ {
+ $attr = $oms->executeReturningAttribute($this->Context, $ecInst);
+ if ($attr !== null)
+ {
+ // $value = $this->Context->getWorkData($attr);
+ return ($attr == "");
+ }
+ return true;
+ }
return $oms->getAttributeValue($relatedInstance, $ecInst) == "" && $oms->getAttributeValue($ecInst, KnownAttributeGuids::Value) == "";
}
// Executable returning Attribute
@@ -1398,7 +1539,16 @@ EOF
}
else
{
+ if ($this->DebugMode)
+ {
+ echo ("related instance: " . $relatedInstance->InstanceKey);
+ echo ("
ec inst: " . $ecInst->InstanceKey);
+ }
$value = $oms->getRelatedInstances($relatedInstance, $ecInst);
+ if ($this->DebugMode)
+ {
+ echo ("
value: " . $oms->getInstanceKeysString($value));
+ }
}
$validClasses = [ $oms->getRelatedInstance($ecInst, KnownRelationshipGuids::Relationship__has_destination__Class) ];
@@ -1437,11 +1587,13 @@ EOF
// Executable returning Attribute
else if ($oms->is_a($ecInst, KnownClassGuids::ExecutableReturningAttribute))
{
+ echo ("");
$this->renderExecutableReturningAttribute($parentElementContents, $elementContent, $ecInst, $relatedInstance, $renderNotEnterable);
}
// Executable returning Attribute
else if ($oms->is_a($ecInst, KnownClassGuids::ReturnAttributeMethodBinding))
{
+ echo ("");
// I *THINK* Return Attribute Method Bindings aren't supposed to return
// just strings, they're supposed to actually return *attributes* that
// can then be edited in the Element Content.
@@ -1455,6 +1607,40 @@ EOF
echo ("ERR: attribute ( from method " . $ecInst->InstanceKey . " ) is null");
}
}
+ else if ($oms->is_a($ecInst, KnownClassGuids::WorkSet))
+ {
+ $targetInstance = $ecInst;
+ if ($this->Context !== null)
+ {
+ $targetInstance = $this->Context->getWorkData($ecInst);
+ }
+
+ $adw = new InstanceBrowser();
+ if ($title !== null)
+ {
+ $adw->Title = $title;
+ }
+ $adw->Name = "ec_" . $fullyQualifiedECID;
+ $adw->Attributes[] = new WebControlAttribute("data-ecid", $elementContent->InstanceKey);
+ $adw->Editable = !($renderNotEnterable || $oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable)));
+ //$adw->ValidClasses[] = $;
+
+ $insts = $this->Context->getWorkData($ecInst);
+ $singular = !is_array($insts); // $oms->getAttributeValue($ecInst, KnownAttributeGuids::Singular, false);
+ if ($insts !== null)
+ {
+ if ($singular)
+ {
+ $adw->SelectedInstances = [ $insts ];
+ }
+ else
+ {
+ $adw->SelectedInstances = $insts;
+ }
+ }
+ $adw->Title = $title;
+ $adw->Render();
+ }
else if ($oms->is_a($ecInst, KnownClassGuids::Clasz))
{
$targetInstance = $ecInst;
@@ -1555,34 +1741,54 @@ EOF
$displayOptions = $oms->getRelatedInstances($elementContent, KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option);
// fill in the value from the target instance
- $targetInstance = $relatedInstance;
- if ($targetInstance === null)
+ $value = null;
+ if (!$oms->is_a($ecInst, KnownClassGuids::Attribute))
{
- $targetInstance = $this->TargetInstance;
-
- $firstElementContent = $oms->getNthRelatedInstance($this->__renderingElement, KnownRelationshipGuids::Element__has__Element_Content, 0);
- $firstElementContentInst = $oms->getRelatedInstance($firstElementContent, KnownRelationshipGuids::Element_Content__has__Instance);
-
- $targetInstance = $oms->getNthInstanceOf($firstElementContentInst, 1);
+ $attr = $oms->executeReturningAttribute($this->Context, $ecInst);
+ if ($attr !== null)
+ {
+ echo ("");
+ // $value = $this->Context->getWorkData($attr);
+ $value = $attr;
+ }
+ else
+ {
+ echo ("");
+ }
}
- if ($targetInstance !== null)
- {
- $value = $oms->getAttributeValue($targetInstance, $ecInst);
- }
-
+
if ($value === null)
{
- $value = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value));
- }
+ $targetInstance = $relatedInstance;
+ if ($targetInstance === null)
+ {
+ $targetInstance = $this->TargetInstance;
- $ecid = "ec_" . $this->getElementContentId($parentElementContents, $elementContent);
- if ($this->IsPostback && isset($_POST[$ecid]))
- {
- // fill in the value from the postback
- $value = $_POST[$ecid];
+ $firstElementContent = $oms->getNthRelatedInstance($this->__renderingElement, KnownRelationshipGuids::Element__has__Element_Content, 0);
+ $firstElementContentInst = $oms->getRelatedInstance($firstElementContent, KnownRelationshipGuids::Element_Content__has__Instance);
+
+ $targetInstance = $oms->getNthInstanceOf($firstElementContentInst, 1);
+ }
+ if ($targetInstance !== null)
+ {
+ $value = $oms->getAttributeValue($targetInstance, $ecInst);
+ }
+
+ if ($value === null)
+ {
+ $value = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value));
+ }
+
+ $ecid = "ec_" . $this->getElementContentId($parentElementContents, $elementContent);
+ if ($this->IsPostback && isset($_POST[$ecid]))
+ {
+ // fill in the value from the postback
+ $value = $_POST[$ecid];
+ }
}
$editor = $this->getEditor($ecInst);
+
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable)) || $renderNotEnterable)
{
if ($editor !== null)
@@ -1603,7 +1809,14 @@ EOF
{
// $adw = new InstanceBrowser(array($rambAttribute));
// $adw->Render();
- echo($context->getWorkData($attr));
+ if (is_string($attr))
+ {
+ echo($attr);
+ }
+ else
+ {
+ echo($context->getWorkData($attr));
+ }
}
public function renderTextAttributeEC(array $parentElementContents, InstanceReference $ec, InstanceReference $inst, $password = false, $value = null)
@@ -2201,10 +2414,6 @@ EOF
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
if (count($contents) > 0)
{
- if ($this->DebugMode)
- {
- echo ("contents is not empty .. ");
- }
$ecInst0 = $oms->getRelatedInstance($contents[0], KnownRelationshipGuids::Element_Content__has__Instance);
if ($ecInst0 !== null)
{
@@ -2395,7 +2604,7 @@ EOF
$parentECDisplayOptions = $oms->getRelatedInstances($parentElementContent, KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option);
- $listviewClasses = [ "uwt-listview", "mcx-element" ];
+ $listviewClasses = [ "uwt-listview", "mcx-element", "mcx-elementcontent" ];
if (!($renderingNotEnterable || $renderNotEnterable || $oms->instanceSetContains($parentECDisplayOptions, $oms->normalizeInstanceReference(KnownInstanceGuids::DisplayOption__NotEnterable)) || $oms->instanceSetContains($parentECDisplayOptions, $oms->normalizeInstanceReference(KnownInstanceGuids::DisplayOption__RowsNotEditable))))
{
$listviewClasses[] = "mcx-editable";
@@ -2417,7 +2626,7 @@ EOF
$mcx_classes[] = "mcx-empty";
}
$this->renderBeginTag("div", [ "data-instance-id" => $element->InstanceKey ], $mcx_classes);
- $this->renderBeginTag("table", [ "data-ecid" => $parentElementContent->InstanceKey, "data-instance-id" => $element->InstanceKey ], $listviewClasses);
+ $this->renderBeginTag("table", [ "data-ecid" => $parentElementContent->InstanceKey, "data-fqecid" => $this->getElementContentId($parentElementContents, null), "data-instance-id" => $element->InstanceKey ], $listviewClasses);
// $this->renderBeginTag("div", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element", "uwt-listview-view-details", "uwt-gridlines", "uwt-hottracking" ]);
@@ -2493,11 +2702,11 @@ EOF
$this->renderEndTag("thead");
//$this->renderEndTag("div");
+ //! TBODY *must* be rendered for Add Row button to work in JS
+ $this->renderBeginTag("tbody");
if ($instances !== null)
{
//$this->renderBeginTag("div", [], [ "uwt-listview-items" ]);
- $this->renderBeginTag("tbody");
-
for ($i = 0; $i < $rowCount; $i++)
{
$rowInst = $instances[$i];
@@ -2538,10 +2747,10 @@ EOF
}
//$this->renderEndTag("div");
- $this->renderEndTag("tbody");
//$this->renderEndTag("div");
}
+ $this->renderEndTag("tbody");
$this->renderEndTag("table");
diff --git a/mocha-php/src/mocha-php/scripts/mcx-element-listview.js b/mocha-php/src/mocha-php/scripts/mcx-element-listview.js
index a4ebb55..524b8df 100644
--- a/mocha-php/src/mocha-php/scripts/mcx-element-listview.js
+++ b/mocha-php/src/mocha-php/scripts/mcx-element-listview.js
@@ -5,6 +5,8 @@ function McxElementListView(parentElement)
this.HeaderElement = this.ParentElement.children[1];
this.HeaderRowElement = this.HeaderElement.children[0];
+ this.CountInput = this.ParentElement.parentElement.parentElement.children[0];
+
this.HeaderAddRowButton = this.HeaderRowElement.children[0].children[0];
this.HeaderAddRowButton.NativeObject = this;
this.HeaderAddRowButton.addEventListener("click", function(e)
@@ -18,14 +20,22 @@ function McxElementListView(parentElement)
});
this.BodyElement = this.ParentElement.children[2];
-
- this.buildRow = function()
+ this.setEmpty = function(value)
{
- var lvInstId = this.ParentElement.getAttribute("data-ecid");
-
- var tr = document.createElement("tr");
- tr.appendChild(this.createAddRemoveColumn());
+ if (value)
+ {
+ System.ClassList.Add(this.ParentElement.parentElement, "mcx-empty");
+ }
+ else
+ {
+ System.ClassList.Remove(this.ParentElement.parentElement, "mcx-empty");
+ }
+ };
+ this.buildRow = function(callback, callback_parms)
+ {
+ var lvInstId = this.ParentElement.getAttribute("data-fqecid");
+
var xhr = new XMLHttpRequest();
var url = System.ExpandRelativePath("~/" + System.TenantName + "/flowController.htmld");
xhr.open("POST", url);
@@ -36,42 +46,116 @@ function McxElementListView(parentElement)
"sessionSecureToken": "7733ad40-edf6-4dc9-aa90-85bcf93cc8f0",
"clientRequestID" : "9af7ce5bc51348a6981539a98b267072"
};
- xhr.send(JSON.stringify(h));
-
- for (var i = 1; i < this.HeaderRowElement.children.length; i++)
+ xhr.__callback = callback;
+ xhr.__this = this;
+ xhr.onreadystatechange = function(e)
{
- var colInstId = this.HeaderRowElement.children[i].getAttribute("data-ecid");
- var fqecid = lvInstId + ":*:" + colInstId;
-
- var td = document.createElement("td");
- var input = document.createElement("input");
- input.id = "ec_" + fqecid;
- input.name = "ec_" + fqecid;
- input.setAttribute("data-ecid", "ec_" + fqecid);
- input.type = "text";
- td.appendChild(input);
+ if (this.readyState === 4)
+ {
+ responseJSON = JSON.parse(this.responseText);
+ if (responseJSON.result == "success")
+ {
+ if (responseJSON.item.widget == "row")
+ {
+ // !!! `this` is now XHR, not McxElementListView !!!
+ var tr = document.createElement("tr");
+ tr.appendChild(this.__this.createAddRemoveColumn());
- tr.appendChild(td);
- }
- return tr;
+ var newRowIndex = this.__this.BodyElement.children.length;
+ this.__this.CountInput.value = this.__this.BodyElement.children.length + 1;
+
+ for (var i = 1; i < this.__this.HeaderRowElement.children.length; i++)
+ {
+ // ! BEGIN HACK !
+ var columnOffset = 0;
+ if (this.__this.HeaderRowElement.children.length != responseJSON.item.contents.length)
+ {
+ columnOffset = 1;
+ }
+
+ var td = document.createElement("td");
+ var rowDefinition = responseJSON.item.contents[i - columnOffset];
+ if (typeof(rowDefinition) !== "undefined")
+ {
+ // var colInstId = this.__this.HeaderRowElement.children[i].getAttribute("data-ecid");
+ var colInstId = rowDefinition.ecid;
+ var colWidget = rowDefinition.widget;
+
+ var fqecid = lvInstId + ":" + newRowIndex + ":" + colInstId;
+
+ if (colWidget === "text")
+ {
+ var input = document.createElement("input");
+ input.id = "ec_" + fqecid;
+ input.name = "ec_" + fqecid;
+ input.setAttribute("data-ecid", "ec_" + fqecid);
+ input.type = "text";
+ td.appendChild(input);
+ }
+ else if (colWidget === "checkbox")
+ {
+ var input = document.createElement("input");
+ input.id = "ec_" + fqecid;
+ input.name = "ec_" + fqecid;
+ input.setAttribute("data-ecid", "ec_" + fqecid);
+ input.type = "checkbox";
+ td.appendChild(input);
+
+ //! must be called after appendChild since it needs to finagle the DOM
+ new CheckBox(input);
+ }
+ else if (colWidget === "monikerListInput")
+ {
+ var multiselect = false;
+ if (rowDefinition.multiselect === true)
+ {
+ multiselect = true;
+ }
+ var moniker = McxInstanceBrowser.create({ "multiselect": multiselect, "fullyQualifiedECID": fqecid, "ecid": rowDefinition.ecid, "validClassIds": [ rowDefinition.ecdt ], "autocompleteUrl": "~/prompt/c0/" + rowDefinition.ecdt });
+ if (moniker)
+ {
+ td.appendChild(moniker);
+ }
+ }
+ }
+ else
+ {
+ td.innerHTML = "undefined row def at index " + i;
+ }
+ tr.appendChild(td);
+ }
+ this.__callback(tr, callback_parms);
+ }
+ }
+ }
+ };
+ xhr.send(JSON.stringify(h));
};
this.addRowBefore = function(beforeIndex)
{
- var tr = this.buildRow();
- this.BodyElement.insertBefore(tr, this.BodyElement.children[beforeIndex]);
+ this.buildRow(function(tr, parms)
+ {
+ parms[0].BodyElement.insertBefore(tr, parms[0].BodyElement.children[parms[1]]);
+ }, [ this, beforeIndex ]);
+ this.setEmpty(false);
};
this.addRowAfter = function(afterElement)
{
- var tr = this.buildRow();
- this.BodyElement.insertAfter(tr, afterElement);
+ this.buildRow(function(tr, parms)
+ {
+ parms[0].BodyElement.insertAfter(tr, parms[1]);
+ }, [ this, afterElement ]);
+ this.setEmpty(false);
};
this.removeRow = function(row)
{
row.remove();
+ this.setEmpty(this.BodyElement.children.length == 0);
};
this.removeRowAt = function(index)
{
this.BodyElement.children[index].remove();
+ this.setEmpty(this.BodyElement.children.length == 0);
};
this.createAddRemoveColumn = function()
@@ -83,9 +167,13 @@ function McxElementListView(parentElement)
aAdd.className = "uwt-listview-row-add";
aAdd.href = "#";
aAdd.NativeObject = this;
- aAdd.addEventListener("click", function()
+ aAdd.addEventListener("click", function(e)
{
this.NativeObject.addRowAfter(this.parentElement);
+
+ e.preventDefault();
+ e.stopPropagation();
+ return false;
});
td.appendChild(aAdd);
@@ -93,9 +181,13 @@ function McxElementListView(parentElement)
aRemove.className = "uwt-listview-row-remove";
aRemove.href = "#";
aRemove.NativeObject = this;
- aRemove.addEventListener("click", function()
+ aRemove.addEventListener("click", function(e)
{
this.NativeObject.removeRow(this.parentElement.parentElement);
+
+ e.preventDefault();
+ e.stopPropagation();
+ return false;
});
td.appendChild(aRemove);
diff --git a/mocha-php/src/mocha-php/scripts/mcx-elementcontent.js b/mocha-php/src/mocha-php/scripts/mcx-elementcontent.js
index b14cf5b..d2f7b27 100644
--- a/mocha-php/src/mocha-php/scripts/mcx-elementcontent.js
+++ b/mocha-php/src/mocha-php/scripts/mcx-elementcontent.js
@@ -16,6 +16,7 @@ function McxElementContent(parentElement)
this.updateElementContentsWithFlowController = function(value, changes)
{
+ alert("update elements");
for (var i = 0; i < changes.length; i++)
{
var ecid = changes[i].ecid;
diff --git a/mocha-php/src/mocha-php/scripts/mcx-instancebrowser.js b/mocha-php/src/mocha-php/scripts/mcx-instancebrowser.js
index d6135ba..d2e2a33 100644
--- a/mocha-php/src/mocha-php/scripts/mcx-instancebrowser.js
+++ b/mocha-php/src/mocha-php/scripts/mcx-instancebrowser.js
@@ -397,6 +397,82 @@ function McxInstanceBrowser(parentElement)
}
}
+McxInstanceBrowser.create = function(parms)
+{
+ var div = document.createElement("DIV");
+ div.className = "mcx-instancebrowser mcx-editable";
+
+ if (parms.multiselect === true)
+ {
+ System.ClassList.Add(div, "mcx-multiselect");
+ }
+
+ var value = null;
+ if (parms.ecid)
+ {
+ div.setAttribute("data-ecid", parms.ecid);
+ }
+ if (typeof(parms.selectedInstanceIds) === "object")
+ {
+ value = parms.selectedInstanceIds.join(";");
+ div.setAttribute("data-instance-ids", value);
+ }
+ if (typeof(parms.validClassIds) === "object")
+ {
+ div.setAttribute("data-valid-class-ids", parms.validClassIds.join(";"));
+ }
+ if (parms.autocompleteUrl)
+ {
+ div.setAttribute("data-autocomplete-url", parms.autocompleteUrl);
+ }
+
+ var divTitle = document.createElement("DIV");
+ if (parms.title)
+ {
+ divTitle.innerHTML = title;
+ }
+ div.appendChild(divTitle);
+
+ var inputHidden = document.createElement("INPUT");
+ inputHidden.type = "hidden";
+ inputHidden.name = "ec_" + parms.fullyQualifiedECID;
+ if (value !== null)
+ {
+ inputHidden.value = value;
+ }
+ div.appendChild(inputHidden);
+
+ var input = document.createElement("INPUT");
+ input.type = "text";
+ div.appendChild(input);
+
+ var ul = document.createElement("UL");
+ ul.className = "mcx-selected-items";
+ div.appendChild(ul);
+
+ var divSearchResults = document.createElement("DIV");
+ divSearchResults.className = "uwt-popup mcx-search-results";
+
+ var ulSearchResults = document.createElement("UL");
+ ulSearchResults.className = "uwt-menu uwt-multiselect uwt-highlight";
+ divSearchResults.appendChild(ulSearchResults);
+
+ var divSpinner = document.createElement("DIV");
+ divSpinner.className = "uwt-spinner";
+ divSearchResults.appendChild(divSpinner);
+
+ var divPlaceholder = document.createElement("DIV");
+ divPlaceholder.className = "uwt-placeholder";
+ divPlaceholder.innerText = "type to search the list";
+ divSearchResults.appendChild(divPlaceholder);
+
+ div.appendChild(divSearchResults);
+
+ new McxInstanceBrowser(div);
+
+ return div;
+};
+
window.addEventListener("load", function()
{
var items = document.getElementsByClassName("mcx-instancebrowser");
diff --git a/mocha-php/src/mocha-php/ui/pages/FlowControllerPage.phpx.php b/mocha-php/src/mocha-php/ui/pages/FlowControllerPage.phpx.php
index 3cca40a..9a1389e 100644
--- a/mocha-php/src/mocha-php/ui/pages/FlowControllerPage.phpx.php
+++ b/mocha-php/src/mocha-php/ui/pages/FlowControllerPage.phpx.php
@@ -2,7 +2,10 @@
namespace Mocha\UI\Pages;
+ use Mocha\Core\KnownAttributeGuids;
+ use Mocha\Oms\Oms;
use Mocha\Core\InstanceKey;
+ use Mocha\Core\InstanceReference;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
@@ -14,6 +17,50 @@
class FlowControllerPage extends WebPage
{
+ private function buildElementContentJSON(Oms $oms, InstanceReference $subEC)
+ {
+ $ecDataType = $oms->getRelatedInstance($subEC, KnownRelationshipGuids::Element_Content__has__Instance);
+ $ary = array
+ (
+ "ecid" => $subEC->InstanceKey->__toString()
+ );
+ $widget = "";
+ if ($ecDataType != null)
+ {
+ $dataTypeClass = $oms->getParentClass($ecDataType);
+ $ary["ecdt"] = $ecDataType->InstanceKey->__toString();
+ if
+ (
+ $dataTypeClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::TextAttribute))
+ || $dataTypeClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::NumericAttribute))
+ || $dataTypeClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::DateAttribute))
+ )
+ {
+ $widget = "text";
+ }
+ else if ($dataTypeClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::BooleanAttribute)))
+ {
+ $widget = "checkbox";
+ }
+ else if ($oms->is_a($dataTypeClass, UUID::parse(KnownClassGuids::Clasz)))
+ {
+ $widget = "monikerListInput";
+ if (($oms->getAttributeValue($subEC, KnownAttributeGuids::Singular))
+ || ($oms->getAttributeValue($ecDataType, KnownAttributeGuids::Singular)))
+ {
+ $ary["multiselect"] = false;
+ }
+ else
+ {
+ $ary["multiselect"] = true;
+ }
+ }
+ }
+
+ $ary["widget"] = $widget;
+ return $ary;
+ }
+
protected function OnInitializing(\Phast\CancelEventArgs $e)
{
header("Content-Type: application/json");
@@ -68,10 +115,7 @@
$elementContents = $oms->getRelatedInstances($element, KnownRelationshipGuids::Element__has__Element_Content);
foreach ($elementContents as $subEC)
{
- $contents[] = array
- (
- "ecid" => $subEC->InstanceKey->__toString()
- );
+ $contents[] = $this->buildElementContentJSON($oms, $subEC);
}
}
else if ($oms->is_a($element, KnownClassGuids::BooleanAttribute))