Das stammt aus den properties des AguilaWidget... So zumindest meine wilde Interpretation
Das Widget wird über eine ASA Server-Aktion gestartet und funktioniert ohne Erweiterung der Metadaten auch.
/* global sc, sca, folder, objects */
let aguila = require('common/aguila');
let objects = require('common/objects');
let objectsSca = require('common/objects')(sca);
let lcs = require('/agorum/roi/customers/fill-template/js/tools/load-customer-settings');
let cnt = require('/agorum/roi/customers/fill-template/js/worker/tools/create-new-template');
let su = require('/agorum/roi/customers/fill-template/js/tools/script-utils');
let fillData = require(lcs.getFillDataScriptAll());
let metadata = require('filingassistant/metadata');
let zielPfadId;
// create widget
let widget = aguila.create({
width: 500,
height: 300,
type: 'agorum.single',
properties: ['targetId', 'metadataObject'],
relayProperties: ['targetId', 'metadataObject'],
items: [
{
type: 'agorum.vbox',
border: true,
items: [
{
type: 'agorum.spacer',
flexible: true,
},
{
type: 'agorum.composite.form.basic',
name: 'form',
labelWidth: 130,
/*
// Das hier anklemmen, dann kommt kein validChanged mehr durch
validation: [
{
required: true, // Global eingestellt, dass das Feld nuicht leer sein darf
},
],
*/
showError: 'always',
elements: [
{
type: 'agorum.textArea',
name: 'testfeld',
},
{
type: 'agorum.composite.form.element.text',
name: 'name',
label: 'Dokumentenname',
},
{
type: 'agorum.composite.form.element.objectPicker',
name: 'empfaenger',
label: 'Empfänger',
pickerType: 'search',
},
{
type: 'agorum.numberInput',
label: 'briefBetreff',
name: 'Betreff',
},
{
type: 'agorum.hbox',
items: [
{
type: 'agorum.spacer',
flexible: true,
},
{
type: 'agorum.composite.form.element.button',
name: 'btCreate',
text: 'Speichern',
disabled: true,
},
{
type: 'agorum.spacer',
flexible: true,
},
],
},
],
},
{
type: 'agorum.spacer',
flexible: true,
},
],
},
],
});
let form = widget.down('form');
let btCreate = form.down('btCreate');
form
.on('validChanged', valid => {
btCreate.disabled = true;
if (valid) {
btCreate.disabled = false;
}
})
.on('action', button => {
if (button.name === 'btCreate') {
//------TESTDATEN ANFANG
let empfaengeriD= '1222212'; // ID der Empfängeradresse
let templateId = '1226265'; // ID der Vorlage
zielPfadId = '1225470'; // ID des Zielordners
//------ TESTDATEN ENDE
let filename = form.down('name').value;
let object;
let templateObject;
object = objects.find(empfaengeriD);
templateObject = objects.find(templateId);
metadataObject.briefBetreff= "Betreffzeile";
let data = {
object: object,
filename: filename,
template: templateObject,
created: objectsSca.find(zielPfadId),
ext: templateObject.nameExtension.toLowerCase(),
metadataObject: metadataObject,
};
fillData = require(lcs.getFillDataScript()).fill(data);
let dataS = metadata().load(templateObject, 'filltemplate_placeholderScript').data();
let script = 'filltemplate_placeholderScript' in dataS ? dataS.filltemplate_placeholderScript : null;
fillData = su.fill(script, fillData);
let createFile = cnt.create(sc, data.created, data.object, data.template, fillData);
}
});
let metadataObject;
// Zusätzliche Metadaten
widget.on('metadataObjectChanged', mdo => {
metadataObject = mdo;
});
widget.on('targetIdChanged', metadataObject => {
form.down('testfeld').value = metadataObject;
});
widget.on('targetIdChanged', targetId => {
zielPfadId = targetId;
});
widget;
Alles anzeigen