From eb3bc6285403e9dd16b5bcfa92632ea81884a7b2 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sun, 7 Jan 2024 01:55:36 -0500 Subject: [PATCH] a whole bunch of ZQ methods work now, yay! --- .../libraryparser/YAMLLibraryParser.py | 6 ++ .../003-Relationships.yaml | 6 ++ .../009-MethodBindings.yaml | 12 ++++ .../003-Classes/00001-Class.yaml | 4 +- .../003-Classes/00003-Relationship.yaml | 31 ++++++++++ .../003-Classes/00010-Method.yaml | 3 + .../003-Classes/00012-GetAttributeMethod.yaml | 7 +++ .../00030-BuildAttributeMethod.yaml | 2 + .../003-Classes/00039-SystemUser.yaml | 3 +- .../00073-AssignAttributeMethod.yaml | 4 ++ .../00086-ReturnAttributeMethodBinding.yaml | 16 +++++ ...kCategory.yaml => 03004-TaskCategory.yaml} | 0 .../Common_Text__get__Forward_Slash.yaml | 8 +++ .../Common_Text__get__Single_Space.yaml | 7 +++ ...tem_User__get__Preferred_Display_Name.yaml | 12 ++++ .../User/System_User__get__User_Name.yaml | 10 ++++ ...m_User__get__User_Name_with_Full_Name.yaml | 19 ++++++ .../lib/mocha/core/KnownClassGuids.inc.php | 2 + .../mocha/core/KnownRelationshipGuids.inc.php | 6 +- .../lib/mocha/oms/MySQLDatabaseOms.inc.php | 24 ++++++-- php/mocha/lib/mocha/oms/Oms.inc.php | 48 ++++++++++++++- .../ui/renderers/html/HTMLRenderer.inc.php | 58 +++++++++++-------- .../themes/common/styles/uwt-listview.less | 11 +++- 23 files changed, 263 insertions(+), 36 deletions(-) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00086-ReturnAttributeMethodBinding.yaml rename common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/{3004-TaskCategory.yaml => 03004-TaskCategory.yaml} (100%) create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Forward_Slash.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Single_Space.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__Preferred_Display_Name.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name.yaml create mode 100644 common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name_with_Full_Name.yaml diff --git a/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py b/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py index 12e6a05..4b28bee 100644 --- a/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py +++ b/common/admin/mocha-libexec/internal/librarymanager/libraryparser/YAMLLibraryParser.py @@ -19,11 +19,17 @@ class YAMLLibraryParser (LibraryParser): def apply_sugar(self): print("applying syntactic sugar to remaining instances...") + # _instances_also_awaiting_sugar = [] + for inst in self._instances_awaiting_sugar: print("applying sugar from '" + inst["from_file_name"] + "'") self.load_instance(inst) print("\n") + # do recursively until we're all out of instances awaiting sugar + # if len(self._instances_awaiting_sugar) > 0: + # self.apply_sugar() + def load_library(self, elem): print("loading library from elem") diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/003-Relationships.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/003-Relationships.yaml index 5a76294..ed46bdd 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/003-Relationships.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/003-Relationships.yaml @@ -28,6 +28,9 @@ - IDR_Class__has__Object_Source: "{B62F9B81-799B-4ABE-A4AF-29B45347DE54}" - IDR_Object_Source__for__Class: "{FBB9391D-C4A2-4326-9F85-7801F377253C}" + - IDR_Class__instances_labeled_by__Executable_returning_Attribute: '{c22fc17f-0c92-47dc-9a8b-28db0db68985}' + - IDR_Executable_returning_Attribute__labels_instances_of__Class: '{f4bc604b-cd2a-42bb-9aed-b0282fb77a0a}' + - 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}" @@ -300,6 +303,9 @@ - IDR_Build_Attribute_Method__returns__Attribute: "{dadbf0f3-7af0-4387-a6b7-a1724a216d88}" - IDR_Attribute__returned_by__Build_Attribute_Method: "{d5a6062b-2e84-46a1-8f54-da630ef6a48c}" + - IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute: '{bb64cd83-85c2-4c20-82eb-2a5a5ead31f1}' + - IDR_Executable_returning_Attribute__builds_for__Build_Attribute_Method: '{a43525da-c9fb-4d4d-96df-850f3911c31b}' + - 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}" diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml index d0d62fa..835ff8a 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/000-EntityDefinitions/009-MethodBindings.yaml @@ -2,3 +2,15 @@ - IDM_User__get__User_for_User_Name_parm: '{43d43f04-0c6d-41e9-9073-36719c4b93f5}' - IDMB_User__get__User_for_User_Name_parm: '{08265aea-1c51-4fa6-9987-242952386cfe}' # '{f3052795-4db7-48fe-a229-e19cac05b463}' + + - IDM_User__get__User_Name: '{e68ea4d8-da30-4ef7-bddf-5b6d77f9ce60}' + - IDMB_User__get__User_Name: '{0ecb9349-4dfe-49a8-964c-67c0fadc251c}' + + - IDM_User__get__User_Name_with_Full_Name: '{43e9c7f6-affb-4fa7-a572-03c6ace04896}' + - IDMB_User__get__User_Name_with_Full_Name: '{bcf591c9-25a3-4080-8ac3-ac5b58143f7b}' + + - IDM_User__get__Preferred_Display_Name: '{2febf91e-df60-4615-a15b-fbbe80b148c5}' + - IDMB_User__get__Preferred_Display_Name: '{12cd3f67-095f-488c-9886-c3a0df97d42c}' + + - IDM_Common_Text__get__Forward_Slash: '{b727d9f4-42e5-4be2-9411-0f794bfe773e}' + - IDM_Common_Text__get__Single_Space: '{94297e64-f210-4777-bd94-a4a19e5fed2c}' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00001-Class.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00001-Class.yaml index a047648..ae7d212 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00001-Class.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00001-Class.yaml @@ -14,6 +14,8 @@ customTagName: 'defaultTask' - instance: '&IDR_Class__has_related__Task;' customTagName: 'relatedTasks' + - instance: '&IDR_Class__instances_labeled_by__Executable_returning_Attribute;' + customTagName: 'instancesLabeledByRAMB' translations: - relationship: '&IDR_Class__has_title__Translation;' values: @@ -25,4 +27,4 @@ index: 1 defaultTask: '&IDI_Task_ViewClass;' relatedTasks: - - instance: '&IDI_Task_ViewClass;' + - instance: '&IDI_Task_ViewClass;' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00003-Relationship.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00003-Relationship.yaml index 41c19dd..468e17b 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00003-Relationship.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00003-Relationship.yaml @@ -204,6 +204,21 @@ siblingRelationshipId: '&IDR_Class__has_default__Task;' singular: no + - relationship: '&IDR_Class__instances_labeled_by__Executable_returning_Attribute;' + index: 109 + sourceClassId: '&IDC_Class;' + type: 'instances labeled by' + destinationClassId: '&IDC_ExecutableReturningAttribute;' + siblingRelationshipId: '&IDR_Executable_returning_Attribute__labels_instances_of__Class;' + singular: yes + + - relationship: '&IDR_Executable_returning_Attribute__labels_instances_of__Class;' + index: 110 + sourceClassId: '&IDC_ExecutableReturningAttribute;' + type: 'labels instances of' + destinationClassId: '&IDC_Class;' + siblingRelationshipId: '&IDR_Class__instances_labeled_by__Executable_returning_Attribute;' + singular: no - relationship: '&IDR_Relationship__has_source__Class;' index: 157 @@ -237,6 +252,22 @@ siblingRelationshipId: '&IDR_Relationship__has_destination__Class;' singular: no + - relationship: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;' + index: 219 + sourceClassId: '&IDC_BuildAttributeMethod;' + type: 'builds with' + destinationClassId: '&IDC_ExecutableReturningAttribute;' + siblingRelationshipId: '&IDR_Executable_returning_Attribute__builds_for__Build_Attribute_Method;' + singular: no + + - relationship: '&IDR_Executable_returning_Attribute__builds_for__Build_Attribute_Method;' + index: 220 + sourceClassId: '&IDC_ExecutableReturningAttribute;' + type: 'builds for' + destinationClassId: '&IDC_BuildAttributeMethod;' + siblingRelationshipId: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;' + singular: no + - relationship: '&IDR_Class__has__Instance;' index: 249 sourceClassId: '&IDC_Class;' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00010-Method.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00010-Method.yaml index af997ca..1c30cb8 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00010-Method.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00010-Method.yaml @@ -10,3 +10,6 @@ values: - languageInstanceId: '&IDI_Language_English;' value: 'Method' + relationships: + - instance: '&IDR_Method__for__Class;' + customTagName: 'forClassId' \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00012-GetAttributeMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00012-GetAttributeMethod.yaml index 17fc272..dc1d490 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00012-GetAttributeMethod.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00012-GetAttributeMethod.yaml @@ -6,7 +6,14 @@ name: GA - Get Attribute Method index: 12 customTagName: getAttributeMethod + attributes: + - instance: '&IDA_Verb;' + customTagName: 'verb' + - instance: '&IDA_Name;' + customTagName: 'name' relationships: + - instance: '&IDR_Method__for__Class;' + customTagName: 'forClassId' - instance: '&IDR_Get_Attribute_Method__returns__Attribute;' customTagName: 'returnsAttributeId' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml index 9d51715..318fa7d 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00030-BuildAttributeMethod.yaml @@ -16,6 +16,8 @@ relationships: - instance: '&IDR_Build_Attribute_Method__returns__Attribute;' customTagName: 'returnsAttributeId' + - instance: '&IDR_Build_Attribute_Method__builds_with__Executable_returning_Attribute;' + customTagName: 'buildsWithAttributes' - relationship: '&IDR_Build_Attribute_Method__returns__Attribute;' index: 60 diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00039-SystemUser.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00039-SystemUser.yaml index b7adc7f..274155c 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00039-SystemUser.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00039-SystemUser.yaml @@ -4,6 +4,7 @@ name: System User index: 39 customTagName: 'user' + instancesLabeledByRAMB: '&IDMB_User__get__User_Name_with_Full_Name;' attributes: - instance: '&IDA_UserName;' customTagName: 'username' @@ -14,7 +15,7 @@ relationships: - instance: '&IDR_System_Account__has__User_Preferences;' customTagName: 'hasUserPreferences' - + - class: '&IDC_UserLogin;' name: System Account Signon index: 4328 diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00073-AssignAttributeMethod.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00073-AssignAttributeMethod.yaml index a99afd6..a39596e 100644 --- a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00073-AssignAttributeMethod.yaml +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00073-AssignAttributeMethod.yaml @@ -17,6 +17,10 @@ - instance: '&IDR_Assign_Attribute_Method__assigns__Attribute;' customTagName: 'assignsAttribute' + # hmm... what's this? + # 3$9824 Assignment Method.assigns attribute or relationship from Executable returning Instance Set + # 3$9825 Executable returning Instance Set.returns assign attribute or relationship for Assignment Method + - relationship: '&IDR_Assign_Attribute_Method__uses__Executable_returning_Attribute;' index: 139 sourceClassId: '&IDC_AssignAttributeMethod;' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00086-ReturnAttributeMethodBinding.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00086-ReturnAttributeMethodBinding.yaml new file mode 100644 index 0000000..fdbf1c7 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/00086-ReturnAttributeMethodBinding.yaml @@ -0,0 +1,16 @@ +--- +- library: '&IDL_MochaBaseSystem;' + instances: + - class: '&IDC_ReturnAttributeMethodBinding;' + name: Return Attribute Method Binding + index: 86 + customTagName: returnAttributeMethodBinding + inherits: '&IDC_MethodBinding;' + translations: + - relationship: '&IDR_Class__has_title__Translation;' + values: + - languageInstanceId: '&IDI_Language_English;' + value: 'Return Attribute Method Binding' + relationships: # FIXME: remove this when we can properly inherit definitions in zq-python + - instance: '&IDR_Method_Binding__executes__Method;' + customTagName: 'executesMethod' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/3004-TaskCategory.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/03004-TaskCategory.yaml similarity index 100% rename from common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/3004-TaskCategory.yaml rename to common/libraries/yaml/net.alcetech.Mocha.System/003-Classes/03004-TaskCategory.yaml diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Forward_Slash.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Forward_Slash.yaml new file mode 100644 index 0000000..44d3985 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Forward_Slash.yaml @@ -0,0 +1,8 @@ +- library: '&IDL_MochaBaseSystem;' + instances: + - buildAttributeMethod: '&IDM_Common_Text__get__Forward_Slash;' + forClassId: '&IDC_CommonText;' + verb: 'get' + name: 'Forward Slash' + initialValue: '/' + static: yes \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Single_Space.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Single_Space.yaml new file mode 100644 index 0000000..1808376 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/CommonText/Common_Text__get__Single_Space.yaml @@ -0,0 +1,7 @@ +- library: '&IDL_MochaBaseSystem;' + instances: + - buildAttributeMethod: '&IDM_Common_Text__get__Single_Space;' + forClassId: '&IDC_CommonText;' + verb: 'get' + name: 'Single Space' + initialValue: ' ' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__Preferred_Display_Name.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__Preferred_Display_Name.yaml new file mode 100644 index 0000000..d92b09f --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__Preferred_Display_Name.yaml @@ -0,0 +1,12 @@ +- library: '&IDL_MochaBaseSystem;' + instances: + - returnAttributeMethodBinding: '&IDMB_User__get__Preferred_Display_Name;' + executesMethod: '&IDM_User__get__Preferred_Display_Name;' + + - buildAttributeMethod: '&IDM_User__get__Preferred_Display_Name;' + forClassId: '&IDC_User;' + verb: 'get' + name: 'Preferred Display Name' + initialValue: 'Testing Preferred Display Name' + + \ No newline at end of file diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name.yaml new file mode 100644 index 0000000..0985376 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name.yaml @@ -0,0 +1,10 @@ +- library: '&IDL_MochaBaseSystem;' + instances: + - returnAttributeMethodBinding: '&IDMB_User__get__User_Name;' + executesMethod: '&IDM_User__get__User_Name;' + + - getAttributeMethod: '&IDM_User__get__User_Name;' + forClassId: '&IDC_User;' + verb: 'get' + name: 'User Name' + returnsAttributeId: '&IDA_UserName;' diff --git a/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name_with_Full_Name.yaml b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name_with_Full_Name.yaml new file mode 100644 index 0000000..ff336a4 --- /dev/null +++ b/common/libraries/yaml/net.alcetech.Mocha.System/004-Methods/User/System_User__get__User_Name_with_Full_Name.yaml @@ -0,0 +1,19 @@ +- library: '&IDL_MochaBaseSystem;' + instances: + - returnAttributeMethodBinding: '&IDMB_User__get__User_Name_with_Full_Name;' + executesMethod: '&IDM_User__get__User_Name_with_Full_Name;' + + # User@get User Name with Full Name(BA)*S*P + # Gets a formatted string including both system user name and preferred display full name + # (e.g. `btrevino / Brooke Trevino` ) + - buildAttributeMethod: '&IDM_User__get__User_Name_with_Full_Name;' + forClassId: '&IDC_User;' + verb: 'get' + name: 'User Name with Full Name' + initialValue: '' + buildsWithAttributes: + - instance: '&IDMB_User__get__User_Name;' + - instance: '&IDM_Common_Text__get__Single_Space;' + - instance: '&IDM_Common_Text__get__Forward_Slash;' + - instance: '&IDM_Common_Text__get__Single_Space;' + - instance: '&IDMB_User__get__Preferred_Display_Name;' diff --git a/php/mocha/lib/mocha/core/KnownClassGuids.inc.php b/php/mocha/lib/mocha/core/KnownClassGuids.inc.php index 254c7a8..3a8c5e6 100644 --- a/php/mocha/lib/mocha/core/KnownClassGuids.inc.php +++ b/php/mocha/lib/mocha/core/KnownClassGuids.inc.php @@ -130,6 +130,8 @@ class KnownClassGuids const ButtonLayout = "6f6338db68e04cc7b257d1b97cf3cb92"; const ImageLayout = "4b1bb7c6168e4ce0b4f876dd5069a80b"; + const BuildAttributeMethod = "{e5879955-0093-48c8-8042-813168578af2}"; + const GetAttributeMethod = "{c3ecf8c9-597f-417b-ad65-fae0401719c6}"; const GetInstancesMethod = "{0a379314-9d0f-432d-ae59-63194ab32dd3}"; const GetSpecifiedInstancesMethod = "{7794c7d0-b15d-4b23-aa40-63bb3d1f53ac}"; diff --git a/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php b/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php index 0c1ed56..ef4d0c1 100644 --- a/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php +++ b/php/mocha/lib/mocha/core/KnownRelationshipGuids.inc.php @@ -45,7 +45,9 @@ class KnownRelationshipGuids const Instance_Attribute_String_Component__has__Attribute = "E15D427769FB4F1992DB8D087F361484"; const String_Component__has_source__Method = "1ef1c965e12048beb682aa040573b5fb"; - const Class__instance_labeled_by__String = "F52FC851D65548A9B526C5FE0D7A29D2"; + // const Class__instance_labeled_by__String = "F52FC851D65548A9B526C5FE0D7A29D2"; + const Class__instances_labeled_by__Executable_returning_Attribute = "{c22fc17f-0c92-47dc-9a8b-28db0db68985}"; + const Class__has_summary__Report_Field = "D11050AD73764AB784DEE8D0336B74D2"; const Class__has_related__Task = "4D8670E12AF14E7C9C87C910BD7B319B"; @@ -92,6 +94,8 @@ class KnownRelationshipGuids const Validation__has_failure_message__Translation = "E15A97DD2A1D4DC0BD6BA957B63D9802"; const Translation__failure_message_for__Validation = "46a7dfcb884847d59ad3d27fbd8b423f"; + const Build_Attribute_Method__returns__Attribute = "{dadbf0f3-7af0-4387-a6b7-a1724a216d88}"; + const Build_Attribute_Method__builds_with__Executable_returning_Attribute = "{bb64cd83-85c2-4c20-82eb-2a5a5ead31f1}"; const Get_Attribute_Method__has__Attribute = "5eca9b3fbe754f6e8495781480774833"; const Get_Referenced_Instance_Set_Method__loop_on__Instance_Set = "2978238f7cb04ba38c6f473df782cfef"; diff --git a/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php b/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php index 4c81df3..def0f87 100644 --- a/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php +++ b/php/mocha/lib/mocha/oms/MySQLDatabaseOms.inc.php @@ -106,11 +106,25 @@ { $query = "SELECT mocha_get_user_by_username(:username);"; $stmt = $this->PDO->prepare($query); - $result = $stmt->execute(array - ( - "username" => $username - )); - $values = $stmt->fetch(); + + try + { + $result = $stmt->execute(array + ( + "username" => $username + )); + $values = $stmt->fetch(); + } + catch (\PDOException $ex) + { + // this may result in a "String data, right truncated" if we pass in + // text longer than whatever the stored procedure expects; in this case + // we should just treat it as the user doesn't exist and return null + // + // * Note that if any methods actually allow us to create users with names + // * this long, this will prevent them from logging in! + return null; + } if ($values[0] == null) return null; diff --git a/php/mocha/lib/mocha/oms/Oms.inc.php b/php/mocha/lib/mocha/oms/Oms.inc.php index e53e78d..399d9f3 100644 --- a/php/mocha/lib/mocha/oms/Oms.inc.php +++ b/php/mocha/lib/mocha/oms/Oms.inc.php @@ -126,6 +126,15 @@ public function getInstanceText($inst) { + $parentClass = $this->getParentClass($inst); + $instancesLabeledByRAMB = $this->getRelatedInstance($parentClass, KnownRelationshipGuids::Class__instances_labeled_by__Executable_returning_Attribute); + if ($instancesLabeledByRAMB !== null) + { + $context = new OmsContext(); + $context->setWorkData($parentClass->GlobalIdentifier->__toString(), $inst); + $text = $this->executeMethod($context, $instancesLabeledByRAMB); + return $text; + } return $this->getAttributeValue($inst, $this->getInstanceByGlobalIdentifier(KnownAttributeGuids::Name)); } @@ -341,8 +350,39 @@ { $methodInstanceClass = $this->getParentClass($methodInstance); //$context->setWorkData("{d53d7283-92a2-4a62-b8f2-cf0a0b975634}", "blah blah"); - - if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::Parse(KnownClassGuids::ProcessRelatedUpdatesMethod))) + + if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ReturnAttributeMethodBinding))) + { + $methodBindingExecutesMethod = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Method_Binding__executes__Method); + + //echo ("RAMB stack: " . $methodInstance->InstanceKey . ":" . $methodBindingExecutesMethod->InstanceKey); + return $this->executeMethod($context, $methodBindingExecutesMethod); + } + else if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::GetAttributeMethod))) + { + $forClass = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Method__for__Class); + $returnsAttribute = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Get_Attribute_Method__has__Attribute); + + $targetInstance = $context->workData[$forClass->GlobalIdentifier->__toString()]; + return $this->getAttributeValue($targetInstance, $returnsAttribute); + } + else if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::BuildAttributeMethod))) + { + $returnsAttribute = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Build_Attribute_Method__returns__Attribute); + $initialValue = $this->getAttributeValue($methodInstance, KnownAttributeGuids::Value); + $buildsWithAttributes = $this->getRelatedInstances($methodInstance, KnownRelationshipGuids::Build_Attribute_Method__builds_with__Executable_returning_Attribute); + + $value = $initialValue; + foreach ($buildsWithAttributes as $buildsWithAttribute) + { + if ($buildsWithAttribute !== null) + { + $value .= $this->executeMethod($context, $buildsWithAttribute); + } + } + return $value; + } + else if ($methodInstanceClass->GlobalIdentifier->__is_equal(UUID::parse(KnownClassGuids::ProcessRelatedUpdatesMethod))) { $classForPRU = $this->getRelatedInstance($methodInstance, KnownRelationshipGuids::Process_Related_Updates_Method__processes_for__Class); if ($classForPRU !== null) @@ -383,6 +423,10 @@ } } } + else + { + trigger_error("unknown method class '" . $methodInstanceClass->GlobalIdentifier . "' [" . $methodInstanceClass->InstanceKey . "]"); + } } public function is_a(InstanceReference $inst, InstanceReference|string|InstanceKey $what) diff --git a/php/mocha/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php b/php/mocha/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php index 3627d08..f7dee27 100644 --- a/php/mocha/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php +++ b/php/mocha/lib/mocha/ui/renderers/html/HTMLRenderer.inc.php @@ -1054,11 +1054,13 @@ MSG_EOF); $rowCount = count($instances); echo(""); - // $this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]); + $this->renderBeginTag("table", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element" ]); - $this->renderBeginTag("div", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element", "uwt-listview-view-details", "uwt-gridlines", "uwt-hottracking" ]); + // $this->renderBeginTag("div", [ "data-instance-id" => $element->InstanceKey ], [ "uwt-listview", "mcx-element", "uwt-listview-view-details", "uwt-gridlines", "uwt-hottracking" ]); - $this->renderBeginTag("div", [ ], [ "uwt-listview-caption" ]); + // $this->renderBeginTag("div", [ ], [ "uwt-listview-caption" ]); + $this->renderBeginTag("caption", [ ], [ ]); + $this->renderTag("span", [ ], [ "uwt-listview-title" ], $title); $this->renderTag("span", [ ], [ "uwt-listview-item-count" ], $rowCount); $this->renderTag("span", [ ], [ "uwt-listview-item-count-label" ], " items"); @@ -1090,53 +1092,61 @@ MSG_EOF); $this->renderEndTag("a"); $this->renderEndTag("div"); - $this->renderEndTag("div"); + // $this->renderEndTag("div"); + $this->renderEndTag("caption"); - $this->renderBeginTag("div", [], ["uwt-content"]); + //$this->renderBeginTag("div", [], ["uwt-content"]); - $this->renderBeginTag("div", [ ], [ "uwt-listview-column-headers" ]); + //$this->renderBeginTag("div", [ ], [ "uwt-listview-column-headers" ]); + $this->renderBeginTag("thead"); + $this->renderBeginTag("tr"); foreach ($contents as $content) { $inst = $oms->getRelatedInstance($content, KnownRelationshipGuids::Element_Content__has__Instance); - // $this->renderBeginTag("td"); - $this->renderBeginTag("div", [], [ "uwt-listview-column-header"]); + $this->renderBeginTag("th"); + //$this->renderBeginTag("div", [], [ "uwt-listview-column-header"]); echo ($this->get__EC_Override_Label_or_default_Instance_Title(array ( KnownClassGuids::Instance => $inst, KnownClassGuids::ElementContent => $content ))); - $this->renderEndTag("div"); - // $this->renderEndTag("td"); + // $this->renderEndTag("div"); + $this->renderEndTag("th"); } - $this->renderEndTag("div"); + + $this->renderEndTag("tr"); + $this->renderEndTag("thead"); + //$this->renderEndTag("div"); - $this->renderBeginTag("div", [], [ "uwt-listview-items" ]); - // $this->renderBeginTag("tr"); + //$this->renderBeginTag("div", [], [ "uwt-listview-items" ]); + $this->renderBeginTag("tbody"); for ($i = 0; $i < $rowCount; $i++) { $rowInst = $instances[$i]; - $this->renderBeginTag("div", [ ], [ "uwt-listview-item" ]); + $this->renderBeginTag("tr", [ ], [ "uwt-listview-item" ]); + //$this->renderBeginTag("div", [ ], [ "uwt-listview-item" ]); foreach ($contents as $content) { - // $this->renderBeginTag("td"); - $this->renderBeginTag("div", [], [ "mcx-elementcontent", "uwt-listview-item-column" ]); + $this->renderBeginTag("td"); + //$this->renderBeginTag("div", [], [ "mcx-elementcontent", "uwt-listview-item-column" ]); $this->renderElementContent($content, $rowInst); - $this->renderEndTag("div"); - // $this->renderEndTag("td"); + //$this->renderEndTag("div"); + $this->renderEndTag("td"); } - // $this->renderEndTag("tr"); - $this->renderEndTag("div"); + $this->renderEndTag("tr"); + //$this->renderEndTag("div"); } - $this->renderEndTag("div"); + //$this->renderEndTag("div"); + $this->renderEndTag("tbody"); - $this->renderEndTag("div"); + //$this->renderEndTag("div"); - // $this->renderEndTag("table"); - $this->renderEndTag("div"); + $this->renderEndTag("table"); + //$this->renderEndTag("div"); } } diff --git a/php/mocha/themes/common/styles/uwt-listview.less b/php/mocha/themes/common/styles/uwt-listview.less index 2b4b0eb..d7112b0 100644 --- a/php/mocha/themes/common/styles/uwt-listview.less +++ b/php/mocha/themes/common/styles/uwt-listview.less @@ -1,9 +1,15 @@ -.uwt-listview-caption, .uwt-listview > caption +div.uwt-listview-caption { display: flex; flex-direction: row; align-items: center; - +} +table.uwt-listview +{ + border-collapse: collapse; +} +.uwt-listview-caption, .uwt-listview > caption +{ text-align: left; padding: 8px; @@ -18,6 +24,7 @@ } &> .uwt-listview-controlbox { + float: right; margin-left: auto; padding-right: 8px; }