Add My Docs picker to deep-research, advocate, barnevernet, korrespond, citations

- PHP: Add docPickerSection (button + chips + hidden input) to all 5 tool pages
- JS: Send doc_ids in payload for deep-research, advocate, barnevernet, korrespond
- Backend: Inject selected corpus doc content into paste_text/narrative/notes via dbnToolsInjectDocContent
- Citations: Add upload zone (file → api/extract.php → textarea) + paste textarea with live Norwegian legal reference extraction (regex) + ref chips → title search; doc picker populates titleInput via MutationObserver

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 13:04:45 +02:00
parent 88555eb8a7
commit bffc714541
13 changed files with 214 additions and 13 deletions
+26
View File
@@ -99,6 +99,32 @@ require_once __DIR__ . '/includes/layout.php';
<form id="citationsForm" class="tool-form" autocomplete="off" novalidate>
<div id="docPickerSection" class="doc-picker-section">
<button type="button" id="docPickerBtn" class="doc-picker-btn" aria-haspopup="dialog">
<svg class="doc-picker-btn__icon" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><rect x="2" y="1" width="9" height="12" rx="1.5" stroke="currentColor" stroke-width="1.4"/><path d="M5 5h5M5 8h3" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/><rect x="7" y="9" width="6" height="5" rx="1" fill="white" stroke="currentColor" stroke-width="1.3"/><path d="M9 11h2M9 12.5h1" stroke="currentColor" stroke-width="1" stroke-linecap="round"/></svg>
<span><?= htmlspecialchars(dbnToolsT('doc_picker_btn', $uiLang)) ?></span>
</button>
<div id="docPickerChips" class="doc-picker-chips" aria-label="Selected documents"></div>
<input type="hidden" id="docPickerIds" name="doc_ids" value="">
</div>
<div class="upload-zone" id="citUploadZone" role="region" aria-label="File upload">
<input type="file" id="citUploadInput" accept=".pdf,.docx,.txt" aria-label="Choose a document to scan for legal references">
<div id="citUploadPrompt" class="upload-prompt">
<span class="upload-icon" aria-hidden="true">&#8679;</span>
<p>Upload a document to extract legal references, or <label for="citUploadInput" class="upload-browse">browse</label></p>
<p class="upload-hint"><strong>PDF</strong>, <strong>DOCX</strong>, <strong>TXT</strong> &mdash; text extracted locally, never stored</p>
</div>
<div id="citUploadFileInfo" class="upload-file is-hidden">
<ul id="citUploadFileList" class="upload-file-list"></ul>
<button type="button" id="citUploadClear" class="upload-clear">&times; Clear</button>
</div>
</div>
<label class="input-label" for="citPasteInput">Paste document text <small class="control-hint">(optional — to extract legal references)</small></label>
<textarea id="citPasteInput" rows="5" placeholder="Paste a court decision, letter, or legal text. Legal references found in the text will be offered as quick-search links below."></textarea>
<div id="citRefChips" class="doc-picker-chips" style="margin-bottom:0.75rem" aria-label="Detected legal references" aria-live="polite"></div>
<label class="input-label" for="titleInput">Document title or ID</label>
<div class="cit-search-wrap">
<input type="text" id="titleInput" class="corpus-search-input"