massive update

This commit is contained in:
Michael Becker 2023-12-19 20:56:26 -05:00
parent 306bd49cd4
commit 5d5202f185
99 changed files with 2795 additions and 663 deletions

View File

@ -6,3 +6,10 @@ class Guid:
def get_value(self) -> str:
return self.value
@staticmethod
def create():
from uuid import uuid4
u = uuid4()
g = Guid(str(u))
return g

View File

@ -26,7 +26,7 @@ class MochaLibraryManager:
def commit(self):
for (class_gid, inst_gid, classIndex, index) in self._instances:
op = PrepareInstanceOperation(Guid(inst_gid), classIndex, index)
op = PrepareInstanceOperation(Guid(class_gid), Guid(inst_gid), classIndex, index)
op.execute(self.db)
for op in self._operations:
@ -34,9 +34,23 @@ class MochaLibraryManager:
for op in self._relOps:
op.execute(self.db)
hasSiblingRelationships = dict()
for op in self._relOps:
if op.relationshipInstanceId.get_value() == "{656110FF-4502-48B8-A7F3-D07F017AEA3F}":
# Relationship.has sibling Relationship
hasSiblingRelationships[op.instanceId.get_value()] = op.targetInstanceId
for op in self._relOps:
if op.relationshipInstanceId.get_value() in hasSiblingRelationships:
siblingOp = AssignRelationshipOperation(op.targetInstanceId, hasSiblingRelationships[op.relationshipInstanceId.get_value()], op.instanceId)
print ("assigning sibling relationship " + siblingOp.instanceId.get_value() + " . " + siblingOp.relationshipInstanceId.get_value() + " = " + siblingOp.instanceId.get_value() + "\n")
siblingOp.execute(self.db)
cur = self.db.cursor()
cur.execute("SELECT * FROM mocha_instances")
rows = cur.fetchall()
# cur.execute("UPDATE mocha_instances SET user_inst_id = mocha_get_instance_by_global_identifier(mocha_normalize_uuid('{B066A54B-B160-4510-A805-436D3F90C2E6}'))")
cur.execute("UPDATE mocha_attributes SET usr_inst_id = mocha_get_instance_by_global_identifier(mocha_normalize_uuid('{B066A54B-B160-4510-A805-436D3F90C2E6}'))")
cur.execute("UPDATE mocha_relationships SET user_inst_id = mocha_get_instance_by_global_identifier(mocha_normalize_uuid('{B066A54B-B160-4510-A805-436D3F90C2E6}'))")
# rows = cur.fetchall()
# print(rows)
# print ("ok , applying `Class.has Instance`...")
@ -85,40 +99,7 @@ class MochaLibraryManager:
cur = self.db.cursor()
cur.execute("CALL mocha_release_tenant()")
self.print_error(cur)
def create_instance(self, instanceGlobalId : Guid, classIndex : int, instanceIndex : int):
#self._operations.append(CreateInstanceOperation(instanceGlobalId, classIndex, instanceIndex))
# cur = self.db.cursor()
# strInstanceGlobalId = "NULL"
# if instanceGlobalId != None:
# strInstanceGlobalId = "mocha_normalize_uuid('" + instanceGlobalId + "')"
# query = "CALL mocha_create_instance(" + strInstanceGlobalId + ", " + str(classIndex) + ", " + str(instanceIndex) + ", NULL, NULL, @q_assigned_inst_id)"
# print(query)
# cur.execute(query)
# self.print_error(cur)
pass
def create_class(self, instanceGlobalId : Guid, classIndex):
#self._operations.append(CreateClassOperation(instanceGlobalId, classIndex))
pass
def create_instance_of(self, classGlobalId : Guid, instanceGlobalId : Guid, classIndex : int, instanceIndex : int):
pass
#self._operations.append(CreateInstanceOperation(instanceGlobalId, classIndex, instanceIndex))
# cur = self.db.cursor()
# strInstanceGlobalId = "NULL"
# if instanceGlobalId != None:
# strInstanceGlobalId = "mocha_normalize_uuid('" + instanceGlobalId + "')"
# query = "CALL mocha_create_instance_of(mocha_get_instance_by_global_identifier('" + classGlobalId + "'), " + strInstanceGlobalId + ", NULL, NULL, @q_assigned_inst_id)"
# print(query)
# cur.execute(query)
# self.print_error(cur)
def assign_relationship(self, instanceId : Guid, relationshipInstanceId : Guid, targetInstanceId : Guid):
print("-- assigning relationship " + relationshipInstanceId.get_value() + " = '" + targetInstanceId.get_value() + "'")
self._relOps.append(AssignRelationshipOperation(instanceId, relationshipInstanceId, targetInstanceId))

View File

@ -69,6 +69,10 @@ class YAMLLibraryParser (LibraryParser):
(parentCreatorKey, parentInstanceId) = self.find_custom_tag_name(template)
(creatorKey, instanceId) = self.find_custom_tag_name(elem)
self.apply_template(elem, template, instanceId)
def apply_template(self, elem, template, instanceId):
if "attributes" in template:
attrs = template["attributes"]
if isinstance(attrs, list):
@ -83,6 +87,12 @@ class YAMLLibraryParser (LibraryParser):
if "relationships" in template:
rels = template["relationships"]
for rel in rels:
if "instance" in rel:
rel_iid = rel["instance"] # the globalId of the relationship instance
else:
print("no relationship instance specified for relationship sugar")
continue
if "customTagName" in rel:
customTagName = rel["customTagName"]
if customTagName in elem:
@ -96,36 +106,46 @@ class YAMLLibraryParser (LibraryParser):
if relinst_key is not None:
# for example, 'relinst_key' is 'elementContent' and 'relinst_iid' is '{8ECA14A4...}'
if "instance" in rel:
rel_iid = rel["instance"] # the globalId of the relationship instance
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("no relationship instance specified for relationship sugar")
else:
print("HELLO!!! NO RELATIONSHIP SUGAR!!! CREATE THE INSTANCE!!!")
else:
# 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)
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:
print("no relationship instance specified for relationship sugar")
# 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
self.apply_template(elem, createsInstanceOfTemplate, globalIdentifier)
def get_instance_sugar_for_elem(self, elem):
@ -191,7 +211,11 @@ class YAMLLibraryParser (LibraryParser):
instanceId = None
creatorKey = None
if "instance" in elem:
instanceId = Guid(self.manager.expand_entity_references(elem["instance"]))
if "templateOnly" in elem and elem["templateOnly"] == True:
instanceId = None
else:
instanceId = Guid(self.manager.expand_entity_references(elem["instance"]))
creatorKey = 'instance'
else:
for key in self.yamlIds:
@ -213,7 +237,7 @@ class YAMLLibraryParser (LibraryParser):
if instanceId is not None:
self.manager.add_instance(classId, instanceId, classIndex, index)
if creatorKey == 'class':
if creatorKey == 'class': #FIXME: remove this special-case behavior
print("creating class " + instanceId.get_value())
# assign relationship `Instance.for Class`

View File

@ -5,7 +5,8 @@ from ..SQLFunctionCall import SQLFunctionCall
class PrepareInstanceOperation(StoredProcedureOperation):
def __init__(self, globalIdentifier : Guid, classIndex : int, instanceIndex : int):
def __init__(self, classGlobalIdentifier : Guid, globalIdentifier : Guid, classIndex : int, instanceIndex : int):
self.classGlobalIdentifier = classGlobalIdentifier
self.globalIdentifier = globalIdentifier
self.classIndex = classIndex
self.instanceIndex = instanceIndex
@ -20,14 +21,16 @@ class PrepareInstanceOperation(StoredProcedureOperation):
if self.globalIdentifier is not None:
globalId = self.globalIdentifier
classGlobalId = None
if self.classGlobalIdentifier is not None:
classGlobalId = self.classGlobalIdentifier
strCid = None
if self.classIndex is not None:
strCid = self.classIndex
else:
strCid = 1
strIid = None
if self.instanceIndex is not None:
strIid = self.instanceIndex
return [strCid, strIid, globalId, None, None, SQLParameter("p_assigned_inst_id")]
return [strCid, strIid, classGlobalId, globalId, None, None, SQLParameter("p_assigned_inst_id")]

View File

@ -64,6 +64,11 @@ elif [ "$1" == "tenant" ]; then
$MOCHA_MYSQL -e "CALL mocha_create_tenant('$3', NULL)"
$MOCHA_MYSQL -e "CALL mocha_build_tenant_from_template(mocha_get_tenant_by_name('$3'), 1);"
OLDTENANT=$(mocha oms tenant)
mocha oms tenant select $3
mocha oms install library /usr/share/mocha/libraries/net.alcetech.Mocha.System/
mocha oms tenant select $OLDTENANT
elif [ "$2" == "delete" ]; then
@ -99,6 +104,12 @@ elif [ "$1" == "tenant" ]; then
rm ~/.config/mocha/tenant
echo "current tenant: (none)"
elif [ "$2" == "" ]; then
if [ -f ~/.config/mocha/tenant ]; then
echo $(cat ~/.config/mocha/tenant)
fi
fi
elif [ "$1" == "user" ]; then
@ -275,18 +286,25 @@ elif [ "$1" == "attribute" ]; then
elif [ "$2" == "get" ]; then
if [ "$3" == "by-gid" ]; then
if [ "$4" == "for" ]; then
# thanks https://stackoverflow.com/a/911213
if [ -t 1 ]; then
ATT_ID=$3
INST_ID=$5
$MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "SELECT * FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');" -e "CALL mocha_release_tenant();"
$MOCHA_MYSQL -N -s -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "CALL mocha_get_attribute_value($INST_ID, $ATT_ID, NULL);" -e "CALL mocha_release_tenant();"
fi
else
elif [ "$2" == "set" ]; then
$MOCHA_MYSQL -N -e "SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_tenant_by_name('$CURRENT_TENANT') AND global_identifier = mocha_normalize_uuid('$4');"
if [ "$4" == "for" ]; then
fi
ATT_ID=$3
INST_ID=$5
ATT_VALUE=$6
$MOCHA_MYSQL -e "CALL mocha_select_tenant(mocha_get_tenant_by_name('$CURRENT_TENANT'));" -e "CALL mocha_set_attribute_value($INST_ID, $ATT_ID, '$ATT_VALUE', NULL, NULL);" -e "CALL mocha_release_tenant();"
fi
fi

View File

@ -220,9 +220,9 @@ Vagrant.configure("2") do |config|
SHELL
end
config.trigger.after :up do |trigger|
trigger.info = "Open newly provisioned SUV in firefox"
trigger.run = {inline: "bash -c 'firefox https://@@MOCHA_SUV_HOSTNAME@@/super/d/home.htmld' &"}
end
#config.trigger.after :up do |trigger|
# trigger.info = "Open newly provisioned SUV in firefox"
# trigger.run = {inline: "bash -c 'firefox https://@@MOCHA_SUV_HOSTNAME@@/super/d/home.htmld' &"}
#end
end

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.6 KiB

9
common/images/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1 @@
- IDI_Module_MochaPowered_VehiclesForHire: '{bb1d56b4-c063-4232-a789-93c8419e2d31}'

View File

@ -0,0 +1 @@
- module: '&IDI_Module_MochaPowered_VehiclesForHire;'

View File

@ -0,0 +1,2 @@
- module: '&IDI_Module_MochaPowered_VehiclesForHire;'
defaultObjectSource: '&IDI_ObjectSource_Delivered;'

View File

@ -0,0 +1,2 @@
- entityDefinitions:
- IDI_Person_BrookeTrevino: ''

View File

@ -18,6 +18,16 @@
- IDC_Element: '{91929595-3dbd-4eae-8add-6120a49797c7}'
- IDC_ElementContent: '{f85d4f5e-c69f-4498-9913-7a8554e233a4}'
- IDC_Person: '{d3f2529d-6daf-4789-93da-8be5348d3aec}'
- IDC_BEMProcess: '{a4c5ffb4-bf37-49f3-9190-dc329d035b46}'
- IDBEM_1: '{8c625250-5c11-44d8-8002-80217e220137}'
- IDC_Layout: '{e10e5978-0943-4971-89ba-ef9932fb3769}'
- IDC_GroupLayout: '{108605af-c20d-42eb-af4f-35b2ff701921}'
- IDC_ButtonLayout: '{6f6338db-68e0-4cc7-b257-d1b97cf3cb92}'
- IDC_ImageLayout: '{4b1bb7c6-168e-4ce0-b4f8-76dd5069a80b}'
- IDC_Language: '{61102B47-9B2F-4CF3-9840-D168B84CF1E5}'
- IDC_Translation: '{04A53CC8-3206-4A97-99C5-464DB8CAA6E6}'
- IDC_TranslationValue: '{6D38E757-EC18-43AD-9C35-D15BB446C0E1}'
@ -80,12 +90,21 @@
- IDC_TaskCategory: '{e8d8060f-a20c-442f-8384-03488b63247f}'
- IDC_Task: '{D4F2564B-2D11-4A5C-8AA9-AF52D4EACC13}'
- IDC_HardcodedTask: '{df1fe350-7670-47d9-91a0-16dafdfbf98d}'
- IDC_SequenceTask: '{2dfd0c4b-3bc7-4fa3-b369-61441f94e88a}'
- IDC_ConvenienceTask: '{83e67c9e-c36b-4275-a35f-e8f60ac4fc44}'
- IDC_RedirectTask: '{170746fc-3ba8-4eb5-b3d9-23813b259e52}'
- IDC_UITask: '{BFD07772-178C-4885-A6CE-C85076C8461C}'
- IDC_SystemTask: '{1db33f14-3010-437c-a37d-594fdb052c52}'
- IDC_ReferencedTask: '{8a02dc7a-b38c-4f44-b05e-21625b08cc2e}'
- IDC_File: '{5D081079-E136-406A-A728-7472937A6E5E}' # {04284dae-2966-4675-b3da-af3cbed745ea}
- IDC_Tenant: '{703F9D65-C584-4D9F-A656-D0E3C247FF1F}'
- IDC_User: '{9C6871C1-9A7F-4A3A-900E-69D1D9E24486}'
- IDC_UserLogin: '{64F4BCDB-38D0-4373-BA30-8AE99AF1A5F7}'
- IDC_UserPreferences: '{d455a1d5-ae47-4d94-ac55-debe5760d682}'
- IDC_MenuItemCommand: '{9D3EDE23-6DB9-4664-9145-ABCBD3A0A2C2}'
- IDC_MenuItemSeparator: '{798DECAB-5119-49D7-B0AD-D4BF45807188}'
@ -96,6 +115,9 @@
- IDC_StyleRule: '{C269A1F3-E014-4230-B78D-38EAF6EA8A81}'
- IDC_StyleClass: '{a725f089-7763-4887-af37-da52358c378c}'
- IDC_Measurement: '{9FAED5A9-040D-4718-92C0-FBE2385F2A97}'
- IDC_MeasurementUnit: '{62693026-B7A0-40B5-92AE-038A2B264F33}'
- IDC_Page: '{D9626359-48E3-4840-A089-CD8DA6731690}'
- IDC_ContainerPageComponent: '{6AD6BD1C-7D1C-4AC9-9642-FEBC61E9D6FF}'
- IDC_ButtonPageComponent: '{F480787D-F51E-498A-8972-72128D808AEB}'
@ -130,3 +152,18 @@
- IDC_OMS: '{1ddf9a56-ebb8-4992-ab68-1820acf6bfc8}'
- IDC_SystemInstanceSetRoutine: '{d17a6d27-da03-4b5d-9256-f67f978f403d}'
- IDI_Tenant_Singleton: '{F2C9D4A9-9EFB-4263-84DB-66A9DA65AD00}'
- IDC_ElementContentTestClass: "{184f60c5-ec07-4003-b13d-ddb171bb2902}"
- IDI_ElementContentTestClass_1: "{b325b8ad-93f9-4aea-987e-8489dbbffa09}"
- IDC_InstanceSource: '{8EE7024D-ED87-4D99-BF21-10E09AF5566D}'
- IDC_ProcessUpdatesMethod: '{91583cc3-6007-40e5-a789-d08c0ff975e6}'
- IDC_ExecuteUpdateMethodBinding: '{b831bdaf-72d8-4585-a9a8-8341ab1005cb}'
- IDC_PUMProcess: '{2cdb2169-7c26-4adb-bc26-e9e75ab1b246}'
- IDC_ProcessRelatedUpdatesMethod: '{6590dd01-6cb9-4440-94b9-d165b9e94a88}'
- IDC_Search: '{7010f26c-df11-4302-a14f-a45b8da28e83}'

View File

@ -4,10 +4,21 @@
- IDA_Verb: '{61345a5d-3397-4a96-8797-8863f03a476c}'
- IDA_Singular: '{F1A06573-C447-4D85-B4E7-54A438C4A960}'
- IDA_Value: '{041DD7FD-2D9C-412B-8B9D-D7125C166FE0}'
- IDA_DisplayID: '{5c54acdd-bd00-4003-96d7-37921b885b1c}'
- IDA_ClassName: '{c7e8d78e-cfac-4dac-ae24-2ac67a0ba9d3}'
- IDA_Expression: '{1289868e-add8-4be0-995b-ea3ba5a4bc87}'
- IDA_ContentType: '{34142FCB-172C-490A-AF03-FF8451D00CAF}' # '{c6bd9f95-c39b-4eb4-b0a9-b8cbd9d6b97d}'
- IDA_Encoding: '{a82f3c46-055e-4e12-9c5d-e40447134389}'
- IDA_Comment: '{a70cbe2b-9e17-45d0-a109-e250b5d500f1}'
- IDA_MethodName: '{de275bb8-5281-48ab-9919-6fa2d790549e}'
- IDA_MaximumLength: '{6d69fee2-f220-4aad-ab89-01bfa491dae1}'
- IDA_MinimumValueNumeric: '{bc90ffdf-9b6e-444a-a484-f9d06d7f3c31}'
- IDA_MaximumValueNumeric: '{b9353b1c-2597-4097-96eb-449a6fafcdab}'
- IDA_Order: '{49423f66-8837-430d-8cac-7892ebdcb1fe}'
- IDA_CSSValue: '{C0DD4A42-F503-4EB3-8034-7C428B1B8803}'
- IDA_RelationshipType: '{71106B12-1934-4834-B0F6-D894637BAEED}'
- IDA_TargetURL: '{970F79A0-9EFE-4E7D-9286-9908C6F06A67}'
- IDA_Label: '{69cdf8af-fcf2-4477-b75d-71593e7dbb22}'
- IDA_UserName: '{960FAF02-5C59-40F7-91A7-20012A99D9ED}'
- IDA_Password: '{f3ef81b9-70c1-4830-a5f1-f567bc2e4f66}'
- IDA_PasswordHash: '{F377FC29-4DF1-4AFB-9643-4191F37A00A9}'

View File

@ -17,6 +17,7 @@
- IDR_Attribute__for__Class: "{FFC8E435-B9F8-4495-8C85-4DDA67F7E2A8}"
- IDR_Class__has_default__Task: "{CF396DAA-75EA-4148-8468-C66A71F2262D}"
- IDR_Task__default_for__Class: "{da4ddf49-1f14-4ba5-a309-e07d8901ce1f}"
- IDR_Class__has_owner__User: "{D1A25625-C90F-4A73-A6F2-AFB530687705}"
- IDR_User__owner_for__Class: "{04DD2E6B-EA57-4840-8DD5-F0AA943C37BB}"
@ -28,7 +29,9 @@
- IDR_Object_Source__for__Class: "{FBB9391D-C4A2-4326-9F85-7801F377253C}"
- IDR_Relationship__has_source__Class: "{7FB5D234-042E-45CB-B11D-AD72F8D45BD3}"
- IDR_Class__source_for__Relationship: "{3de784b9-4561-42f0-946f-b1e90d80029e}"
- IDR_Relationship__has_destination__Class: "{F220F1C2-0499-4E87-A32E-BDBF80C1F8A4}"
- IDR_Class__destination_for__Relationship: "{b5f59216-a1f1-4979-8642-a4845e59daa8}"
- IDR_Relationship__has_sibling__Relationship: "{656110FF-4502-48B8-A7F3-D07F017AEA3F}"
- IDR_Relationship__is_sibling__Relationship: "{FA08B2A4-71E2-44CB-9252-8CE336E2E1AD}"
@ -36,6 +39,9 @@
- IDR_Translation__has__Translation_Value: "{F9B60C00-FF1D-438F-AC74-6EDFA8DD7324}"
- IDR_Translation_Value__has__Language: "{3655AEC2-E2C9-4DDE-8D98-0C4D3CE1E569}"
- IDR_Element_Content__built_from__BEM_Process: '{3d7094ff-33e5-4800-9e4e-93dde0d1d331}'
- IDR_BEM_Process__builds__Element_Content: '{9d3220a3-6919-4ebe-97be-49bb9c304c2d}'
- IDR_String__has__String_Component: "{3B6C4C25-B7BC-4242-8ED1-BA6D01B834BA}"
- IDR_Extract_Single_Instance_String_Component__has__Relationship: "{5E499753-F50F-4A9E-BF53-DC013820499C}"
- IDR_Instance_Attribute_String_Component__has__Attribute: "{E15D4277-69FB-4F19-92DB-8D087F361484}"
@ -55,8 +61,8 @@
- IDR_Task__executes__Method_Call: "{D8C0D4D4-F8C6-4B92-A2C1-8BF16B16203D}"
- IDR_Task__has_preview_action_title__Translation: "{3f65ce02-11dd-4829-a46b-b9ea1b43e56a}"
- IDR_Prompt__has__Report_Field: "{922CCB05-61EA-441D-96E0-63D58231D202}" # 3de784b9-4561-42f0-946f-b1e90d80029e
- IDR_Report_Field__for__Prompt: "{5DED3DB4-6864-45A9-A5FF-8E5A35AD6E6F}" # b5f59216-a1f1-4979-8642-a4845e59daa8
- IDR_Prompt__has__Report_Field: "{922CCB05-61EA-441D-96E0-63D58231D202}"
- IDR_Report_Field__for__Prompt: "{5DED3DB4-6864-45A9-A5FF-8E5A35AD6E6F}"
- IDR_Instance_Prompt__has_valid__Class: "{D5BD754B-F401-4FD8-A707-82684E7E25F0}"
@ -230,6 +236,18 @@
- IDR_Element_Content__has__Instance: "{315b71ba-953d-45fc-87e5-4f0a268242a9}"
- IDR_Instance__for__Element_Content: "{c3959f84-248d-4ede-a3f2-f262917c7b56}"
- IDR_Element_Content__has__Layout: "{1ab74120-05ea-4aca-b6d3-c7e0133e0c4f}"
- IDR_Layout__for__Element_Content: "{efdce6d8-c6aa-4019-a6e4-fff5db1224aa}"
- IDR_Layout__has__Style: '{e684bb26-7e78-4a21-b8b4-5a550f3053d5}'
- IDR_Style__for__Layout: '{7588a2f7-823d-4e00-ae37-10547c8d06e4}'
- IDR_Button_Layout__executes_task_from__Instance_Set: '{04d104fa-a6c4-425e-a6cd-56d847c63e9d}'
- IDR_Instance_Set__has_task_executed_by__Button_Layout: '{c17171be-9d7a-4df9-8903-2b9d5cc26742}'
- IDR_Measurement__has__Measurement_Unit: '{C9720082-1F40-406D-80B7-81C1B690354D}'
- IDR_Measurement_Unit__for__Measurement: '{3117CB16-6860-48B6-8E21-3655A121E695}'
- IDR_Element_Content__has__Element_Content_Display_Option: "{f070dfa7-6260-4488-a779-fae291903f2d}"
- IDR_Element_Content_Display_Option__for__Element_Content: "{12fe7923-b3d2-4152-96c7-a901410b3466}"
@ -261,6 +279,12 @@
- IDR_Style__implements__Style: "{99b1c16a-f2cb-4cc5-a3bb-82a96335aa39}"
- IDR_Style__implemented_for__Style: "{271ef816-1e94-4f02-a805-4f9536c28dca}"
- IDR_Style__has_width__Measurement: "{4930ca87-641a-426d-9d67-cda6d5f22303}"
- IDR_Measurement__width_for__Style: "{304981bc-8747-48e0-8b54-fd7ffa2e1e4e}"
- IDR_Style__has_height__Measurement: "{978e6de0-af73-45a0-bb56-aaf451615b06}"
- IDR_Measurement__height_for__Style: "{ab43f0d4-3099-4f4c-9001-6a1270f6e2fa}"
- IDR_Control_Transaction_Method__processes__Element: "{24bc1dc0-d6cc-44ff-86ba-1360ebd59f3a}"
- IDR_Element__processed_by__Control_Transaction_Method: "{0f182291-6784-47b3-a8d3-d2f6ebf3950c}"
@ -272,3 +296,40 @@
- IDR_Get_Instance_Set_By_System_Routine_Method__uses__System_Instance_Set_Routine: "{085bd706-eece-4604-ac04-b7af114d1d21}"
- IDR_System_Instance_Set_Routine__used_by__Get_Instance_Set_By_System_Routine_Method: "{6fb6534c-2a46-4d6d-b9df-fd581f19efed}"
- IDR_Derived_Element_Content__has__Derived_EC_Parameter: "{985189a7-fc9e-4eb6-8db2-7362fb60b5d1}"
- IDR_Derived_EC_Parameter__for__Derived_Element_Content: "{2687dd17-3891-4835-8cd7-7b488c51c4bc}"
- IDR_Derived_EC_Parameter__assigns__Work_Data: "{540b7a0a-6dff-4601-a796-c451963e912a}"
- IDR_Work_Data__assigned_by__Derived_EC_Parameter: "{e7ce127d-6b17-4795-abf4-cbcf29a0bf68}"
- IDR_Derived_Element_Content__update_with__Executable_returning_Work_Data: "{4151911a-485c-4488-8e19-1560f489d411}"
- IDR_Executable_returning_Work_Data__used_by__Derived_Element_Content: "{75fdacf8-163c-45ac-86eb-80677ff738ad}"
- IDR_System_Account__has__User_Preferences: "{ada4deb2-adfd-409f-b13a-9856fabd5522}"
- IDR_User_Preferences__for__System_Account: "{ab2372a5-a4c7-488a-89f6-67e5834f8c83}"
- IDR_Instance__has__Instance_Source: '{B62F9B81-799B-4ABE-A4AF-29B45347DE54}'
- IDR_Instance_Source__for__Instance: '{FBB9391D-C4A2-4326-9F85-7801F377253C}'
- IDR_Element__processed_by__Process_Related_Updates_Method: '{ed9c836a-04a4-4505-8953-3c567e841c66}'
- IDR_Process_Related_Updates_Method__processes__Element: '{bb281665-7000-4144-994e-ffb40f6b4d2d}'
- IDR_PUM_Process__invokes__Execute_Update_Method_Binding: '{d3e83c17-fd38-46a0-a055-66281eabe9b0}'
- IDR_Execute_Update_Method_Binding__invoked_by__PUM_Process: '{8f22f056-12c7-4fa2-93fb-b07821bd3946}'
- IDR_PUM_Process__invokes__Process_Related_Updates_Method: '{ec39cc23-661a-4677-86e7-21cbf309af1a}'
- IDR_Process_Related_Updates_Method__invoked_by__PUM_Process: '{5d7d09f8-399e-4b49-a63b-2834a1f49f69}'
- IDR_Process_Updates_Method__has__PUM_Process: '{0ffaf08e-dbb5-49d0-8de9-d253ce6cbe7c}'
- IDR_PUM_Process__for__Process_Updates_Method: '{12c9b11b-c56b-4ca4-aaa0-2c3d4474e6a3}'
- IDR_System_Account__has__User_Preferences: '{327f1242-6a51-470b-8115-d05ec285a1fa}'
- IDR_User_Preferences__for__System_Account: '{da20aab7-155e-4e06-8377-ef58b14f9979}'
- IDR_User_Preferences__has_favorite__Instance: '{a3de0c1c-31f5-4871-a135-98fd87595932}'
- IDR_Instance__favorite_for__User_Preferences: '{3dab8340-0cb9-450d-85ce-c6db5aedbdd5}'
- IDR_User_Preferences__has_recent__Search: '{2166fcf2-fc8d-4190-95ff-e7c8eaa31321}'
- IDR_Search__recent_for__User_Preferences: '{3f7506c0-0cc0-4612-91b6-94558c91f14b}'

View File

@ -1,3 +1,6 @@
- entityDefinitions:
- IDC_SequenceTask: "{74c26737-000e-4bda-a1af-ad6d59bcc4b2}"
- IDC_ConvenienceTask: "{8a9fb632-6d04-49ff-8271-1f41dce1f254}"
- IDI_Task_ViewElementContent: '{9c90e09a-2efc-4ebd-92e6-c0767ac3fbfd}'
- IDI_Task_ViewClass: '{cd9366be-08d7-4b32-8963-3c42753fa8d9}'
#- IDC_SequenceTask: "{74c26737-000e-4bda-a1af-ad6d59bcc4b2}"
#- IDC_ConvenienceTask: "{8a9fb632-6d04-49ff-8271-1f41dce1f254}"
- IDI_SequenceTask_TestMethodBinding: '{3e55af17-00a9-418d-ae6f-7e52ec11148e}'

View File

@ -2,3 +2,5 @@
- IDE_LoginPage: '{9E272BC3-0358-4EB7-8B3B-581964A59634}'
- IDE_LoginPageSubedit: '{2b7d4481-b7c2-4e26-a917-e3ff7c367a8a}'
- IDE_HomePage: '{3c1f92a5-09a0-4b52-9269-46c386b0c905}'
- IDE_ViewElementContent: '{e68bb6c4-29eb-4c77-908a-1b3793c952bc}'
- IDE_ViewElementContent_Summary: '{a639e587-f8a5-4503-afb6-08e98cb40a09}'

View File

@ -0,0 +1,2 @@
- entityDefinitions:
- IDI_ButtonLayout_DefaultButtonGroup: '{af72c9a1-7f71-4cc7-af83-fa32b641b293}'

View File

@ -0,0 +1,4 @@
- entityDefinitions:
- IDI_InstanceSource_System: '{9547EB35-07FB-4B64-B82C-6DA1989B9165}'
- IDI_InstanceSource_Delivered: '{062B57B5-D728-4DF8-903A-AD79D843B5CA}'
- IDI_InstanceSource_Custom: '{63D91CCD-D196-4C3A-8609-6DF371E2406F}'

View File

@ -0,0 +1,2 @@
- entityDefinitions:
- IDI_WorkSet_ClassForEditClassTask: '{b56ac9b9-efce-4a40-8c04-ffdf90174285}'

View File

@ -0,0 +1,2 @@
- entityDefinitions:
- IDI_File_SignonLogo: '{c4f31b1a-aede-4e91-9fa0-511537f098a5}'

View File

@ -0,0 +1,11 @@
- entityDefinitions:
- IDI_MeasurementUnit_Centimeter: '{BBBB1E24-8C0F-48B5-8529-7BB522415D35}'
- IDI_MeasurementUnit_Em: '{D55BF6E0-D6DB-43CA-909E-C66E25328F4E}'
- IDI_MeasurementUnit_Ex: '{912A40FE-778C-4004-9685-1F2BF8618026}'
- IDI_MeasurementUnit_Inch: '{6D670E0D-536C-46DF-801A-2DFFA086350F}'
- IDI_MeasurementUnit_Millimeter: '{180B1276-BD0D-43A6-BD3D-8A0D4043FFCE}'
- IDI_MeasurementUnit_Percentage: '{5DF5DE6A-819F-4880-9F48-098CB7F67FA2}'
- IDI_MeasurementUnit_Pica: '{D0A462FC-683C-4C14-945F-F8F0B02C472F}'
- IDI_MeasurementUnit_Pixel: '{A945C259-06AC-428C-BE8B-7B54B1911A2A}'
- IDI_MeasurementUnit_Point: '{33027987-0466-439A-B53B-1950FD65EA03}'
- IDI_MeasurementUnit_Twip: '{70e2638a-3521-41eb-8c26-2828c0343812}'

View File

@ -1,7 +1,6 @@
--- #definitions for YAML
- instance: '&IDC_Class;'
name: Class
index: 1
templateOnly: yes
customTagName: 'class'
attributes:
- instance: '&IDA_Name;'
@ -9,9 +8,15 @@
relationships:
- instance: '&IDR_Class__has_super__Class;'
customTagName: 'inherits'
- instance: '&IDR_Class__has_default__Task;'
customTagName: 'defaultTask'
translations:
- relationship: '&IDR_Class__has_title__Translation;'
values:
- language: '&IDI_Language_English;'
- value: 'Class'
- class: '&IDC_Class;'
name: Class
index: 1
defaultTask: '&IDI_Task_ViewClass;'

View File

@ -186,6 +186,55 @@
# siblingRelationshipId: '&IDR_Method__implements__Method;'
# singular: no
- relationship: '&IDR_Class__has_default__Task;'
index: 87
sourceClassId: '&IDC_Class;'
type: 'has default'
destinationClassId: '&IDC_Task;'
siblingRelationshipId: '&IDR_Task__default_for__Class;'
singular: yes
- relationship: '&IDR_Task__default_for__Class;'
index: 88
sourceClassId: '&IDC_Task;'
type: 'default for'
destinationClassId: '&IDC_Class;'
siblingRelationshipId: '&IDR_Class__has_default__Task;'
singular: no
- relationship: '&IDR_Relationship__has_source__Class;'
index: 157
sourceClassId: '&IDC_Relationship;'
type: 'has source'
destinationClassId: '&IDC_Class;'
siblingRelationshipId: '&IDR_Class__source_for__Relationship;'
singular: yes
- relationship: '&IDR_Class__source_for__Relationship;'
index: 158
sourceClassId: '&IDC_Class;'
type: 'source for'
destinationClassId: '&IDC_Relationship;'
siblingRelationshipId: '&IDR_Relationship__has_source__Class;'
singular: no
- relationship: '&IDR_Relationship__has_destination__Class;'
index: 159
sourceClassId: '&IDC_Relationship;'
type: 'has destination'
destinationClassId: '&IDC_Class;'
siblingRelationshipId: '&IDR_Class__destination_for__Relationship;'
singular: yes
- relationship: '&IDR_Class__destination_for__Relationship;'
index: 160
sourceClassId: '&IDC_Class;'
type: 'destination for'
destinationClassId: '&IDC_Relationship;'
siblingRelationshipId: '&IDR_Relationship__has_destination__Class;'
singular: no
- relationship: '&IDR_Class__has__Instance;'
index: 249
sourceClassId: '&IDC_Class;'

