major updates, we can now properly iterate through BEMs

This commit is contained in:
Michael Becker 2024-01-06 15:49:48 -05:00
parent c561422292
commit 852a2e7f2b
75 changed files with 1854 additions and 444 deletions

View File

@ -64,6 +64,54 @@ class YAMLLibraryParser (LibraryParser):
self.apply_template(elem, template, instanceId) self.apply_template(elem, template, instanceId)
def assign_relationship_value(self, instanceId, rel, rel_iid, relationshipValue):
if (isinstance(relationshipValue, str)):
# single instance, this should be a GUID or entityref
# we should only need to refer to existing instance in this case
relationshipValueInst = Guid(self.manager.expand_entity_references(relationshipValue))
if "instance" in rel:
self.manager.assign_relationship(instanceId, Guid(self.manager.expand_entity_references(rel["instance"])), relationshipValueInst)
else:
print("no relationship instance specified for relationship sugar")
else:
# dynamically created instance
#FIXME: this 'instance' isn't always the tag name, this can be subject to customTagName as well!and should be processed accordingly
(relinst_key, relinst_iid) = self.find_custom_tag_name(relationshipValue)
if relinst_key is not None:
# for example, 'relinst_key' is 'elementContent' and 'relinst_iid' is '{8ECA14A4...}'
if rel_iid is not None:
print("found customTagName '" + str(relinst_key) + "' with value '" + str(relinst_iid.get_value()) + "'")
# relval = Guid(self.manager.expand_entity_references(elem[customTagName]))
# we need to create the new instance and assign relationship
self.manager.assign_relationship(instanceId, rel_iid, relinst_iid)
else:
if "globalIdentifier" in relationshipValue:
globalIdentifier = Guid(relationshipValue["globalIdentifier"])
else:
globalIdentifier = Guid.create()
print("creating new instance for relationship '%s' with globalid '%s'" % (rel_iid, globalIdentifier.get_value()))
if "customTagNameCreatesInstanceOf" in rel:
createsInstanceOf = Guid(self.manager.expand_entity_references(rel["customTagNameCreatesInstanceOf"]))
# create the new instance
self.manager.add_instance(createsInstanceOf, globalIdentifier, None, None)
# assign relationships
self.manager.assign_relationship(instanceId, rel_iid, globalIdentifier)
# self.manager.assign_relationship(globalIdentifier, relationshipInstanceId, instanceId)
# FIXME: apply relationships from the parent class template
if createsInstanceOf.get_value() in self.templates:
print("applying template for createsInstanceOf '%s'" % (createsInstanceOf.get_value()))
createsInstanceOfTemplate = self.templates[createsInstanceOf.get_value()]
self.apply_template(relationshipValue, createsInstanceOfTemplate, globalIdentifier)
else:
print("no template registered for createsInstanceOf '%s'" % (createsInstanceOf.get_value()))
def apply_template(self, elem, template, instanceId): def apply_template(self, elem, template, instanceId):
if "value" in elem: if "value" in elem:
@ -94,61 +142,16 @@ class YAMLLibraryParser (LibraryParser):
customTagName = rel["customTagName"] customTagName = rel["customTagName"]
if customTagName in elem: if customTagName in elem:
relationshipValue = elem[customTagName] relationshipValue = elem[customTagName]
if relationshipValue is None:
continue
if isinstance(relationshipValue, list): if isinstance(relationshipValue, list):
# multiple instances # multiple instances
for v in relationshipValue: for v in relationshipValue:
#FIXME: this 'instance' isn't always the tag name, this can be subject to customTagName as well!and should be processed accordingly self.assign_relationship_value(instanceId, rel, Guid(self.manager.expand_entity_references(rel_iid)), v)
(relinst_key, relinst_iid) = self.find_custom_tag_name(v)
if relinst_key is not None:
# for example, 'relinst_key' is 'elementContent' and 'relinst_iid' is '{8ECA14A4...}'
if rel_iid is not None:
print("found customTagName '" + str(relinst_key) + "' with value '" + str(relinst_iid.get_value()) + "'")
# relval = Guid(self.manager.expand_entity_references(elem[customTagName]))
# we need to create the new instance and assign relationship
self.manager.assign_relationship(instanceId, Guid(self.manager.expand_entity_references(rel_iid)), relinst_iid)
else:
print("HELLO!!! NO RELATIONSHIP SUGAR!!! CREATE THE INSTANCE!!!")
else: else:
self.assign_relationship_value(instanceId, rel, Guid(self.manager.expand_entity_references(rel_iid)), relationshipValue)
if (isinstance(relationshipValue, str)):
# single instance, this should be a GUID or entityref
# we should only need to refer to existing instance in this case
relationshipValueInst = Guid(self.manager.expand_entity_references(relationshipValue))
if "instance" in rel:
self.manager.assign_relationship(instanceId, Guid(self.manager.expand_entity_references(rel["instance"])), relationshipValueInst)
else:
print("no relationship instance specified for relationship sugar")
else:
# dynamically created instance
if "globalIdentifier" in relationshipValue:
globalIdentifier = relationshipValue["globalIdentifier"]
else:
globalIdentifier = Guid.create()
print("creating new instance for relationship '%s' with globalid '%s'" % (rel_iid, globalIdentifier.get_value()))
if "customTagNameCreatesInstanceOf" in rel:
createsInstanceOf = Guid(self.manager.expand_entity_references(rel["customTagNameCreatesInstanceOf"]))
# create the new instance
self.manager.add_instance(createsInstanceOf, globalIdentifier, None, None)
# assign relationships
self.manager.assign_relationship(instanceId, Guid(self.manager.expand_entity_references(rel_iid)), globalIdentifier)
# self.manager.assign_relationship(globalIdentifier, relationshipInstanceId, instanceId)
# FIXME: apply relationships from the parent class template
if createsInstanceOf.get_value() in self.templates:
print("applying template for createsInstanceOf '%s'" % (createsInstanceOf.get_value()))
createsInstanceOfTemplate = self.templates[createsInstanceOf.get_value()]
self.apply_template(relationshipValue, createsInstanceOfTemplate, globalIdentifier)
else:
print("no template registered for createsInstanceOf '%s'" % (createsInstanceOf.get_value()))
def get_instance_sugar_for_elem(self, elem): def get_instance_sugar_for_elem(self, elem):
if "instance" in elem: if "instance" in elem:
@ -219,7 +222,8 @@ class YAMLLibraryParser (LibraryParser):
creatorKey = None creatorKey = None
if "instance" in elem: if "instance" in elem:
if "templateOnly" in elem and elem["templateOnly"] == True: if "templateOnly" in elem and elem["templateOnly"] == True:
instanceId = None # instanceId = None
instanceId = Guid(self.manager.expand_entity_references(elem["instance"]))
else: else:
instanceId = Guid(self.manager.expand_entity_references(elem["instance"])) instanceId = Guid(self.manager.expand_entity_references(elem["instance"]))
@ -240,6 +244,7 @@ class YAMLLibraryParser (LibraryParser):
if classId is None and instanceId is not None: if classId is None and instanceId is not None:
classId = instanceId # HACK HACK classId = instanceId # HACK HACK
print("WARNING: class hack used for instanceId " + instanceId.get_value())
if instanceId is not None: if instanceId is not None:
self.manager.add_instance(classId, instanceId, classIndex, index) self.manager.add_instance(classId, instanceId, classIndex, index)

View File

@ -62,4 +62,6 @@
- IDA_AllowAny: '{af02b1d7-b261-4eaf-9f99-37356c74e237}' - IDA_AllowAny: '{af02b1d7-b261-4eaf-9f99-37356c74e237}'
- IDA_UserNameOrPasswordIncorrectMessage: '{7a63f087-f47c-4b49-9043-94d6d59ac6c4}' - IDA_UserNameOrPasswordIncorrectMessage: '{7a63f087-f47c-4b49-9043-94d6d59ac6c4}'
- IDA_LoginPageInstructions: '{dc11f905-335d-4e9b-8f03-55551a184dc3}' - IDA_LoginPageInstructions: '{dc11f905-335d-4e9b-8f03-55551a184dc3}'
- IDA_OpenInNewWindow: '{4a211f11-c5c3-4b58-a7f4-ed62538c5a3d}' - IDA_OpenInNewWindow: '{4a211f11-c5c3-4b58-a7f4-ed62538c5a3d}'
- IDA_LongRunning: '{c03aa999-83bc-49db-a27e-70fee477b9fb}'
- IDA_SuppressRIHints: '{43328aec-6a5d-4955-8d04-a96dcf98ab02}'

View File

@ -50,6 +50,7 @@
- IDR_Class__instance_labeled_by__String: "{F52FC851-D655-48A9-B526-C5FE0D7A29D2}" - IDR_Class__instance_labeled_by__String: "{F52FC851-D655-48A9-B526-C5FE0D7A29D2}"
- IDR_Class__has_summary__Report_Field: "{D11050AD-7376-4AB7-84DE-E8D0336B74D2}" - IDR_Class__has_summary__Report_Field: "{D11050AD-7376-4AB7-84DE-E8D0336B74D2}"
- IDR_Class__has_related__Task: "{4D8670E1-2AF1-4E7C-9C87-C910BD7B319B}" - IDR_Class__has_related__Task: "{4D8670E1-2AF1-4E7C-9C87-C910BD7B319B}"
- IDR_Task__related_for__Class: "{F6D05235-AAA8-4DC0-8D3A-A0F336B39F01}"
- IDR_Report_Object__has__Report_Field: "{0af62656-42bc-40a5-b0bc-dbba67c347f6}" - IDR_Report_Object__has__Report_Field: "{0af62656-42bc-40a5-b0bc-dbba67c347f6}"
- IDR_Report_Field__for__Report_Object: "{b46c8caa-3f46-465f-ba11-7d6f385425a2}" - IDR_Report_Field__for__Report_Object: "{b46c8caa-3f46-465f-ba11-7d6f385425a2}"
@ -108,7 +109,10 @@
- IDR_Get_Referenced_Attribute_Method__has__Attribute: "{87f90fe9-5ec6-4b09-8f51-b8a4d1544cae}" - IDR_Get_Referenced_Attribute_Method__has__Attribute: "{87f90fe9-5ec6-4b09-8f51-b8a4d1544cae}"
- IDR_Get_Referenced_Attribute_Method__loop_on__Instance_Set: "{c7ecd498-6d05-4e07-b1bc-f7127d0d6666}" - IDR_Get_Referenced_Attribute_Method__loop_on__Instance_Set: "{c7ecd498-6d05-4e07-b1bc-f7127d0d6666}"
- IDR_Get_Specific_Instances_Method__has__Instance: "{dea1aa0b-2bef-4bac-b4f9-0ce8cf7006fc}" - IDR_Get_Specified_Instances_Method__returns__Work_Set: "{27796f3d-0cbd-42c5-a840-791d3af6c16d}"
- IDR_Work_Set__returned_by__Get_Specified_Instances_Method: "{3a0080c7-7061-42a4-9814-cd3f6efaaa16}"
- IDR_Get_Specified_Instances_Method__uses__Instance: "{dea1aa0b-2bef-4bac-b4f9-0ce8cf7006fc}"
- IDR_Instance__used_by__Get_Specified_Instances_Method: "{13978b33-dd35-4d96-9414-4cb929b549e9}"
- IDR_Evaluate_Boolean_Expression_Method__has_source_attribute__Method: "{45d76d56-01ed-4641-9f68-cfe0c7d0d265}" - IDR_Evaluate_Boolean_Expression_Method__has_source_attribute__Method: "{45d76d56-01ed-4641-9f68-cfe0c7d0d265}"
- IDR_Evaluate_Boolean_Expression_Method__equal_to_attribute__Method: "{0646df91-7e3e-4d59-be71-b978a22ced8e}" - IDR_Evaluate_Boolean_Expression_Method__equal_to_attribute__Method: "{0646df91-7e3e-4d59-be71-b978a22ced8e}"
@ -352,4 +356,11 @@
- IDR_Assign_Attribute_Method__assigns__Attribute: '{74061875-8a27-403b-9456-02e52cfd13b2}' - IDR_Assign_Attribute_Method__assigns__Attribute: '{74061875-8a27-403b-9456-02e52cfd13b2}'
- IDR_Attribute__assigned_by__Assign_Attribute_Method: '{d3b540e8-0f52-4595-bf52-1968637da59a}' - IDR_Attribute__assigned_by__Assign_Attribute_Method: '{d3b540e8-0f52-4595-bf52-1968637da59a}'
- IDR_BEM_Process__uses_loop__Executable_returning_Instance_Set: '{0fb2b538-eacb-418a-b7d8-43a584b85952}'
- IDR_Executable_returning_Instance_Set__loop_used_by__BEM_Process: '{903e0a4b-f93b-420c-a11d-f34be76d0479}'
- IDR_Build_Element_Method__has__BEM_Process: '{6f1811b0-4e58-4e66-8318-083b62aac5de}'
- IDR_BEM_Process__for__Build_Element_Method: '{da991add-0a67-428c-9568-efba5633c91a}'
- IDR_Build_Element_Method__returns__Element: '{4d13d021-7363-4131-b74a-241698c3f1d0}'
- IDR_Element__returned_by__Build_Element_Method: '{ae6a82f0-950b-44c0-a1e6-53d8a7e9e46d}'

View File

@ -35,7 +35,7 @@
- IDC_GetReferencedElementMethod: "{7b46b5d7-0130-44c9-9c7a-89e693369cc7}" # 1$197 - IDC_GetReferencedElementMethod: "{7b46b5d7-0130-44c9-9c7a-89e693369cc7}" # 1$197
- IDC_GetRelationshipMethod: "{d53c9232-89ef-4cca-8520-261da6787450}" # 1$207 - IDC_GetRelationshipMethod: "{d53c9232-89ef-4cca-8520-261da6787450}" # 1$207
- IDC_InvokeWebServiceMethod: "{26d9e733-50a0-49f7-9b2c-2142934e3952}" # 1$208 - IDC_InvokeWebServiceMethod: "{26d9e733-50a0-49f7-9b2c-2142934e3952}" # 1$208
- IDC_GetInstancesMethod: '{0a379314-9d0f-432d-ae59-63194ab32dd3}' # 1$393
- IDC_InstanceOpMethod: "{4c814982-938f-4116-bdc1-827bae6a5f71}" - IDC_InstanceOpMethod: "{4c814982-938f-4116-bdc1-827bae6a5f71}"
- IDC_ConditionalSelectAttributeMethod: "{d534a369-321e-4c32-bd7f-8ff2017f191e}" # 1$13038 - IDC_ConditionalSelectAttributeMethod: "{d534a369-321e-4c32-bd7f-8ff2017f191e}" # 1$13038
- IDC_ConditionalSelectFromInstanceSetMethod: "{ffea8e52-06e5-4e95-8c40-da3ba54ce95f}" # 1$13039 - IDC_ConditionalSelectFromInstanceSetMethod: "{ffea8e52-06e5-4e95-8c40-da3ba54ce95f}" # 1$13039

View File

@ -1,6 +1,10 @@
- entityDefinitions: - entityDefinitions:
- IDI_Task_ViewElement: '{64e9c8f6-c3d7-4915-98c8-83b91c211a8d}'
- IDI_Task_ViewElementContent: '{9c90e09a-2efc-4ebd-92e6-c0767ac3fbfd}' - IDI_Task_ViewElementContent: '{9c90e09a-2efc-4ebd-92e6-c0767ac3fbfd}'
- IDI_Task_ViewClass: '{cd9366be-08d7-4b32-8963-3c42753fa8d9}' - IDI_Task_ViewClass: '{cd9366be-08d7-4b32-8963-3c42753fa8d9}'
#- IDC_SequenceTask: "{74c26737-000e-4bda-a1af-ad6d59bcc4b2}" #- IDC_SequenceTask: "{74c26737-000e-4bda-a1af-ad6d59bcc4b2}"
#- IDC_ConvenienceTask: "{8a9fb632-6d04-49ff-8271-1f41dce1f254}" #- IDC_ConvenienceTask: "{8a9fb632-6d04-49ff-8271-1f41dce1f254}"
- IDI_SequenceTask_TestMethodBinding: '{3e55af17-00a9-418d-ae6f-7e52ec11148e}' - IDI_SequenceTask_TestMethodBinding: '{3e55af17-00a9-418d-ae6f-7e52ec11148e}'
- IDI_Task_ShowDefinitionInCodeEditor: '{4f8a0e8e-e139-4cc6-b8cf-a32e67bd192d}'
- IDI_Task_DeleteInstance: '{276c5933-89a9-4a22-8fe3-cd9fda5377a8}'
- IDI_Task_ViewIntegrationIDs: '{8a2a0ef3-a145-4026-9c55-4d0133eff929}'

View File

