Files
nextcloud-collabora-nodered/nodes/nc-office.html
T
root a6ff9b20e5 Add node docs, collabora purple UI, and portable install env
Human-readable help in all six palette nodes, docs/NODES.md with usage examples, expanded example flows, and auto-detect NODERED_DIR plus CODE bridge IP from .env on any VM.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 17:10:34 +02:00

66 lines
3.2 KiB
HTML

<script type="text/javascript">
RED.nodes.registerType('nc-office', {
category: 'nextcloud collabora',
color: '#7950a2',
defaults: {
name: { value: '' },
config: { type: 'nc-collab-config', required: true },
operation: { value: 'templates:list' }
},
inputs: 1,
outputs: 1,
icon: 'font-awesome/fa-file-text-o',
label: function () {
return this.name || `nc-office ${this.operation}`;
}
});
</script>
<script type="text/html" data-template-name="nc-office">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Namn</label>
<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>
<div class="form-row">
<label for="node-input-operation"><i class="fa fa-wrench"></i> Operation</label>
<select id="node-input-operation">
<option value="templates:list">templates:list</option>
<option value="templates:create">templates:create</option>
<option value="template:extractFields">template:extractFields</option>
<option value="template:fillFields">template:fillFields</option>
<option value="document:direct">document:direct</option>
<option value="document:public">document:public</option>
<option value="files:convert">files:convert</option>
<option value="assets:create">assets:create</option>
</select>
</div>
</script>
<script type="text/html" data-help-name="nc-office">
<p><strong>Nextcloud Office-API.</strong> Trafik till Nextcloud OCS richdocuments — inte direkt till <code>/cool</code> (utom <code>files:convert</code> som internt kör WebDAV + CODE + WebDAV).</p>
<p>Bas: <code>.../ocs/v2.php/apps/richdocuments/api/v1/...</code></p>
<table style="width:100%; font-size:11px;">
<tr><th>Operation</th><th>Gör</th></tr>
<tr><td><code>templates:list</code></td><td>Lista mallar (ev. <code>templateType</code>)</td></tr>
<tr><td><code>templates:create</code></td><td>Ny fil från NC-mall</td></tr>
<tr><td><code>template:extractFields</code></td><td>Fält-JSON (som extract, via NC)</td></tr>
<tr><td><code>template:fillFields</code></td><td>Fyll mall, spara i NC</td></tr>
<tr><td><code>document:direct</code></td><td><code>editorUrl</code> — öppna fil i Office</td></tr>
<tr><td><code>document:public</code></td><td>Samma via <code>shareToken</code></td></tr>
<tr><td><code>files:convert</code></td><td>NC-fil → ny NC-fil (t.ex. PDF)</td></tr>
<tr><td><code>assets:create</code></td><td>Engångslänk för infogning i öppen editor</td></tr>
</table>
<p><code>fileId</code> kan saknas — slås upp med WebDAV PROPFIND från <code>ncPath</code>.</p>
<p>Överstyr via <code>msg.operation</code>. Gemensamma fält: <code>ncPath</code>, <code>fileId</code>, <code>destNcPath</code>, <code>fields</code>.</p>
<pre>inject { ncPath: "/Dokument/avtal.docx" }
→ nc-office (document:direct)
→ debug (editorUrl)</pre>
</script>