View File

@ -10,6 +10,8 @@
customTagName: 'name'
- instance: '&IDA_Value;'
customTagName: 'value'
- instance: '&IDA_MaximumLength;'
customTagName: 'maximumLength'
# YAML definition for Instances of Boolean Attribute, 1$5
@ -19,24 +21,36 @@
- textAttribute: '&IDA_Value;'
name: Value
index: 2
# - textAttribute: '&IDA_DisplayID;'
# name: Display ID
# index: 3
# - textAttribute: '&IDA_ClassName;'
# name: Class Name
# index: 4
# - textAttribute: '&IDA_Expression;'
# name: Expression
# index: 5
# - textAttribute: '&IDA_Comment;'
# name: Comment
# index: 6
- textAttribute: '&IDA_DisplayID;'
name: Display ID
index: 3
- textAttribute: '&IDA_ClassName;'
name: Class Name
index: 4
- textAttribute: '&IDA_Expression;'
name: Expression
index: 5
- textAttribute: '&IDA_Comment;'
name: Comment
index: 6
- textAttribute: '&IDA_RelationshipType;'
name: 'Relationship Type'
index: 8
- textAttribute: '&IDA_MethodName;'
name: 'Method Name'
index: 9
- textAttribute: '&IDA_UserName;'
name: 'UserName'
index: 11
- textAttribute: '&IDA_ContentType;'
name: 'Content Type'
index: 16
- textAttribute: '&IDA_Encoding;'
name: 'Content Encoding'
index: 18
- textAttribute: '&IDA_Label;'
name: 'Label'
index: 22
- textAttribute: '&IDA_Token;'
name: 'Token'
index: 33
@ -50,16 +64,9 @@
- language: '&IDI_Language_English;'
- value: 'User Name or Password Incorrect Message'
- textAttribute: '&IDA_LoginPageInstructions;'
name: 'Login Page Instructions'
index: 1034
value: 'Please enter your user name and password to log in to this system.'
translations:
- relationship: '&IDR_Translatable__has__Translation;'
values:
- language: '&IDI_Language_English;'
- value: 'Login Page Instructions'
- textAttribute: '&IDA_IPAddress;'
index: 51
- textAttribute: '&IDA_Verb;'
name: Verb
index: 35

View File

@ -6,14 +6,34 @@
attributes:
- instance: '&IDA_Name;'
customTagName: 'name'
- instance: '&IDA_Label;'
customTagName: 'label'
relationships:
- instance: '&IDR_Element__has__Element_Content;'
customTagName: 'elementContents'
- instance: '&IDR_Element__processed_by__Process_Related_Updates_Method;'
customTagName: 'processedByPRUMethod'
instances:
- instance: '&IDI_Element_AddMetadataInstance;'
name: add metadata instance
index: 1
- relationship: '&IDR_Element__processed_by__Process_Related_Updates_Method;'
index: 98
sourceClassId: '&IDC_Element;'
type: 'processed by'
destinationClassId: '&IDC_ProcessRelatedUpdatesMethod;'
siblingRelationshipId: '&IDR_Element_Content__for__Element;'
singular: no
- relationship: '&IDR_Process_Related_Updates_Method__processes__Element;'
index: 99
sourceClassId: '&IDC_ProcessRelatedUpdatesMethod;'
type: 'processes'
destinationClassId: '&IDC_Element;'
siblingRelationshipId: '&IDR_Element__processed_by__Process_Related_Updates_Method;'
singular: no
- relationship: '&IDR_Element__has__Element_Content;'
index: 101
sourceClassId: '&IDC_Element;'
@ -29,19 +49,4 @@
destinationClassId: '&IDC_Element;'
siblingRelationshipId: '&IDR_Element__has__Element_Content;'
singular: no
- relationship: '&IDR_Element_Content__has__Instance;'
index: 103
sourceClassId: '&IDC_ElementContent;'
type: 'has'
destinationClassId: '&IDC_Instance;'
siblingRelationshipId: '&IDR_Instance__for__Element_Content;'
singular: no
- relationship: '&IDR_Instance__for__Element_Content;'
index: 104
sourceClassId: '&IDC_Instance;'
type: 'for'
destinationClassId: '&IDC_ElementContent;'
siblingRelationshipId: '&IDR_Element_Content__has__Instance;'
singular: no

View File

@ -0,0 +1,12 @@
---
- class: '&IDC_ProcessUpdatesMethod;'
name: PU - Process Updates Method
index: 11
abstract: no
inherits: '&IDC_Method;'
customTagName: 'processUpdatesMethod'
translations:
- relationship: '&IDR_Class__has_title__Translation;'
values:
- languageInstanceId: '&IDI_Language_English;'
value: 'PU - Process Updates Method'

View File

@ -0,0 +1,27 @@
---
- class: '&IDC_WorkSet;'
name: Work Set
index: 15
customTagName: workSet
attributes:
- instance: '&IDA_Name;'
customTagName: 'name'
relationships:
- instance: '&IDR_Work_Set__has_valid__Class;'
customTagName: 'validClasses'
- relationship: '&IDR_Work_Set__has_valid__Class;'
index: 9
sourceClassId: '&IDC_WorkSet;'
type: 'has valid'
destinationClassId: '&IDC_Class;'
siblingRelationshipId: '&IDR_Class__valid_for__Work_Set;'
singular: no
- relationship: '&IDR_Class__valid_for__Work_Set;'
index: 10
sourceClassId: '&IDC_Class;'
type: 'valid for'
destinationClassId: '&IDC_WorkSet;'
siblingRelationshipId: '&IDR_Work_Set__has_valid__Class;'
singular: no

View File

@ -0,0 +1,30 @@
---
- class: '&IDC_BEMProcess;'
name: BEM Process
index: 16
translations:
- relationship: '&IDR_Class__has_title__Translation;'
values:
- languageInstanceId: '&IDI_Language_English;'
value: 'BEM Process'
instances:
- instance: '&IDBEM_1;'
- relationship: '&IDR_Element_Content__built_from__BEM_Process;'
index: 105
sourceClassId: '&IDC_ElementContent;'
type: 'built from'
destinationClassId: '&IDC_BEMProcess;'
siblingRelationshipId: '&IDR_BEM_Process__builds__Element_Content;'
singular: yes
- relationship: '&IDR_BEM_Process__builds__Element_Content;'
index: 106
sourceClassId: '&IDC_BEMProcess;'
type: 'builds'
destinationClassId: '&IDC_ElementContent;'
siblingRelationshipId: '&IDR_Element_Content__built_from__BEM_Process;'
singular: no

View File

@ -0,0 +1,26 @@
---
# YAML definition for Numeric Attribute
- class: '&IDC_NumericAttribute;'
inherits: '&IDC_Attribute;'
name: Numeric Attribute
index: 20
customTagName: 'numericAttribute'
attributes:
- instance: '&IDA_Name;'
customTagName: 'name'
- instance: '&IDA_Value;'
customTagName: 'value'
- instance: '&IDA_MaximumValueNumeric;'
customTagName: 'maximumValue'
- instance: '&IDA_MinimumValueNumeric;'
customTagName: 'minimumValue'
- numericAttribute: '&IDA_MaximumLength;'
name: 'Maximum Length'
index: 4
- numericAttribute: '&IDA_MaximumValueNumeric;'
name: 'Maximum Value'
- numericAttribute: '&IDA_MinimumValueNumeric;'
name: 'Minimum Value'

View File

@ -0,0 +1,11 @@
---
- class: '&IDC_Person;'
name: Person
index: 33
relationships:
- instance: '&IDR_Person__has__Person_Name;'
customTagName: 'names'
instances:
- instance: '&IDI_Element_AddMetadataInstance;'
name: add metadata instance
index: 1

View File

@ -9,15 +9,19 @@
customTagName: 'passwordHash'
- instance: '&IDA_PasswordSalt;'
customTagName: 'passwordSalt'
relationships:
- instance: '&IDR_System_Account__has__User_Preferences;'
customTagName: 'hasUserPreferences'
- class: '&IDC_UserLogin;'
name: User Login
index: 46
name: System Account Signon
index: 4328
# System Account Signon.for System User (3$12257)
- relationship: '&IDR_User_Login__has__User;'
index: 87
index: 12257
sourceClassId: '&IDC_UserLogin;'
type: 'has'
type: 'for'
destinationClassId: '&IDC_User;'
# siblingRelationshipId: '&IDR_User__for__User_Login;'
singular: no

View File

@ -0,0 +1,4 @@
- class: '&IDC_Layout;'
name: Layout
index: 41
abstract: yes

View File

@ -0,0 +1,5 @@
---
- class: '&IDC_WorkData;'
name: Work Data
index: 42
abstract: yes

View File

@ -0,0 +1,7 @@
- class: '&IDC_ElementContentTestClass;'
index: 47
description: the Element Content test class is the target to be abused by EC attribute submit update tests
customTagName: elementContentTestClass
- elementContentTestClass: '&IDI_ElementContentTestClass_1;'
index: 1

View File

@ -0,0 +1,15 @@
---
- class: '&IDC_ProcessRelatedUpdatesMethod;'
name: PRU - Process Related Updates Method
index: 54
abstract: no
inherits: '&IDC_Method;'
customTagName: 'processRelatedUpdatesMethod'
attributes:
- instance: '&IDA_Name;'
customTagName: 'name'
translations:
- relationship: '&IDR_Class__has_title__Translation;'
values:
- languageInstanceId: '&IDI_Language_English;'
value: 'PRU - Process Related Updates Method'

View File

@ -1,16 +1,56 @@
---
- relationship: '&IDR_Element_Content__has__Instance;'
index: 103
sourceClassId: '&IDC_ElementContent;'
type: 'has'
destinationClassId: '&IDC_Instance;'
siblingRelationshipId: '&IDR_Instance__for__Element_Content;'
singular: no
- relationship: '&IDR_Instance__for__Element_Content;'
index: 104
sourceClassId: '&IDC_Instance;'
type: 'for'
destinationClassId: '&IDC_ElementContent;'
siblingRelationshipId: '&IDR_Element_Content__has__Instance;'
singular: no
- relationship: '&IDR_Element_Content__has__Layout;'
index: 105
sourceClassId: '&IDC_ElementContent;'
type: 'has'
destinationClassId: '&IDC_Layout;'
siblingRelationshipId: '&IDR_Layout__for__Element_Content;'
singular: no
- relationship: '&IDR_Layout__for__Element_Content;'
index: 106
sourceClassId: '&IDC_Layout;'
type: 'for'
destinationClassId: '&IDC_ElementContent;'
siblingRelationshipId: '&IDR_Element_Content__has__Layout;'
singular: no
- class: '&IDC_ElementContent;'
name: Element Content
index: 56
customTagName: 'elementContent'
defaultTask: '&IDI_Task_ViewElementContent;'
attributes:
- instance: '&IDA_Order;'
customTagName: 'order'
- instance: '&IDA_Label;'
customTagName: 'label'
relationships:
- instance: '&IDR_Element_Content__has__Instance;'
customTagName: 'defaultDataType'
- instance: '&IDR_Element_Content__has__Element_Content_Display_Option;'
customTagName: 'displayOptions'
- instance: '&IDR_Element_Content__has__Layout;'
customTagName: 'layout'
- instance: '&IDR_Element_Content__built_from__BEM_Process;'
customTagName: 'builtFromBEMProcess'
instances:
- instance: '&IDI_Element_AddMetadataInstance;'
name: add metadata instance

View File

@ -0,0 +1,5 @@
---
- class: '&IDC_ExecuteUpdateMethodBinding;'
index: 83
name: Execute Update Method Binding
inherits: '&IDC_MethodBinding;'

View File

@ -0,0 +1,30 @@
---
- class: '&IDC_InstanceSource;'
name: Instance Source
index: 109
attributes:
- instance: '&IDA_Name;'
customTagName: 'name'
instances:
- instance: '&IDI_InstanceSource_System;'
name: 'System'
- instance: '&IDI_InstanceSource_Delivered;'
name: 'Delivered'
- instance: '&IDI_InstanceSource_Custom;'
name: 'Custom'
- relationship: '&IDR_Instance__has__Instance_Source;'
index: 209
sourceClassId: '&IDC_Instance;'
type: 'has'
destinationClassId: '&IDC_InstanceSource;'
siblingRelationshipId: '&IDR_Instance_Source__for__Instance;'
singular: yes
- relationship: '&IDR_Instance_Source__for__Instance;'
index: 210
sourceClassId: '&IDC_InstanceSource;'
type: 'for'
destinationClassId: '&IDC_Instance;'
siblingRelationshipId: '&IDR_Instance__has__Instance_Source;'
singular: no

View File

@ -5,6 +5,6 @@
sealed: yes
customTagName: 'tenant'
- tenant: '&IDI_Language_English;'
- tenant: '&IDI_Tenant_Singleton;'
index: 1

View File

@ -0,0 +1,56 @@
- class: '&IDC_PUMProcess;'
name: PUM Process
index: 371
abstract: no
customTagName: pumProcess
relationships:
- instance: '&IDR_PUM_Process__invokes__Execute_Update_Method_Binding;'
customTagName: invokesExecutesUpdateMethodBindings
- relationship: '&IDR_PUM_Process__invokes__Execute_Update_Method_Binding;'
index: 859
sourceClassId: '&IDC_PUMProcess;'
type: 'invokes'
destinationClassId: '&IDC_ExecuteUpdateMethodBinding;'
siblingRelationshipId: '&IDR_Execute_Update_Method_Binding__invoked_by__PUM_Process;'
singular: no
- relationship: '&IDR_Execute_Update_Method_Binding__invoked_by__PUM_Process;'
index: 860
sourceClassId: '&IDC_ExecuteUpdateMethodBinding;'
type: 'invoked by'
destinationClassId: '&IDC_PUMProcess;'
siblingRelationshipId: '&IDR_PUM_Process__invokes__Execute_Update_Method_Binding;'
singular: no
- relationship: '&IDR_PUM_Process__invokes__Process_Related_Updates_Method;'
index: 861
sourceClassId: '&IDC_PUMProcess;'
type: 'invokes'
destinationClassId: '&IDC_ProcessRelatedUpdatesMethod;'
siblingRelationshipId: '&IDR_Process_Related_Updates_Method__invoked_by__PUM_Process;'
singular: no
- relationship: '&IDR_Process_Related_Updates_Method__invoked_by__PUM_Process;'
index: 862
sourceClassId: '&IDC_ProcessRelatedUpdatesMethod;'
type: 'invoked by'
destinationClassId: '&IDC_PUMProcess;'
siblingRelationshipId: '&IDR_PUM_Process__invokes__Process_Related_Updates_Method;'
singular: no
- relationship: '&IDR_Process_Updates_Method__has__PUM_Process;'
index: 863
sourceClassId: '&IDC_ProcessUpdatesMethod;'
type: 'has'
destinationClassId: '&IDC_PUMProcess;'
siblingRelationshipId: '&IDR_PUM_Process__for__Process_Updates_Method;'
singular: yes
- relationship: '&IDR_PUM_Process__for__Process_Updates_Method;'
index: 864
sourceClassId: '&IDC_PUMProcess;'
type: 'for'
destinationClassId: '&IDC_ProcessUpdatesMethod;'
siblingRelationshipId: '&IDR_Process_Updates_Method__has__PUM_Process;'
singular: no

View File

@ -0,0 +1,3 @@
- class: '&IDC_Search;'
name: Search
index: 496

View File

@ -0,0 +1,3 @@
- class: '&IDC_GroupLayout;'
index: 1599
customTagName: 'groupLayout'

View File

@ -0,0 +1,8 @@
- class: '&IDC_ImageLayout;'
index: 1604
customTagName: 'imageLayout'
inherits: '&IDC_Layout;'
relationships:
- instance: '&IDR_Layout__has__Style;'
customTagName: 'style'
customTagNameCreatesInstanceOf: '&IDC_Style;'

View File

