Skip to content
Snippets Groups Projects
Commit ea54ab72 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

AdminView copy to clipboard action

parent 069b3723
No related branches found
No related tags found
No related merge requests found
Showing
with 219 additions and 35 deletions
......@@ -42,6 +42,11 @@
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityActionField>
<name>copyValueToClipboard</name>
<onActionProcess>%aditoprj%/entity/AdminViewRow_entity/entityfields/copyvaluetoclipboard/onActionProcess.js</onActionProcess>
<iconId>VAADIN:CLIPBOARD</iconId>
</entityActionField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
import("system.vars");
import("system.neon");
var fieldValues = JSON.parse(vars.get("$param.Rows_param"));
var fieldId = vars.get("$local.uid");
var row = fieldValues.find(function ([id])
{
return id === fieldId;
});
if (row)
neon.copyToClipboard(row[2]);
\ No newline at end of file
import("system.vars");
import("Context_lib");
AdminViewUtils.open("ATTRIBUTEID", [
["ATTRIBUTE_PARENT_ID", vars.get("$field.ATTRIBUTE_PARENT_ID")]
]);
\ No newline at end of file
AdminViewUtils.open("AB_ATTRIBUTEID", ["ATTRIBUTE_PARENT_ID", "ATTRIBUTE_ACTIVE", "ATTRIBUTE_TYPE", "SORTING"]);
\ No newline at end of file
......@@ -19,17 +19,17 @@
<entityConsumer>
<name>Rows</name>
<state>READONLY</state>
<dependency>
<name>dependency</name>
<entityName>AdminViewRow_entity</entityName>
<fieldName>AdminViewRows</fieldName>
</dependency>
<children>
<entityParameter>
<name>Rows_param</name>
<valueProcess>%aditoprj%/entity/DefaultAdminView_entity/entityfields/rows/children/rows_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
<dependency>
<name>dependency</name>
<entityName>AdminViewRow_entity</entityName>
<fieldName>AdminViewRows</fieldName>
</dependency>
</entityConsumer>
<entityParameter>
<name>Uid_param</name>
......@@ -40,6 +40,14 @@
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityParameter>
<name>Entity_param</name>
<expose v="true" />
</entityParameter>
<entityField>
<name>ENTITY</name>
<title>Entity</title>
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......@@ -49,6 +57,9 @@
<jDitoRecordFieldMapping>
<name>UID.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ENTITY.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
......
import("system.vars");
import("system.result");
result.object([[vars.get("$param.Uid_param")]]);
\ No newline at end of file
result.object([[vars.get("$param.Uid_param"), vars.get("$param.Entity_param")]]);
\ No newline at end of file
......@@ -7299,6 +7299,66 @@
<entry>
<key>#login</key>
</entry>
<entry>
<key>Last change</key>
</entry>
<entry>
<key>Knowledge entries</key>
</entry>
<entry>
<key>Newsfeed (Preview)</key>
</entry>
<entry>
<key>Edited on</key>
</entry>
<entry>
<key>Created on</key>
</entry>
<entry>
<key>Discussion</key>
</entry>
<entry>
<key>Newsfeed (Full)</key>
</entry>
<entry>
<key>Closed</key>
</entry>
<entry>
<key>Text content</key>
</entry>
<entry>
<key>Reply</key>
</entry>
<entry>
<key>All Knowledge Entries</key>
</entry>
<entry>
<key>Export HTML</key>
</entry>
<entry>
<key>Publishing level</key>
</entry>
<entry>
<key>Discussions</key>
</entry>
<entry>
<key>Knowledge Management</key>
</entry>
<entry>
<key>List news articles</key>
</entry>
<entry>
<key>Knowledge Role</key>
</entry>
<entry>
<key>Shows complete news articles</key>
</entry>
<entry>
<key>Knowledge</key>
</entry>
<entry>
<key>Toggle status</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
<sqlModels>
......
......@@ -9346,7 +9346,7 @@ Bitte Datumseingabe prüfen</value>
</entry>
<entry>
<key>Child Attributes</key>
<value>Diagrameigenschaften</value>
<value>Untergeordnete Eigenschaften</value>
</entry>
<entry>
<key>Recalculate all Classifications</key>
......
......@@ -7380,6 +7380,66 @@
<entry>
<key>#login</key>
</entry>
<entry>
<key>Last change</key>
</entry>
<entry>
<key>Knowledge entries</key>
</entry>
<entry>
<key>Newsfeed (Preview)</key>
</entry>
<entry>
<key>Edited on</key>
</entry>
<entry>
<key>Created on</key>
</entry>
<entry>
<key>Discussion</key>
</entry>
<entry>
<key>Newsfeed (Full)</key>
</entry>
<entry>
<key>Closed</key>
</entry>
<entry>
<key>Text content</key>
</entry>
<entry>
<key>Reply</key>
</entry>
<entry>
<key>All Knowledge Entries</key>
</entry>
<entry>
<key>Export HTML</key>
</entry>
<entry>
<key>Publishing level</key>
</entry>
<entry>
<key>Discussions</key>
</entry>
<entry>
<key>Knowledge Management</key>
</entry>
<entry>
<key>List news articles</key>
</entry>
<entry>
<key>Knowledge Role</key>
</entry>
<entry>
<key>Shows complete news articles</key>
</entry>
<entry>
<key>Knowledge</key>
</entry>
<entry>
<key>Toggle status</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -3,22 +3,16 @@
<name>AdminViewRow_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<noneLayout>
<boxLayout>
<name>layout</name>
</noneLayout>
</boxLayout>
</layout>
<children>
<titledListViewTemplate>
<name>TitledList</name>
<actionListViewTemplate>
<name>ActionList</name>
<titleField>TITLE</titleField>
<fixedDrawer v="true" />
<entityField>#ENTITY</entityField>
<columns>
<neonTitledListTableColumn>
<name>d42ddaa4-1996-41b3-be19-2f3c721f9536</name>
<entityField>VALUE</entityField>
</neonTitledListTableColumn>
</columns>
</titledListViewTemplate>
<descriptionField>VALUE</descriptionField>
<entryAction>copyValueToClipboard</entryAction>
</actionListViewTemplate>
</children>
</neonView>
......@@ -5,11 +5,21 @@
<size>SMALL</size>
<overlayOrientation>PORTRAIT</overlayOrientation>
<layout>
<noneLayout>
<boxLayout>
<name>layout</name>
</noneLayout>
</boxLayout>
</layout>
<children>
<genericViewTemplate>
<name>EntityInfo</name>
<isEditable v="false" />
<fields>
<entityFieldLink>
<name>09fb02da-699a-431b-8a5c-a22396ddf5b5</name>
<entityField>ENTITY</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<neonViewReference>
<name>80206d15-7132-45c1-9cf5-e2236d0f2fdb</name>
<entityField>Rows</entityField>
......
......@@ -19,9 +19,9 @@
</neonDashletConfiguration>
</dashletConfigurations>
<layout>
<boxLayout>
<groupLayout>
<name>layout</name>
</boxLayout>
</groupLayout>
</layout>
<children>
<tableViewTemplate>
......@@ -46,5 +46,12 @@
</neonTableColumn>
</columns>
</tableViewTemplate>
<timelineViewTemplate>
<name>Timeline</name>
<dateField>LastChange</dateField>
<titleField>TITLE</titleField>
<descriptionField>CONTENT</descriptionField>
<subdescriptionField>AUTHOR_CONTACT_ID</subdescriptionField>
</timelineViewTemplate>
</children>
</neonView>
import("Util_lib");
import("system.entities");
import("system.tools");
import("system.neon");
......@@ -754,6 +755,8 @@ function AdminViewUtils () {}
*/
AdminViewUtils.open = function (pUidField, pFields)
{
if (!AdminViewUtils.userHasAdminRole)
return;
var uid = vars.get("$sys.uid");
if (!pUidField)
pUidField = "UID";
......@@ -766,19 +769,31 @@ AdminViewUtils.open = function (pUidField, pFields)
{
pFields.forEach(function (field)
{
rows.push([field[0], field[0], field[1], field[2] || "TEXT"]);
if (Utils.isString(field))
{
var fieldVar = field.startsWith("$") ? field : "$field." + field;
rows.push([field, field, vars.get(fieldVar), "TEXT"]);
}
else
rows.push([field[0], field[0], field[1], field[2] || "TEXT"]);
});
}
var params = {
"Uid_param" : uid,
"Rows_param" : JSON.stringify(rows)
"Uid_param": uid,
"Rows_param": JSON.stringify(rows),
"Entity_param": vars.get("$sys.currententityname")
};
neon.openContext("DefaultAdminView", "DefaultAdminView_view", [uid], neon.OPERATINGSTATE_VIEW, params);
}
AdminViewUtils.getActionState = function ()
{
if (tools.currentUserHasRole("INTERNAL_ADMINISTRATOR"))
if (AdminViewUtils.userHasAdminRole())
return neon.COMPONENTSTATE_EDITABLE;
return neon.COMPONENTSTATE_INVISIBLE;
}
AdminViewUtils.userHasAdminRole = function ()
{
return tools.currentUserHasRole("INTERNAL_ADMINISTRATOR");
}
\ No newline at end of file
......@@ -16,4 +16,12 @@ if (variables.attributeName)
else
attributeId = variables.attributeId;
//attributeValueVariable -> instance variable to use for the attribute value
if (variables.attributeValueVariable)
{
var attributeValue = variables[variables.attributeValueVariable];
if (attributeValue !== null && attributeValue !== undefined && attributeValue !== "")
variables.attributeValue = attributeValue;
}
new AttributeRelationQuery(variables.targetId, attributeId, variables.targetContext).insertAttribute(variables.attributeValue);
\ No newline at end of file
......@@ -31,19 +31,22 @@ attributes = attributes.map(function (attributeId)
var parentId = attributeId;
var fullName = "";
//the loop will stop if an id comes up twice, because otherwise that could cause an infinite loop if the data is faulty
var alreadyEncountered = {};
while (parentId && attributeNameMap[parentId] && !alreadyEncountered[parentId])
var alreadyEncountered = new Set();
while (parentId && attributeNameMap[parentId] && !alreadyEncountered.has(parentId))
{
var [currentName, currentParent] = attributeNameMap[parentId];
if (!fullName)
fullName = currentName;
else
fullName = currentName + " / " + fullName;
alreadyEncountered[parentId] = true;
alreadyEncountered.add(parentId);
parentId = currentParent;
}
return {id : attributeId, name : fullName};
return {
id: attributeId,
name: fullName
};
});
var parameters = [
......@@ -74,4 +77,6 @@ if (currentValues.attributeId && currentValues.attributeId.value)
parameters.push(new WorkflowServiceTaskParameter("attributeValue", "Value", paramType, enumValues));
}
parameters.push(new WorkflowServiceTaskParameter("attributeValueVariable", "Value variable", WorkflowServiceTaskParameter.STRING()));
result.object(parameters);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment