From cfa379932be9ef6c7255a53d69efb03e02b03986 Mon Sep 17 00:00:00 2001
From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local>
Date: Thu, 21 Mar 2019 13:38:31 +0100
Subject: [PATCH] Attribute tree

---
 entity/Attribute_entity/Attribute_entity.aod    | 12 ++++++++++++
 .../entityfields/name_with_type/valueProcess.js | 12 ++++++++++++
 .../entityfields/usagelist/valueProcess.js      | 12 ++++++++++++
 .../_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod |  3 +++
 language/_____LANGUAGE_en/_____LANGUAGE_en.aod  |  3 +++
 .../AttributeFilter_view.aod                    |  4 ++--
 .../AttributePreview_view.aod                   | 17 +++++++++++++----
 7 files changed, 57 insertions(+), 6 deletions(-)
 create mode 100644 entity/Attribute_entity/entityfields/name_with_type/valueProcess.js
 create mode 100644 entity/Attribute_entity/entityfields/usagelist/valueProcess.js

diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod
index 291112f15f..230a538109 100644
--- a/entity/Attribute_entity/Attribute_entity.aod
+++ b/entity/Attribute_entity/Attribute_entity.aod
@@ -194,6 +194,7 @@
     </entityProvider>
     <entityField>
       <name>FULL_ATTRIBUTE_NAME</name>
+      <state>READONLY</state>
       <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js</valueProcess>
     </entityField>
     <entityParameter>
@@ -227,6 +228,17 @@
       <expose v="true" />
       <description>PARAMETER</description>
     </entityParameter>
+    <entityField>
+      <name>USAGELIST</name>
+      <title>Usages</title>
+      <state>READONLY</state>
+      <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/usagelist/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>NAME_WITH_TYPE</name>
+      <title>Name</title>
+      <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/name_with_type/valueProcess.js</valueProcess>
+    </entityField>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Attribute_entity/entityfields/name_with_type/valueProcess.js b/entity/Attribute_entity/entityfields/name_with_type/valueProcess.js
new file mode 100644
index 0000000000..d14e07a844
--- /dev/null
+++ b/entity/Attribute_entity/entityfields/name_with_type/valueProcess.js
@@ -0,0 +1,12 @@
+import("system.translate");
+import("system.result");
+import("system.vars");
+import("Attribute_lib");
+import("Keyword_lib");
+import("KeywordRegistry_basic")
+
+var name = vars.get("$field.ATTRIBUTE_NAME");
+var type = vars.get("$field.ATTRIBUTE_TYPE");
+if (type.trim() != $AttributeTypes.COMBOVALUE)
+    name += " (" + translate.text("Type") + ": " + KeywordUtils.getViewValue($KeywordRegistry.attributeType(), type) + ")";
+result.string(name);
\ No newline at end of file
diff --git a/entity/Attribute_entity/entityfields/usagelist/valueProcess.js b/entity/Attribute_entity/entityfields/usagelist/valueProcess.js
new file mode 100644
index 0000000000..0192da48ac
--- /dev/null
+++ b/entity/Attribute_entity/entityfields/usagelist/valueProcess.js
@@ -0,0 +1,12 @@
+import("system.translate");
+import("system.result");
+import("system.db");
+import("system.vars");
+import("Sql_lib");
+
+var usages = db.array(db.COLUMN, SqlCondition.begin()
+    .andPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", vars.get("$field.AB_ATTRIBUTEID"))
+    .buildSql("select OBJECT_TYPE from AB_ATTRIBUTEUSAGE"));
+var usageStr = translate.text("Usage");
+
+result.string(usages.length ? usageStr + ": " + usages.join(", ") : "\u00A0"); // \u00A0 -> space character that doesn't get trimmed 
\ No newline at end of file
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index fc4bfc4605..82c7f229e6 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -2448,6 +2448,9 @@
     <entry>
       <key>Object tree</key>
     </entry>
+    <entry>
+      <key>New Appointment</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
   <sqlModels>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index 08bb5c285a..fe72a0aaa5 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -2472,6 +2472,9 @@
     <entry>
       <key>Object tree</key>
     </entry>
+    <entry>
+      <key>New Appointment</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/neonView/AttributeFilter_view/AttributeFilter_view.aod b/neonView/AttributeFilter_view/AttributeFilter_view.aod
index a5e0dc9ccb..823ebd3b35 100644
--- a/neonView/AttributeFilter_view/AttributeFilter_view.aod
+++ b/neonView/AttributeFilter_view/AttributeFilter_view.aod
@@ -14,8 +14,8 @@
       <name>AttributesTreetable</name>
       <parentField>ATTRIBUTE_PARENT_ID</parentField>
       <favoriteActionGroup1>AttributeActions</favoriteActionGroup1>
-      <titleField>ATTRIBUTE_NAME</titleField>
-      <descriptionField>ATTRIBUTE_TYPE</descriptionField>
+      <titleField>NAME_WITH_TYPE</titleField>
+      <descriptionField>USAGELIST</descriptionField>
       <entityField>#ENTITY</entityField>
     </treetableViewTemplate>
     <tableViewTemplate>
diff --git a/neonView/AttributePreview_view/AttributePreview_view.aod b/neonView/AttributePreview_view/AttributePreview_view.aod
index d7a389b7df..c96aad0cda 100644
--- a/neonView/AttributePreview_view/AttributePreview_view.aod
+++ b/neonView/AttributePreview_view/AttributePreview_view.aod
@@ -14,8 +14,21 @@
       <subtitleField>ATTRIBUTE_TYPE</subtitleField>
       <entityField>#ENTITY</entityField>
     </cardViewTemplate>
+    <genericViewTemplate>
+      <name>Details</name>
+      <showDrawer v="true" />
+      <drawerCaption>Details</drawerCaption>
+      <entityField>#ENTITY</entityField>
+      <fields>
+        <entityFieldLink>
+          <name>70953962-9472-484b-ac95-567d2249f42e</name>
+          <entityField>ATTRIBUTE_ACTIVE</entityField>
+        </entityFieldLink>
+      </fields>
+    </genericViewTemplate>
     <genericViewTemplate>
       <name>Info</name>
+      <editMode v="false" />
       <showDrawer v="true" />
       <entityField>#ENTITY</entityField>
       <title></title>
@@ -28,10 +41,6 @@
           <name>7e64cd02-e91e-4845-bc77-256a4945670e</name>
           <entityField>KEYWORD_CONTAINER</entityField>
         </entityFieldLink>
-        <entityFieldLink>
-          <name>e00bfeb1-7003-4d5a-b71a-c6921e255c9d</name>
-          <entityField>ATTRIBUTE_ACTIVE</entityField>
-        </entityFieldLink>
         <entityFieldLink>
           <name>00a51564-0eca-43f9-8235-b811df1dbafd</name>
           <entityField>ATTRIBUTE_LEVEL</entityField>
-- 
GitLab