@ -3,4 +3,7 @@
- IDE_LoginPageSubedit: '{2b7d4481-b7c2-4e26-a917-e3ff7c367a8a}' - IDE_LoginPageSubedit: '{2b7d4481-b7c2-4e26-a917-e3ff7c367a8a}'
- IDE_HomePage: '{3c1f92a5-09a0-4b52-9269-46c386b0c905}' - IDE_HomePage: '{3c1f92a5-09a0-4b52-9269-46c386b0c905}'
- IDE_ViewElementContent: '{e68bb6c4-29eb-4c77-908a-1b3793c952bc}' - IDE_ViewElementContent: '{e68bb6c4-29eb-4c77-908a-1b3793c952bc}'
- IDE_ViewElementContent_Summary: '{a639e587-f8a5-4503-afb6-08e98cb40a09}' - IDE_ViewElementContent_Summary: '{a639e587-f8a5-4503-afb6-08e98cb40a09}'
- IDE_ViewElement: '{f39280f4-a62a-4fb3-9f58-3a4abe57cee9}'
- IDE_ElementStart: '{3abffca7-b904-4988-9583-cf7f4fc4146e}'

View File

@ -4,3 +4,6 @@
- IDI_TaskCategory_Instance: '{5303969f-dafc-4c1f-916c-f1079c3b19b5}' - IDI_TaskCategory_Instance: '{5303969f-dafc-4c1f-916c-f1079c3b19b5}'
- IDI_TaskCategory_MethodBinding: '{871cec9e-faf3-4996-b873-57e78c988b11}' - IDI_TaskCategory_MethodBinding: '{871cec9e-faf3-4996-b873-57e78c988b11}'
- IDI_TaskCategory_ReturnedWorkData: '{57443af8-65f2-4e9b-97c7-f36a4b635760}' - IDI_TaskCategory_ReturnedWorkData: '{57443af8-65f2-4e9b-97c7-f36a4b635760}'
- IDI_TaskCategory_Debugging: '{8f6e81be-9663-4226-85c3-253588126ea2}'
- IDI_TaskCategory_IntegrationIDs: '{79449821-89d6-4f83-b3dd-0e780b0a9fef}'
- IDI_TaskCategory_Element: '{7ac1d803-7007-4b3d-b06e-886d62f758c9}'

View File

@ -12,6 +12,8 @@
customTagName: 'inherits' customTagName: 'inherits'
- instance: '&IDR_Class__has_default__Task;' - instance: '&IDR_Class__has_default__Task;'
customTagName: 'defaultTask' customTagName: 'defaultTask'
- instance: '&IDR_Class__has_related__Task;'
customTagName: 'relatedTasks'
translations: translations:
- relationship: '&IDR_Class__has_title__Translation;' - relationship: '&IDR_Class__has_title__Translation;'
values: values:
@ -22,3 +24,5 @@
name: Class name: Class
index: 1 index: 1
defaultTask: '&IDI_Task_ViewClass;' defaultTask: '&IDI_Task_ViewClass;'
relatedTasks:
- instance: '&IDI_Task_ViewClass;'

View File

@ -267,4 +267,20 @@
type: 'for' type: 'for'
destinationClassId: '&IDC_Task;' destinationClassId: '&IDC_Task;'
siblingRelationshipId: '&IDR_Task__has__Task_Category;' siblingRelationshipId: '&IDR_Task__has__Task_Category;'
singular: no
- relationship: '&IDR_Class__has_related__Task;'
index: 7948 # was: Related Menu Item.uses object of Class
sourceClassId: '&IDC_Class;'
type: 'has related'
destinationClassId: '&IDC_Task;'
siblingRelationshipId: '&IDR_Task__related_for__Class;'
singular: no
- relationship: '&IDR_Task__related_for__Class;'
index: 7949 # was: Related Menu Item.for UI Task
sourceClassId: '&IDC_Task;'
type: 'related for'
destinationClassId: '&IDC_Class;'
siblingRelationshipId: '&IDR_Class__has_related__Task;'
singular: no singular: no

View File

@ -35,6 +35,9 @@
- textAttribute: '&IDA_Comment;' - textAttribute: '&IDA_Comment;'
name: Comment name: Comment
index: 6 index: 6
- textAttribute: '&IDA_Order;'
name: 'Order'
index: 7
- textAttribute: '&IDA_RelationshipType;' - textAttribute: '&IDA_RelationshipType;'
name: 'Relationship Type' name: 'Relationship Type'
index: 8 index: 8

View File

@ -59,6 +59,9 @@
- instance: '&IDA_UseAnyCondition;' - instance: '&IDA_UseAnyCondition;'
name: Use Any Condition name: Use Any Condition
index: 18 index: 18
- instance: '&IDA_LongRunning;'
name: Long Running
index: 19
- instance: '&IDA_IncludeMIs;' - instance: '&IDA_IncludeMIs;'
name: Include MIs name: Include MIs
index: 20 index: 20
@ -69,6 +72,9 @@
name: Allow Any name: Allow Any
index: 22 index: 22
- instance: '&IDA_OpenInNewWindow;' - instance: '&IDA_OpenInNewWindow;'
name: Open in New Winow name: Open in New Window
index: 23 index: 23
- instance: '&IDA_SuppressRIHints;'
name: Suppress RI Hints
index: 24

View File

@ -5,6 +5,9 @@
name: Element name: Element
index: 6 index: 6
customTagName: 'element' customTagName: 'element'
defaultTask: '&IDI_Task_ViewElement;'
relatedTasks:
- instance: '&IDI_Task_ViewElement;'
attributes: attributes:
- instance: '&IDA_Name;' - instance: '&IDA_Name;'
customTagName: 'name' customTagName: 'name'
@ -13,6 +16,7 @@
relationships: relationships:
- instance: '&IDR_Element__has__Element_Content;' - instance: '&IDR_Element__has__Element_Content;'
customTagName: 'elementContents' customTagName: 'elementContents'
customTagNameCreatesInstanceOf: '&IDC_ElementContent;'
- instance: '&IDR_Element__processed_by__Process_Related_Updates_Method;' - instance: '&IDR_Element__processed_by__Process_Related_Updates_Method;'
customTagName: 'processedByPRUMethod' customTagName: 'processedByPRUMethod'
instances: instances:

View File

@ -4,15 +4,35 @@
- class: '&IDC_BEMProcess;' - class: '&IDC_BEMProcess;'
name: BEM Process name: BEM Process
index: 16 index: 16
customTagName: 'bemProcess'
registerForTemplate: yes
translations: translations:
- relationship: '&IDR_Class__has_title__Translation;' - relationship: '&IDR_Class__has_title__Translation;'
values: values:
- languageInstanceId: '&IDI_Language_English;' - languageInstanceId: '&IDI_Language_English;'
value: 'BEM Process' value: 'BEM Process'
relationships:
- instance: '&IDR_BEM_Process__uses_loop__Executable_returning_Instance_Set;'
customTagName: 'loopExecutableReturningInstanceSet'
instances: - bemProcess: '&IDBEM_1;'
- instance: '&IDBEM_1;'
- relationship: '&IDR_BEM_Process__uses_loop__Executable_returning_Instance_Set;'
index: 44
sourceClassId: '&IDC_BEMProcess;'
type: 'uses loop'
destinationClassId: '&IDC_ExecutableReturningInstanceSet;'
siblingRelationshipId: '&IDR_Executable_returning_Instance_Set__loop_used_by__BEM_Process;'
singular: yes
- relationship: '&IDR_Executable_returning_Instance_Set__loop_used_by__BEM_Process;'
index: 45
sourceClassId: '&IDC_ExecutableReturningInstanceSet;'
type: 'loop used by'
destinationClassId: '&IDC_BEMProcess;'
siblingRelationshipId: '&IDR_BEM_Process__uses_loop__Executable_returning_Instance_Set;'
singular: no
- relationship: '&IDR_Element_Content__built_from__BEM_Process;' - relationship: '&IDR_Element_Content__built_from__BEM_Process;'
index: 105 index: 105

View File

@ -0,0 +1,20 @@
---
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_Instance;'
name: Instance
index: 17
translations:
- relationship: '&IDR_Class__has_title__Translation;'
values:
- languageInstanceId: '&IDI_Language_English;'
value: 'Instance'
relatedTasks:
# !FIXME: there should be a better way to do this, like specifying an Instance Set
# ! containing multiple related tasks that can be reused across different class definitions
- instance: '&IDI_Task_ShowDefinitionInCodeEditor;'
- instance: '&IDI_Task_DeleteInstance;'
- instance: '&IDI_Task_ViewIntegrationIDs;'
- instance: '{42bdbbc9-214f-4d81-b91f-36a177e5087b}'
- instance: '{643a3780-250b-4575-be50-50dc346137c0}'
- instance: '{5aafc3a1-8490-4860-866d-717a4c2c77e2}'

View File

@ -0,0 +1,51 @@
---
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_BuildElementMethod;'
inherits: '&IDC_Method;'
name: BEM - Build Element Method
index: 29
customTagName: buildElementMethod
attributes:
- instance: '&IDA_Verb;'
customTagName: 'verb'
- instance: '&IDA_Name;'
customTagName: 'name'
relationships:
- instance: '&IDR_Build_Element_Method__has__BEM_Process;'
customTagName: 'hasBemProcess'
customTagNameCreatesInstanceOf: '&IDC_BEMProcess;'
- instance: '&IDR_Build_Element_Method__returns__Element;'
customTagName: 'returnsElement'
- relationship: '&IDR_Build_Element_Method__has__BEM_Process;'
index: 52
sourceClassId: '&IDC_BuildElementMethod;'
type: 'returns'
destinationClassId: '&IDC_BEMProcess;'
siblingRelationshipId: '&IDR_BEM_Process__for__Build_Element_Method;'
singular: yes
- relationship: '&IDR_BEM_Process__for__Build_Element_Method;'
index: 53
sourceClassId: '&IDC_BEMProcess;'
type: 'for'
destinationClassId: '&IDC_BuildElementMethod;'
siblingRelationshipId: '&IDR_Build_Element_Method__has__BEM_Process;'
singular: no
- relationship: '&IDR_Build_Element_Method__returns__Element;'
index: 54
sourceClassId: '&IDC_BuildAttributeMethod;'
type: 'returns'
destinationClassId: '&IDC_BuildElementMethod;'
siblingRelationshipId: '&IDR_Element__returned_by__Build_Element_Method;'
singular: no
- relationship: '&IDR_Element__returned_by__Build_Element_Method;'
index: 55
sourceClassId: '&IDC_Element;'
type: 'returned by'
destinationClassId: '&IDC_BuildElementMethod;'
siblingRelationshipId: '&IDR_Build_Element_Method__returns__Element;'
singular: no

View File

@ -0,0 +1,44 @@
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_GetSpecifiedInstancesMethod;'
name: GSI - Get Specified Instances Method
index: 40
inherits: '&IDC_Method;'
customTagName: getSpecifiedInstancesMethod
relationships:
- instance: '&IDR_Get_Specified_Instances_Method__returns__Work_Set;'
customTagName: 'returnsWorkSet'
- instance: '&IDR_Get_Specified_Instances_Method__uses__Instance;'
customTagName: 'selectsInstances'
- relationship: '&IDR_Get_Specified_Instances_Method__returns__Work_Set;'
index: 74
sourceClassId: '&IDC_GetSpecifiedInstancesMethod;'
type: 'returns'
destinationClassId: '&IDC_WorkSet;'
siblingRelationshipId: '&IDR_Work_Set__returned_by__Get_Specified_Instances_Method;'
singular: yes
- relationship: '&IDR_Work_Set__returned_by__Get_Specified_Instances_Method;'
index: 75
sourceClassId: '&IDC_WorkSet;'
type: 'returned by'
destinationClassId: '&IDC_GetSpecifiedInstancesMethod;'
siblingRelationshipId: '&IDR_Get_Specified_Instances_Method__returns__Work_Set;'
singular: no
- relationship: '&IDR_Get_Specified_Instances_Method__uses__Instance;'
index: 76
sourceClassId: '&IDC_GetSpecifiedInstancesMethod;'
type: 'uses'
destinationClassId: '&IDC_Instance;'
siblingRelationshipId: '&IDR_Instance__used_by__Get_Specified_Instances_Method;'
singular: yes
- relationship: '&IDR_Instance__used_by__Get_Specified_Instances_Method;'
index: 77
sourceClassId: '&IDC_Instance;'
type: 'used by'
destinationClassId: '&IDC_GetSpecifiedInstancesMethod;'
siblingRelationshipId: '&IDR_Get_Specified_Instances_Method__uses__Instance;'
singular: no

View File

@ -38,6 +38,7 @@
name: Element Content name: Element Content
index: 56 index: 56
customTagName: 'elementContent' customTagName: 'elementContent'
registerForTemplate: yes
defaultTask: '&IDI_Task_ViewElementContent;' defaultTask: '&IDI_Task_ViewElementContent;'
attributes: attributes:
- instance: '&IDA_Order;' - instance: '&IDA_Order;'
@ -53,6 +54,8 @@
customTagName: 'layout' customTagName: 'layout'
- instance: '&IDR_Element_Content__built_from__BEM_Process;' - instance: '&IDR_Element_Content__built_from__BEM_Process;'
customTagName: 'builtFromBEMProcess' customTagName: 'builtFromBEMProcess'
- instance: '&IDR_Derived_Element_Content__update_with__Executable_returning_Work_Data;'
customTagName: 'value'
instances: instances:
- instance: '&IDI_Element_AddMetadataInstance;' - instance: '&IDI_Element_AddMetadataInstance;'
name: add metadata instance name: add metadata instance
@ -71,4 +74,19 @@
type: 'for' type: 'for'
destinationClassId: '&IDC_ElementContent;' destinationClassId: '&IDC_ElementContent;'
siblingRelationshipId: '&IDR_Element_Content__has__Element_Content_Display_Option;' siblingRelationshipId: '&IDR_Element_Content__has__Element_Content_Display_Option;'
singular: no
- relationship: '&IDR_Derived_Element_Content__update_with__Executable_returning_Work_Data;'
index: 2165
sourceClassId: '&IDC_ElementContent;'
type: 'update with'
destinationClassId: '&IDC_ExecutableReturningWorkData;'
siblingRelationshipId: '&IDR_Executable_returning_Work_Data__used_by__Derived_Element_Content;'
singular: no
- relationship: '&IDR_Executable_returning_Work_Data__used_by__Derived_Element_Content;'
index: 2166
sourceClassId: '&IDC_ExecutableReturningWorkData;'
type: 'used by'
destinationClassId: '&IDC_ElementContent;'
siblingRelationshipId: '&IDR_Derived_Element_Content__update_with__Executable_returning_Work_Data;'
singular: no singular: no

View File

@ -0,0 +1,51 @@
---
- entityDefinitions:
- IDR_Get_Instances_Method__returns__Work_Set: '{7d0f93b1-8c93-464e-a44d-d674f910b589}'
- IDR_Work_Set__returned_by__Get_Instances_Method: '{6a5873ac-13f8-4688-96ac-3d43403dc291}'
- IDR_Get_Instances_Method__selects_instances_of__Class: '{c0b85d90-de8c-44c2-9420-c5e724ccdf2c}'
- IDR_Class__instances_selected_by__Get_Instances_Method: '{7a20a467-fdb3-4932-8372-f93f0fc8f77f}'
- library: '&IDL_MochaBaseSystem;'
instances:
- class: '&IDC_GetInstancesMethod;'
inherits: '&IDC_Method;'
name: GI - Get Instances Method
index: 393
customTagName: getInstancesMethod
relationships:
- instance: '&IDR_Get_Instances_Method__returns__Work_Set;'
customTagName: 'returnsWorkSet'
- instance: '&IDR_Get_Instances_Method__selects_instances_of__Class;'
customTagName: 'selectsInstancesOfClass'
- relationship: '&IDR_Get_Instances_Method__returns__Work_Set;'
index: 915
sourceClassId: '&IDC_GetInstancesMethod;'
type: 'returns'
destinationClassId: '&IDC_WorkSet;'
siblingRelationshipId: '&IDR_Work_Set__returned_by__Get_Instances_Method;'
singular: yes
- relationship: '&IDR_Work_Set__returned_by__Get_Instances_Method;'
index: 916
sourceClassId: '&IDC_WorkSet;'
type: 'returned by'
destinationClassId: '&IDC_GetInstancesMethod;'
siblingRelationshipId: '&IDR_Get_Instances_Method__returns__Work_Set;'
singular: no
- relationship: '&IDR_Get_Instances_Method__selects_instances_of__Class;'
index: 918
sourceClassId: '&IDC_GetInstancesMethod;'
type: 'selects instances of'
destinationClassId: '&IDC_Class;'
siblingRelationshipId: '&IDR_Class__instances_selected_by__Get_Instances_Method;'
singular: yes
- relationship: '&IDR_Class__instances_selected_by__Get_Instances_Method;'
index: 920
sourceClassId: '&IDC_Class;'
type: 'instances selected by'
destinationClassId: '&IDC_GetInstancesMethod;'
siblingRelationshipId: '&IDR_Get_Instances_Method__selects_instances_of__Class;'
singular: no

