Skip to content
Snippets Groups Projects
Commit dc83be77 authored by S.Listl's avatar S.Listl
Browse files

Admin view

parent a1e36962
No related branches found
No related tags found
No related merge requests found
......@@ -897,6 +897,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<title>Open admin info</title>
<onActionProcess>%aditoprj%/entity/Person_entity/entityfields/openadmininfo/onActionProcess.js</onActionProcess>
<iconId>VAADIN:CURLY_BRACKETS</iconId>
<stateProcess>%aditoprj%/entity/Person_entity/entityfields/openadmininfo/stateProcess.js</stateProcess>
</entityActionField>
</entityFields>
<recordContainers>
......
import("system.vars");
import("Context_lib");
import("system.neon");
var openAdminView = function (pViewName)
{
var context = ContextUtils.getCurrentContextId();
if (!pViewName)
pViewName = context + "Admin_view";
neon.openContext(context, pViewName, [vars.get("$sys.uid")], neon.OPERATINGSTATE_VIEW, null);
}
openAdminView();
import("system.result");
import("system.tools");
import("system.neon");
function isAdmin ()
{
return tools.currentUserHasRole("INTERNAL_ADMINISTRATOR");
}
if (isAdmin())
result.string(neon.COMPONENTSTATE_EDITABLE);
else
result.string(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
......@@ -46,5 +46,9 @@
<name>b1ef43d1-ce20-4a67-bace-ed59e5527842</name>
<view>PersonAdmin_view</view>
</neonViewReference>
<neonViewReference>
<name>b0105010-457a-4866-a9cd-277d183ea130</name>
<view>PersonAdmin_view</view>
</neonViewReference>
</references>
</neonContext>
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
<name>OrganisationAdmin_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
</neonView>
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
<name>PersonAdmin_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<isSmall v="true" />
<layout>
<noneLayout>
<name>layout</name>
</noneLayout>
</layout>
<children>
<genericViewTemplate>
<name>Info</name>
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>fb53347a-00e7-4b10-a84d-7ee022ca5c20</name>
<entityField>CONTACTID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>11dbf6a2-b795-4e94-b1e0-09f4d14e28b1</name>
<entityField>PERSON_ID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>1792811a-107c-408c-91fb-3539325cf72c</name>
<entityField>ORGANISATION_ID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>9dee9668-ce14-496e-b9cb-840f0b18d876</name>
<entityField>ADDRESS_ID</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<genericViewTemplate>
<name>Info2</name>
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>363e8c8c-7670-4ff1-b4f9-c8ff46d8744e</name>
<entityField>DATE_NEW</entityField>
</entityFieldLink>
<entityFieldLink>
<name>3d41529d-f9ae-4cf3-8ab5-4b490bc82566</name>
<entityField>DATE_EDIT</entityField>
</entityFieldLink>
<entityFieldLink>
<name>21c3b6fd-0203-440e-a6f7-ee8950fbf854</name>
<entityField>DATE_NEW_CONTACT</entityField>
</entityFieldLink>
<entityFieldLink>
<name>d1703ed2-cf89-4afd-83bf-ff350611336d</name>
<entityField>USER_NEW</entityField>
</entityFieldLink>
<entityFieldLink>
<name>8e23c269-28dd-4f87-a040-ec687bbdbd62</name>
<entityField>USER_EDIT</entityField>
</entityFieldLink>
<entityFieldLink>
<name>578cd57b-963a-4882-870a-d4e82889106f</name>
<entityField>USER_NEW_CONTACT</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
......@@ -74,6 +74,10 @@ DocumentTemplate.loadTemplate = function (pTemplateId)
return new DocumentTemplate(db.getBinaryContent(binaryId, alias), type, filename);
}
/**
* Replace function that works with strings instead of regular expressions
* so that control characters (for example '{', '}') don't have to be escaped.
*/
DocumentTemplate._replaceText = function (pText, pReplacements)
{
for (let placeholder in pReplacements)
......@@ -83,7 +87,7 @@ DocumentTemplate._replaceText = function (pText, pReplacements)
DocumentTemplate.prototype.toString = function ()
{
this.getReplacedContent({});
return this.getReplacedContent({});
}
/**
......
import("Sql_lib");
import("Communication_lib");
/**
* represents a placeholder
*
* @param {String} pName name of the placeholder (without prefix and postfix)
* @param {String} pType type of the placeholder, see PlaceholderUtils.types
* @param {String|Function} pValueDef string or function (depends on the type) defining the value
* @param {String} [pTarget] what contact is used to get the data, see PlaceholderUtils.targets
/* Library for document template placeholders.
* All possible placeholders that can be used in a template are defined here.
*/
function Placeholder (pName, pType, pValueDef, pTarget)
{
this.placeholderName = PlaceholderUtils.formatPlaceholder(pName);
this.simpleName = pName;
this.type = pType;
this.target = pTarget || Placeholder.targets.RECIPIENT;
this.valueDefinition = pValueDef;
}
Placeholder.prototype.toString = function ()
{
return this.placeholderName;
}
/**
* placeholder types, defines how the value is acquired
*/
Placeholder.types = {
ADDRESSFORMAT : "ADDRESSFORMAT",
SQLPART : "SQLPART",
SQLPARTFUNCTION : "SQLPARTFUNCTION"
};
/**
* placeholder targets, defines whose data is used
*/
Placeholder.targets = {
/**
* use the data of the recipient (default)
*/
RECIPIENT : "RECIPIENT",
/**
* use the data of the sender
*/
SENDER : "SENDER",
/**
* use the data of the user
*/
EMPLOYEE : "EMPLOYEE"
};
function PlaceholderUtils () {}
/**
* Returns the placeholder with the required prefix and postfix added.
* This function defines the format for placeholders.
*/
PlaceholderUtils.formatPlaceholder = function (pPlaceholder)
{
return "{@" + pPlaceholder + "@}";
}
/**
* placeholder configuration
*
......@@ -78,6 +22,37 @@ PlaceholderUtils.getPlaceholders = function (pFilter)
this[p] = true;
}, filter);
}
var placeholders = [];
/***************************************************************************************************************/
//Definition of available Placeholders. Placeholders should be added here:
_addAddressFormat("address", "{street} {buildingno}");
_addAddressFormat("zipCode", "{zip}");
_addAddressFormat("city", "{city}");
_addAddressFormat("district", "{district}");
_addAddressFormat("region", "{region}");
_addAddressFormat("country", "{country}");
_addAddressFormat("letterSalutation", "{letter_salutation}");
_addAddressFormat("fullAddress", "");
_addAddressFormat("senderOrgname", "{organisation_name}", Placeholder.targets.SENDER);
_addAddressFormat("senderAddress", "{street} {buildingno}", Placeholder.targets.SENDER);
_addAddressFormat("senderZipCity", "{country} - {zip} {city}", Placeholder.targets.SENDER);
_addAddressFormat("senderFullAddress", "", Placeholder.targets.SENDER);
_addSqlPart("orgname", "ORGANISATION.NAME");
_addSqlPartFunction("phone", CommUtil.getStandardSubSqlPhone);
_addSqlPartFunction("email", CommUtil.getStandardSubSqlMail);
_addSqlPartFunction("senderPhone", CommUtil.getStandardSubSqlPhone, Placeholder.targets.SENDER);
_addSqlPartFunction("senderEmail", CommUtil.getStandardSubSqlMail, Placeholder.targets.SENDER);
_addSqlPartFunction("senderName", function () {return (new SqlMaskingUtils()).concat(["SALUTATION", "TITLE", "FIRSTNAME", "LASTNAME"])}, Placeholder.targets.SENDER);
/***************************************************************************************************************/
return placeholders;
//these functions should make adding placeholders easier and require less code:
......@@ -109,36 +84,73 @@ PlaceholderUtils.getPlaceholders = function (pFilter)
if (!pFilter || filter[pName])
placeholders.push(new Placeholder(pName, Placeholder.types.SQLPARTFUNCTION, pSqlPartFunction, pTarget));
}
var placeholders = [];
/*****************************************************************************************************/
//Definition of available Placeholders. Placeholders should be added here:
_addAddressFormat("address", "{street} {buildingno}");
_addAddressFormat("zipCode", "{zip}");
_addAddressFormat("city", "{city}");
_addAddressFormat("district", "{district}");
_addAddressFormat("region", "{region}");
_addAddressFormat("country", "{country}");
_addAddressFormat("letterSalutation", "{letter_salutation}");
_addAddressFormat("fullAddress", "");
_addAddressFormat("senderOrgname", "{organisation_name}", Placeholder.targets.SENDER);
_addAddressFormat("senderAddress", "{street} {buildingno}", Placeholder.targets.SENDER);
_addAddressFormat("senderZipCity", "{country} - {zip} {city}", Placeholder.targets.SENDER);
_addAddressFormat("senderFullAddress", "", Placeholder.targets.SENDER);
_addSqlPart("orgname", "ORGANISATION.NAME");
_addSqlPartFunction("phone", CommUtil.getStandardSubSqlPhone);
_addSqlPartFunction("email", CommUtil.getStandardSubSqlMail);
_addSqlPartFunction("senderPhone", CommUtil.getStandardSubSqlPhone, Placeholder.targets.SENDER);
_addSqlPartFunction("senderEmail", CommUtil.getStandardSubSqlMail, Placeholder.targets.SENDER);
_addSqlPartFunction("senderName", function () {return SqlMaskingUtils.concat()}, Placeholder.targets.SENDER);
/*****************************************************************************************************/
}
/**
* Returns the placeholder with the required prefix and postfix added.
* This function defines the format for placeholders.
*/
PlaceholderUtils.formatPlaceholder = function (pPlaceholder)
{
return "{@" + pPlaceholder + "@}";
}
/**
* object representing a placeholder
*
* @param {String} pName name of the placeholder (without prefix and postfix)
* @param {String} pType type of the placeholder, see PlaceholderUtils.types
* @param {String|Function} pValueDef string or function (depends on the type) defining the value
* @param {String} [pTarget] what contact is used to get the data, see PlaceholderUtils.targets
*/
function Placeholder (pName, pType, pValueDef, pTarget)
{
this.placeholderName = PlaceholderUtils.formatPlaceholder(pName);
this.simpleName = pName;
this.type = pType;
this.target = pTarget || Placeholder.targets.RECIPIENT;
this.valueDefinition = pValueDef;
}
Placeholder.prototype.toString = function ()
{
return this.placeholderName;
}
/**
* placeholder types, defines how the value is acquired
*/
Placeholder.types = {
/**
* define an address format for the placeholder
*/
ADDRESSFORMAT : "ADDRESSFORMAT",
/**
* sub-sql or field
*/
SQLPART : "SQLPART",
/**
* function that returns a sub-sql
*/
SQLPARTFUNCTION : "SQLPARTFUNCTION"
};
/**
* placeholder targets, defines whose data is used
*/
Placeholder.targets = {
/**
* use the data of the recipient (default)
*/
RECIPIENT : "RECIPIENT",
/**
* use the data of the sender
*/
SENDER : "SENDER",
/**
* use the data of the user
*/
EMPLOYEE : "EMPLOYEE"
};
return placeholders;
}
\ 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