@ -0,0 +1,62 @@
- class: '&IDC_Style;'
index: 1605
customTagName: 'style'
registerForTemplate: yes
attributes:
- instance: '&IDA_Name;'
customTagName: 'name'
relationships:
- instance: '&IDR_Style__has_width__Measurement;'
customTagName: 'width'
customTagNameCreatesInstanceOf: '&IDC_Measurement;'
- instance: '&IDR_Style__has_height__Measurement;'
customTagName: 'height'
customTagNameCreatesInstanceOf: '&IDC_Measurement;'
- relationship: '&IDR_Style__has_width__Measurement;'
index: 24610
sourceClassId: '&IDC_Style;'
type: 'has width'
destinationClassId: '&IDC_Measurement;'
siblingRelationshipId: '&IDR_Measurement__width_for__Style;'
singular: yes
- relationship: '&IDR_Measurement__width_for__Style;'
index: 24611
sourceClassId: '&IDC_Measurement;'
type: 'width for'
destinationClassId: '&IDC_Style;'
siblingRelationshipId: '&IDR_Style__has_width__Measurement;'
singular: no
- relationship: '&IDR_Style__has_height__Measurement;'
index: 24612
sourceClassId: '&IDC_Style;'
type: 'has height'
destinationClassId: '&IDC_Measurement;'
siblingRelationshipId: '&IDR_Measurement__height_for__Style;'
singular: yes
- relationship: '&IDR_Measurement__height_for__Style;'
index: 24613
sourceClassId: '&IDC_Measurement;'
type: 'height for'
destinationClassId: '&IDC_Style;'
siblingRelationshipId: '&IDR_Style__has_height__Measurement;'
singular: no
- relationship: '&IDR_Layout__has__Style;'
index: 24620
sourceClassId: '&IDC_Layout;'
type: 'has'
destinationClassId: '&IDC_Style;'
siblingRelationshipId: '&IDR_Style__for__Layout;'
singular: no
- relationship: '&IDR_Style__for__Layout;'
index: 24621
sourceClassId: '&IDC_Style;'
type: 'for'
destinationClassId: '&IDC_Layout;'
siblingRelationshipId: '&IDR_Layout__has__Style;'
singular: no

View File

@ -0,0 +1,10 @@
- class: '&IDC_Measurement;'
index: 1606
name: 'Measurement'
customTagName: 'measurement'
attributes:
- instance: '&IDA_Value;'
customTagName: value
relationships:
- instance: '&IDR_Measurement__has__Measurement_Unit;'
customTagName: unit

View File

@ -0,0 +1,46 @@
- class: '&IDC_MeasurementUnit;'
name: 'Measurement Unit'
# zq-yaml: this attribute on the instance should be interpreted as an alias for that global identifier
# so if we write ... { width: { value: 4, unit: em } } it should refer to {D55B...}
instanceReferenceAliasTagName: 'symbol'
instances:
- instance: '&IDI_MeasurementUnit_Centimeter;'
name: 'Centimeter'
symbol: 'cm'
description: 'Measurement is in centimeters.'
- instance: '&IDI_MeasurementUnit_Em;'
name: 'Em'
symbol: 'em'
description: "Measurement is relative to the height of the parent element's font."
- instance: '&IDI_MeasurementUnit_Ex;'
name: 'Ex'
symbol: 'ex'
description: "Measurement is relative to the height of the lowercase letter x of the parent element's font."
- instance: '&IDI_MeasurementUnit_Inch;'
name: 'Inch'
symbol: 'in'
description: "Measurement is in inches."
- instance: "&IDI_MeasurementUnit_Millimeter;"
name: "Millimeter"
symbol: 'mm'
description: "Measurement is in millimeters."
- instance: "&IDI_MeasurementUnit_Percentage;"
name: "Percentage"
symbol: '%'
description: "Measurement is a percentage relative to the parent element."
- instance: "&IDI_MeasurementUnit_Pica;"
name: "Pica"
symbol: 'pc'
description: "Measurement is in picas. A pica represents 12 points."
- instance: "&IDI_MeasurementUnit_Pixel;"
name: "Pixel"
symbol: "px"
description: "Measurement is in pixels."
- instance: "&IDI_MeasurementUnit_Point;"
name: "Point"
symbol: "pt"
description: "Measurement is in points. A point represents 1/72 of an inch."
- instance: "&IDI_MeasurementUnit_Twip;"
name: "Twip"
symbol: null
description: "Measurement is in twips. A twip is 1/20th of a point. This is not natively supported by CSS."

View File

@ -0,0 +1,12 @@
- class: '&IDC_File;'
customTagName: 'file'
index: 1614
attributes:
- instance: '&IDA_Name;'
customTagName: 'name'
- instance: '&IDA_Value;'
customTagName: 'data'
- instance: '&IDA_ContentType;'
customTagName: 'contentType'
- instance: '&IDA_Encoding;'
customTagName: 'contentEncoding'

View File

@ -0,0 +1,16 @@
- class: '&IDC_HardcodedTask;'
name: 'Hardcoded Task'
index: 2994
inherits: '&IDC_Task;'
customTagName: 'hardcodedTask'
attributes:
- instance: '&IDA_ClassName;'
customTagName: 'className'
- hardcodedTask: '&IDI_Task_ViewClass;'
name: 'View Class'
className: 'Mocha\\UI\\Tasks\\ViewClass'
- hardcodedTask: '&IDI_Task_ViewElementContent;'
name: 'View Element Content'
className: 'Mocha\\UI\\Tasks\\ViewElementContent'

View File

@ -0,0 +1,25 @@
- class: '&IDC_ButtonLayout;'
index: 3009
name: Button Layout
customTagName: buttonLayout
superclasses:
- instance: '&IDC_Layout;'
relationships:
- instance: '&IDR_Button_Layout__executes_task_from__Instance_Set;'
customTagName: 'executesTask'
- relationship: '&IDR_Button_Layout__executes_task_from__Instance_Set;'
index: 9232
sourceClassId: '&IDC_ButtonLayout;'
type: 'executes task from'
destinationClassId: '&IDC_InstanceSet;'
siblingRelationshipId: '&IDR_Instance_Set__has_task_executed_by__Button_Layout;'
singular: yes
- relationship: '&IDR_Instance_Set__has_task_executed_by__Button_Layout;'
index: 9233
sourceClassId: '&IDC_InstanceSet;'
type: 'has task executed by'
destinationClassId: '&IDC_ButtonLayout;'
siblingRelationshipId: '&IDR_Button_Layout__executes_task_from__Instance_Set;'
singular: no

View File

@ -0,0 +1,56 @@
- class: '&IDC_UserPreferences;'
index: 4307
customTagName: userPreferences
relationships:
- instance: '&IDR_User_Preferences__has_favorite__Instance;'
customTagName: 'favoriteInstances'
- instance: '&IDR_User_Preferences__has_recent__Search;'
customTagName: 'recentSearches'
- relationship: '&IDR_System_Account__has__User_Preferences;'
index: 12211
sourceClassId: '&IDC_User;'
type: 'has'
destinationClassId: '&IDC_UserPreferences;'
siblingRelationshipId: '&IDR_User_Preferences__for__System_Account;'
singular: yes
- relationship: '&IDR_User_Preferences__for__System_Account;'
index: 12212
sourceClassId: '&IDC_UserPreferences;'
type: 'for'
destinationClassId: '&IDC_User;'
siblingRelationshipId: '&IDR_System_Account__has__User_Preferences;'
singular: yes
- relationship: '&IDR_User_Preferences__has_favorite__Instance;'
index: 12213
sourceClassId: '&IDC_UserPreferences;'
type: 'has'
destinationClassId: '&IDC_Instance;'
siblingRelationshipId: '&IDR_Instance__favorite_for__User_Preferences;'
singular: no
- relationship: '&IDR_Instance__favorite_for__User_Preferences;'
index: 12214
sourceClassId: '&IDC_Instance;'
type: 'for'
destinationClassId: '&IDC_UserPreferences;'
siblingRelationshipId: '&IDR_User_Preferences__has_favorite__Instance;'
singular: no
- relationship: '&IDR_User_Preferences__has_recent__Search;'
index: 12215
sourceClassId: '&IDC_UserPreferences;'
type: 'has recent'
destinationClassId: '&IDC_Search;'
siblingRelationshipId: '&IDR_Search__recent_for__User_Preferences;'
singular: no
- relationship: '&IDR_Search__recent_for__User_Preferences;'
index: 12216
sourceClassId: '&IDC_Search;'
type: 'recent for'
destinationClassId: '&IDC_UserPreferences;'
siblingRelationshipId: '&IDR_User_Preferences__has_recent__Search;'
singular: no

View File

@ -1,6 +1,7 @@
---
- element: '&IDE_LoginPage;'
name: login page
label: Log In
# elementContents:
# - elementContent: '&IDE_LoginPageSubedit;'
# displayOptions:

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,25 @@
- element: '&IDE_ViewElementContent;'
name: view element content
module: '&IDI_Module_MochaBaseSystem;'
elementContents:
- instance: '{4004bfb2-0f81-4e52-a88b-646ba564be3b}'
- elementContent: '{4004bfb2-0f81-4e52-a88b-646ba564be3b}'
defaultDataType: '&IDE_ViewElementContent_Summary;'
order: a
displayOptions:
- instance: '&IDI_DisplayOption_Singular;'
- instance: '&IDI_DisplayOption_ShowSubelementsVertically;'
- element: '&IDE_ViewElementContent_Summary;'
name: view element content summary
module: '&IDI_Module_MochaBaseSystem;'
elementContents:
- instance: '{bce8db21-66e1-4cfb-b398-9f010747c225}'
- elementContent: '{bce8db21-66e1-4cfb-b398-9f010747c225}'
defaultDataType: '&IDR_Element_Content__for__Element;'
label: 'For Element'
order: a
displayOptions:
- instance: '&IDI_DisplayOption_NotEnterable;'

View File

@ -0,0 +1,81 @@
---
- element: '{29694806-1882-4cf9-b1c9-aaeee2d729a5}'
name: Element Tests
index: 113800
processedByPRUMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}'
elementContents:
- instance: '{91b1a767-08ac-47f0-9f30-620de6374d12}'
- instance: '{628550d8-673d-4156-8983-447ea2ee6d1b}'
- instance: '{8c69fd8c-28fa-4f3c-a283-5d0006c1027d}'
- instance: '{535b1507-68ed-4981-8cd4-e8e843a24916}'
- instance: '{d74123b5-9fde-4c2a-bd28-8cd00ce86734}'
- class: '{cce471d6-5fe7-4202-b678-9fcab20fd864}'
name: 'Element Tests Testing Class 1'
processedByPRUMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}'
- processRelatedUpdatesMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}'
name: 'PRU for Element Tests Class 1'
- buttonLayout: '&IDI_ButtonLayout_DefaultButtonGroup;'
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}'
name: 'Test_With_MaxLength_20'
maximumLength: 20
- textAttribute: '{d53d7283-92a2-4a62-b8f2-cf0a0b975634}'
name: 'Test_for_Required_Field'
- textAttribute: '{dd33bb2a-1e10-4090-a846-89a225103c07}'
name: 'Not Enterable Text Attribute Test'
value: 'This element content is `Not Enterable`, and will always have its default value'
- elementContent: '{91b1a767-08ac-47f0-9f30-620de6374d12}'
order: 'a'
label: 'Element Content Test Class'
defaultDataType: '&IDI_ElementContentTestClass_1;'
displayOptions:
- instance: '&IDI_DisplayOption_DoNotShow;'
- elementContent: '{535b1507-68ed-4981-8cd4-e8e843a24916}'
order: 'b'
label: 'Label Override for Not Enterable'
defaultDataType: '{dd33bb2a-1e10-4090-a846-89a225103c07}'
builtFromBEMProcess: '&IDBEM_1;'
displayOptions:
- instance: '&IDI_DisplayOption_NotEnterable;'
- derivedECParameter: '{08563151-04c7-40d1-adff-a3dc2e12be2b}'
assignsToParm: '{1a907d6e-b3fd-4f8e-a170-550aeb2faea5}'
# contextType: null
# specificWorkData: null
# onMultipleSelection: null
- elementContent: '{8c69fd8c-28fa-4f3c-a283-5d0006c1027d}'
order: 'c'
label: 'Test with MaxLength 20'
defaultDataType: '{1a907d6e-b3fd-4f8e-a170-550aeb2faea5}'
builtFromBEMProcess: '&IDBEM_1;'
parameters:
- instance: '{08563151-04c7-40d1-adff-a3dc2e12be2b}'
# Test for Required Field
- derivedECParameter: '{a8c306ed-9eb6-49c8-a6dc-357617e493d5}'
assignsToParm: '{d53d7283-92a2-4a62-b8f2-cf0a0b975634}'
- elementContent: '{d74123b5-9fde-4c2a-bd28-8cd00ce86734}'
order: 'd'
label: 'This field is required'
defaultDataType: '{d53d7283-92a2-4a62-b8f2-cf0a0b975634}'
builtFromBEMProcess: '&IDBEM_1;'
displayOptions:
- instance: '&IDI_DisplayOption_Required;'
parameters:
- instance: '{a8c306ed-9eb6-49c8-a6dc-357617e493d5}'

View File

@ -1,17 +1,38 @@
---
- element: '&IDE_HomePage;'
name: Home Page
label: Home Page
index: 113859
# elementContents:
# - elementContent: '&IDE_LoginPageSubedit;'
# displayOptions:
# - instance: '&IDI_DisplayOption_ShowSubelementsVertically;'
# - instance: '&IDI_DisplayOption_Singular;'
#elementContents:
#- instance: '{f2f77680-37ca-48fa-b4b3-5f8a382e5d8c}'
elementContents:
- instance: '{16c0571e-b025-4a8f-afdd-4443d0a06831}'
- instance: '{cc15510f-6230-4e29-b7b8-b887bc5f3ff0}'
# - elementContent: '{f2f77680-37ca-48fa-b4b3-5f8a382e5d8c}'
# defaultDataType: '&IDE_LoginPageSubedit;'
# displayOptions:
# - instance: '&IDI_DisplayOption_ShowSubelementsVertically;'
# - instance: '&IDI_DisplayOption_Singular;'
- element: '{5e66e253-e19b-4ae5-8c5c-6775f5881e2a}'
name: Home Page Welcome
index: 113860
#processedByPRUMethod: '{2aa20384-4132-49d3-a661-ae7d9a2e2feb}'
elementContents:
- instance: '{572e3060-025b-4dff-a352-23dd8bfcfa0a}'
- elementContent: '{572e3060-025b-4dff-a352-23dd8bfcfa0a}'
defaultDataType: '{e3549308-76b9-4602-98fc-012cccf37f74}'
displayOptions:
- instance: '&IDI_DisplayOption_NotEnterable;'
- instance: '&IDI_DisplayOption_DoNotShowLabel;'
- instance: '&IDI_DisplayOption_WideText;'
- textAttribute: '{e3549308-76b9-4602-98fc-012cccf37f74}'
name: 'Home Page Welcome Text'
value: 'Welcome to Mocha'
- elementContent: '{16c0571e-b025-4a8f-afdd-4443d0a06831}'
defaultDataType: '{5e66e253-e19b-4ae5-8c5c-6775f5881e2a}'
displayOptions:
- instance: '&IDI_DisplayOption_ShowSubelementsVertically;'
- instance: '&IDI_DisplayOption_Singular;'
- elementContent: '{cc15510f-6230-4e29-b7b8-b887bc5f3ff0}'
defaultDataType: '{29694806-1882-4cf9-b1c9-aaeee2d729a5}'
displayOptions:
- instance: '&IDI_DisplayOption_ShowSubelementsVertically;'
- instance: '&IDI_DisplayOption_Singular;'

View File

@ -1,38 +0,0 @@
- element: '&IDE_LoginPageSubedit;'
name: login page subedit
module: '&IDI_Module_MochaBaseSystem;'
elementContents:
- instance: '{4a827e38-e07a-4b8b-a19f-9217299f5c45}'
- instance: '{c67f305e-bd4d-4628-816b-55fb85ea1b67}'
- instance: '{51b51be3-44fd-48f1-971f-682aee0a6132}'
- instance: '{684f1e03-9ecd-43d5-8aca-dcf5b84c71f8}'
- elementContent: '{4a827e38-e07a-4b8b-a19f-9217299f5c45}'
defaultDataType: '&IDA_LoginPageInstructions;'
order: a
displayOptions:
- instance: '&IDI_DisplayOption_DoNotShowLabel;'
- instance: '&IDI_DisplayOption_NotEnterable;'
- instance: '&IDI_DisplayOption_WideText;'
- elementContent: '{c67f305e-bd4d-4628-816b-55fb85ea1b67}'
defaultDataType: '&IDA_UserName;'
order: b
displayOptions:
- instance: '&IDI_DisplayOption_Required;'
- elementContent: '{51b51be3-44fd-48f1-971f-682aee0a6132}'
defaultDataType: '&IDA_Password;'
order: c
displayOptions:
- instance: '&IDI_DisplayOption_Required;'
- instance: '&IDI_DisplayOption_ObscuredText;'
- elementContent: '{684f1e03-9ecd-43d5-8aca-dcf5b84c71f8}'
defaultDataType: '&IDA_UserNameOrPasswordIncorrectMessage;'
order: d
displayOptions:
- instance: '&IDI_DisplayOption_DoNotShowLabel;'
- instance: '&IDI_DisplayOption_DoNotShow;'
- instance: '&IDI_DisplayOption_NotEnterable;'
- instance: '&IDI_DisplayOption_WideText;'

View File

@ -0,0 +1,8 @@
- workSet: '&IDI_WorkSet_ClassForEditClassTask;'
name: 'Class for Edit Class Task'
validClasses:
- instance: '&IDC_Class;'
- sequenceTask: '{9dbdb202-e9f8-49ca-bbc2-0b63df651246}'
name: 'Edit Class'
relatedTaskParameter: '&IDI_WorkSet_ClassForEditClassTask;'

View File

@ -0,0 +1,20 @@
- sequenceTask: '&IDI_SequenceTask_TestMethodBinding;'
index: 312
name: 'Test Method Binding'
initialElement: '{2696449c-a517-48cc-9348-03abca291cf0}'
- element: '{2696449c-a517-48cc-9348-03abca291cf0}'
elementContents:
- instance: '{fda2b13e-4495-4b35-bde2-40d2ab57b977}'
- elementContent: '{fda2b13e-4495-4b35-bde2-40d2ab57b977}'
label: 'Test Parms'
# TODO: implement get element contents from method (maybe Get Element from Parameters Method?)
# Test Parms gets its contents from `Method Binding.has Parameter Assignment`
# Test Context has:
# Effective Moment [DT]
# Effective Local Date Time [DT]
# Effective Date Time Zone [DT]+TZ

View File

@ -0,0 +1,21 @@
# - task: '&IDI_Task_ViewClass;'
# name: View Class
# module: '&IDI_Module_MochaBaseSystem;'
# schedulable: no
# longRunning: no
# suppressRIHints: no
# stepName: View Class
# showSpreadsheetButtonOnSelection: no
# relatedAction:
# object: '&IDC_Class;'
# action: 'View'
# menuPath: 'Class > View'
# initiatingElement: '&IDI_Element_ViewClass;'
# taskDirectiveRAMB: '&IDMB_Element__get_Help_Text_for_View_Element;' # Element@get Help Text for View Element(GRA)*P*S(public)[ramb]
# enableSaveParameters: no
# enableReportGroups: no
# handledByControlTransaction: '&IDM_Element__View_Start;' # Element@ View Start(CT)*S
# respondsWithElement: '&IDE_ViewElementEdit;'
# updating: no
# targetAudience: 'ESS'
# businessProcessType: 'VIEWELEMENT'

View File

@ -5,6 +5,11 @@
username: zq-developer
passwordHash: f4f166c4d578cb5ca942e07851d7c09de07d417463f2d8e5165a779f768d14b370cd1e82826a94b617b6c6359253e8c12ea8285cba1e6e69e2e13f2bdc0425d0
passwordSalt: 7e893ba949b041bab73c6f4f0bcb9413
hasUserPreferences: '{d7e9b412-c916-42e7-b788-3bbfac92822c}'
- userPreferences: '{d7e9b412-c916-42e7-b788-3bbfac92822c}'
favoriteInstances:
- instance: '{098DDA82-CD04-4B53-8C75-89D420EA6902}'
- user: '{69e291d8-381b-4ad8-9013-f3b0a0c693fe}'
username: superuser

View File

@ -133,18 +133,25 @@ System::$BeforeLaunchEventHandler = function($path)
*/
$oms = mocha_get_oms();
if (count($path) >= 1 && $path[0] == "suv")
if (count($path) >= 1)
{
if (count($path) == 2 && ($path[1] == "suvinfo.html" || $path[1] == "phpinfo.html"))
if ($path[0] == "suv")
{
//
return true;
if (count($path) == 2 && ($path[1] == "suvinfo.html" || $path[1] == "phpinfo.html"))
{
//
return true;
}
else
{
header("HTTP/1.1 404 Not Found");
echo ("Not Found");
return false;
}
}
else
else if ($path[0] == "scripts")
{
header("HTTP/1.1 404 Not Found");
echo ("Not Found");
return false;
return true;
}
}

View File

@ -21,6 +21,8 @@
// other Phast-specific stuff)
require_once("lib/phast/System.inc.php");
require_once("lib/mocha/system.inc.php");
require_once("ui/tasks/ViewElementContent.inc.php");
// Bring in the Phast\System and Phast\IncludeFile classes so we can simply refer
// to them (in this file only) as "System" and "IncludeFile", respectively, from

View File

@ -6,12 +6,28 @@
public $ClassIndex;
public $InstanceIndex;
public function __construct($class_id, $inst_id)
public function __construct(int $class_id, int $inst_id)
{
$this->ClassIndex = $class_id;
$this->InstanceIndex = $inst_id;
}
public static function Parse(?string $instanceKeyStr) : ?InstanceKey
{
if ($instanceKeyStr !== null)
{
$split = explode("$", $instanceKeyStr);
if (count($split) == 2)
{
if (is_numeric($split[0]) && is_numeric($split[1]))
{
return new InstanceKey(intval($split[0]), intval($split[1]));
}
}
}
return null;
}
public function __toString()
{
return $this->ClassIndex . "$" . $this->InstanceIndex;

View File

@ -26,6 +26,10 @@
$instances = [];
return $instances;
}
public function getAttributeValue($attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
{
return $this->OMS->getAttributeValue($this, $attributeInstance, $defaultValue, $effectiveDate);
}
public function asMethod()
{

View File

@ -10,6 +10,14 @@ class KnownAttributeGuids
const Value = "041DD7FD2D9C412B8B9DD7125C166FE0";
const CSSValue = "C0DD4A42F5034EB380347C428B1B8803";
const RelationshipType = "71106B1219344834B0F6D894637BAEED";
const Label = "69cdf8affcf24477b75d71593e7dbb22";
const ClassName = "c7e8d78ecfac4dacae242ac67a0ba9d3";
/**
* A Numeric Attribute specifying the maximum length of an input field.
*/
const MaximumLength = "6d69fee2f2204aadab8901bfa491dae1";
const TargetURL = "970F79A09EFE4E7D92869908C6F06A67";
@ -17,6 +25,7 @@ class KnownAttributeGuids
const PasswordHash = "F377FC294DF14AFB96434191F37A00A9";
const PasswordSalt = "8C5A99BC40ED4FA2B23FF373C1F3F4BE";
const Encoding = "a82f3c46055e4e129c5de40447134389";
const ContentType = "34142FCB172C490AAF03FF8451D00CAF";
const BackgroundColor = "B817BE3BD0AC4A60A98A97F99E96CC89";

View File

@ -19,6 +19,8 @@ class KnownClassGuids
const Element = "919295953dbd4eae8add6120a49797c7";
const ElementContent = "f85d4f5ec69f449899137a8554e233a4";
const BEMProcess = "a4c5ffb4bf3749f39190dc329d035b46";
const Translation = "04A53CC832064A9799C5464DB8CAA6E6";
const TranslationValue = "6D38E757EC1843AD9C35D15BB446C0E1";
@ -81,6 +83,7 @@ class KnownClassGuids
const TaskCategory = "e8d8060fa20c442f838403488b63247f";
const Task = "D4F2564B2D114A5C8AA9AF52D4EACC13";
const UITask = "BFD07772178C4885A6CEC85076C8461C";
const HardcodedTask = "df1fe350767047d991a016dafdfbf98d";
const Tenant = "703F9D65C5844D9FA656D0E3C247FF1F";
@ -123,5 +126,8 @@ class KnownClassGuids
const CommonBoolean = "5b025da3b7bd45a9b08448c4a922bf72";
const CommonInstanceSet = "3382da214fc545dcbbd1f7ba3ece1a1b";
const ButtonLayout = "6f6338db68e04cc7b257d1b97cf3cb92";
const ImageLayout = "4b1bb7c6168e4ce0b4f876dd5069a80b";
}
?>

View File

@ -32,5 +32,7 @@ class KnownInstanceGuids
const ElementContent__UserNameForLoginPage = "c67f305ebd4d4628816b55fb85ea1b67";
const ElementContent__PasswordForLoginPage = "51b51be344fd48f1971f682aee0a6132";
const Element__ViewElementContent = "e68bb6c429eb4c77908a1b3793c952bc";
}
?>

View File

@ -227,6 +227,10 @@ class KnownRelationshipGuids
const Element_Content__has__Instance = "315b71ba953d45fc87e54f0a268242a9";
const Instance__for__Element_Content = "c3959f84248d4edea3f2f262917c7b56";
const Element_Content__has__Layout = "1ab7412005ea4acab6d3c7e0133e0c4f";
const Layout__has__Style = "{e684bb26-7e78-4a21-b8b4-5a550f3053d5}";
const Element_Content__has__Element_Content_Display_Option = "f070dfa762604488a779fae291903f2d";
const Element_Content__has__Parameter_Assignment = "51214ef0458a44fa8b9df3d9d2309388";
@ -259,5 +263,8 @@ class KnownRelationshipGuids
const Get_Instance_Set_by_System_Routine_Method__uses__System_Instance_Set_Routine = "{085bd706-eece-4604-ac04-b7af114d1d21}";
const System_Instance_Set_Routine__used_by__Get_Instance_Set_By_System_Routine_Method = "{6fb6534c-2a46-4d6d-b9df-fd581f19efed}";
const System_Account__has__User_Preferences = "{ada4deb2-adfd-409f-b13a-9856fabd5522}";
const User_Preferences__for__System_Account = "{ab2372a5-a4c7-488a-89f6-67e5834f8c83}";
}
?>

View File

@ -2,7 +2,7 @@
namespace Mocha\Oms;
class DatabaseOms extends Oms
abstract class DatabaseOms extends Oms
{
}

View File

@ -147,6 +147,53 @@
return $ir;
}
public function getInstanceByKey(InstanceKey $instanceKey) : ?InstanceReference
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$query = "CALL mocha_get_instance_by_key(:class_id, :inst_id)";
$stmt = $this->PDO->prepare($query);
$parms = array
(
"class_id" => $instanceKey->ClassIndex,
"inst_id" => $instanceKey->InstanceIndex
);
$result = $stmt->execute($parms);
if ($result === false)
{
trigger_error("unknown database error, query was:", \E_USER_ERROR);
trigger_error($query, \E_USER_NOTICE);
return null;
}
$values = $stmt->fetchAll();
if (count($values) == 0)
{
trigger_error("no records found, query was:", \E_USER_NOTICE);
trigger_error($query, \E_USER_NOTICE);
foreach ($parms as $key => $value)
{
trigger_error($key . ": '" . $value . "'", \E_USER_NOTICE);
}
return null;
}
$dbid = $values[0]["id"];
$class_id = $values[0]["class_id"];
$inst_id = $values[0]["inst_id"];
$global_id = $values[0]["global_identifier"];
$ir = new InstanceReference($this, $dbid, new InstanceKey($class_id, $inst_id), $global_id);
return $ir;
}
public function getInstanceByGlobalIdentifier(string $globalIdentifier) : ?InstanceReference
{
$tenant = $this->getTenant();
@ -192,15 +239,8 @@
return $ir;
}
public function getRelatedInstances(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array
protected function getRelatedInstancesInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$dt = null;
if ($effectiveDate !== null)
{
@ -241,15 +281,8 @@
return [];
}
public function getAttributeValue($sourceInstance, $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
protected function getAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$query = "CALL mocha_get_attribute_value(:src_inst_id, :attr_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query);
@ -274,15 +307,8 @@
}
return $defaultValue;
}
public function setAttributeValue(InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
public function setAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$query = "CALL mocha_set_attribute_value(:src_inst_id, :attr_inst_id, :attr_value, :user_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
@ -294,18 +320,24 @@
"eff_date" => $effectiveDate
));
}
public function assignRelationship(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, mixed $targetInstance, ?\DateTime $effectiveDate = null)
protected function assignRelationshipInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, InstanceReference|array $targetInstances, ?\DateTime $effectiveDate = null)
{
$tenant = $this->getTenant();
if ($tenant === null)
if (is_array($targetInstances))
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
if (is_array($targetInstance))
{
foreach ($targetInstances as $targetInstance)
{
$query = "CALL mocha_assign_relationship(:src_inst_id, :rel_inst_id, :dest_inst_id, :user_inst_id, :eff_date)";
$stmt = $this->PDO->prepare($query);
$result = $stmt->execute(array
(
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance),
"dest_inst_id" => $this->getDbId($targetInstance),
"user_inst_id" => null,
"eff_date" => null
));
}
}
else
{
@ -315,7 +347,7 @@
(
"src_inst_id" => $this->getDbId($sourceInstance),
"rel_inst_id" => $this->getDbId($relationshipInstance),
"dest_inst_id" => $this->getDbId($targetInstance),
"dest_inst_id" => $this->getDbId($targetInstances),
"user_inst_id" => null,
"eff_date" => null
));

View File

@ -7,7 +7,9 @@
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownMethodBindingGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Core\TenantReference;
abstract class Oms
@ -25,11 +27,25 @@
return null;
}
public function getRelatedInstances(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array
public function getRelatedInstances(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey|null $relationshipInstance, \DateTime $effectiveDate = null) : ?array
{
return null;
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$relationshipInstance = $this->normalizeInstanceReference($relationshipInstance);
if ($relationshipInstance === null)
return null;
return $this->getRelatedInstancesInternal($sourceInstance, $relationshipInstance, $effectiveDate);
}
public function getRelatedInstance(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?InstanceReference
protected abstract function getRelatedInstancesInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, \DateTime $effectiveDate = null) : ?array;
public function getRelatedInstance(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance, \DateTime $effectiveDate = null) : ?InstanceReference
{
$insts = $this->getRelatedInstances($sourceInstance, $relationshipInstance, $effectiveDate);
if ($insts === null)
@ -59,15 +75,60 @@
/**
* Gets the value of the given attribute on the specified instance.
*/
public function getAttributeValue($sourceInstance, $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
public function getAttributeValue(InstanceReference|string|InstanceKey|null $sourceInstance, InstanceReference|string|InstanceKey|null $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string
{
return null;
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$attributeInstance = $this->normalizeInstanceReference($attributeInstance);
if ($sourceInstance === null || $attributeInstance === null)
return $defaultValue;
return $this->getAttributeValueInternal($sourceInstance, $attributeInstance, $defaultValue, $effectiveDate);
}
protected abstract function getAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, $defaultValue = null, $effectiveDate = null) : ?string;
public function setAttributeValue(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null)
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$attributeInstance = $this->normalizeInstanceReference($attributeInstance);
$this->setAttributeValueInternal($sourceInstance, $attributeInstance, $value, $effectiveDate);
}
protected abstract function setAttributeValueInternal(InstanceReference $sourceInstance, InstanceReference $attributeInstance, mixed $value, ?\DateTime $effectiveDate = null);
public function getInstanceText($inst)
{
return $this->getAttributeValue($inst, $this->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name));
}
public function assignRelationship(InstanceReference|string|InstanceKey $sourceInstance, InstanceReference|string|InstanceKey $relationshipInstance, InstanceReference|string|InstanceKey|array $targetInstances, ?\DateTime $effectiveDate = null)
{
$tenant = $this->getTenant();
if ($tenant === null)
{
trigger_error("tenant cannot be null", \E_USER_ERROR);
return null;
}
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$relationshipInstance = $this->normalizeInstanceReference($relationshipInstance);
$targetInstances = $this->normalizeInstanceReference($targetInstances);
return $this->assignRelationshipInternal($sourceInstance, $relationshipInstance, $targetInstances, $effectiveDate);
}
protected abstract function assignRelationshipInternal(InstanceReference $sourceInstance, InstanceReference $relationshipInstance, InstanceReference|array $targetInstances, ?\DateTime $effectiveDate = null);
private $_tenant;
public function getTenant()
{
@ -126,5 +187,64 @@
return null;
}
/**
* Given an InstanceReference, GUID (string), or InstanceKey, return the normalized InstanceReference for that representation.
*
* @return InstanceReference|array|null
*/
public function normalizeInstanceReference(InstanceReference|string|InstanceKey|array|null $instanceReferenceOrGuidOrInstanceKey) : InstanceReference|array|null
{
if ($instanceReferenceOrGuidOrInstanceKey === null)
return null;
if (is_array($instanceReferenceOrGuidOrInstanceKey))
{
$arry = array();
foreach ($instanceReferenceOrGuidOrInstanceKey as $instanceRef)
{
$arry[] = $this->normalizeInstanceReference($instanceRef);
}
return $arry;
}
else if (is_string($instanceReferenceOrGuidOrInstanceKey))
{
// assume GUID
return $this->getInstanceByGlobalIdentifier($instanceReferenceOrGuidOrInstanceKey);
}
else if ($instanceReferenceOrGuidOrInstanceKey instanceof InstanceKey)
{
return $this->getInstanceByKey($instanceReferenceOrGuidOrInstanceKey);
}
else if ($instanceReferenceOrGuidOrInstanceKey instanceof InstanceReference)
{
return $instanceReferenceOrGuidOrInstanceKey;
}
return null;
}
public function getTranslationValue($sourceInstance, $relationshipInstance, $defaultValue = null)
{
$sourceInstance = $this->normalizeInstanceReference($sourceInstance);
$relationshipInstance = $this->normalizeInstanceReference($relationshipInstance);
$ctx = new OmsContext();
$m_Translatable__get__Translation_Value_for_Relationship_parm = $this->getInstanceByGlobalIdentifier(KnownMethodGuids::Translatable__get__Translation_Value_for_Relationship_parm);
$ctx->setWorkData(KnownClassGuids::Relationship, $relationshipInstance);
$mb_Translatable__get__Translation_Value_for_Relationship_parm = $this->executeMethodReturningAttribute($m_Translatable__get__Translation_Value_for_Relationship_parm, $ctx);
// Translatable@get Translation Value for Relationship parm(GRA)*S(public)[ramb]
// loop on instance seTranslation Value for Relationship parm(GRA)*S(public)[ramb]
// loop on instance settTranslation Value for Relationship parm(GRA)*S(public)[ramb]
// loop on instance set: Translatable@get Translations for Effective User Language(GRS)*S[rsmb]
// ---- Translatable@get Translations for Language parm(GRS)*S[rsmb]
// ---- Language => User@get Effective Language(SSC)[rsmb]
// ---- ---- if User@get Current Language then User@get Current Language
// ---- ---- if not User@get Current Language then Tenant@get Default Language
// get attribute: Translation@get Value(GA)[ramb]
}
}
?>