View File

@ -7,3 +7,23 @@
relationships: relationships:
- instance: '&IDR_Task__related_action_for__Instance;' - instance: '&IDR_Task__related_action_for__Instance;'
customTagName: relatedActionForInstanceId customTagName: relatedActionForInstanceId
# BUIR - Build UI Response Method.uses Executable returning Element
# the BUIR is referenced via a Build Response Method Binding [BRMB] on the CT
# the CT is in turn referenced by the Task
- relationship: '&IDR_Task__has_initiating__Element;'
index: 89
sourceClassId: '&IDC_Task;'
type: 'has initiating'
destinationClassId: '&IDC_Element;'
siblingRelationshipId: '&IDR_Element__initiates_for__Task;'
singular: yes
- relationship: '&IDR_Element__initiates_for__Task;'
index: 90
sourceClassId: '&IDC_Element;'
type: 'initiates for'
destinationClassId: '&IDC_Task;'
siblingRelationshipId: '&IDR_Task__has_initiating__Element;'
singular: no

View File

@ -10,10 +10,9 @@
customTagName: 'name' customTagName: 'name'
- instance: '&IDA_ClassName;' - instance: '&IDA_ClassName;'
customTagName: 'className' customTagName: 'className'
relationships:
- hardcodedTask: '&IDI_Task_ViewClass;' - instance: '&IDR_Task__has__Task_Category;'
name: 'View Class' customTagName: 'taskCategory'
className: 'Mocha\\UI\\Tasks\\ViewClass'
- hardcodedTask: '&IDI_Task_ViewElementContent;' - hardcodedTask: '&IDI_Task_ViewElementContent;'
name: 'View Element Content' name: 'View Element Content'

View File

@ -7,6 +7,8 @@
superclasses: superclasses:
- '&IDC_Task;' - '&IDC_Task;'
attributes: attributes:
- instance: '&IDA_Name;' #!FIXME: inherit from class 'inherits' attribute
customTagName: 'name'
- instance: '&IDA_Schedulable' - instance: '&IDA_Schedulable'
customTagName: schedulable customTagName: schedulable
- instance: '&IDA_LongRunning;' - instance: '&IDA_LongRunning;'
@ -19,4 +21,24 @@
relationships: relationships:
- instance: '&IDR_Task__has_initiating__Element;' - instance: '&IDR_Task__has_initiating__Element;'
customTagName: initiatingElementId customTagName: initiatingElementId
- instance: '&IDR_Task__has__Task_Category;'
customTagName: taskCategory
- sequenceTask: '&IDI_Task_ViewElement;'
name: 'View Element'
schedulable: no
longRunning: no
suppressRIHints: no
stepName: View Element
showSpreadsheetButonOnSelection: no
taskCategory: '&IDI_TaskCategory_Element;'
initiatingElementId: '&IDE_ElementStart;'
- element: '&IDE_ElementStart;'
name: 'Element Start'
elementContents:
- elementContent: '{2b534e53-b0ef-429d-b9a4-4eba9e36a455}'
defaultDataType: '&IDC_Element;'
order: a
- elementContent: '{3dd3c7f6-9da6-48bc-8fe5-a6d03dcd1d9e}'
defaultDataType: '&IDA_Name;'

View File

@ -9,9 +9,9 @@
attributes: attributes:
- instance: '&IDA_Name;' - instance: '&IDA_Name;'
customTagName: name customTagName: name
- instance: '&IDA_OpenInNewWindow' - instance: '&IDA_OpenInNewWindow;'
customTagName: openInNewWindow customTagName: openInNewWindow
- instance: '&IDA_TargetURL' - instance: '&IDA_TargetURL;'
customTagName: targetUrl customTagName: targetUrl
relationships: relationships:

View File

@ -5,7 +5,7 @@
name: Task Category name: Task Category
customTagName: taskCategory customTagName: taskCategory
attributes: attributes:
- instance: '&IDA_Name' - instance: '&IDA_Name;'
customTagName: name customTagName: name
# ents defined in ../000-EntityDefinitions/016-TaskCategories.yaml # ents defined in ../000-EntityDefinitions/016-TaskCategories.yaml
@ -18,4 +18,8 @@
- taskCategory: '&IDI_TaskCategory_MethodBinding;' - taskCategory: '&IDI_TaskCategory_MethodBinding;'
name: 'Method Binding' name: 'Method Binding'
- taskCategory: '&IDI_TaskCategory_ReturnedWorkData;' - taskCategory: '&IDI_TaskCategory_ReturnedWorkData;'
name: 'Returned Work Data' name: 'Returned Work Data'
- taskCategory: '&IDI_TaskCategory_Debugging;'
name: 'Debugging'
- taskCategory: '&IDI_TaskCategory_Element;'
name: 'Element'

View File

@ -18,6 +18,7 @@
module: '&IDI_Module_MochaBaseSystem;' module: '&IDI_Module_MochaBaseSystem;'
elementContents: elementContents:
- instance: '{bce8db21-66e1-4cfb-b398-9f010747c225}' - instance: '{bce8db21-66e1-4cfb-b398-9f010747c225}'
- instance: '{22eb6d52-6ad9-4b6f-8f59-d7c896cae8ac}'
- elementContent: '{bce8db21-66e1-4cfb-b398-9f010747c225}' - elementContent: '{bce8db21-66e1-4cfb-b398-9f010747c225}'
defaultDataType: '&IDR_Element_Content__for__Element;' defaultDataType: '&IDR_Element_Content__for__Element;'
@ -25,3 +26,10 @@
order: a order: a
displayOptions: displayOptions:
- instance: '&IDI_DisplayOption_NotEnterable;' - instance: '&IDI_DisplayOption_NotEnterable;'
- elementContent: '{22eb6d52-6ad9-4b6f-8f59-d7c896cae8ac}'
defaultDataType: '&IDA_Order;'
label: 'Order'
order: b
displayOptions:
- instance: '&IDI_DisplayOption_NotEnterable;'

View File

@ -0,0 +1,44 @@
---
- entityDefinitions:
- IDE_UserList: '{ceccad4f-a1c2-4945-831a-a34ee2c502ea}'
- IDBEM_UserList: '{0c202bb4-6afb-4f34-8a29-55723dc61ae1}'
- IDBEMP_UserList: '{ca4361b5-c336-4c6d-8f44-95487879fca4}'
- IDI_GetInstances_User: '{7415d0de-ec70-4542-8885-f4c6319f08a8}'
- library: '&IDL_MochaBaseSystem;'
instances:
- getInstancesMethod: '&IDI_GetInstances_User;'
returnsWorkSet: null
selectsInstancesOfClass: '&IDC_User;'
- buildElementMethod: '&IDBEM_UserList;'
hasBemProcess: '&IDBEMP_UserList;'
- bemProcess: '&IDBEMP_UserList;'
loopExecutableReturningInstanceSet: '&IDI_GetInstances_User;' # the GSI, below
- element: '&IDE_UserList;'
name: user list
index: 113789
processedByPRUMethod: null
elementContents:
- globalIdentifier: '{ce9eff84-034f-49ab-a976-adff7c402f00}'
order: 'a'
label: 'User'
defaultDataType: '&IDC_User;'
# builtFromBEMProcess: '&IDBEM_1;'
- globalIdentifier: '{f24ec140-7f6c-4efc-920d-076352f257ae}'
order: 'b'
label: 'User Name'
defaultDataType: '&IDA_UserName;'
# builtFromBEMProcess: '&IDBEM_1;'
- globalIdentifier: '{82b0a709-eedc-4af2-9ffa-b91648b6e53f}'
order: 'c'
label: 'Nonce'
defaultDataType: '&IDA_PasswordSalt;'
# builtFromBEMProcess: '&IDBEM_1;'
- globalIdentifier: '{52dadfbd-79d7-409b-9b3e-710c13a7aefc}'
order: 'd'
label: 'SHA-512 Hash'
defaultDataType: '&IDA_PasswordHash;'
# builtFromBEMProcess: '&IDBEM_1;'

View File

@ -7,11 +7,21 @@
processedByPRUMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}' processedByPRUMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}'
elementContents: elementContents:
- instance: '{91b1a767-08ac-47f0-9f30-620de6374d12}' - instance: '{91b1a767-08ac-47f0-9f30-620de6374d12}'
- instance: '{628550d8-673d-4156-8983-447ea2ee6d1b}' - elementContent: '{628550d8-673d-4156-8983-447ea2ee6d1b}'
layout: '&IDI_ButtonLayout_DefaultButtonGroup;'
label: 'Test Method Binding'
value:
- taskId: '{d44b1278-4e29-44f4-b1ca-2e6bde40377e}'
- elementContent: '{dafb235b-ba1a-4b1a-8f9b-84cd987553e4}'
layout: '&IDI_ButtonLayout_DefaultButtonGroup;'
label: 'Edit Class'
value:
- taskId: '{9dbdb202-e9f8-49ca-bbc2-0b63df651246}'
- instance: '{8c69fd8c-28fa-4f3c-a283-5d0006c1027d}' - instance: '{8c69fd8c-28fa-4f3c-a283-5d0006c1027d}'
- instance: '{535b1507-68ed-4981-8cd4-e8e843a24916}' - instance: '{535b1507-68ed-4981-8cd4-e8e843a24916}'
- instance: '{d74123b5-9fde-4c2a-bd28-8cd00ce86734}' - instance: '{d74123b5-9fde-4c2a-bd28-8cd00ce86734}'
- instance: '{d5653b81-a5e2-4f77-92f8-bcbae09f0d71}' - instance: '{d5653b81-a5e2-4f77-92f8-bcbae09f0d71}'
- instance: '{946f14a7-559f-4f6f-ae47-cbcad1523ad5}'
- class: '{cce471d6-5fe7-4202-b678-9fcab20fd864}' - class: '{cce471d6-5fe7-4202-b678-9fcab20fd864}'
name: 'Element Tests Testing Class 1' name: 'Element Tests Testing Class 1'
@ -26,13 +36,42 @@
- ettc: '{98e038eb-ad55-4259-a4c5-8e82c221270c}' - ettc: '{98e038eb-ad55-4259-a4c5-8e82c221270c}'
twml: 'hi world' twml: 'hi world'
rqft: 'test test' rqft: 'test test'
- ettc: '{d1a0e1d2-e380-4056-8c4f-f893c554527f}'
twml: 'second ETTC test'
rqft: 'another value for testing required'
- workSet: '{36af925a-93f5-4cb8-986e-19ac239af253}'
validClasses:
- instance: '{cce471d6-5fe7-4202-b678-9fcab20fd864}' # ETTC 1
- buildElementMethod: '{7a1add0d-1789-430f-95aa-203fe6991fcd}'
hasBemProcess: {
globalIdentifier: '{d1326df7-d897-46de-bad1-4d1e6f85b042}',
loopExecutableReturningInstanceSet: '{ce3a9fcc-f5a1-45a6-9d9f-6e805906bb1f}' # the GSI, below
}
# `Element Tests Testing Class 1@get Instances for Element Tests Testing (GSI)*P*S`
- getSpecifiedInstancesMethod: '{ce3a9fcc-f5a1-45a6-9d9f-6e805906bb1f}'
forClass: '{cce471d6-5fe7-4202-b678-9fcab20fd864}' # ETTC 1
verb: 'get'
name: 'Instances for Element Tests Testing'
returnsWorkSet: '{36af925a-93f5-4cb8-986e-19ac239af253}'
selectsInstances:
- instance: '{98e038eb-ad55-4259-a4c5-8e82c221270c}'
- instance: '{d1a0e1d2-e380-4056-8c4f-f893c554527f}'
- processRelatedUpdatesMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}' - processRelatedUpdatesMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}'
name: 'PRU for Element Tests Class 1' name: 'PRU for Element Tests Class 1'
processesForClass: '{cce471d6-5fe7-4202-b678-9fcab20fd864}' processesForClass: '{cce471d6-5fe7-4202-b678-9fcab20fd864}'
usesExecutableForPUMB: usesExecutableForPUMB:
- instance: '{0063c073-28be-4e81-a9bc-b551a17e75e0}'
- instance: '{d6aea527-d0a8-4070-9332-9101ee14c656}' - instance: '{d6aea527-d0a8-4070-9332-9101ee14c656}'
- assignAttributeMethod: '{0063c073-28be-4e81-a9bc-b551a17e75e0}'
usesExecutableReturningAttribute: '{1a907d6e-b3fd-4f8e-a170-550aeb2faea5}' # EC
assignsAttribute: '{1a907d6e-b3fd-4f8e-a170-550aeb2faea5}' # req field test
- assignAttributeMethod: '{d6aea527-d0a8-4070-9332-9101ee14c656}' - assignAttributeMethod: '{d6aea527-d0a8-4070-9332-9101ee14c656}'
usesExecutableReturningAttribute: '{d53d7283-92a2-4a62-b8f2-cf0a0b975634}' # EC usesExecutableReturningAttribute: '{d53d7283-92a2-4a62-b8f2-cf0a0b975634}' # EC
assignsAttribute: '{d53d7283-92a2-4a62-b8f2-cf0a0b975634}' # req field test assignsAttribute: '{d53d7283-92a2-4a62-b8f2-cf0a0b975634}' # req field test
@ -40,12 +79,6 @@
- buttonLayout: '&IDI_ButtonLayout_DefaultButtonGroup;' - buttonLayout: '&IDI_ButtonLayout_DefaultButtonGroup;'
executesTask: '&IDI_SequenceTask_TestMethodBinding;' executesTask: '&IDI_SequenceTask_TestMethodBinding;'
- elementContent: '{628550d8-673d-4156-8983-447ea2ee6d1b}'
layout: '&IDI_ButtonLayout_DefaultButtonGroup;'
label: 'Test Method Binding'
value:
- taskId: '{d44b1278-4e29-44f4-b1ca-2e6bde40377e}'
- textAttribute: '{1a907d6e-b3fd-4f8e-a170-550aeb2faea5}' - textAttribute: '{1a907d6e-b3fd-4f8e-a170-550aeb2faea5}'
name: 'Test_With_MaxLength_20' name: 'Test_With_MaxLength_20'
maximumLength: 20 maximumLength: 20
@ -102,10 +135,19 @@
index: 113803 index: 113803
#processedByPRUMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}' #processedByPRUMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}'
elementContents: elementContents:
- instance: '{c87a8626-0b3c-4ef2-97b0-f5064f6b09d9}'
- instance: '{482845f5-c9cc-4c7b-ad5b-5aecbce3b086}' - instance: '{482845f5-c9cc-4c7b-ad5b-5aecbce3b086}'
- instance: '{c38d8498-005e-4046-8150-e3def3c091ca}' - instance: '{c38d8498-005e-4046-8150-e3def3c091ca}'
- instance: '{a3032fd2-e149-4b00-b702-17862254adc2}' - instance: '{a3032fd2-e149-4b00-b702-17862254adc2}'
- elementContent: '{c87a8626-0b3c-4ef2-97b0-f5064f6b09d9}'
order: 'a'
label: 'Test Class Again'
defaultDataType: '{cce471d6-5fe7-4202-b678-9fcab20fd864}'
value: '{98e038eb-ad55-4259-a4c5-8e82c221270c}'
#displayOptions:
#- instance: '&IDI_DisplayOption_DoNotShow;'
- elementContent: '{482845f5-c9cc-4c7b-ad5b-5aecbce3b086}' - elementContent: '{482845f5-c9cc-4c7b-ad5b-5aecbce3b086}'
label: 'Not Enterable Again' label: 'Not Enterable Again'
defaultDataType: '{dd33bb2a-1e10-4090-a846-89a225103c07}' defaultDataType: '{dd33bb2a-1e10-4090-a846-89a225103c07}'
@ -128,8 +170,14 @@
order: 'e' order: 'e'
label: 'Test Horizontal EC with Grid Layout' label: 'Test Horizontal EC with Grid Layout'
defaultDataType: '{0f95606c-3653-4e40-af4e-34c501b669af}' defaultDataType: '{0f95606c-3653-4e40-af4e-34c501b669af}'
# builtFromBEMProcess: '&IDBEM_1;' builtFromBEMProcess: '{d1326df7-d897-46de-bad1-4d1e6f85b042}'
# displayOptions: # displayOptions:
# - instance: '&IDI_DisplayOption_Required;' # - instance: '&IDI_DisplayOption_Required;'
parameters:
- instance: '{a8c306ed-9eb6-49c8-a6dc-357617e493d5}' - elementContent: '{946f14a7-559f-4f6f-ae47-cbcad1523ad5}'
order: 'f'
label: 'Users On This SUV'
defaultDataType: '&IDE_UserList;'
builtFromBEMProcess: '&IDBEMP_UserList;'
displayOptions:
- instance: '&IDI_DisplayOption_NotEnterable;'

