view.cfm: предпросмотр первых 15 строк документа (v1.0.69)
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<img src="/nubes-logo.svg" alt="Nubes">
|
||||
<span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.68 — Lucee</span></span>
|
||||
<span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.69 — Lucee</span></span>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
@@ -76,7 +76,7 @@
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Имя</th><th style="width:130px;">Изменён</th><th style="width:90px;">Размер</th><th style="width:115px;">Статус</th><th style="width:30px;">Базовый</th><th style="width:30px;"></th><th style="width:30px;"></th></tr>
|
||||
<tr><th>Имя</th><th style="width:130px;">Изменён</th><th style="width:90px;">Размер</th><th style="width:115px;">Статус</th><th style="width:30px;">Базовый</th><th style="width:30px;">View</th><th style="width:30px;"></th><th style="width:30px;"></th></tr>
|
||||
</thead>
|
||||
<tbody id="fileTable"></tbody>
|
||||
</table>
|
||||
@@ -164,7 +164,7 @@ function formatDate(ts) {
|
||||
|
||||
function renderTable() {
|
||||
if (fileQueue.length === 0) {
|
||||
fileTable.innerHTML = '<tr class="empty-row"><td colspan="7">Нет файлов — выберите .docx / .pdf / .zip</td></tr>';
|
||||
fileTable.innerHTML = '<tr class="empty-row"><td colspan="8">Нет файлов — выберите .docx / .pdf / .zip</td></tr>';
|
||||
parseBtn.disabled = true;
|
||||
} else {
|
||||
fileTable.innerHTML = fileQueue.map(function(f, i) {
|
||||
@@ -178,6 +178,7 @@ function renderTable() {
|
||||
'<td class="num-cell" style="font-size:12px;color:var(--muted);">' + formatSize(f.size) + '</td>' +
|
||||
'<td class="status-cell">' + (f.status || '') + '</td>' +
|
||||
'<td style="text-align:center;">' + radio + '</td>' +
|
||||
'<td><button class="info-btn' + (f.doc_id ? ' visible' : '') + '" onclick="window.open(\'/view.cfm?doc_id=' + (f.doc_id||'') + '\', \'_blank\')" title="Просмотр"><i data-lucide="eye" style="width:16px;height:16px;"></i></button></td>' +
|
||||
'<td><button class="info-btn' + (f.doc_id ? ' visible' : '') + '" id="info_' + i + '" onclick="showInfo(' + i + ')" title="Инфо"><i data-lucide="info" style="width:16px;height:16px;"></i></button></td>' +
|
||||
'<td><button class="remove-btn" onclick="removeFile(' + i + ')" title="Удалить"><i data-lucide="trash-2" style="width:16px;height:16px;"></i></button></td>' +
|
||||
'</tr>';
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<cfsetting showdebugoutput="no" enablecfoutputonly="true">
|
||||
<cfheader name="Content-Type" value="text/plain; charset=utf-8">
|
||||
|
||||
<cfparam name="url.doc_id" default="">
|
||||
|
||||
<cftry>
|
||||
<cfif NOT len(url.doc_id)>
|
||||
<cfoutput>doc_id required</cfoutput><cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfquery name="doc" datasource="baza">
|
||||
SELECT filename, elements_json FROM documents WHERE id = <cfqueryparam value="#url.doc_id#" cfsqltype="cf_sql_varchar">
|
||||
</cfquery>
|
||||
|
||||
<cfif doc.recordCount EQ 0>
|
||||
<cfoutput>not found</cfoutput><cfabort>
|
||||
</cfif>
|
||||
|
||||
<cfset elements = deserializeJSON(doc.elements_json)>
|
||||
<cfset count = 0>
|
||||
<cfset outLines = []>
|
||||
<cfset arrayAppend(outLines, "=== " & doc.filename & " ===")>
|
||||
<cfset arrayAppend(outLines, "")>
|
||||
|
||||
<cfloop array="#elements#" index="el">
|
||||
<cfif count GTE 15><cfbreak></cfif>
|
||||
<cfif el.type EQ "paragraph">
|
||||
<cfset prefix = len(el.style) ? "[#el.style#] " : "">
|
||||
<cfset arrayAppend(outLines, prefix & el.text)>
|
||||
<cfset count++>
|
||||
<cfelseif el.type EQ "table">
|
||||
<cfset arrayAppend(outLines, "")>
|
||||
<cfset rows = el.rows>
|
||||
<cfset shown = 0>
|
||||
<cfloop array="#rows#" index="row">
|
||||
<cfif shown GTE 5><cfbreak></cfif>
|
||||
<cfset cells = []>
|
||||
<cfloop array="#row#" index="cell">
|
||||
<cfset arrayAppend(cells, replace(replace(toString(cell), chr(10), " ", "ALL"), "|", "\|", "ALL"))>
|
||||
</cfloop>
|
||||
<cfset arrayAppend(outLines, "| " & arrayToList(cells, " | ") & " |")>
|
||||
<cfset shown++>
|
||||
</cfloop>
|
||||
<cfif arrayLen(rows) GT 5>
|
||||
<cfset arrayAppend(outLines, "... (" & (arrayLen(rows) - 5) & " more rows)")>
|
||||
</cfif>
|
||||
<cfset arrayAppend(outLines, "")>
|
||||
<cfset count++>
|
||||
</cfif>
|
||||
</cfloop>
|
||||
|
||||
<cfif count EQ 0>
|
||||
<cfset arrayAppend(outLines, "(пустой документ)")>
|
||||
</cfif>
|
||||
|
||||
<cfoutput>#arrayToList(outLines, chr(10))#</cfoutput>
|
||||
|
||||
<cfcatch>
|
||||
<cfoutput>Error: #cfcatch.message#</cfoutput>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
Reference in New Issue
Block a user