View File

@ -22,6 +22,11 @@
require("ui/DisplayOption.inc.php");
require("ui/ElementContent.inc.php");
require("ui/renderers/HTMLRenderer.inc.php");
require("ui/ValidationResult.inc.php");
require("ui/renderers/html/HTMLRenderer.inc.php");
require("ui/tasks/Task.inc.php");
require("ui/tasks/HardcodedTask.inc.php");
?>

View File

@ -0,0 +1,20 @@
<?php
namespace Mocha\UI;
use Mocha\Core\InstanceReference;
class ValidationResult
{
public $ValidationInstance;
public $Title;
public $Message;
public function __construct(?InstanceReference $validationInstance, ?string $title, ?string $message)
{
$this->ValidationInstance = $validationInstance;
$this->Title = $title;
$this->Message = $message;
}
}
?>

View File

@ -1,357 +0,0 @@
<?php
namespace Mocha\UI\Renderers;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownMethodBindingGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\MySQLDatabaseOms;
use Phast\System;
class HTMLRenderer
{
/**
* @var OmsContext
*/
public $Context;
public function __construct(OmsContext $context)
{
$this->Context = $context;
}
/**
* Thanks https://stackoverflow.com/a/31107425
*
* Generate a random string, using a cryptographically secure
* pseudorandom number generator (random_int)
*
* This function uses type hints now (PHP 7+ only), but it was originally
* written for PHP 5 as well.
*
* For PHP 7, random_int is a PHP core function
* For PHP 5.x, depends on https://github.com/paragonie/random_compat
*
* @param int $length How many characters do we want?
* @param string $keyspace A string of all possible characters
* to select from
* @return string
*/
private function random_str(int $length = 64, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ) : string
{
if ($length < 1)
{
throw new \RangeException("Length must be a positive integer");
}
$pieces = [];
$max = \mb_strlen($keyspace, '8bit') - 1;
for ($i = 0; $i < $length; ++$i)
{
$pieces[] = $keyspace[\random_int(0, $max)];
}
return \implode('', $pieces);
}
public function getElementContentValue(InstanceReference $elementContent, $defaultValue = null)
{
if (isset($_POST["ec_" . $elementContent->InstanceKey]))
{
return $_POST["ec_" . $elementContent->InstanceKey];
}
return $defaultValue;
}
public function processPostback(InstanceReference $element)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$ec_UserName = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::ElementContent__UserNameForLoginPage);
$ec_Password = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::ElementContent__PasswordForLoginPage);
// $ct = $oms->getRelatedInstance($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__processed_by__Control_Transaction_Method));
// Login Page@ Login Page Edit(CT)*S
// uses Build Response Method Binding...
//
$userName = $this->getElementContentValue($ec_UserName); // $_POST["ec_56$4"];
$password = $this->getElementContentValue($ec_Password); // $_POST["ec_56$5"];
$mbUser__get__User_for_User_Name_parm = $oms->getInstanceByGlobalIdentifier(KnownMethodBindingGuids::User__get__User_for_User_Name_parm);
if ($mbUser__get__User_for_User_Name_parm === null)
{
echo("`User@get User for User Name parm`: method not found ('" . KnownMethodBindingGuids::User__get__User_for_User_Name_parm . "')");die();
}
$mbUser__get__User_for_User_Name_parm = $mbUser__get__User_for_User_Name_parm->asMethodBinding();
$instUser = $mbUser__get__User_for_User_Name_parm->executeReturningInstanceSet(array( KnownAttributeGuids::UserName => $userName ));
if ($instUser !== null)
{
$passwordSalt = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordSalt));
$passwordHashExpected = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordHash));
$passwordHashActual = hash('sha512', $password . $passwordSalt);
if ($passwordHashExpected == $passwordHashActual)
{
$token = $this->random_str();
// create the instance of `User Login`
$instLogin = $oms->createInstanceOf($oms->getInstanceByGlobalIdentifier(KnownClassGuids::UserLogin));
if ($instLogin !== null)
{
$oms->setAttributeValue($instLogin, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Token), $token);
$oms->assignRelationship($instLogin, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User), $instUser);
}
$_SESSION["user_token_" . $oms->getTenant()->ID] = $token;
System::Redirect("~/d/home.htmld");
exit();
}
else
{
//$this->Page->GetControlByID("literal1")->EnableRender = true;
//System::RedirectToLoginPage(true);
}
}
$ecPasswordMsg = $oms->getInstanceByGlobalIdentifier("684f1e039ecd43d58acadcf5b84c71f8");
$this->Context->setElementParm($ecPasswordMsg, "visible", true);
}
public function shouldRenderElementContent(InstanceReference $elementContent)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
if ($this->Context->getElementParm($elementContent, "visible", false))
{
return true;
}
$displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__DoNotShow)))
return false;
if (!$this->Context->getElementParm($elementContent, "visible", true))
{
return false;
}
return true;
}
public function renderElementContent(InstanceReference $elementContent)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$ecInst = $oms->getRelatedInstance($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Instance));
if ($ecInst === null)
{
}
else
{
if ($this->shouldRenderElementContent($elementContent))
{
$this->renderBeginTag("tr", [ "data-instance-id" => $elementContent->InstanceKey ], [ "mcx-elementcontent" ]);
$ecPClass = $oms->getParentClass($ecInst);
$title = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name));
//!HACK
if ($ecInst->InstanceKey->ClassIndex == 6)
{
// ELements should not have a title
$title = "";
}
echo("<!-- " . $ecInst->InstanceKey . " -->");
$displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__WideText)))
{
$this->renderBeginTag("td");
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__DoNotShowLabel)))
{
echo ("<label for=\"ec_" . $elementContent->InstanceKey . "\">" . $title . "</label>");
}
$this->renderEndTag("td");
$this->renderBeginTag("td");
}
else
{
$this->renderBeginTag("td", [ "colspan" => "2" ]);
}
if (strtolower($ecPClass->GlobalIdentifier) == strtolower(KnownClassGuids::Element))
{
$this->renderElement($ecInst, $displayOptions);
}
else if (strtolower($ecPClass->GlobalIdentifier) == strtolower(KnownClassGuids::TextAttribute))
{
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable)))
{
$this->renderTextAttribute($elementContent, $ecInst, $oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ObscuredText)));
}
else
{
// get the default value of the Text Attribute ( the Text Attribute `Value` on the EC text attribute )
$value = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value));
echo($value);
}
}
else
{
echo ("<span class=\"mcx-value\">unknown pclass ident " . $ecPClass->GlobalIdentifier . "</span>");
}
echo ("</td>");
$this->renderEndTag("tr");
}
}
}
public function renderTextAttribute(InstanceReference $ec, InstanceReference $inst, $password = false)
{
$ecid = $ec->InstanceKey;
echo("<input id=\"ec_" . $ecid . "\" name=\"ec_" . $ecid . "\" type=\"");
if ($password)
{
echo("password");
}
else
{
echo("text");
}
echo("\" data-ecid=\"" . $ecid . "\" />");
}
public function renderArray(?array $array, string $separator, string $prefix = "", string $suffix = "")
{
if ($array === null)
return "";
if (\count($array) > 0)
{
return $prefix . \implode($separator, $array) . $suffix;
}
return "";
}
public function renderKeyedArray(?array $array, string $separator, string $prefix = "", string $suffix = "", string $partSeparator = "", string $keyPrefix = "", string $keySuffix = "", string $valuePrefix = "", string $valueSuffix = "")
{
if ($array === null)
return "";
if (\count($array) > 0)
{
$str = $prefix;
foreach ($array as $key => $value)
{
$str .= $keyPrefix . $key . $keySuffix;
$str .= $partSeparator;
$str .= $valuePrefix . $value . $valueSuffix;
$str .= $separator;
}
$str .= $suffix;
return $str;
}
return "";
}
public function renderInitialElement(InstanceReference $element)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$metaCharset = "UTF-8";
$metaAttributes = [];
$metaAttributes["viewport"] = "width=device-width, initial-scale=1.0";
echo ("<!DOCTYPE html>");
echo ("<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>");
echo ("<meta charset=\"" . $metaCharset . "\" />");
foreach ($metaAttributes as $key => $value)
{
echo ("<meta name=\"" . $key . "\" content=\"" . $value . "\" />");
}
echo ("<title></title>");
echo("<link rel=\"stylesheet\" type=\"text/css\" href=\"" . System::ExpandRelativePath("~/themes/clearview/theme.css", false, true) . "\" />");
echo("</head><body>");
echo("<form method=\"POST\">");
$DO_Singular = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular);
$this->renderElement($element, [ $DO_Singular ]);
echo("<div class=\"uwt-page-footer\">");
echo ("<input class=\"uwt-button uwt-color-primary\" type=\"submit\" value=\"OK\" />");
echo("</div>");
echo ("</form>");
echo("</body></html>");
}
public function renderBeginTag($tagName, ?array $attributeList = null, ?array $classList = null)
{
echo ("<" . $tagName . $this->renderArray($classList, " ", " class=\"", "\"") . $this->renderKeyedArray($attributeList, " ", " ", "", "=", "", "", "\"", "\"") . ">");
}
public function renderEndTag($tagName)
{
echo ("</" . $tagName . ">");
}
public function renderElement(InstanceReference $element, array $displayOptions)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ShowSubelementsVertically)))
{
$this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-formview", "mcx-element" ]);
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
foreach ($contents as $content)
{
$this->renderElementContent($content);
}
$this->renderEndTag ("table");
}
else
{
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular)))
{
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
foreach ($contents as $content)
{
$this->renderElementContent($content);
}
}
else
{
$this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]);
$this->renderBeginTag("<tr>");
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
foreach ($contents as $content)
{
$this->renderBeginTag("<td>");
$this->renderElementContent($content);
$this->renderEndTag("<td>");
}
$this->renderEndTag("<tr>");
$this->renderEndTag("table");
}
}
}
}
?>

View File

@ -0,0 +1,761 @@
<?php
namespace Mocha\UI\Renderers\HTML;
use Mocha\Core\InstanceKey;
use Mocha\Core\InstanceReference;
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownMethodBindingGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\MySQLDatabaseOms;
use Mocha\UI\ValidationResult;
use Phast\System;
class HTMLRenderer
{
/**
* @var OmsContext
*/
public $Context;
public $TargetInstance;
/**
* User-defined function to process entire postback (including validations).
*/
public $ProcessPostbackFunction;
/**
* User-defined function to process updates (not including validations). Validations will still
* be processed by Mocha before this function is called. This function will NOT be called if the
* validations fail.
*/
public $ProcessUpdatesFunction;
public $FailedValidations;
public $FailedValidationElements;
public $StyleClasses;
public bool $IsPostback;
public function __construct(OmsContext $context)
{
$this->Context = $context;
$this->FailedValidations = [];
$this->FailedValidationElements = [];
$this->IsPostback = false;
$this->StyleClasses = [];
}
/**
* Thanks https://stackoverflow.com/a/31107425
*
* Generate a random string, using a cryptographically secure
* pseudorandom number generator (random_int)
*
* This function uses type hints now (PHP 7+ only), but it was originally
* written for PHP 5 as well.
*
* For PHP 7, random_int is a PHP core function
* For PHP 5.x, depends on https://github.com/paragonie/random_compat
*
* @param int $length How many characters do we want?
* @param string $keyspace A string of all possible characters
* to select from
* @return string
*/
private function random_str(int $length = 64, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ) : string
{
if ($length < 1)
{
throw new \RangeException("Length must be a positive integer");
}
$pieces = [];
$max = \mb_strlen($keyspace, '8bit') - 1;
for ($i = 0; $i < $length; ++$i)
{
$pieces[] = $keyspace[\random_int(0, $max)];
}
return \implode('', $pieces);
}
public function getElementContentValue(InstanceReference $elementContent, $defaultValue = null)
{
if (isset($_POST["ec_" . $elementContent->InstanceKey]))
{
return $_POST["ec_" . $elementContent->InstanceKey];
}
return $defaultValue;
}
public function renderTask(InstanceReference $task, InstanceReference $relatedInstance)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$parentClass = $oms->getParentClass($task);
if ($parentClass->GlobalIdentifier == KnownClassGuids::HardcodedTask)
{
$className = $oms->getAttributeValue($task, KnownAttributeGuids::ClassName);
$taskClass = null;
try
{
$taskClass = new $className($task, $relatedInstance);
}
catch (\Error $ex)
{
}
if ($taskClass !== null)
{
$value = $taskClass->Render();
if ($value instanceof InstanceReference)
{
$pc = $oms->getParentClass($value);
if ($pc->GlobalIdentifier == KnownClassGuids::Element)
{
$this->renderInitialElement($value);
}
}
else if (is_string($value))
{
echo($value);
}
}
else
{
echo("could not find hardcoded task class '" . $className . "'");
}
}
}
public function processPostback(InstanceReference $element)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
if (is_callable($this->ProcessPostbackFunction))
{
// call user-defined ProcessPostbackFunction
return call_user_func($this->ProcessPostbackFunction, $this, $element);
}
else
{
$ecs = array();
foreach ($_POST as $key => $value)
{
if (str_starts_with($key, "ec_"))
{
$ecid = substr($key, 3);
$ecs[$ecid] = $value;
}
}
$result = null;
foreach ($ecs as $key => $value)
{
$inst_ec = $oms->getInstanceByKey(InstanceKey::Parse($key));
if (!$this->checkValidationsForElementContent($inst_ec, $value))
{
$result = false;
}
}
if ($result === false)
{
return false;
}
if (is_callable($this->ProcessUpdatesFunction))
{
// call user-defined ProcessUpdatesFunction
return call_user_func($this->ProcessUpdatesFunction, $this, $element);
}
else
{
// process updates
foreach ($ecs as $key => $value)
{
$inst_ec = $oms->getInstanceByKey(InstanceKey::Parse($key));
if (!$this->processUpdatesForElementContent($inst_ec, $value))
{
return false;
}
}
}
}
}
/**
* @return true if the validation passes; false otherwise
*/
private function checkValidationForElementContent(InstanceReference $elementContent, string $value, InstanceReference $validation)
{
return true;
}
/**
* @return true if the validations pass (or there are no validations); false otherwise.
*/
private function checkValidationsForElementContent(InstanceReference $elementContent, string $value)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Required)))
{
// this is a required parm
if ($value == null)
{
$this->FailedValidations[] = new ValidationResult(null, "Missing required parameter", $oms->getAttributeValue($elementContent, KnownAttributeGuids::Label));
$this->FailedValidationElements[] = $elementContent;
return false;
}
}
$validations = $oms->getRelatedInstances($elementContent, KnownRelationshipGuids::Element_Content__has__Validation);
foreach ($validations as $validation)
{
if (!$this->checkValidationForElementContent($elementContent, $value, $validation))
{
$this->FailedValidations[] = new ValidationResult($validation, null, null);
$this->FailedValidationElements[] = $elementContent;
return false;
}
}
return true;
}
private function processUpdatesForElementContent(InstanceReference $elementContent, string $value)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
/*
if (!$oms->getAttributeValue($inst_ec, KnownAttributeGuids::DoNotUpdateOnSubmit))
{
*/
$inst_target = $oms->getRelatedInstance($elementContent, KnownRelationshipGuids::Element_Content__has__Instance);
/*
$value = $oms->getAttributeValue($this->TargetInstance, $ecInst);
if ($value === null)
{
$value = $oms->getAttributeValue($inst_target, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value));
}
*/
$oms->setAttributeValue($inst_target, KnownAttributeGuids::Value, $value);
/*
}
*/
return true;
}
public function shouldRenderElementContentLabel(InstanceReference $elementContent)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__WideText)))
{
return false;
}
$ecLayout = $oms->getRelatedInstance($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Layout));
if ($ecLayout !== null)
{
$ecLayoutParentClass = $oms->getParentClass($ecLayout);
if ($ecLayoutParentClass !== null)
{
if (
($ecLayoutParentClass->GlobalIdentifier == KnownClassGuids::ButtonLayout)
|| ($ecLayoutParentClass->GlobalIdentifier == KnownClassGuids::ImageLayout)
)
{
return false;
}
}
}
return true;
}
public function shouldRenderElementContent(InstanceReference $elementContent)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
if ($this->Context->getElementParm($elementContent, "visible", false))
{
return true;
}
$displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__DoNotShow)))
return false;
if (!$this->Context->getElementParm($elementContent, "visible", true))
{
return false;
}
return true;
}
public function buildStyleAttribute(array $constantStyles, array $stylesFromInstanceSet)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$str = "";
foreach ($constantStyles as $key => $value)
{
$str .= $key . ": " . $value . ";";
}
foreach ($stylesFromInstanceSet as $ir)
{
# $styleHasStyleRule = $oms->getRelatedInstances($ir, KnownRelationshipGuids::Style__has__Style_Rule);
$styleHasWidthAttr = $oms->getAttributeValue($ir, KnownRelationshipGuids::Style__has_width__Measurement);
if ($styleHasWidthAttr !== null)
{
}
$styleHasHeightAttr = $oms->getAttributeValue($ir, KnownRelationshipGuids::Style__has_height__Measurement);
if ($styleHasHeightAttr !== null)
{
}
}
}
public function renderElementContent(InstanceReference $elementContent)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$ecInst = $oms->getRelatedInstance($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Instance));
$ecLayout = $oms->getRelatedInstance($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Layout));
if ($ecLayout !== null)
{
$ecStyles = $oms->getRelatedInstances($ecLayout, KnownRelationshipGuids::Layout__has__Style);
$ecLayoutParentClass = $oms->getParentClass($ecLayout);
if ($ecLayoutParentClass !== null)
{
if ($ecLayoutParentClass->GlobalIdentifier == KnownClassGuids::ButtonLayout)
{
// override layout : button
echo ("<a class=\"uwt-button\" href=\"\">");
// TODO: get Translatable label text from EC
$attrLabel = $oms->getAttributeValue($elementContent, KnownAttributeGuids::Label, "NO_LABEL_" . $elementContent->InstanceKey);
echo ($attrLabel);
echo ("</a>");
}
else if ($ecLayoutParentClass->GlobalIdentifier == KnownClassGuids::ImageLayout)
{
// override layout : image
echo ("<div class=\"uwt-image\" style=\"");
// EC instance should be of type `File`
$attrContentType = $oms->getAttributeValue($ecInst, KnownAttributeGuids::ContentType);
$attrContentEncoding = $oms->getAttributeValue($ecInst, KnownAttributeGuids::Encoding);
$attrValue = $oms->getAttributeValue($ecInst, KnownAttributeGuids::Value);
echo ($this->buildStyleAttribute([
"background-image" => "url('data:" . $attrContentType . ";" . $attrContentEncoding . "," . $attrValue . "')"
], $ecStyles));
echo("\">&nbsp;</div>");
}
}
}
else
{
// default layout
if ($ecInst === null)
{
}
else
{
if ($this->shouldRenderElementContent($elementContent))
{
$displayOptions = $oms->getRelatedInstances($elementContent, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
$ecPClass = $oms->getParentClass($ecInst);
if (strtolower($ecPClass->GlobalIdentifier) == strtolower(KnownClassGuids::Element))
{
$this->renderElement($ecInst, $displayOptions);
}
else if (strtolower($ecPClass->GlobalIdentifier) == strtolower(KnownClassGuids::Relationship))
{
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable)))
{
//$this->renderRelationship($ecInst);
}
else
{
// get the current value of the relationship
$value = $oms->getRelatedInstances($this->TargetInstance, $ecInst);
if (count($value) > 0)
{
$this->renderBeginTag("ul");
$this->renderBeginTag("li");
$this->renderEndTag("li");
$this->renderEndTag("ul");
}
else
{
echo("(empty)");
}
}
}
else if (strtolower($ecPClass->GlobalIdentifier) == strtolower(KnownClassGuids::TextAttribute))
{
$value = $oms->getAttributeValue($this->TargetInstance, $ecInst);
if ($value === null)
{
$value = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Value));
}
if ($this->IsPostback && isset($_POST["ec_" . strval($elementContent->InstanceKey)]))
{
$value = $_POST["ec_" . strval($elementContent->InstanceKey)];
}
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__NotEnterable)))
{
$this->renderTextAttribute($elementContent, $ecInst, $oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ObscuredText)), $value);
}
else
{
echo($value);
}
}
else
{
echo ("<span class=\"mcx-value\">unknown pclass ident " . $ecPClass->GlobalIdentifier . "</span>");
}
echo ("</td>");
}
}
}
}
public function renderTextAttribute(InstanceReference $ec, InstanceReference $inst, $password = false, $value = null)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$displayOptions = $oms->getRelatedInstances($ec, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element_Content__has__Element_Content_Display_Option));
$ecid = $ec->InstanceKey;
$p = new \Phast\WebControl();
$p->TagName = "input";
$p->ClientID = "ec_" . $ecid;
$p->Attributes[] = new \Phast\WebControlAttribute("name", "ec_" . $ecid);
$p->Attributes[] = new \Phast\WebControlAttribute("data-ecid", $ecid);
$p->Attributes[] = new \Phast\WebControlAttribute("value", $value);
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Required)))
{
$p->ClassList[] = "uwt-required";
}
if ($this->IsPostback && $oms->instanceSetContains($this->FailedValidationElements, $ec))
{
$p->ClassList[] = "uwt-failed-validation";
}
$maxLength = $inst->getAttributeValue(KnownAttributeGuids::MaximumLength);
if ($maxLength !== null)
{
$p->Attributes[] = new \Phast\WebControlAttribute("maxlength", $maxLength);
}
$p->HasContent = false;
$attType = new \Phast\WebControlAttribute("type", "text");
if ($password)
{
$attType->Value = "password";
}
$p->Attributes[] = $attType;
$p->Render();
}
public function renderArray(?array $array, string $separator, string $prefix = "", string $suffix = "")
{
if ($array === null)
return "";
if (\count($array) > 0)
{
return $prefix . \implode($separator, $array) . $suffix;
}
return "";
}
public function renderKeyedArray(?array $array, string $separator, string $prefix = "", string $suffix = "", string $partSeparator = "", string $keyPrefix = "", string $keySuffix = "", string $valuePrefix = "", string $valueSuffix = "")
{
if ($array === null)
return "";
if (\count($array) > 0)
{
$str = $prefix;
foreach ($array as $key => $value)
{
$str .= $keyPrefix . $key . $keySuffix;
$str .= $partSeparator;
$str .= $valuePrefix . $value . $valueSuffix;
$str .= $separator;
}
$str .= $suffix;
return $str;
}
return "";
}
public function renderInitialElement(InstanceReference $element)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$metaCharset = "UTF-8";
$metaAttributes = [];
$metaAttributes["viewport"] = "width=device-width, initial-scale=1.0";
echo ("<!DOCTYPE html>");
$this->renderBeginTag("html", array("xmlns" => "http://www.w3.org/1999/xhtml"));
$this->renderBeginTag("head");
echo ("<meta charset=\"" . $metaCharset . "\" />");
foreach ($metaAttributes as $key => $value)
{
echo ("<meta name=\"" . $key . "\" content=\"" . $value . "\" />");
}
$applicationTitle = "Mocha"; // TOOD: get tenant application title
$pageTitle = null;
$pageTitle = $oms->getAttributeValue($element, KnownAttributeGuids::Label);
if ($pageTitle !== null && $applicationTitle !== null)
{
$title = $pageTitle . " - " . $applicationTitle;
}
else if ($pageTitle !== null)
{
$title = $pageTitle;
}
else if ($applicationTitle !== null)
{
$title = $applicationTitle;
}
$this->renderBeginTag("title");
echo($title);
$this->renderEndTag("title");
echo("<link rel=\"stylesheet\" type=\"text/css\" href=\"" . System::ExpandRelativePath("~/themes/clearview/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/mocha.js.php", false, true)));
$this->renderBeginTag("script", array("type" => "text/javascript"));
echo("System.BasePath = '" . System::GetConfigurationValue("Application.BasePath") . "';");
echo("System.IsTenantedHostingEnabled = function() { return false; };");
echo("System.TenantName = '" . $oms->getTenantName() . "';");
$this->renderEndTag("script");
$this->renderEndTag("head");
$bodyClasses = [];
foreach ($this->StyleClasses as $className)
{
$bodyClasses[] = $className;
}
if ($this->IsPostback)
{
$bodyClasses[] = "uwt-postback";
}
$this->renderBeginTag("body", null, $bodyClasses);
if ($this->IsPostback)
{
echo("<div class=\"uwt-alert-container\">");
if (count($this->FailedValidations) > 0)
{
foreach ($this->FailedValidations as $validation)
{
$ik = "";
echo("<div class=\"uwt-alert uwt-color-danger\" data-instance-id=\"" . $ik . "\">");
echo("<div class=\"uwt-title\">" . $validation->Title . "</div>");
echo("<div class=\"uwt-content\">" . $validation->Message . "</div>");
echo("</div>");
}
}
else
{
echo("<div class=\"uwt-alert uwt-color-success\">");
echo("<div class=\"uwt-title\">Saved</div>");
echo("</div>");
}
echo("</div>");
}
echo("<form method=\"POST\">");
$DO_Singular = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular);
$this->renderElement($element, [ $DO_Singular ]);
echo("<div class=\"uwt-page-footer\">");
echo ("<input class=\"uwt-button uwt-color-primary\" type=\"submit\" value=\"OK\" />");
echo("</div>");
echo ("</form>");
$this->renderEndTag("body");
$this->renderEndTag("html");
}
public function renderTag($tagName, ?array $attributeList = null, ?array $classList = null)
{
$canBeEmpty = true;
if ($tagName == "script")
{
$canBeEmpty = false;
}
if ($canBeEmpty)
{
echo ("<" . $tagName . $this->renderArray($classList, " ", " class=\"", "\"") . $this->renderKeyedArray($attributeList, " ", " ", "", "=", "", "", "\"", "\"") . " />");
}
else
{
$this->renderBeginTag($tagName, $attributeList, $classList);
$this->renderEndTag($tagName);
}
}
public function renderBeginTag($tagName, ?array $attributeList = null, ?array $classList = null)
{
echo ("<" . $tagName . $this->renderArray($classList, " ", " class=\"", "\"") . $this->renderKeyedArray($attributeList, " ", " ", "", "=", "", "", "\"", "\"") . ">");
}
public function renderEndTag($tagName)
{
echo ("</" . $tagName . ">");
}
public function renderElement(InstanceReference $element, array $displayOptions)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__ShowSubelementsVertically)))
{
$this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-formview", "mcx-element" ]);
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
foreach ($contents as $elementContent)
{
if (!$this->shouldRenderElementContent($elementContent))
{
continue;
}
$mcx_classes = [ "mcx-elementcontent" ];
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Required)))
{
$mcx_classes[] = "mcx-required";
}
if ($this->IsPostback && $oms->instanceSetContains($this->FailedValidationElements, $elementContent))
{
$mcx_classes[] = "mcx-failed-validation";
}
$ecInst = $oms->getRelatedInstance($elementContent, KnownRelationshipGuids::Element_Content__has__Instance);
$this->renderBeginTag("tr", [ "data-instance-id" => $ecInst->InstanceKey, "data-ecid" => $elementContent->InstanceKey ], $mcx_classes);
$title = $oms->getAttributeValue($ecInst, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name));
$label = $oms->getAttributeValue($elementContent, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Label));
//!HACK
if ($ecInst->InstanceKey->ClassIndex == 6)
{
// ELements should not have a title
$title = "";
}
if ($label !== null)
{
$title = $label;
}
if ($this->shouldRenderElementContentLabel($elementContent))
{
$this->renderBeginTag("td");
if (!$oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__DoNotShowLabel)))
{
echo ("<label for=\"ec_" . $elementContent->InstanceKey . "\">" . $title . "</label>");
}
$this->renderEndTag("td");
$this->renderBeginTag("td");
}
else
{
$this->renderBeginTag("td", [ "colspan" => "2" ]);
}
$this->renderElementContent($elementContent);
$this->renderEndTag("td");
$this->renderEndTag("tr");
}
$this->renderEndTag ("table");
}
else
{
if ($oms->instanceSetContains($displayOptions, $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::DisplayOption__Singular)))
{
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
foreach ($contents as $content)
{
$this->renderElementContent($content);
}
}
else
{
$this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]);
$this->renderBeginTag("tr");
$contents = $oms->getRelatedInstances($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
foreach ($contents as $content)
{
$this->renderBeginTag("td");
$this->renderElementContent($content);
$this->renderEndTag("td");
}
$this->renderEndTag("tr");
$this->renderEndTag("table");
}
}
}
}
?>

View File

@ -0,0 +1,38 @@
<?php
namespace Mocha\UI\Tasks;
use Mocha\Core\InstanceReference;
class HardcodedTask extends Task
{
public InstanceReference $TaskInstance;
public InstanceReference $RelatedInstance;
public function __construct(InstanceReference $instTask, InstanceReference $instRelatedInstance)
{
$this->TaskInstance = $instTask;
$this->RelatedInstance = $instRelatedInstance;
}
protected function OnProcessUpdates()
{
}
protected function OnRender()
{
}
public function Render()
{
return $this->OnRender();
}
public function ProcessUpdates()
{
$this->OnProcessUpdates();
}
}
?>

View File

@ -0,0 +1,9 @@
<?php
namespace Mocha\UI\Tasks;
abstract class Task
{
}
?>

View File

@ -0,0 +1,89 @@
function McxElementContent(parentElement)
{
this.ParentElement = parentElement;
this.LabelTd = this.ParentElement.children[0];
this.LabelElement = this.LabelTd.children[0];
this.InstanceID = this.ParentElement.getAttribute("data-instance-id");
this.ECID = this.ParentElement.getAttribute("data-ecid");
if (this.LabelElement)
{
this.LabelElement.NativeObject = this;
this.LabelElement.addEventListener("contextmenu", function(e)
{
var cm = new ContextMenu();
var ecid = this.NativeObject.ECID;
var iid = this.NativeObject.InstanceID;
cm.Items = [
{
"JJJJ": this.NativeObject,
"ClassName": "MenuItemCommand",
"Title": "Show Field Properties",
"Visible": true,
"Execute": function()
{
var popup = Popup.create(this.JJJJ.LabelTd);
var listview = ListView.create(popup.ParentElement, {
"columns": [
{
"id": "ecid",
"title": "ECID"
},
{
"id": "iid",
"title": "Instance ID"
}
],
"items": [
{
"columns": [
{
"id": "ecid",
"value": ecid
},
{
"id": "iid",
"value": iid
}
]
}
]
});
popup.ParentElement.appendChild(listview.ParentElement);
popup.Show();
}
},
{
"ClassName": "MenuItemCommand",
"Title": "Show Field EC",
"Visible": true,
"Execute": function()
{
window.open(System.ExpandRelativePath("~/" + System.TenantName + "/d/inst/1$56/" + ecid + ".htmld"));
}
}
];
cm.Show(e.clientX, e.clientY, this);
e.preventDefault();
e.stopPropagation();
return false;
});
}
}
window.addEventListener("load", function()
{
var items = document.getElementsByClassName("mcx-elementcontent");
for (var i = 0; i < items.length; i++)
{
items[i].McxNativeObject = new McxElementContent(items[i]);
}
});

View File

@ -0,0 +1,55 @@
<?php
if (file_exists(dirname(__FILE__) . "/phast/JSMin.inc.php"))
{
include_once(dirname(__FILE__) . "/phast/JSMin.inc.php");
}
$last_modified_time = filemtime(__FILE__);
$etag = md5_file(__FILE__);
// always send headers
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT");
header("Etag: $etag");
// exit if not modified
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
@trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)
{
header("HTTP/1.1 304 Not Modified");
exit;
}
header ("Content-Type: text/javascript");
$bundles = array();
$files = glob("*.js");
foreach ($files as $file)
{
$bundles[] = $file;
}
$input = "";
foreach ($bundles as $bundle)
{
$input .= "/* BEGIN '" . $bundle . "' */\r\n";
$input .= file_get_contents($bundle) . "\r\n";
$input .= "/* END '" . $bundle . "' */\r\n\r\n";
}
if (isset($_GET["minify"]) && $_GET["minify"] == "false")
{
echo($input);
}
else
{
if (class_exists("\\JSMin\\JSMin"))
{
$output = \JSMin\JSMin::minify($input);
}
else
{
$output = "/* could not find class '\\JSMin\\JSMin'; minify is unavailable */\r\n";
$output .= $input;
}
echo($output);
}
?>

1
php/mocha/scripts/phast Symbolic link
View File

@ -0,0 +1 @@
/home/beckermj/Documents/Projects/phast/lib/phast/client/scripts

View File

@ -0,0 +1,32 @@
div.uwt-alert
{
padding: .75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: .25rem;
&.uwt-color-success
{
background-color: #d4edda;
border-color: #c3e6cb;
color: #155724;
}
&.uwt-color-info
{
background-color: #d1ecf1;
border-color: #bee5eb;
color: #0c5460;
}
&.uwt-color-warning
{
background-color: #fff3cd;
border-color: #ffeeba;
color: #856404;
}
&.uwt-color-danger
{
background-color: #f8d7da;
border-color: #f5c6cb;
color: #721c24;
}
}