View File

@ -7,4 +7,5 @@
- sequenceTask: '{9dbdb202-e9f8-49ca-bbc2-0b63df651246}' - sequenceTask: '{9dbdb202-e9f8-49ca-bbc2-0b63df651246}'
name: 'Edit Class' name: 'Edit Class'
relatedTaskParameter: '&IDI_WorkSet_ClassForEditClassTask;' relatedTaskParameter: '&IDI_WorkSet_ClassForEditClassTask;'
taskCategory: '&IDI_TaskCategory_Class;'

View File

@ -0,0 +1,21 @@
- library: '&IDL_MochaBaseSystem;'
instances:
- taskCategory: '&IDI_TaskCategory_IntegrationIDs;'
name: 'Integration IDs'
- sequenceTask: '&IDI_Task_ViewIntegrationIDs;'
name: 'View Integration IDs'
relatedTaskParameter: '&IDI_WorkSet_ClassForEditClassTask;'
taskCategory: '&IDI_TaskCategory_IntegrationIDs;'
- sequenceTask: '{42bdbbc9-214f-4d81-b91f-36a177e5087b}'
name: 'Edit External IDs'
relatedTaskParameter: '&IDI_WorkSet_ClassForEditClassTask;'
taskCategory: '&IDI_TaskCategory_IntegrationIDs;'
- sequenceTask: '{643a3780-250b-4575-be50-50dc346137c0}'
name: 'Edit Reference ID'
relatedTaskParameter: '&IDI_WorkSet_ClassForEditClassTask;'
taskCategory: '&IDI_TaskCategory_IntegrationIDs;'
- sequenceTask: '{5aafc3a1-8490-4860-866d-717a4c2c77e2}'
name: 'Maintain Reference IDs'
relatedTaskParameter: '&IDI_WorkSet_ClassForEditClassTask;'
taskCategory: '&IDI_TaskCategory_IntegrationIDs;'

View File

@ -1,7 +1,12 @@
- library: '&IDL_MochaBaseSystem;' - library: '&IDL_MochaBaseSystem;'
instances: instances:
- redirectTask: '{4f8a0e8e-e139-4cc6-b8cf-a32e67bd192d}' - redirectTask: '&IDI_Task_ShowDefinitionInCodeEditor;'
name: 'ViewInCodeEditor' name: 'Show Definition in Code Editor'
openInNewWindow: yes
taskCategory: '&IDI_TaskCategory_Debugging;'
targetUrl: 'https://localhost:47071/?hi'
- redirectTask: '&IDI_Task_DeleteInstance;'
name: 'Delete Instance'
openInNewWindow: yes openInNewWindow: yes
taskCategory: '&IDI_TaskCategory_Instance;' taskCategory: '&IDI_TaskCategory_Instance;'
targetUrl: 'https://localhost:47071/?hi' targetUrl: 'https://localhost:47071/?hi'

View File

@ -1,5 +1,10 @@
# - library: '&IDL_MochaBaseSystem;' - library: '&IDL_MochaBaseSystem;'
# instances: instances:
- hardcodedTask: '&IDI_Task_ViewClass;'
name: 'View Class'
className: 'Mocha\\UI\\Tasks\\ViewClass'
taskCategory: '&IDI_TaskCategory_Class;'
# - task: '&IDI_Task_ViewClass;' # - task: '&IDI_Task_ViewClass;'
# name: View Class # name: View Class
# module: '&IDI_Module_MochaBaseSystem;' # module: '&IDI_Module_MochaBaseSystem;'

View File

@ -1,95 +1,8 @@
<?php <?php
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Oms\MySQLDatabaseOms;
use Phast\System; use Phast\System;
function mocha_get_oms() require_once("mochacommon.inc.php");
{
global $oms;
if ($oms === null)
{
$oms = new MySQLDatabaseOms(System::GetConfigurationValue("Database.ServerName"), System::GetConfigurationValue("Database.PortNumber"), System::GetConfigurationValue("Database.DatabaseName"), System::GetConfigurationValue("Database.UserName"), System::GetConfigurationValue("Database.Password"));
}
return $oms;
}
function mocha_init_spot_timer($pg)
{
$literalSpotTimer = $pg->GetControlByID("literalSpotTimer");
if (file_exists("/etc/mocha/suvstart"))
{
$suv_start_time = trim(file_get_contents("/etc/mocha/suvstart"));
$suv_start_time_d = new \DateTime($suv_start_time);
$suv_start_time_d->setTimezone(new \DateTimeZone("UTC"));
// this can be adjusted?
$suv_end_time_d = $suv_start_time_d->add(new \DateInterval("PT10H"));
$suv_end_time_d->setTimezone(new \DateTimeZone("UTC"));
$suv_end_time = $suv_end_time_d->format('Y-m-d\TH:i:s\Z');
$suv_current_time_d = new \DateTime();
$interval = $suv_end_time_d->diff($suv_current_time_d);
$literalSpotTimer->Content = $interval->h . ":" . $interval->i;
$spotTimerInitializationScript = $pg->Page->GetControlByID("spotTimerInitializationScript");
$spotTimerInitializationScript->Content = <<<EOT
<script type="text/javascript">
var spot_end_time = new Date('$suv_end_time');
window.datediff = function(earlierDate, laterDate)
{
var interval = { };
var a = earlierDate, b = laterDate;
console.log(earlierDate);
console.log(laterDate);
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
// Discard the time and time-zone information.
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds());
const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate(), b.getHours(), b.getMinutes(), b.getSeconds());
console.log(utc2);
console.log(utc1);
var diffMS = (utc2 - utc1);
console.log(diffMS);
var secs = (diffMS / 1000) % 60;
var mins = (diffMS / (1000 * 60)) % 60;
var hrs = (diffMS / (1000 * 60 * 60)) % 24;
interval =
{
"raw": diffMS,
"seconds": Math.floor(secs),
"minutes": Math.floor(mins),
"hours": Math.floor(hrs)
};
return interval;
};
window.spot_timer_tick = function()
{
var spot_cur_time = new Date();
var diff = datediff(spot_cur_time, spot_end_time);
console.log(diff);
document.getElementById('spot_timer').innerHTML = diff.hours + ':' + diff.minutes.toString().padStart(2, '0');
window.setTimeout(spot_timer_tick, 60000);
};
window.addEventListener("load", function()
{
spot_timer_tick();
});
</script>
EOT;
}
}
System::$BeforeGetTenantNameHandler = function() System::$BeforeGetTenantNameHandler = function()
{ {
@ -129,10 +42,10 @@ function requiresLogin($path)
System::$BeforeLaunchEventHandler = function($path) System::$BeforeLaunchEventHandler = function($path)
{ {
/** /**
* @var MySQLDatabaseOms * @var \Mocha\Oms\MySQLDatabaseOms
*/ */
$oms = mocha_get_oms(); $oms = mocha_get_oms();
if (count($path) >= 1) if (count($path) >= 1)
{ {
if ($path[0] == "suv") if ($path[0] == "suv")
@ -196,64 +109,6 @@ System::$BeforeLaunchEventHandler = function($path)
{ {
$oms->setTenant($currentTenant); $oms->setTenant($currentTenant);
} }
$currentUser = null;
if (isset($_SESSION["user_token_" . $currentTenant->ID]))
{
// SELECT FROM `Users` WHERE `Token` = $_SESSION["user_token"]
$insts = $oms->getInstancesByAttributes(array
(
KnownAttributeGuids::Token => $_SESSION["user_token_" . $currentTenant->ID]
));
$currentUser = null;
$loginEntry = null;
if (count($insts) == 1)
{
$loginEntry = $insts[0];
if ($loginEntry != null)
{
$users = $oms->getRelatedInstances($loginEntry, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User));
if (count($users) == 1)
{
$currentUser = $users[0];
}
}
if ($currentUser === null)
{
echo("returned null");
die();
}
}
}
$page = null;
$pathVars = null;
System::ParsePathVariablesIntoPage($page, $pathVars);
if ($currentUser === null)
{
if (count($path) >= 4)
{
if ($path[0] == "madi" && $path[1] == "authgwy")
{
return true;
}
}
if ($page != null)
{
if (requiresLogin($page->FileName))
{
echo($page->FileName);
$_SESSION["login_return"] = $path;
System::RedirectToLoginPage(true);
return false;
}
}
}
return true; return true;
}; };

View File

@ -0,0 +1,159 @@
<?php
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Oms\MySQLDatabaseOms;
use Phast\System;
function mocha_get_oms()
{
global $oms;
if ($oms === null)
{
$oms = new MySQLDatabaseOms(System::GetConfigurationValue("Database.ServerName"), System::GetConfigurationValue("Database.PortNumber"), System::GetConfigurationValue("Database.DatabaseName"), System::GetConfigurationValue("Database.UserName"), System::GetConfigurationValue("Database.Password"));
}
$oms->setCurrentUser(mocha_get_current_user());
return $oms;
}
function mocha_get_current_user() : ?InstanceReference
{
/**
* @var MySQLDatabaseOms
*/
global $oms; //! WE CANNOT CALL mocha_get_oms() HERE!
$currentTenant = $oms->getTenant();
if (isset($_SESSION["user_token_" . $currentTenant->ID]))
{
// SELECT FROM `Users` WHERE `Token` = $_SESSION["user_token"]
$insts = $oms->getInstancesByAttributes(array
(
KnownAttributeGuids::Token => $_SESSION["user_token_" . $currentTenant->ID]
));
$currentUser = null;
$loginEntry = null;
if (count($insts) == 1)
{
$loginEntry = $insts[0];
if ($loginEntry != null)
{
$users = $oms->getRelatedInstances($loginEntry, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User));
if (count($users) == 1)
{
$currentUser = $users[0];
}
}
if ($currentUser === null)
{
echo("returned null");
die();
}
return $currentUser;
}
}
return null;
}
/**
* Initializes the SPOT timer into the specified WebPage.
*
* @return bool true if the spot timer was initialized successfully; false otherwise.
*/
function mocha_init_spot_timer($pg) : bool
{
if ($pg === null)
return false;
$literalSpotTimer = $pg->GetControlByID("literalSpotTimer");
$spotTimerInitializationScript = $pg->GetControlByID("spotTimerInitializationScript");
if ($literalSpotTimer === null || $spotTimerInitializationScript === null)
return false;
$spotTimerContent = "";
$spotTimerScript = "";
mocha_get_spot_timer_script($spotTimerContent, $spotTimerScript);
$literalSpotTimer->Content = $spotTimerContent;
$spotTimerInitializationScript->Content = $spotTimerScript;
return true;
}
function mocha_get_spot_timer_script(&$spotTimerContent, &$spotTimerScript)
{
$spotTimerContent = "";
$spotTimerScript = "";
if (file_exists("/etc/mocha/suvstart"))
{
$suv_start_time = trim(file_get_contents("/etc/mocha/suvstart"));
$suv_start_time_d = new \DateTime($suv_start_time);
$suv_start_time_d->setTimezone(new \DateTimeZone("UTC"));
// this can be adjusted?
$suv_end_time_d = $suv_start_time_d->add(new \DateInterval("PT10H"));
$suv_end_time_d->setTimezone(new \DateTimeZone("UTC"));
$suv_end_time = $suv_end_time_d->format('Y-m-d\TH:i:s\Z');
$suv_current_time_d = new \DateTime();
$interval = $suv_end_time_d->diff($suv_current_time_d);
$spotTimerContent = $interval->h . ":" . $interval->i;
$spotTimerScript = <<<EOT
<script type="text/javascript">
var spot_end_time = new Date('$suv_end_time');
window.datediff = function(earlierDate, laterDate)
{
var interval = { };
var a = earlierDate, b = laterDate;
console.log(earlierDate);
console.log(laterDate);
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
// Discard the time and time-zone information.
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds());
const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate(), b.getHours(), b.getMinutes(), b.getSeconds());
console.log(utc2);
console.log(utc1);
var diffMS = (utc2 - utc1);
console.log(diffMS);
var secs = (diffMS / 1000) % 60;
var mins = (diffMS / (1000 * 60)) % 60;
var hrs = (diffMS / (1000 * 60 * 60)) % 24;
interval =
{
"raw": diffMS,
"seconds": Math.floor(secs),
"minutes": Math.floor(mins),
"hours": Math.floor(hrs)
};
return interval;
};
window.spot_timer_tick = function()
{
var spot_cur_time = new Date();
var diff = datediff(spot_cur_time, spot_end_time);
console.log(diff);
document.getElementById('spot_timer').innerHTML = diff.hours + ':' + diff.minutes.toString().padStart(2, '0');
window.setTimeout(spot_timer_tick, 60000);
};
window.addEventListener("load", function()
{
spot_timer_tick();
});
</script>
EOT;
}
}
?>

View File

@ -130,6 +130,9 @@ class KnownClassGuids
const ButtonLayout = "6f6338db68e04cc7b257d1b97cf3cb92"; const ButtonLayout = "6f6338db68e04cc7b257d1b97cf3cb92";
const ImageLayout = "4b1bb7c6168e4ce0b4f876dd5069a80b"; const ImageLayout = "4b1bb7c6168e4ce0b4f876dd5069a80b";
const GetInstancesMethod = "{0a379314-9d0f-432d-ae59-63194ab32dd3}";
const GetSpecifiedInstancesMethod = "{7794c7d0-b15d-4b23-aa40-63bb3d1f53ac}";
const ProcessRelatedUpdatesMethod = "2953e69803c54752a1ebcbbfa8f13905"; const ProcessRelatedUpdatesMethod = "2953e69803c54752a1ebcbbfa8f13905";
} }
?> ?>

View File

@ -39,5 +39,7 @@ class KnownInstanceGuids
const Alignment__Near = "35ea407a45e1462fa923a526d12fbc47"; const Alignment__Near = "35ea407a45e1462fa923a526d12fbc47";
const Alignment__Center = "{63179b92-9a6a-495b-a823-f45e353be9d8}"; const Alignment__Center = "{63179b92-9a6a-495b-a823-f45e353be9d8}";
const Alignment__Far = "f19d16c799ff48a3b86a7db8f400d869"; const Alignment__Far = "f19d16c799ff48a3b86a7db8f400d869";
const WorkSet__RelatedInstance = "{d9634929-0bb4-482a-85cc-9c8f1251556f}";
} }
?> ?>

View File

@ -100,7 +100,7 @@ class KnownRelationshipGuids
const Get_Referenced_Attribute_Method__has__Attribute = "87f90fe95ec64b098f51b8a4d1544cae"; const Get_Referenced_Attribute_Method__has__Attribute = "87f90fe95ec64b098f51b8a4d1544cae";
const Get_Referenced_Attribute_Method__loop_on__Instance_Set = "c7ecd4986d054e07b1bcf7127d0d6666"; const Get_Referenced_Attribute_Method__loop_on__Instance_Set = "c7ecd4986d054e07b1bcf7127d0d6666";
const Get_Specific_Instances_Method__has__Instance = "dea1aa0b2bef4bacb4f90ce8cf7006fc"; const Get_Specified_Instances_Method__uses__Instance = "dea1aa0b2bef4bacb4f90ce8cf7006fc";
const Evaluate_Boolean_Expression_Method__has_source_attribute__Method = "45d76d5601ed46419f68cfe0c7d0d265"; const Evaluate_Boolean_Expression_Method__has_source_attribute__Method = "45d76d5601ed46419f68cfe0c7d0d265";
const Evaluate_Boolean_Expression_Method__equal_to_attribute__Method = "0646df917e3e4d59be71b978a22ced8e"; const Evaluate_Boolean_Expression_Method__equal_to_attribute__Method = "0646df917e3e4d59be71b978a22ced8e";
@ -237,6 +237,10 @@ class KnownRelationshipGuids
const Element_Content__has__Layout = "1ab7412005ea4acab6d3c7e0133e0c4f"; const Element_Content__has__Layout = "1ab7412005ea4acab6d3c7e0133e0c4f";
const Element_Content__built_from__BEM_Process = "{3d7094ff-33e5-4800-9e4e-93dde0d1d331}";
const BEM_Process__uses_loop__Executable_returning_Instance_Set = "{0fb2b538-eacb-418a-b7d8-43a584b85952}";
const Layout__has__Style = "{e684bb26-7e78-4a21-b8b4-5a550f3053d5}"; const Layout__has__Style = "{e684bb26-7e78-4a21-b8b4-5a550f3053d5}";
const Element_Content__has__Element_Content_Display_Option = "f070dfa762604488a779fae291903f2d"; const Element_Content__has__Element_Content_Display_Option = "f070dfa762604488a779fae291903f2d";
@ -289,5 +293,7 @@ class KnownRelationshipGuids
const Assign_Attribute_Method__uses__Executable_returning_Attribute = "{9313f96e-58af-416f-852e-ef83725057fc}"; 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_Attribute_Method__assigns__Attribute = "{74061875-8a27-403b-9456-02e52cfd13b2}";
const Get_Instances_Method__selects_instances_of__Class = "{c0b85d90-de8c-44c2-9420-c5e724ccdf2c}";
} }
?> ?>

