2026-08-22 14:56:38 +02:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
RED.nodes.registerType('collabora-transform', {
|
|
|
|
|
category: 'nextcloud collabora',
|
2026-08-22 17:10:34 +02:00
|
|
|
color: '#7950a2',
|
2026-08-22 14:56:38 +02:00
|
|
|
defaults: {
|
|
|
|
|
name: { value: '' },
|
|
|
|
|
config: { type: 'nc-collab-config', required: true }
|
|
|
|
|
},
|
|
|
|
|
inputs: 1,
|
|
|
|
|
outputs: 1,
|
|
|
|
|
icon: 'font-awesome/fa-magic',
|
|
|
|
|
label: function () {
|
|
|
|
|
return this.name || 'transform structure';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script type="text/html" data-template-name="collabora-transform">
|
|
|
|
|
<div class="form-row">
|
2026-08-22 17:36:38 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
2026-08-22 14:56:38 +02:00
|
|
|
<input type="text" id="node-input-name">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-row">
|
|
|
|
|
<label for="node-input-config"><i class="fa fa-cog"></i> Config</label>
|
|
|
|
|
<input type="text" id="node-input-config">
|
|
|
|
|
</div>
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script type="text/html" data-help-name="collabora-transform">
|
2026-08-22 17:36:38 +02:00
|
|
|
<p><strong>Write values into a document.</strong> Takes document + JSON fields/transform and asks CODE to fill them in. Result is a new document binary, not JSON.</p>
|
2026-08-22 17:10:34 +02:00
|
|
|
|
2026-08-22 17:36:38 +02:00
|
|
|
<h4>Input</h4>
|
2026-08-22 17:10:34 +02:00
|
|
|
<ul>
|
2026-08-22 17:36:38 +02:00
|
|
|
<li>Document: <code>msg.payload</code> or <code>msg.ncPath</code> (WebDAV)</li>
|
|
|
|
|
<li>Instruction: <code>msg.transform</code> or <code>msg.fields</code> — required</li>
|
2026-08-22 17:10:34 +02:00
|
|
|
</ul>
|
|
|
|
|
|
2026-08-22 17:36:38 +02:00
|
|
|
<h4>Output</h4>
|
|
|
|
|
<p>POST multipart to <code>/cool/transform-document-structure</code>. Fields: <code>data</code> = file, <code>transform</code> = JSON.</p>
|
|
|
|
|
<p><code>msg.payload</code> = modified file (Buffer), plus <code>contentType</code></p>
|
2026-08-22 17:10:34 +02:00
|
|
|
|
2026-08-22 17:36:38 +02:00
|
|
|
<h4>When to use</h4>
|
|
|
|
|
<p>Fill a template via CODE directly, not Nextcloud's template API. Save yourself afterwards (WebDAV PUT / bridge / nc-office) if the file should live in the cloud.</p>
|
2026-08-22 17:10:34 +02:00
|
|
|
|
2026-08-22 17:36:38 +02:00
|
|
|
<pre>msg.ncPath = "/Templates/contract.docx"
|
|
|
|
|
msg.fields = { "Customer": "ACME Ltd", "Date": "2026-08-22" }
|
2026-08-22 17:10:34 +02:00
|
|
|
→ collabora-transform
|
2026-08-22 17:36:38 +02:00
|
|
|
→ (save or convert to PDF)</pre>
|
2026-08-22 14:56:38 +02:00
|
|
|
</script>
|