View File

@ -1,11 +1,21 @@
.uwt-button
{
background-color: #fff;
border: solid 1px #d2d2d2;
border: solid 1px rgb(231, 234, 236);
color: inherit;
padding: 6px;
min-width: 80px;
min-height: 24px;
text-decoration: none;
transition: all 0.3s;
&:hover
{
border-color: rgb(210, 210, 210);
color: inherit;
text-decoration: none;
}
}
.uwt-button.uwt-color-primary
{

View File

@ -0,0 +1,44 @@
.uwt-popup
{
background-color: #fff;
border: medium none;
border-radius: 3px;
box-shadow: 0 0 3px rgba(86, 96, 117, 0.7);
position: fixed;
transition: all 0.3s;
&:not(.uwt-visible)
{
opacity: 0;
visibility: hidden;
}
}
ul.uwt-menu
{
list-style-type: none;
padding: 0px;
margin: 0px;
&> li
{
&> a
{
border-radius: 3px;
color: #262626;
font-weight: normal;
display: block;
margin: 4px;
padding: 3px 20px;
text-decoration: none;
&:hover
{
background-color: #f5f5f5;
text-decoration: none;
}
}
}
}

View File

@ -1,3 +1,6 @@
@import "../common/styles/uwt.less";
@import "uwt-alert.less";
@import "uwt-badge.less";
@import "uwt-button.less";
@import "uwt-colors.less";
@ -8,6 +11,7 @@
@import "uwt-listbox.less";
@import "uwt-listview.less";
@import "uwt-panel.less";
@import "uwt-popup.less";
@import "uwt-textbox.less";
@import "uwt-toolbar.less";
@ -20,4 +24,13 @@
@import "../common/fonts/awesome/css/all.min.css";
@import "../common/styles/mochahacks.less";
@import "../common/styles/mochahacks.less";
body.uwt-postback
{
input.uwt-failed-validation
{
border: solid 1px var(--uwt-color-danger) !important;
box-shadow: 0px 0px 4px var(--uwt-color-danger) !important;
}
}

View File

@ -15,9 +15,27 @@ body
/* overflow: hidden; */
}
body.login-page
body.mcx-loginpage
{
justify-content: center;
form
{
margin-top: 64px;
align-items: flex-start;
width: 640px;
margin-left: auto;
margin-right: auto;
background-color: #ffffff;
padding: 15px 20px 20px 20px;
border: 1px solid #e7eaec;
&> table.uwt-formview
{
margin-top: 32px;
}
}
}
img.header-image
@ -25,22 +43,6 @@ img.header-image
width: 128px;
}
/*
div.login-container
{
margin-top: 64px;
align-items: flex-start;
width: 640px;
margin-left: auto;
margin-right: auto;
border: solid 1px #1ab394;
}
div.login-container > table.uwt-formview
{
margin-top: 32px;
}
*/
@media (min-width: 1000px)
{
div.login-container
@ -143,4 +145,13 @@ div.mcx-element
display: flex;
flex-direction: column;
}
}
}
.mcx-required label::after
{
content: '*';
float: right;
color: #f00;
font-size: 24pt;
font-weight: normal;
}

View File

@ -6,4 +6,16 @@ body > div.uwt-alert-container
min-width: 320px;
z-index: 100;
}
div.uwt-alert
{
position: relative;
transition: all 1s;
right: 0px;
&> div.uwt-title
{
font-weight: bold;
}
}

View File

@ -1,7 +1,7 @@
// @ButtonSelector: 'a.uwt-button, button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a';
// (~'@{ButtonSelector}')
a.uwt-button, button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a
.uwt-button /* , button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a */
{
display: inline-block;
font-weight: 400;
@ -19,13 +19,16 @@ a.uwt-button, button, input[type=button], input[type=submit], input[type=reset],
min-width: 80px;
margin-right: 6px;
&+ .uwt-button
{
margin-right: 6px;
}
}
div.uwt-button-group
{
//(~'@{ButtonSelector}')
a.uwt-button, button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a
.uwt-button /*, button, input[type=button], input[type=submit], input[type=reset], div.uwt-button > a */
{
margin-right: 0px;
}

View File

@ -15,4 +15,4 @@ body > div.uwt-footer, body > form > div.uwt-footer
padding: 16px;
*/
}
}
}

View File

@ -2,10 +2,10 @@ table.uwt-formview
{
border-collapse: collapse;
&:not(.uwt-expand)
{
display: inline-block;
}
// &:not(.uwt-expand)
// {
// display: inline-block;
// }
&> tr > td, &> thead > tr > td, &> tbody > tr > td
{
@ -14,8 +14,11 @@ table.uwt-formview
vertical-align: top;
&:first-child
{
font-weight: bold;
padding-right: 24px;
&> label
{
font-weight: bold;
padding-right: 24px;
}
}
}
&.uwt-formview-stacked

View File

@ -0,0 +1,5 @@
div.uwt-image
{
background-repeat: no-repeat;
background-size: 100% 100%;
}

View File

@ -0,0 +1,6 @@
div.uwt-page-footer
{
display: flex;
flex-direction: row;
justify-content: end;
}

View File

@ -13,6 +13,7 @@
@import "uwt-formview.less";
@import "uwt-gripper.less";
@import "uwt-header.less";
@import "uwt-image.less";
@import "uwt-label.less";
@import "uwt-layout-box.less";
@import "uwt-listbox.less";
@ -22,6 +23,7 @@
@import "uwt-meter.less";
@import "uwt-page-header.less";
@import "uwt-page.less";
@import "uwt-page-footer.less";
@import "uwt-panel.less";
@import "uwt-popup.less";
@import "uwt-progressbar.less";

View File

@ -9,7 +9,7 @@
use Mocha\Core\OmsContext;
use Mocha\UI\Renderers\HTMLRenderer;
use Mocha\UI\Renderers\HTML\HTMLRenderer;
use Phast\RenderingEventArgs;
use Phast\System;
use Phast\WebPage;
@ -40,11 +40,11 @@
die();
}
$renderer->IsPostback = $this->Page->IsPostback;
if ($this->Page->IsPostback)
{
$renderer->processPostback($pageElement);
}
$renderer->renderInitialElement($pageElement);
exit();

View File

@ -17,5 +17,23 @@
</wcx:Section>
</Content>
</Page>
<Page MasterPageFileName="masterPages/Blank.phpx" FileName="{tenant}/d/inst/{castinstid}/{instid}.htmld" CodeBehindClassName="Mocha\UI\Pages\InstancePage">
<References>
<Reference TagPrefix="html" NamespacePath="Phast\HTMLControls" />
<Reference TagPrefix="wcx" NamespacePath="Phast\WebControls" />
</References>
<Content>
<wcx:Section PlaceholderID="aspcContent">
<html:Literal id="spotTimerInitializationScript" />
<div class="mocha-ams-spot-popup" id="spot_popup"><h1>SPOT:</h1><h3>Stop in: <label id="spot_timer"><html:Literal id="literalSpotTimer">--:--</html:Literal></label></h3></div>
<div style="display: block;">
<h1><html:Literal id="taskTitle">Test Instance</html:Literal></h1>
<p>Cast to Class Instance ID: <html:Literal id="castId" /></p>
<p>Instance ID: <html:Literal id="instId" /></p>
</div>
</wcx:Section>
</Content>
</Page>
</Pages>
</Website>

View File

@ -1,6 +1,14 @@
<?php
namespace Mocha\UI\Pages;
use Mocha\Core\InstanceKey;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\Oms\MySQLDatabaseOms;
use Mocha\UI\Renderers\HTML\HTMLRenderer;
use Phast\RenderingEventArgs;
use Phast\WebPage;
@ -11,12 +19,68 @@
{
parent::OnRendering($re);
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
mocha_init_spot_timer($this);
$instIdCtl = $this->GetControlByID("instId");
$taskInstIdCtl = $this->GetControlByID("taskInstId");
$castIdCtl = $this->GetControlByID("castId");
$instIdCtl->Content = $this->Page->GetPathVariableValue("instid");
$instkey = InstanceKey::Parse($this->Page->GetPathVariableValue("instid"));
$castkey = InstanceKey::Parse($this->Page->GetPathVariableValue("castinstid"));
if ($castIdCtl !== null)
{
if ($castkey === null)
{
$castIdCtl->Content = "invalid inst id " . $castkey . " (inst not found)";
}
else
{
$castIdCtl->Content = strval($castkey);
}
}
$inst = $oms->getInstanceByKey($instkey);
if ($inst === null)
{
$instIdCtl->Content = "invalid inst id " . $instkey . " (inst not found)";
}
else
{
$parentClass = $oms->getParentClass($inst);
if ($castkey !== null)
{
$parentClass = $oms->getInstanceByKey($castkey);
}
$instIdCtl->Content = strval(($inst->InstanceKey));
$rel_Class__has_default__Task = $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Class__has_default__Task);
if ($rel_Class__has_default__Task !== null)
{
$defaultTask = $oms->getRelatedInstance($parentClass, $rel_Class__has_default__Task);
if ($defaultTask !== null)
{
$context = new OmsContext();
$taskRenderer = new HTMLRenderer($context);
$taskRenderer->TargetInstance = $inst;
$taskRenderer->IsPostback = $this->Page->IsPostback;
if ($this->IsPostback)
{
$taskRenderer->processPostback($defaultTask);
}
else
{
$taskRenderer->renderTask($defaultTask, $inst);
}
exit();
}
}
}
}
}

View File

@ -4,11 +4,12 @@
use Mocha\Core\KnownAttributeGuids;
use Mocha\Core\KnownClassGuids;
use Mocha\Core\KnownInstanceGuids;
use Mocha\Core\KnownMethodBindingGuids;
use Mocha\Core\KnownRelationshipGuids;
use Mocha\Core\OmsContext;
use Mocha\UI\Renderers\HTMLRenderer;
use Mocha\UI\Renderers\HTML\HTMLRenderer;
use Phast\RenderingEventArgs;
use Phast\System;
use Phast\WebPage;
@ -82,62 +83,80 @@
$renderer = new HTMLRenderer($context);
# $contents = $pageElement->getRelatedInstances($oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
$renderer->ProcessUpdatesFunction = function($sender, $element)
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$ec_UserName = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::ElementContent__UserNameForLoginPage);
$ec_Password = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::ElementContent__PasswordForLoginPage);
// $ct = $oms->getRelatedInstance($element, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__processed_by__Control_Transaction_Method));
// Login Page@ Login Page Edit(CT)*S
// uses Build Response Method Binding...
//
$userName = $sender->getElementContentValue($ec_UserName); // $_POST["ec_56$4"];
$password = $sender->getElementContentValue($ec_Password); // $_POST["ec_56$5"];
$mbUser__get__User_for_User_Name_parm = $oms->getInstanceByGlobalIdentifier(KnownMethodBindingGuids::User__get__User_for_User_Name_parm);
if ($mbUser__get__User_for_User_Name_parm === null)
{
echo("`User@get User for User Name parm`: method not found ('" . KnownMethodBindingGuids::User__get__User_for_User_Name_parm . "')");die();
}
$mbUser__get__User_for_User_Name_parm = $mbUser__get__User_for_User_Name_parm->asMethodBinding();
$instUser = $mbUser__get__User_for_User_Name_parm->executeReturningInstanceSet(array( KnownAttributeGuids::UserName => $userName ));
if ($instUser !== null)
{
$passwordSalt = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordSalt));
$passwordHashExpected = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordHash));
$passwordHashActual = hash('sha512', $password . $passwordSalt);
if ($passwordHashExpected == $passwordHashActual)
{
$token = $this->random_str();
// create the instance of `System Account Signon`
$instLogin = $oms->createInstanceOf($oms->getInstanceByGlobalIdentifier(KnownClassGuids::UserLogin));
if ($instLogin !== null)
{
// FIXME: these attribute should be defined in the Mocha/ZQ
// FIXME: they should be wrapped in a conditional which checks if we are serving in a GDPR compliant region
// should we be storing this information then? probably not...
$oms->setAttributeValue($instLogin, KnownAttributeGuids::Token, $token);
$oms->setAttributeValue($instLogin, KnownAttributeGuids::IPAddress, $_SERVER["REMOTE_ADDR"]);
$oms->assignRelationship($instLogin, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User), $instUser);
}
$_SESSION["user_token_" . $oms->getTenant()->ID] = $token;
System::RedirectFromLoginPage();
exit();
}
else
{
//$this->Page->GetControlByID("literal1")->EnableRender = true;
//System::RedirectToLoginPage(true);
}
}
$ecPasswordMsg = $oms->getInstanceByGlobalIdentifier("684f1e039ecd43d58acadcf5b84c71f8");
$sender->Context->setElementParm($ecPasswordMsg, "visible", true);
};
$renderer->IsPostback = $this->Page->IsPostback;
$renderer->StyleClasses[] = "mcx-loginpage";
if ($this->Page->IsPostback)
{
$renderer->processPostback($pageElement);
}
# $contents = $pageElement->getRelatedInstances($oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::Element__has__Element_Content));
$renderer->renderInitialElement($pageElement);
exit();
$tenant = $oms->getTenantByName($tenantName);
if ($tenant === null)
{
$this->Page->GetControlByID("header-image")->EnableRender = false;
$this->Page->GetControlByID("header-text")->Content = "Tenant Not Found";
$this->Page->GetControlByID("litPanelElements")->EnableRender = false;
$this->Page->GetControlByID("litTenantText")->Content = "The specified tenant was not found on this server.<br /><br />If you require assistance, please contact your system administrator.";
}
else
{
$oms->setTenant($tenant);
$this->Page->GetControlByID("header-image")->ImageUrl = System::ExpandRelativePath("~/madi/authgwy/" . $oms->getTenantName() . "/images/signon.xml", false, true);
}
if ($this->Page->IsPostback)
{
$userName = $_POST["ec__56$1"];
$password = $_POST["ec__56$2"];
$oms->setTenant($oms->getTenantByName($this->Page->GetPathVariableValue("tenant")));
$instUser = $oms->getUserByUserName($userName);
$passwordSalt = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordSalt));
$passwordHashExpected = $oms->getAttributeValue($instUser, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::PasswordHash));
$passwordHashActual = hash('sha512', $password . $passwordSalt);
if ($passwordHashExpected == $passwordHashActual)
{
$token = $this->random_str();
// create the instance of `User Login`
$instLogin = $oms->createInstanceOf($oms->getInstanceByGlobalIdentifier(KnownClassGuids::UserLogin));
if ($instLogin !== null)
{
$oms->setAttributeValue($instLogin, $oms->getInstanceByGlobalIdentifier(KnownAttributeGuids::Token), $token);
$oms->assignRelationship($instLogin, $oms->getInstanceByGlobalIdentifier(KnownRelationshipGuids::User_Login__has__User), $instUser);
}
$_SESSION["user_token_" . $oms->getTenant()->ID] = $token;
System::Redirect("~/d/home.htmld");
exit();
}
else
{
$this->Page->GetControlByID("literal1")->EnableRender = true;
}
}
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace Mocha\UI\Tasks;
use Mocha\Core\KnownInstanceGuids;
use Mocha\UI\Tasks\HardcodedTask;
class ViewElementContent extends HardcodedTask
{
protected function OnProcessUpdates()
{
}
protected function OnRender()
{
/**
* @var MySQLDatabaseOms
*/
$oms = mocha_get_oms();
$value = <<<EOK
<html>
<head>
<title>View Element Content</title>
</head>
<body>
<h1>View Element Content</h1>
<p>
EOK;
$value .= $this->TaskInstance->InstanceKey;
$value .= <<<EOK
</p>
</body>
</html>
EOK;
$element = $oms->getInstanceByGlobalIdentifier(KnownInstanceGuids::Element__ViewElementContent);
return $element;
return $value;
/*
echo ("Related Instance: <br />");
print_r($this->RelatedInstance);
*/
}
}
?>

View File

@ -4,6 +4,7 @@ CREATE PROCEDURE mocha_prepare_instance
(
IN p_class_inst_id INT,
IN p_inst_id INT,
IN p_class_global_identifier CHAR(32), -- the global identifier of the class of the newly created instance
IN p_global_identifier CHAR(32), -- the desired global identifier for the newly created instance
IN p_user_inst_id INT,
IN p_effective_date DATETIME,
@ -23,6 +24,11 @@ sp: BEGIN
-- SET p_class_index = (SELECT inst_id FROM mocha_instances WHERE tenant_id = p_tenant_id AND class_id = 1 AND id = p_class_inst_id);
SET p_class_index = p_class_inst_id;
IF p_class_index IS NULL AND NOT p_class_global_identifier IS NULL THEN
SET p_class_index = (SELECT inst_id FROM mocha_instances WHERE tenant_id = p_tenant_id AND id = mocha_get_instance_by_global_identifier(p_class_global_identifier));
END IF;
-- IF p_class_index IS NULL THEN