View File

@ -11,6 +11,16 @@
{ {
private \PDO $PDO; private \PDO $PDO;
private ?InstanceReference $_currentUser = null;
public function setCurrentUser(?InstanceReference $userInstance)
{
$this->_currentUser = $userInstance;
}
public function getCurrentUser() : ?InstanceReference
{
return $this->_currentUser;
}
/** /**
* Raised when the tenant is changed via setTenant. * Raised when the tenant is changed via setTenant.
*/ */
@ -275,13 +285,13 @@
); );
$result = $stmt->execute($parms); $result = $stmt->execute($parms);
trigger_error($query, \E_USER_NOTICE); // trigger_error($query, \E_USER_NOTICE);
trigger_error("source inst id: " . $sourceInstance->InstanceKey, \E_USER_NOTICE); // trigger_error("source inst id: " . $sourceInstance->InstanceKey, \E_USER_NOTICE);
trigger_error("relationship inst id: " . $relationshipInstance->InstanceKey, \E_USER_NOTICE); // trigger_error("relationship inst id: " . $relationshipInstance->InstanceKey, \E_USER_NOTICE);
foreach ($parms as $key => $value) // foreach ($parms as $key => $value)
{ // {
trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE); // trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE);
} // }
if ($result === false) if ($result === false)
{ {
@ -333,6 +343,14 @@
} }
public function setAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null) public function setAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
{ {
$currentUser = $this->getCurrentUser();
$cudbid = null;
if ($currentUser !== null)
{
$cudbid = $currentUser->DatabaseId;
}
$query = "CALL mocha_set_attribute_value(:src_inst_id, :attr_inst_id, :attr_value, :user_inst_id, :eff_date)"; $query = "CALL mocha_set_attribute_value(:src_inst_id, :attr_inst_id, :attr_value, :user_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query); $stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array $result = $stmt->execute(array
@ -340,7 +358,7 @@
"src_inst_id" => $this->getDbId($sourceInstance), "src_inst_id" => $this->getDbId($sourceInstance),
"attr_inst_id" => $this->getDbId($attributeInstance), "attr_inst_id" => $this->getDbId($attributeInstance),
"attr_value" => $value, "attr_value" => $value,
"user_inst_id" => null, "user_inst_id" => $cudbid,
"eff_date" => $effectiveDate "eff_date" => $effectiveDate
)); ));
} }

View File

@ -20,7 +20,7 @@
{ {
$this->_tenant = null; $this->_tenant = null;
} }
/** /**
* Gets the instance with the specified global identifier. * Gets the instance with the specified global identifier.
*/ */
@ -29,6 +29,19 @@
return null; return null;
} }
/**
* Indices are 1-based
*/
public function getNthInstanceOf(InstanceReference|string|InstanceKey $sourceInstance, int $index, $defaultValue = null)
{
$insts = $this->getRelatedInstances($sourceInstance, KnownRelationshipGuids::Class__has__Instance);
if (count($insts) > 0)
{
return $insts[$index - 1];
}
return $defaultValue;
}
public function getRelatedInstances(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey|null $relationshipInstance, \DateTime $effectiveDate = null) : ?array public function getRelatedInstances(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey|null $relationshipInstance, \DateTime $effectiveDate = null) : ?array
{ {
$tenant = $this->getTenant(); $tenant = $this->getTenant();
@ -169,6 +182,19 @@
return null; return null;
} }
public function printInstanceKeys(array $instanceReferences, string $separator = ":")
{
$ct = count($instanceReferences);
for($i = 0; $i < $ct; $i++)
{
echo($instanceReferences[$i]->InstanceKey);
if ($i < $ct - 1)
{
echo ($separator);
}
}
}
public function instanceSetContains(array /*<InstanceReference>*/ $haystack, InstanceReference $needle) public function instanceSetContains(array /*<InstanceReference>*/ $haystack, InstanceReference $needle)
{ {
foreach ($haystack as $v) foreach ($haystack as $v)
@ -181,12 +207,34 @@
return false; return false;
} }
public function executeMethodReturningInstanceSet(InstanceReference $method, array $parms) public function getInstancesOf(InstanceReference $classInstance)
{
$instances = $this->getRelatedInstances($classInstance, KnownRelationshipGuids::Class__has__Instance);
return $instances;
}
public function executeMethodReturningInstanceSet(InstanceReference $method, array $parms) : ?array
{ {
$parentClass = $this->getParentClass($method); $parentClass = $this->getParentClass($method);
echo("parent class of method"); if ($parentClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnInstanceSetMethodBinding)))
print_r($parentClass); {
die(); //return $this->executeMethodReturningInstanceSet($methodBindingHasMethod, $parms);
}
else if ($parentClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::GetSpecifiedInstancesMethod)))
{
$instances = $this->getRelatedInstances($method, KnownRelationshipGuids::Get_Specified_Instances_Method__uses__Instance);
return $instances;
}
else if ($parentClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::GetInstancesMethod)))
{
$selectsOfClass = $this->getRelatedInstance($method, KnownRelationshipGuids::Get_Instances_Method__selects_instances_of__Class);
return $this->getInstancesOf($selectsOfClass);
}
else
{
echo("zq: executeMethod: unknown parent class '" . $parentClass->GlobalIdentifier . "' [" . $parentClass->InstanceKey . "]");
die();
}
return null; return null;
} }
@ -251,6 +299,44 @@
} }
public function getRelatedTasks(InstanceReference $inst)
{
$instParent = $this->getParentClass($inst);
$relatedTasks = [];
$instInstance = $this->getInstanceByGlobalIdentifier(KnownClassGuids::Instance);
$relatedTasks0 = $this->getRelatedInstances($instInstance, KnownRelationshipGuids::Class__has_related__Task);
foreach ($relatedTasks0 as $task)
{
$relatedTasks[] = $task;
}
$relatedTasks1 = $this->getRelatedInstances($instParent, KnownRelationshipGuids::Class__has_related__Task);
foreach ($relatedTasks1 as $task)
{
$relatedTasks[] = $task;
}
$superclasses = $this->getRelatedInstances($instParent, KnownRelationshipGuids::Class__has_super__Class);
foreach ($superclasses as $superclass)
{
$relatedTasks2 = $this->getRelatedInstances($superclass, KnownRelationshipGuids::Class__has_related__Task);
foreach ($relatedTasks2 as $task)
{
$relatedTasks[] = $task;
}
}
return $relatedTasks;
}
public function getNthRelatedInstance(InstanceReference $inst, InstanceReference|string|InstanceKey|array $rel, int $index)
{
$rel = $this->normalizeInstanceReference($rel);
$relInsts = $this->getRelatedInstances($inst, $rel);
return $relInsts[$index];
}
public function executeMethod(OmsContext $context, InstanceReference $methodInstance) public function executeMethod(OmsContext $context, InstanceReference $methodInstance)
{ {
$methodInstanceClass = $this->getParentClass($methodInstance); $methodInstanceClass = $this->getParentClass($methodInstance);
@ -261,8 +347,15 @@
$classForPRU = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Process_Related_Updates_Method__processes_for__Class); $classForPRU = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Process_Related_Updates_Method__processes_for__Class);
if ($classForPRU !== null) if ($classForPRU !== null)
{ {
echo("current work data for '" . $classForPRU->GlobalIdentifier . "' = '" . $context->getWorkData($classForPRU->GlobalIdentifier->__toString()) . "'");
} }
//!HACK!
$instForPRU = $this->getNthInstanceOf($classForPRU, 1);
if ($instForPRU !== null)
{
//echo("current work data for '" . $instForPRU->GlobalIdentifier . "' = '" . $context->getWorkData($instForPRU->GlobalIdentifier->__toString()) . "'");
}
$instExecutablesForPUMB = $this->getRelatedInstances($methodInstance, KnownRelationshipGuids::Process_Related_Updates_Method__uses__Executable_for_PUMB); $instExecutablesForPUMB = $this->getRelatedInstances($methodInstance, KnownRelationshipGuids::Process_Related_Updates_Method__uses__Executable_for_PUMB);
foreach ($instExecutablesForPUMB as $instExecutableForPUMB) foreach ($instExecutablesForPUMB as $instExecutableForPUMB)
{ {
@ -271,9 +364,18 @@
$assignsAttribute = $this->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__assigns__Attribute); $assignsAttribute = $this->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__assigns__Attribute);
$usesExecutableReturningAttribute = $this->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__uses__Executable_returning_Attribute); $usesExecutableReturningAttribute = $this->getRelatedInstance($instExecutableForPUMB, KnownRelationshipGuids::Assign_Attribute_Method__uses__Executable_returning_Attribute);
$context->setWorkData($assignsAttribute->GlobalIdentifier->__toString(), $usesExecutableReturningAttribute); //$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 . "'");
//echo ("the value from work data is '" . $context->getWorkData($usesExecutableReturningAttribute->GlobalIdentifier) . "'");
$value = $context->getWorkData($usesExecutableReturningAttribute->GlobalIdentifier->__toString());
if ($value instanceof InstanceReference)
{
//echo ("the value from work data is ##IS#'" . $value->GlobalIdentifier . "'##");
}
else
{
$this->setAttributeValue($instForPRU, $assignsAttribute, $value);
}
} }
else else
{ {

View File

@ -3,6 +3,8 @@
use Mocha\Core\InstanceKey; use Mocha\Core\InstanceKey;
use Mocha\Core\InstanceReference; use Mocha\Core\InstanceReference;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Oms\MySQLDatabaseOms; use Mocha\Oms\MySQLDatabaseOms;
use Phast\HTMLControl; use Phast\HTMLControl;
@ -17,6 +19,11 @@
{ {
public $Name; public $Name;
public bool $Editable;
public bool $MultiSelect;
public bool $DisplayAsCount;
public bool $DisableLink;
public array $SelectedInstances; public array $SelectedInstances;
public array $ValidClasses; public array $ValidClasses;
@ -27,6 +34,10 @@
$this->Name = null; $this->Name = null;
$this->TagName = "div"; $this->TagName = "div";
$this->ClassList[] = "mcx-instancebrowser"; $this->ClassList[] = "mcx-instancebrowser";
$this->Editable = false;
$this->MultiSelect = false;
$this->DisplayAsCount = false;
$this->DisableLink = false;
$this->ValidClasses = array(); $this->ValidClasses = array();
if ($instanceReferences === null) if ($instanceReferences === null)
@ -152,6 +163,21 @@
$adw->Attributes[] = new WebControlAttribute("data-instance-id", $inst->InstanceKey); $adw->Attributes[] = new WebControlAttribute("data-instance-id", $inst->InstanceKey);
$adw->ClassList[] = "mcx-moniker"; $adw->ClassList[] = "mcx-moniker";
$adw->ClassTitle = $parentClassName; $adw->ClassTitle = $parentClassName;
$adw->ShowURL = false;
$instDefaultTask = $oms->getRelatedInstance($instParent, KnownRelationshipGuids::Class__has_default__Task);
if ($instDefaultTask != null)
{
// !FIXME: check to see if the task is authorized for the current user
// (e.g. this can be by if `User .has Security Domain` any in `Securable.has Security Domain`)
// e.g. if User has `Administrator` and Task has `Administrator`, return true
if (true) // ($oms->isTaskAuthorizedForUser($instDefaultTask, $oms->getCurrentUser()))
{
$adw->TargetURL = System::ExpandRelativePath("~/d/inst/" . $instParent->InstanceKey . "/" . $inst->InstanceKey . ".htmld");
$adw->ShowURL = true;
}
}
$adw->Text = $oms->getInstanceText($inst); $adw->Text = $oms->getInstanceText($inst);
/* /*
@ -179,7 +205,6 @@
)) ))
); );
*/ */
$adw->TargetURL = System::ExpandRelativePath("~/d/inst/" . $inst->InstanceKey . ".htmld");
$li->Controls[] = $adw; $li->Controls[] = $adw;
$ul->Controls[] = $li; $ul->Controls[] = $li;

View File

@ -47,6 +47,8 @@
public bool $IsPostback; public bool $IsPostback;
public string $SubmitButtonText; public string $SubmitButtonText;
private $__renderingNotEnterable;
public function __construct(OmsContext $context) public function __construct(OmsContext $context)
{ {
$this->Context = $context; $this->Context = $context;
@ -55,6 +57,7 @@
$this->IsPostback = false; $this->IsPostback = false;
$this->StyleClasses = []; $this->StyleClasses = [];
$this->SubmitButtonText = "Save Changes"; $this->SubmitButtonText = "Save Changes";
$this->__renderingNotEnterable = false;
} }
/** /**
* Thanks https://stackoverflow.com/a/31107425 * Thanks https://stackoverflow.com/a/31107425
@ -154,11 +157,30 @@
private function updateWorkDataWithElementContents() private function updateWorkDataWithElementContents()
{ {
echo ("updating work datas from element contents...<br/>"); /**
echo ("current work data: <br/>"); * @var MySQLDatabaseOms
print_r($this->Context->workData); */
echo ("<br/><br/>"); $oms = mocha_get_oms();
echo ("proposed changes: <br/>");
// echo ("updating work datas from element contents...<br/>");
// echo ("current work data: <br/>");
// print_r($this->Context->workData);
foreach ($_POST as $key => $value)
{
if (str_starts_with($key, "ec_"))
{
$ecid = substr($key, 3);
$inst_ec = $oms->getInstanceByKey(InstanceKey::Parse($ecid));
$value = $this->Context->getElementParm($inst_ec, $inst_ec->GlobalIdentifier->__toString());
$targetInst = $oms->getRelatedInstance($inst_ec, KnownRelationshipGuids::Element_Content__has__Instance);
//? this feels like a hack...
$this->Context->setWorkData($targetInst->GlobalIdentifier->__toString(), $value);
}
}
} }
@ -212,7 +234,7 @@
else else
{ {
$this->updateWorkDataWithElementContents(); $this->updateWorkDataWithElementContents();
$pru = $oms->getRelatedInstance($element, KnownRelationshipGuids::Element__processed_by__Process_Related_Updates_Method); $pru = $oms->getRelatedInstance($element, KnownRelationshipGuids::Element__processed_by__Process_Related_Updates_Method);
if ($pru !== null) if ($pru !== null)
{ {
@ -471,7 +493,7 @@
return $str; return $str;
} }
public function renderElementContent(InstanceReference $elementContent) public function renderElementContent(InstanceReference $elementContent, InstanceReference $relatedInstanceParm = null)
{ {
/** /**
* @var MySQLDatabaseOms * @var MySQLDatabaseOms
@ -479,6 +501,7 @@
$oms = mocha_get_oms(); $oms = mocha_get_oms();
$ecInst = $oms->getRelatedInstance($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Instance)); $ecInst = $oms->getRelatedInstance($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Instance));
$relatedInstance = $this->Context->getWorkData(KnownInstanceGuids::WorkSet__RelatedInstance);
echo ("<!-- " . $elementContent->InstanceKey . " ; " . $ecInst->InstanceKey . " -->"); echo ("<!-- " . $elementContent->InstanceKey . " ; " . $ecInst->InstanceKey . " -->");
@ -565,7 +588,26 @@
} }
else if ($oms->is_a($ecInst, KnownClassGuids::TextAttribute)) else if ($oms->is_a($ecInst, KnownClassGuids::TextAttribute))
{ {
$value = $oms->getAttributeValue($this->TargetInstance, $ecInst); // fill in the value from the target instance
$targetInstance = $relatedInstance;
if ($relatedInstanceParm !== null)
{
$targetInstance = $relatedInstanceParm;
}
if ($targetInstance === null)
{
$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);
}
if ($targetInstance !== null)
{
$value = $oms->getAttributeValue($targetInstance, $ecInst);
}
if ($value === null) if ($value === null)
{ {
$value = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value)); $value = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value));
@ -573,21 +615,27 @@
if ($this->IsPostback && isset($_POST["ec_" . strval($elementContent->InstanceKey)])) if ($this->IsPostback && isset($_POST["ec_" . strval($elementContent->InstanceKey)]))
{ {
// fill in the value from the postback
$value = $_POST["ec_" . strval($elementContent->InstanceKey)]; $value = $_POST["ec_" . strval($elementContent->InstanceKey)];
} }
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable))) if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable)) || $this->__renderingNotEnterable)
{ {
$this->renderTextAttribute($elementContent, $ecInst, $oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ObscuredText)), $value); echo($value);
} }
else else
{ {
echo($value); $this->renderTextAttribute($elementContent, $ecInst, $oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ObscuredText)), $value);
} }
} }
else else
{ {
$adw = new InstanceBrowser(array($ecInst)); $targetInstance = $relatedInstanceParm;
if ($targetInstance === null)
{
$targetInstance = $ecInst;
}
$adw = new InstanceBrowser(array($targetInstance));
$adw->Render(); $adw->Render();
// echo ("<span class=\"mcx-value\">unknown pclass ident " . $oms->getParentClass($ecInst)->GlobalIdentifier . "</span>"); // echo ("<span class=\"mcx-value\">unknown pclass ident " . $oms->getParentClass($ecInst)->GlobalIdentifier . "</span>");
} }
@ -603,6 +651,7 @@
* @var MySQLDatabaseOms * @var MySQLDatabaseOms
*/ */
$oms = mocha_get_oms(); $oms = mocha_get_oms();
$displayOptions = $oms->getRelatedInstances($ec, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option)); $displayOptions = $oms->getRelatedInstances($ec, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
$ecid = $ec->InstanceKey; $ecid = $ec->InstanceKey;
@ -695,7 +744,20 @@
$this->renderBeginTag("title"); $this->renderBeginTag("title");
echo($title); echo($title);
$this->renderEndTag("title"); $this->renderEndTag("title");
echo("<link rel=\"stylesheet\" type=\"text/css\" href=\"" . System::ExpandRelativePath("~/themes/" . System::GetConfigurationValue("Application.ThemeName") . "/theme.css", false, true) . "\" />");
$this->renderTag("link", array
(
"rel" => "stylesheet",
"type" => "text/css",
"href" => System::ExpandRelativePath("~/themes/" . System::GetConfigurationValue("Application.ThemeName") . "/theme.css", false, true)
));
$this->renderTag("link", array
(
"rel" => "stylesheet",
"type" => "text/css",
"href" => System::ExpandRelativePath("~/themes/mocha/theme.css", false, true)
));
$this->renderTag("script", array("type" => "text/javascript", "src" => System::ExpandRelativePath("~/scripts/phast/System.js.php", false, true))); $this->renderTag("script", array("type" => "text/javascript", "src" => System::ExpandRelativePath("~/scripts/phast/System.js.php", false, true)));
$this->renderTag("script", array("type" => "text/javascript", "src" => System::ExpandRelativePath("~/scripts/mocha.js.php", false, true))); $this->renderTag("script", array("type" => "text/javascript", "src" => System::ExpandRelativePath("~/scripts/mocha.js.php", false, true)));
$this->renderBeginTag("script", array("type" => "text/javascript")); $this->renderBeginTag("script", array("type" => "text/javascript"));
@ -715,9 +777,12 @@
} }
$this->renderBeginTag("body", null, $bodyClasses); $this->renderBeginTag("body", null, $bodyClasses);
$this->renderBeginTag("div", [ ], [ "uwt-page-header" ] ); $spotTimerContent = ""; $spotTimerScript = "";
\mocha_get_spot_timer_script($spotTimerContent, $spotTimerScript);
$this->renderEndTag("div"); echo(<<<MSG_EOF
<div class="mocha-ams-spot-popup" id="spot_popup"><h1>SPOT:</h1><h3>Stop in: <label id="spot_timer">$spotTimerContent</label></h3></div>
MSG_EOF);
$this->renderTag("script", [ ], [ ], $spotTimerScript);
} }
public function renderEndPage() public function renderEndPage()
{ {
@ -859,13 +924,21 @@
return $title; return $title;
} }
private InstanceReference $__renderingElement;
public function renderElement(InstanceReference $element, array $displayOptions) public function renderElement(InstanceReference $element, array $displayOptions)
{ {
/** /**
* @var MySQLDatabaseOms * @var MySQLDatabaseOms
*/ */
$oms = mocha_get_oms(); $oms = mocha_get_oms();
$this->__renderingElement = $element;
$parentElementContent = $oms->getRelatedInstance($element, KnownRelationshipGuids::Instance__for__Element_Content);
$renderingNotEnterable = $this->__renderingNotEnterable;
$this->__renderingNotEnterable = $oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable));
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ShowSubelementsVertically))) if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ShowSubelementsVertically)))
{ {
echo("<!-- show subelements vertically -->"); echo("<!-- show subelements vertically -->");
@ -886,6 +959,10 @@
{ {
$mcx_classes = [ "mcx-element" ]; $mcx_classes = [ "mcx-element" ];
} }
if (!$this->shouldRenderElementContentLabel($elementContent))
{
$mcx_classes[] = "mcx-hidden-label";
}
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Required))) if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Required)))
{ {
@ -895,6 +972,10 @@
{ {
$mcx_classes[] = "mcx-failed-validation"; $mcx_classes[] = "mcx-failed-validation";
} }
if (!$this->shouldRenderElementContentLabel($elementContent))
{
$mcx_classes[] = "mcx-hidden-label";
}
// $this->renderBeginTag("tr", [ "data-instance-id" => $ecInst->InstanceKey, "data-ecid" => $elementContent->InstanceKey ], $mcx_classes); // $this->renderBeginTag("tr", [ "data-instance-id" => $ecInst->InstanceKey, "data-ecid" => $elementContent->InstanceKey ], $mcx_classes);
$this->renderBeginTag("div", [ "data-instance-id" => $ecInst->InstanceKey, "data-ecid" => $elementContent->InstanceKey ], $mcx_classes); $this->renderBeginTag("div", [ "data-instance-id" => $ecInst->InstanceKey, "data-ecid" => $elementContent->InstanceKey ], $mcx_classes);
@ -908,10 +989,6 @@
if ($this->shouldRenderElementContentLabel($elementContent)) if ($this->shouldRenderElementContentLabel($elementContent))
{ {
// $this->renderBeginTag("td"); // $this->renderBeginTag("td");
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__DoNotShowLabel)))
{
echo ("<label for=\"ec_" . $elementContent->InstanceKey . "\">" . $title . "</label>");
}
// $this->renderEndTag("td"); // $this->renderEndTag("td");
// $this->renderBeginTag("td"); // $this->renderBeginTag("td");
} }
@ -919,6 +996,7 @@
{ {
// $this->renderBeginTag("td", [ "colspan" => "2" ]); // $this->renderBeginTag("td", [ "colspan" => "2" ]);
} }
echo ("<label for=\"ec_" . $elementContent->InstanceKey . "\">" . $title . "</label>");
$this->renderBeginTag("div"); $this->renderBeginTag("div");
$this->renderElementContent($elementContent); $this->renderElementContent($elementContent);
@ -954,7 +1032,26 @@
} }
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content)); $contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
$rowCount = 5;
$instances = [];
// $bem = $oms->getRelatedInstance($element, KnownRelationshipGuids::Element__returned_by__Build_Element_Method);
//$bemProcess = $oms->getRelatedInstance($bem, KnownRelationshipGuids::Build_Element_Method__has__BEM_Process);
if ($parentElementContent !== null)
{
$bemProcess = $oms->getRelatedInstance($parentElementContent, KnownRelationshipGuids::Element_Content__built_from__BEM_Process);
if ($bemProcess != null)
{
// execute the `Executable returning Instance Set` to get the rows to display (Primary Instances)
$instanceExecutable = $oms->getRelatedInstance($bemProcess, KnownRelationshipGuids::BEM_Process__uses_loop__Executable_returning_Instance_Set);
if ($instanceExecutable !== null)
{
//! FIXME: this array should be put into teh specified `returns Work Set` variable
// ... BUT this works the way it's supposed to , for right now!
$instances = $oms->executeMethodReturningInstanceSet($instanceExecutable, array());
}
}
}
$rowCount = count($instances);
echo("<!-- nonsingular -->"); echo("<!-- nonsingular -->");
// $this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]); // $this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]);
@ -1018,13 +1115,14 @@
for ($i = 0; $i < $rowCount; $i++) for ($i = 0; $i < $rowCount; $i++)
{ {
$rowInst = $instances[$i];
$this->renderBeginTag("div", [ ], [ "uwt-listview-item" ]); $this->renderBeginTag("div", [ ], [ "uwt-listview-item" ]);
foreach ($contents as $content) foreach ($contents as $content)
{ {
// $this->renderBeginTag("td"); // $this->renderBeginTag("td");
$this->renderBeginTag("div", [], [ "mcx-elementcontent", "uwt-listview-item-column" ]); $this->renderBeginTag("div", [], [ "mcx-elementcontent", "uwt-listview-item-column" ]);
$this->renderElementContent($content); $this->renderElementContent($content, $rowInst);
$this->renderEndTag("div"); $this->renderEndTag("div");
// $this->renderEndTag("td"); // $this->renderEndTag("td");
} }
@ -1041,7 +1139,10 @@
$this->renderEndTag("div"); $this->renderEndTag("div");
} }
} }
$this->__renderingNotEnterable = $renderingNotEnterable;
} }
} }
?> ?>

View File

@ -97,4 +97,9 @@ window.addEventListener("load", function()
console.log(items[i]); console.log(items[i]);
items[i].McxNativeObject = new McxElementContent(items[i]); items[i].McxNativeObject = new McxElementContent(items[i]);
} }
var items = document.getElementsByClassName("mcx-element");
for (var i = 0; i < items.length; i++)
{
items[i].McxNativeObject = new McxElementContent(items[i]);
}
}); });

View File

@ -0,0 +1,22 @@
function InstanceKey()
{
this.ClassIndex = 0;
this.InstanceIndex = 0;
this.toString = function()
{
return this.ClassIndex + "$" + this.InstanceIndex;
};
}
InstanceKey.parse = function(value)
{
var split = value.split("$");
var classIndex = parseInt(split[0]);
var instanceIndex = parseInt(split[1]);
var ik = new InstanceKey();
ik.ClassIndex = classIndex;
ik.InstanceIndex = instanceIndex;
return ik;
};

View File

@ -0,0 +1,15 @@
var mochaMessages = {
"MXRES.CONTEXTMENUITEM.ViewPrintableVersion": "View Printable Version",
"MXRES.CONTEXTMENUITEM.ExportToSpreadsheet": "Export to Spreadsheet",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyInstanceID": "Copy Instance ID ({0})",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyText": "Copy Text",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyTextAndInstanceID": "Copy Text and Instance ID",
"MXRES.MONIKER.CONTEXTMENUITEM.CopyURL": "Copy URL",
"MXRES.MONIKER.CONTEXTMENUITEM.EditInNewWindow": "Edit in New Window",
"MXRES.MONIKER.CONTEXTMENUITEM.EditInstance": "Edit Instance",
"MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceID": "Search Instance ID ({0})",
"MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceIDInMaster": "Search Instance ID ({0}) in Master",
"MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceIDInNewWindow": "Search Instance ID ({0}) in New Window",
"MXRES.MONIKER.CONTEXTMENUITEM.SeeInNewWindow": "See in New Tab",
"MXRES.MONIKER.CONTEXTMENUITEM.SeeRelatedInstances": "See Related Instances"
};

View File

@ -5,6 +5,137 @@ function McxMoniker(parentElement)
this.ButtonElement = this.ParentElement.children[1]; this.ButtonElement = this.ParentElement.children[1];
this.PopupElement = this.ParentElement.children[2]; this.PopupElement = this.ParentElement.children[2];
this.ParentElement.addEventListener("contextmenu", function(e)
{
var cm = new ContextMenu();
cm.Data = this.McxNativeObject;
var ecid = this.NativeObject.ECID;
var iid = this.McxNativeObject.ParentElement.getAttribute("data-instance-id");
cm.Items = [
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.SeeInNewWindow"],
"Visible": function()
{
return this.Menu.Data.LabelElement.tagName == "A";
},
"Execute": function()
{
var ik = InstanceKey.parse(iid);
var castClassId = "1$" + ik.ClassIndex;
var relativeUrl = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + castClassId + "/" + iid + ".htmld");
var url = new URL(relativeUrl, document.baseURI).href;
window.open(relativeUrl);
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": function()
{
return this.Menu.Data.LabelElement.tagName == "A";
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyURL"],
"Visible": true,
"Execute": function()
{
var ik = InstanceKey.parse(iid);
var castClassId = "1$" + ik.ClassIndex;
var relativeUrl = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + castClassId + "/" + iid + ".htmld");
var url = new URL(relativeUrl, document.baseURI).href;
Clipboard.setText(url);
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyText"],
"Visible": true,
"Execute": function()
{
Clipboard.setText(this.Menu.Data.LabelElement.innerText);
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": true
},
{
"ClassName": "MenuItemCommand",
"Title": String.format(mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyInstanceID"], iid),
"Visible": true,
"Execute": function()
{
Clipboard.setText(iid);
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.CopyTextAndInstanceID"],
"Visible": true,
"Execute": function()
{
Clipboard.setText(this.Menu.Data.LabelElement.innerText);
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": true
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.EditInstance"],
"Visible": true,
"TargetURL": function()
{
var ik = InstanceKey.parse(iid);
var castClassId = "1$" + ik.ClassIndex;
var relativeUrl = System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/" + castClassId + "/" + iid + ".htmld");
var url = new URL(relativeUrl, document.baseURI).href;
return url;
}
},
{
"ClassName": "MenuItemCommand",
"Title": String.format(mochaMessages["MXRES.MONIKER.CONTEXTMENUITEM.SearchInstanceID"], iid),
"Visible": true,
"TargetURL": function()
{
return System.ExpandRelativePath("~/" + System.TenantName + "/d/search.htmld?q=" + iid + "&branch=true");
}
},
{
"ClassName": "MenuItemSeparator",
"Visible": true
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.CONTEXTMENUITEM.ViewPrintableVersion"],
"Visible": true,
"Execute": function()
{
Window.ShowDialog("The method or operation is not implemented", "Not Implemented");
}
},
{
"ClassName": "MenuItemCommand",
"Title": mochaMessages["MXRES.CONTEXTMENUITEM.ExportToSpreadsheet"],
"Visible": true,
"Execute": function()
{
Window.ShowDialog("The method or operation is not implemented", "Not Implemented");
}
}
];
cm.Show(e.clientX, e.clientY, this);
e.preventDefault();
e.stopPropagation();
return false;
});
this.ActionsMenuElement = this.PopupElement.children[0].children[1]; this.ActionsMenuElement = this.PopupElement.children[0].children[1];
this.ClassTitleElement = this.PopupElement.children[1].children[0].children[0].children[0]; this.ClassTitleElement = this.PopupElement.children[1].children[0].children[0].children[0];
this.InstanceTitleElement = this.PopupElement.children[1].children[0].children[0].children[1]; this.InstanceTitleElement = this.PopupElement.children[1].children[0].children[0].children[1];
@ -32,6 +163,7 @@ function McxMoniker(parentElement)
var url = System.ExpandRelativePath("~/" + System.TenantName + "/inst/" + this.McxNativeObject.InstanceID + "/rel-tasks.htmld"); var url = System.ExpandRelativePath("~/" + System.TenantName + "/inst/" + this.McxNativeObject.InstanceID + "/rel-tasks.htmld");
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.timeout = 5000;
xhr.open("GET", url); xhr.open("GET", url);
xhr.thiss = this.McxNativeObject; xhr.thiss = this.McxNativeObject;
xhr.onreadystatechange = function(e) xhr.onreadystatechange = function(e)
@ -39,73 +171,93 @@ function McxMoniker(parentElement)
var xhr = e.target; var xhr = e.target;
if (xhr.readyState == 4) if (xhr.readyState == 4)
{ {
var json = JSON.parse(xhr.responseText); if (xhr.status == 200)
console.log(json);
if (json.instance)
{ {
if (json.instance.label) var json = JSON.parse(xhr.responseText);
{ console.log(json);
// xhr.thiss.setClassTitle("Return Attribute Method Binding");
xhr.thiss.setClassTitle(json.instance.label);
}
if (json.instance.title)
{
// xhr.thiss.setInstanceTitle("Common Text@get Concatenated Date and Time Format (BA)*P*S(public)[ramb]");
xhr.thiss.setInstanceTitle(json.instance.title);
}
}
if (json.taskGroups)
{
System.ClassList.Remove(xhr.thiss.ActionsMenuElement.parentElement, "uwt-empty");
xhr.thiss.ActionsMenuElement.innerHTML = ""; if (json.result == "failure" && json.responseCode == 403)
for (var i = 0; i < json.taskGroups.length; i++)
{ {
var tgprimary = json.taskGroups[i].taskGroups[0]; Alert.show(json.message, json.title, "uwt-color-danger");
var label = tgprimary.label; return;
}
var li = document.createElement("li");
li.className = "uwt-menu-item-command uwt-menu-item-popup uwt-visible";
var a = document.createElement("a");
a.href = "#";
var span = document.createElement("span");
span.className = "uwt-title";
span.innerText = label;
a.appendChild(span);
li.appendChild(a);
var ulMenuChild = document.createElement("ul"); if (json.instance)
ulMenuChild.className = "uwt-menu uwt-popup"; {
if (json.instance.label)
for (var j = 0; j < tgprimary.taskGroups.length; j++)
{ {
var tgsecondary = tgprimary.taskGroups[j].tasks[0]; // xhr.thiss.setClassTitle("Return Attribute Method Binding");
var li2 = document.createElement("li"); xhr.thiss.setClassTitle(json.instance.label);
li2.className = "uwt-menu-item-command uwt-visible"; }
if (json.instance.title)
var a2 = document.createElement("a"); {
a2.href = tgsecondary.uri; // xhr.thiss.setInstanceTitle("Common Text@get Concatenated Date and Time Format (BA)*P*S(public)[ramb]");
xhr.thiss.setInstanceTitle(json.instance.title);
var span2 = document.createElement("span");
span2.className = "uwt-title";
span2.innerText = tgsecondary.label;
a2.appendChild(span2);
li2.appendChild(a2);
ulMenuChild.appendChild(li2);
} }
li.appendChild(ulMenuChild);
xhr.thiss.ActionsMenuElement.appendChild(li);
} }
if (json.taskGroups)
{
System.ClassList.Remove(xhr.thiss.ActionsMenuElement.parentElement, "uwt-empty");
xhr.thiss.ActionsMenuElement.innerHTML = "";
for (var i = 0; i < json.taskGroups.length; i++)
{
var tgprimary = json.taskGroups[i].taskGroups[0];
if (tgprimary.taskGroups.length === 0)
continue;
var label = tgprimary.label;
var li = document.createElement("li");
li.className = "uwt-menu-item-command uwt-menu-item-popup uwt-visible";
var a = document.createElement("a");
a.href = "#";
var span = document.createElement("span");
span.className = "uwt-title";
span.innerText = label;
a.appendChild(span);
li.appendChild(a);
var ulMenuChild = document.createElement("ul");
ulMenuChild.className = "uwt-menu uwt-popup";
for (var j = 0; j < tgprimary.taskGroups.length; j++)
{
var tgsecondary = tgprimary.taskGroups[j].tasks[0];
var li2 = document.createElement("li");
li2.className = "uwt-menu-item-command uwt-visible";
var a2 = document.createElement("a");
a2.href = tgsecondary.uri;
var span2 = document.createElement("span");
span2.className = "uwt-title";
span2.innerText = tgsecondary.label;
a2.appendChild(span2);
li2.appendChild(a2);
ulMenuChild.appendChild(li2);
}
li.appendChild(ulMenuChild);
xhr.thiss.ActionsMenuElement.appendChild(li);
}
}
System.ClassList.Remove(xhr.thiss.PopupElement, "uwt-loading");
}
else if (xhr.status == 403)
{
}
else if (xhr.status == 0)
{
Alert.show("Please check your connection and try again", "Connection lost", "uwt-color-danger", 5000);
} }
System.ClassList.Remove(xhr.thiss.PopupElement, "uwt-loading");
} }
}; };
xhr.send(null); xhr.send(null);

View File

@ -48,7 +48,7 @@ div.apb-preview
} }
&> div.apb-actions &> div.apb-actions
{ {
background: #eeeeee; background: #eeeeee; // #ccaaff - we could use this for Sydne;
border-right: solid 1px #ccc; border-right: solid 1px #ccc;
&> h2 &> h2
{ {
@ -61,15 +61,13 @@ div.apb-preview
{ {
&> a &> a
{ {
/*
&> span.uwt-title &> span.uwt-title
{ {
font-size: 12pt; font-size: 12pt;
font-weight: 300; font-weight: 300;
} }
} */
&:hover > a
{
background-color: #ddd;
} }
&.uwt-menu-item-popup &.uwt-menu-item-popup
{ {
@ -88,11 +86,6 @@ div.apb-preview
background-color: #fff; background-color: #fff;
border: solid 1px #ccc; border: solid 1px #ccc;
box-shadow: 2px 2px 4px #ccc; box-shadow: 2px 2px 4px #ccc;
&> li > a > span.uwt-title
{
font-size: 12pt;
font-weight: 300;
}
} }
} }
} }

View File

@ -19,10 +19,18 @@ div.uwt-listview > .uwt-content
} }
.uwt-listview .uwt-listview
{ {
&:not(.uwt-gridlines)
{
&> thead, &> .uwt-content > .uwt-listview-column-headers
{
border-bottom: solid 2px;
border-bottom-color: @TableGridLineColor;
}
}
&> thead, &> .uwt-content > .uwt-listview-column-headers &> thead, &> .uwt-content > .uwt-listview-column-headers
{ {
border-bottom: solid 2px; //border-bottom: solid 2px;
border-bottom-color: @TableGridLineColor; //border-bottom-color: @TableGridLineColor;
&> tr &> tr
{ {
&> th &> th
@ -118,9 +126,32 @@ div.uwt-listview > .uwt-content
} }
&.uwt-gridlines &.uwt-gridlines
{ {
&> .uwt-content > .uwt-listview-column-headers > .uwt-listview-column-header, &> .uwt-listview-items > .uwt-listview-item > .uwt-listview-item-column &> .uwt-content, &> .uwt-content > .uwt-listview-column-headers
{ {
border: solid 1px @TableGridLineColor; border: 1px solid rgba(0,0,0,0.2);
}
&> .uwt-content > .uwt-listview-column-headers > .uwt-listview-column-header
{
border: 1px solid @TableGridLineColor;
/*
&:not(:first-child)
{
border-left: 1px solid rgba(0,0,0,0.1);
}
&:not(:last-child)
{
border-right: 1px solid rgba(0,0,0,0.1);
}
*/
font-weight: bold;
}
&> .uwt-content > .uwt-listview-items > .uwt-listview-item > .uwt-listview-item-column
{
border: 1px solid rgba(0,0,0,0.05);
}
&> .uwt-content > .uwt-listview-items > .uwt-listview-item
{
border-bottom: none;
} }
} }
&.uwt-hottracking &.uwt-hottracking

View File

@ -15,8 +15,13 @@ ul.uwt-menu
{ {
&> a &> a
{ {
/*
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
*/
font-size: 12pt;
font-weight: 300;
padding: 0.309375rem 0.9375rem; padding: 0.309375rem 0.9375rem;
&:not(:hover) > span.uwt-description &:not(:hover) > span.uwt-description

View File

@ -0,0 +1,10 @@
@media (max-width: 1000px)
{
div.uwt-window
{
left: 0px !important;
top: 0px !important;
right: 0px !important;
bottom: 0px !important;
}
}

View File

@ -0,0 +1 @@
@import "uwt-window.less";

View File

@ -23,6 +23,10 @@ div.uwt-actionpreviewbutton
content: "..."; content: "...";
font-family: inherit; font-family: inherit;
font-weight: bold; font-weight: bold;
display: block;
margin-top: -3px;
height: 0px;
} }
} }
&:hover, &:focus-within &:hover, &:focus-within

View File

@ -10,6 +10,7 @@ body > div.uwt-alert-container
div.uwt-alert div.uwt-alert
{ {
margin-bottom: 8px;
position: relative; position: relative;
transition: all 1s; transition: all 1s;
right: 0px; right: 0px;

View File

@ -12,16 +12,14 @@
font-weight: bold; font-weight: bold;
padding-right: 8px; padding-right: 8px;
} }
&> span.uwt-listview-item-count &> span.uwt-listview-item-count, &> span.uwt-listview-item-count-label
{
}
&> span.uwt-listview-item-count-label
{ {
color: var(--uwt-color-secondary);
} }
&> .uwt-listview-controlbox &> .uwt-listview-controlbox
{ {
margin-left: auto; margin-left: auto;
padding: 8px; padding-right: 8px;
} }
} }
@ -31,6 +29,16 @@
{ {
border-collapse: collapse; border-collapse: collapse;
margin-top: 10px; margin-top: 10px;
&> .uwt-listview-items
{
&> .uwt-listview-item
{
&> .uwt-listview-item-column
{
word-wrap: break-word;
}
}
}
} }
&.uwt-expand &.uwt-expand
{ {

View File

@ -25,14 +25,14 @@ ul.uwt-menu
display: block; display: block;
&.uwt-title &.uwt-title
{ {
font-weight: bold; //font-weight: bold;
} }
} }
&:hover }
{ &:hover > a
background-color: var(--uwt-dropdown-menu-highlight-background); {
color: var(--uwt-dropdown-menu-highlight-foreground); background-color: rgba(0, 0, 0, 0.05); // var(--uwt-dropdown-menu-highlight-background);
} color: var(--uwt-dropdown-menu-highlight-foreground);
} }
&.uwt-separator &.uwt-separator
{ {

View File

@ -1,8 +1,18 @@
div.uwt-window div.uwt-window
{ {
position: fixed;
&> div.uwt-header &> div.uwt-header
{ {
-moz-user-select: none; -moz-user-select: none;
&> div.uwt-controlbox
{
float: right;
}
}
&> div.uwt-footer
{
text-align: right;
} }
&.uwt-footer-hidden > div.uwt-footer &.uwt-footer-hidden > div.uwt-footer

View File

@ -48,6 +48,8 @@
@import "uwt-window.less"; @import "uwt-window.less";
@import "uwt-wunderbar.less"; @import "uwt-wunderbar.less";
@import "mobile/uwt.less";
@import "../fonts/awesome/css/all.min.less"; @import "../fonts/awesome/css/all.min.less";
html html

View File

@ -0,0 +1,25 @@
.uwt-button:not(.uwt-toolbar > .uwt-button)
{
background-color: #9c6516;
border-color: #804b00;
border-radius: 24px;
color: #ffffff;
&:hover
{
background-color: #dea147;
border-color: #9c6516;
}
}
.uwt-toolbar > .uwt-button
{
&:hover
{
background-color: #efc381;
border-color: #9c6516;
}
&:active, &.uwt-selected
{
background-color: #dea147;
border-color: #9c6516;
}
}

View File

@ -0,0 +1,145 @@
div.mcx-instancebrowser
{
&> ul
{
list-style-type: none;
margin: 0px;
padding: 0px;
}
}
/*
div.mcx-instancebrowser
{
display: inline-block;
position: relative;
&:not(.mcx-display-as-count):not(.mcx-editable).mcx-empty
{
&::after
{
content: "(empty)";
color: #aaaaaa;
}
}
&:not(.mcx-editable) > input
{
display: none;
}
&> input
{
&:not(:focus)
{
cursor: default;
}
}
&.mcx-editable
{
&> input
{
padding-right: 32px;
}
&::before
{
content: "\f0c9";
position: absolute;
right: 10px;
top: 7px;
pointer-events: none;
font-family: FontAwesome;
font-size: 16px;
color: #999;
}
&> ul
{
border: solid 1px #ccc;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
margin-top: -1px;
padding: 4px;
}
}
&.mcx-editable:hover::before, &.mcx-active::before
{
color: #00ACAC;
}
&> ul
{
margin: 0px;
padding: 0px;
&> li
{
list-style-type: none;
&+ li
{
padding-top: 8px;
}
&> a.mcx-count-link
{
cursor: pointer;
&::after
{
content: "\f0d7";
font-family: "FontAwesome";
padding-left: 4px;
}
}
}
}
&> div.uwt-popup > div.uwt-dropdown-content > ul.uwt-menu
{
width: max-content;
min-width: 100%;
max-width: 400px;
&> li
{
&> a
{
&> span.uwt-subtitle, &> span.uwt-content
{
display: none;
}
}
}
}
&:not(.uwt-loading) > div.uwt-popup > div.uwt-spinner
{
display: none;
}
&.uwt-loading > div.uwt-popup > div.uwt-dropdown-content
{
display: none;
}
}
div.apb-preview.uwt-collapsed
{
height: 10px;
overflow: hidden;
&> div.apb-actions, &> div.apb-content > div > div.uwt-content
{
visibility: hidden;
}
&> div.apb-content > div > div.apb-title
{
position: absolute;
left: 4px;
top: 0px;
&> h1, h2
{
display: inline-block;
font-size: 16pt;
font-weight: bold;
margin: 0px;
margin-right: 8px;
}
}
}
*/

View File

@ -1,3 +1,5 @@
@import "mcx-colors.less";
@import "mcx-instancebrowser.less";
html html
{ {
@ -80,6 +82,9 @@ div.mocha-ams-spot-popup
text-align: center; text-align: center;
z-index: 5000; z-index: 5000;
position: fixed;
top: 0px;
&> h1 &> h1
{ {
font-weight: 600; font-weight: 600;
@ -210,28 +215,44 @@ div.mcx-element
font-weight: normal; font-weight: normal;
} }
.uwt-button:not(.uwt-toolbar > .uwt-button)
// these styles override the previous ones earlier defined
div.mcx-element
{ {
background-color: #9c6516 !important; display: block;
border-color: #804b00 !important; }
border-radius: 24px !important; div.mcx-element > label, div.mcx-elementcontent > label
color: #ffffff !important; {
&:hover display: table-cell;
padding: 8px;
padding-right: 32px;
}
div.mcx-elementcontent
{
&:not(.uwt-listview-item-column)
{ {
background-color: #dea147 !important; display: table-row;
border-color: #9c6516 !important; }
&.uwt-listview-item-column
{
display: table-cell;
}
&.mcx-hidden-label
{
display: block;
&> label
{
display: none;
}
} }
} }
.uwt-toolbar > .uwt-button
div.mcx-moniker > span.apb-text:empty::after
{ {
&:hover display: inline-block;
{ font-weight: bold;
background-color: #efc381 !important; content: "\f002";
border-color: #9c6516 !important; font-family: var(--fa-style-family,"Font Awesome 6 Pro");
}
&:active, &.uwt-selected
{
background-color: #dea147 !important;
border-color: #9c6516 !important;
}
} }

View File

@ -0,0 +1,33 @@
.uwt-button
{
border: 1px solid #ccc;
border-radius: 3px;
font-weight: bold;
padding: 4px 8px;
/* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#ffffff+0,f1f1f3+100 */
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f1f1f3 100%); /* FF3.6-15 */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#f1f1f3)); /* Chrome4-9,Safari4-5 */
background: -webkit-linear-gradient(top, #ffffff 0%,#f1f1f3 100%); /* Chrome10-25,Safari5.1-6 */
background: -o-linear-gradient(top, #ffffff 0%,#f1f1f3 100%); /* Opera 11.10-11.50 */
background: -ms-linear-gradient(top, #ffffff 0%,#f1f1f3 100%); /* IE10 preview */
background: linear-gradient(to bottom, #ffffff 0%,#f1f1f3 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f1f1f3',GradientType=0 ); /* IE6-9 */
&.uwt-color-success
{
border-color: #719a56;
/* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#9acd70+0,8cc759+49,87c651+51,78bf45+100 */
background: #9acd70; /* Old browsers */
background: -moz-linear-gradient(top, #9acd70 0%, #8cc759 49%, #87c651 51%, #78bf45 100%); /* FF3.6-15 */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9acd70), color-stop(49%,#8cc759), color-stop(51%,#87c651), color-stop(100%,#78bf45)); /* Chrome4-9,Safari4-5 */
background: -webkit-linear-gradient(top, #9acd70 0%,#8cc759 49%,#87c651 51%,#78bf45 100%); /* Chrome10-25,Safari5.1-6 */
background: -o-linear-gradient(top, #9acd70 0%,#8cc759 49%,#87c651 51%,#78bf45 100%); /* Opera 11.10-11.50 */
background: -ms-linear-gradient(top, #9acd70 0%,#8cc759 49%,#87c651 51%,#78bf45 100%); /* IE10 preview */
background: linear-gradient(to bottom, #9acd70 0%,#8cc759 49%,#87c651 51%,#78bf45 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9acd70', endColorstr='#78bf45',GradientType=0 ); /* IE6-9 */
}
}

View File

@ -0,0 +1,7 @@
@import "Fonts/SourceSansPro/SourceSansPro.css";
@import "../common/styles/uwt.less";
@import "uwt-button.less";
@import "../common/styles/mochahacks.less";

View File

@ -4,6 +4,9 @@
<Scripts> <Scripts>
<Script ContentType="text/javascript" FileName="~/scripts/spot_timer.js" /> <Script ContentType="text/javascript" FileName="~/scripts/spot_timer.js" />
</Scripts> </Scripts>
<StyleSheets>
<StyleSheet ContentType="text/css" FileName="~~/themes/mocha/theme.css" />
</StyleSheets>
<References> <References>
<Reference TagPrefix="html" NamespacePath="Phast\HTMLControls" /> <Reference TagPrefix="html" NamespacePath="Phast\HTMLControls" />
<Reference TagPrefix="wcx" NamespacePath="Phast\WebControls" /> <Reference TagPrefix="wcx" NamespacePath="Phast\WebControls" />

View File

@ -1,6 +1,7 @@
<?php <?php
namespace Mocha\UI\MasterPages; namespace Mocha\UI\MasterPages;
use Phast\CancelEventArgs;
use Phast\RenderedEventArgs; use Phast\RenderedEventArgs;
use Phast\RenderingEventArgs; use Phast\RenderingEventArgs;
use Phast\RenderMode; use Phast\RenderMode;
@ -9,12 +10,50 @@
class BlankMasterPage extends WebPage class BlankMasterPage extends WebPage
{ {
public $RequireLogin;
public function __construct()
{
parent::__construct();
$this->RequireLogin = true;
}
protected function OnPreRender(CancelEventArgs $e)
{
/**
* @var \Mocha\Oms\MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$path = System::GetVirtualPath();
$currentUser = mocha_get_current_user();
$page = null;
$pathVars = null;
System::ParsePathVariablesIntoPage($page, $pathVars);
if ($currentUser === null)
{
if ($page != null)
{
if ($page->MasterPage->ClassReference->RequireLogin) // requiresLogin($page->FileName))
{
// echo($page->FileName);
$_SESSION["login_return"] = $path;
System::RedirectToLoginPage(true);
$e->Cancel = true;
}
}
}
return true;
}
protected function OnRendering(RenderingEventArgs $re) protected function OnRendering(RenderingEventArgs $re)
{ {
if ($re->RenderMode === RenderMode::Complete) if ($re->RenderMode === RenderMode::Complete)
{ {
echo("<!DOCTYPE html>"); echo("<!DOCTYPE html>");
echo("<html xmlns=\"http:http://www.w3.org/1999/xhtml\">"); echo("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
} }
} }

View File

@ -0,0 +1,17 @@
<Website>
<MasterPages>
<MasterPage FileName="masterPages/Blank2.phpx" CodeBehindClassName="Mocha\UI\MasterPages\BlankMasterPage2">
<Scripts>
<Script ContentType="text/javascript" FileName="~/scripts/spot_timer.js" />
</Scripts>
<References>
<Reference TagPrefix="html" NamespacePath="Phast\HTMLControls" />
<Reference TagPrefix="wcx" NamespacePath="Phast\WebControls" />
</References>
<Content>
<wcx:SectionPlaceholder ID="aspcContent">
</wcx:SectionPlaceholder>
</Content>
</MasterPage>
</MasterPages>
</Website>

View File

@ -0,0 +1,31 @@
<?php
namespace Mocha\UI\MasterPages;
use Phast\CancelEventArgs;
use Phast\RenderedEventArgs;
use Phast\RenderingEventArgs;
use Phast\RenderMode;
use Phast\System;
use Phast\WebPage;
class BlankMasterPage2 extends WebPage
{
protected function OnRendering(RenderingEventArgs $re)
{
if ($re->RenderMode === RenderMode::Complete)
{
echo("<!DOCTYPE html>");
echo("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
}
}
protected function OnRendered(RenderedEventArgs $e)
{
if ($e->RenderMode === RenderMode::Complete)
{
echo("</html>");
}
}
}
?>

View File

@ -29,6 +29,8 @@
*/ */
$oms = mocha_get_oms(); $oms = mocha_get_oms();
mocha_init_spot_timer($this->Page);
$context = new OmsContext(); $context = new OmsContext();
$renderer = new HTMLRenderer($context); $renderer = new HTMLRenderer($context);

View File

@ -3,6 +3,7 @@
namespace Mocha\UI\Pages; namespace Mocha\UI\Pages;
use Mocha\Core\InstanceKey; use Mocha\Core\InstanceKey;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownRelationshipGuids; use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext; use Mocha\Core\OmsContext;
@ -24,10 +25,10 @@
*/ */
$oms = mocha_get_oms(); $oms = mocha_get_oms();
mocha_init_spot_timer($this); mocha_init_spot_timer($this->Page);
$instIdCtl = $this->GetControlByID("instId"); $instIdCtl = $this->Page->GetControlByID("instId");
$castIdCtl = $this->GetControlByID("castId"); $castIdCtl = $this->Page->GetControlByID("castId");
$instkey = InstanceKey::Parse($this->Page->GetPathVariableValue("instid")); $instkey = InstanceKey::Parse($this->Page->GetPathVariableValue("instid"));
@ -66,6 +67,8 @@
{ {
$context = new OmsContext(); $context = new OmsContext();
$context->setWorkData(KnownInstanceGuids::WorkSet__RelatedInstance, $inst);
$taskRenderer = new HTMLRenderer($context); $taskRenderer = new HTMLRenderer($context);
$taskRenderer->TargetInstance = $inst; $taskRenderer->TargetInstance = $inst;
$taskRenderer->IsPostback = $this->Page->IsPostback; $taskRenderer->IsPostback = $this->Page->IsPostback;

View File

@ -1,6 +1,6 @@
<Website> <Website>
<Pages> <Pages>
<Page MasterPageFileName="masterPages/Blank.phpx" FileName="invalid-url"> <Page MasterPageFileName="masterPages/Blank.phpx" FileName="invalid-url" CodeBehindClassName="Mocha\UI\Pages\InvalidURLPage">
<References> <References>
<Reference TagPrefix="html" NamespacePath="Phast\HTMLControls" /> <Reference TagPrefix="html" NamespacePath="Phast\HTMLControls" />
<Reference TagPrefix="wcx" NamespacePath="Phast\WebControls" /> <Reference TagPrefix="wcx" NamespacePath="Phast\WebControls" />

View File

@ -0,0 +1,18 @@
<?php
namespace Mocha\UI\Pages;
use Phast\CancelEventArgs;
use Phast\WebPage;
class InvalidURLPage extends WebPage
{
protected function OnInitializing(CancelEventArgs $re)
{
$this->Page->MasterPage->ClassReference->RequireLogin = false;
return true;
}
}
?>

View File

@ -10,6 +10,8 @@
use Mocha\Core\OmsContext; use Mocha\Core\OmsContext;
use Mocha\UI\Renderers\HTML\HTMLRenderer; use Mocha\UI\Renderers\HTML\HTMLRenderer;
use Phast\CancelEventArgs;
use Phast\EventArgs;
use Phast\RenderingEventArgs; use Phast\RenderingEventArgs;
use Phast\System; use Phast\System;
use Phast\WebPage; use Phast\WebPage;
@ -17,6 +19,12 @@
use Mocha\Oms\MySQLDatabaseOms; use Mocha\Oms\MySQLDatabaseOms;
class LoginPage extends WebPage class LoginPage extends WebPage
{ {
protected function OnInitializing(CancelEventArgs $e)
{
$this->Page->MasterPage->ClassReference->RequireLogin = false;
return true;
}
/** /**
* Thanks https://stackoverflow.com/a/31107425 * Thanks https://stackoverflow.com/a/31107425
* *
@ -52,13 +60,13 @@
protected function OnRendering(RenderingEventArgs $re) protected function OnRendering(RenderingEventArgs $re)
{ {
parent::OnRendering($re); parent::OnRendering($re);
/** /**
* @var MySQLDatabaseOms * @var MySQLDatabaseOms
*/ */
$oms = mocha_get_oms(); $oms = mocha_get_oms();
mocha_init_spot_timer($this); //mocha_init_spot_timer($this);
$path = System::GetVirtualPath(); $path = System::GetVirtualPath();
$tenantName = ""; $tenantName = "";
@ -132,8 +140,8 @@
$oms->setAttributeValue($instLogin, KnownAttributeGuids::IPAddress, $_SERVER["REMOTE_ADDR"]); $oms->setAttributeValue($instLogin, KnownAttributeGuids::IPAddress, $_SERVER["REMOTE_ADDR"]);
$oms->assignRelationship($instLogin, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User), $instUser); $oms->assignRelationship($instLogin, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User), $instUser);
} }
$_SESSION["user_token_" . $oms->getTenant()->ID] = $token; $_SESSION["user_token_" . $oms->getTenant()->ID] = $token;
System::RedirectFromLoginPage(); System::RedirectFromLoginPage();
exit(); exit();
} }

View File

@ -2,8 +2,13 @@
namespace Mocha\UI\Pages; namespace Mocha\UI\Pages;
use Mocha\Core\InstanceKey; use Mocha\Core\InstanceKey;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownRelationshipGuids;
use Phast\CancelEventArgs; use Phast\CancelEventArgs;
use Phast\EventArgs;
use Phast\QuickSort;
use Phast\RenderingEventArgs; use Phast\RenderingEventArgs;
use Phast\System;
use Phast\WebPage; use Phast\WebPage;
class RelatedTaskListPageAPI extends WebPage class RelatedTaskListPageAPI extends WebPage
@ -11,6 +16,54 @@
protected function OnInitializing(CancelEventArgs $e) protected function OnInitializing(CancelEventArgs $e)
{ {
$this->Page->ContentType = "application/json"; $this->Page->ContentType = "application/json";
$this->Page->MasterPage->ClassReference->RequireLogin = false;
return true;
}
private function createRelatedTask(InstanceReference $inst, InstanceReference $task)
{
/** @var \Mocha\Oms\MySQLDatabaseOMS */
$oms = mocha_get_oms();
$label = $oms->getInstanceText($task);
$json = array
(
"widget" => "relatedTaskGroup",
"tasks" => array
(
array
(
"widget" => "relatedTask",
"uri" => System::ExpandRelativePath("~/d/inst/" . $inst->InstanceKey . "/rel-task/" . $task->InstanceKey . ".htmld"),
"view" => true,
"webService" => false,
"iid" => $task->InstanceKey->__toString(),
"label" => $label
)
)
);
return $json;
}
private function createTaskGroup($name, $taskGroup)
{
$json = array
(
"widget" => "relatedTaskGroup",
"renderDifferently" => false,
"taskGroups" => array
(
array
(
"widget" => "relatedTaskGroup",
"label" => $name,
"renderDifferently" => false,
"taskGroups" => $taskGroup
)
)
);
return $json;
} }
protected function OnRendering(RenderingEventArgs $re) protected function OnRendering(RenderingEventArgs $re)
@ -18,51 +71,58 @@
/** @var \Mocha\Oms\MySQLDatabaseOMS */ /** @var \Mocha\Oms\MySQLDatabaseOMS */
$oms = mocha_get_oms(); $oms = mocha_get_oms();
if ($oms->getCurrentUser() === null)
{
$json = array
(
"result" => "failure",
"responseCode" => 403,
"responseText" => "Forbidden",
"title" => "Not Authorized",
"message" => "Please log in to perform this action"
);
echo (json_encode($json));
$re->Handled = true;
return true;
}
$tenant = $this->Page->GetPathVariableValue("tenant"); $tenant = $this->Page->GetPathVariableValue("tenant");
$iid = $this->Page->GetPathVariableValue("instid"); $iid = $this->Page->GetPathVariableValue("instid");
$inst = $oms->getInstanceByKey(InstanceKey::Parse($iid)); $inst = $oms->getInstanceByKey(InstanceKey::Parse($iid));
$instParent = $oms->getParentClass($inst); $instParent = $oms->getParentClass($inst);
$tasks = $oms->getRelatedTasks($inst);
$taskGroupsDefs = [ ];
$names = [ ];
foreach ($tasks as $task)
{
$taskCategory = $oms->getRelatedInstance($task, KnownRelationshipGuids::Task__has__Task_Category);
$name = $oms->getInstanceText($taskCategory);
if (!in_array($name, $names))
{
$names[] = $name;
}
if (!array_key_exists($name, $taskGroupsDefs))
{
$taskGroupsDefs[$name] = array();
}
$taskGroupsDefs[$name][] = $this->createRelatedTask($inst, $task);
}
natsort($names);
$taskGroups = [ ];
foreach ($names as $name)
{
$taskGroups[] = $this->createTaskGroup($name, $taskGroupsDefs[$name]);
}
$json = array $json = array
( (
"result" => "success",
"widget" => "relatedTasks", "widget" => "relatedTasks",
"taskGroups" => array "taskGroups" => $taskGroups,
(
array
(
"widget" => "relatedTaskGroup",
"renderDifferently" => false,
"taskGroups" => array
(
array
(
"widget" => "relatedTaskGroup",
"label" => "Preferences",
"renderDifferently" => false,
"taskGroups" => array
(
array
(
"widget" => "relatedTaskGroup",
"tasks" => array
(
array
(
"widget" => "relatedTask",
"uri" => "",
"view" => true,
"webService" => false,
"iid" => "192$1080",
"label" => "Hello World"
)
)
)
)
)
)
)
),
"instance" => array "instance" => array
( (
"instanceId" => strval($inst->InstanceKey), "instanceId" => strval($inst->InstanceKey),
@ -70,6 +130,8 @@
"title" => $oms->getInstanceText($inst) "title" => $oms->getInstanceText($inst)
) )
); );
$json["result"] = "success";
echo(json_encode($json)); echo(json_encode($json));
$re->Handled = true; $re->Handled = true;
} }

View File

@ -11,10 +11,10 @@
{ {
parent::OnRendering($re); parent::OnRendering($re);
mocha_init_spot_timer($this); //mocha_init_spot_timer($this->Page);
$instIdCtl = $this->GetControlByID("instId"); $instIdCtl = $this->Page->GetControlByID("instId");
$taskInstIdCtl = $this->GetControlByID("taskInstId"); $taskInstIdCtl = $this->Page->GetControlByID("taskInstId");
$instIdCtl->Content = $this->Page->GetPathVariableValue("instid"); $instIdCtl->Content = $this->Page->GetPathVariableValue("instid");
$taskInstIdCtl->Content = $this->Page->GetPathVariableValue("reltaskid"); $taskInstIdCtl->Content = $this->Page->GetPathVariableValue("reltaskid");

View File

@ -1,6 +1,6 @@
<Website> <Website>
<Pages> <Pages>
<Page FileName="suv/suvinfo.html" CodeBehindClassName="Mocha\UI\Pages\SUVPage" /> <Page MasterPageFileName="masterPages/Blank2.phpx" FileName="suv/suvinfo.html" CodeBehindClassName="Mocha\UI\Pages\SUVPage" />
<Page FileName="suv/phpinfo.html" CodeBehindClassName="Mocha\UI\Pages\SUVPage" /> <Page FileName="suv/phpinfo.html" CodeBehindClassName="Mocha\UI\Pages\SUVPage" />
</Pages> </Pages>
</Website> </Website>

View File

@ -8,10 +8,8 @@
class SUVPage extends WebPage class SUVPage extends WebPage
{ {
protected function OnRendering(RenderingEventArgs $re) protected function RenderContents()
{ {
parent::OnRendering($re);
$path = System::GetVirtualPath(); $path = System::GetVirtualPath();
$tenantName = null; $tenantName = null;
@ -27,27 +25,29 @@
<div class="uwt-panel"> <div class="uwt-panel">
<div class="uwt-content"> <div class="uwt-content">
<table class="uwt-listview"> <table class="uwt-listview">
<tr> <thead>
<th>Property</th> <tr>
<th>Value</th> <th>Property</th>
</tr> <th>Value</th>
<tr> </tr>
<td>Name</td> </thead>
<td>suv</td> <tbody>
</tr> <tr>
<tr> <td>Name</td>
<td>Instance Id</td> <td>suv</td>
<td><?php echo($_SERVER["SERVERNAME"]); ?></td> </tr>
</tr> <tr>
<td>Instance Id</td>
<td><?php echo($_SERVER["SERVERNAME"]); ?></td>
</tr>
</tbody>
</table> </table>
<h3>Actions</h3> <h3>Actions</h3>
<button>SUV Logs</button> <button class="uwt-button uwt-color-primary">SUV Logs</button>
</div> </div>
</div> </div>
<?php <?php
} }
$re->Cancel = true;
} }
} }

View File

@ -0,0 +1,5 @@
<Website>
<Pages>
<Page MasterPageFileName="masterPages/Blank.phpx" FileName="{tenant}/d/search.htmld" CodeBehindClassName="Mocha\UI\Pages\SearchPage" />
</Pages>
</Website>

View File

@ -0,0 +1,19 @@
<?php
namespace Mocha\UI\Pages;
use Phast\RenderingEventArgs;
use Phast\System;
use Phast\WebPage;
class SearchPage extends WebPage
{
protected function RenderContents()
{
?>
<h1>Search Results</h1>
<?php
}
}
?>

View File

@ -27,6 +27,6 @@ BEGIN
AND mocha_relationships.source_inst_id = p_src_inst_id AND mocha_relationships.source_inst_id = p_src_inst_id
AND mocha_relationships.relationship_inst_id = p_rel_inst_id AND mocha_relationships.relationship_inst_id = p_rel_inst_id
AND mocha_relationships.effective_date <= z_effective_date AND mocha_relationships.effective_date <= z_effective_date
ORDER BY mocha_relationships.effective_date, mocha_instances.class_id, mocha_instances.inst_id ASC; ORDER BY mocha_relationships.effective_date ASC;
END; END;