Skip to content

Commit 16032f6

Browse files
committed
Adjust paper title prefix from intent metadata
1 parent c5f868b commit 16032f6

3 files changed

Lines changed: 43 additions & 12 deletions

File tree

paperworks/lib/isocpp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ def _read_form(self, form_id):
372372
name = inp.get("name")
373373
if not name:
374374
continue
375+
if name == "audience[]":
376+
continue
375377
fields[name] = inp.get("value", "")
376378

377379
for ta in form.find_all("textarea"):

paperworks/lib/server.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,15 @@ def auth_status():
563563

564564
# -- Routes: Queue operations --
565565

566+
def _upload_audience(intent, audience):
567+
"""Return the audience to submit for upload.
568+
569+
Info papers always target All of WG21 regardless of front matter audience,
570+
since they inform the room without implying a scheduling request.
571+
"""
572+
return "WG21" if intent == "info" else audience
573+
574+
566575
@app.route("/api/upload", methods=["POST"])
567576
def upload_paper():
568577
data = request.get_json(force=True) or {}
@@ -583,7 +592,7 @@ def upload_paper():
583592
"author": data.get("author", ""),
584593
"abstract": data.get("abstract", ""),
585594
"status": data.get("status", ""),
586-
"audience": data.get("audience", ""),
595+
"audience": _upload_audience(data.get("intent", ""), data.get("audience", "")),
587596
})
588597
return jsonify({"job_id": job_id})
589598

@@ -606,15 +615,20 @@ def upload_all():
606615
continue
607616
if p.get("status") == "mailed":
608617
continue
618+
intent = p.get("intent", "")
619+
title = p.get("title", "")
620+
if intent:
621+
intent_label = {"info": "Info", "ask": "Ask"}.get(intent, intent.capitalize())
622+
title = f"{intent_label}: {title}"
609623
_isocpp.submit({
610624
"type": "upload",
611625
"form_id": p["remote"]["form_id"],
612626
"pdf_path": p["pdf_path"],
613627
"doc_number": p["doc_number"],
614-
"title": p.get("title", ""),
628+
"title": title,
615629
"author": p.get("primary_author", ""),
616630
"abstract": p.get("brutal_summary", ""),
617-
"audience": p.get("audience", ""),
631+
"audience": _upload_audience(p.get("intent", ""), p.get("audience", "")),
618632
})
619633
queued += 1
620634
if not queued:

paperworks/lib/templates/index.html

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
.file-btn-pdf:hover { filter: drop-shadow(0 0 3px #e53935); box-shadow: 0 0 6px rgba(229,57,53,0.4); }
104104
.file-btn-rev { color: var(--amber); border-color: rgba(240,165,0,0.3); background: rgba(240,165,0,0.08); }
105105
.file-btn-rev:hover { filter: drop-shadow(0 0 3px var(--amber)); box-shadow: 0 0 6px rgba(240,165,0,0.4); }
106+
.file-btn-ghost { opacity: 0.2; pointer-events: none; cursor: default; }
106107

107108
/* Detail row */
108109
.detail-row td { padding: 0; }
@@ -215,8 +216,8 @@
215216
<div class="section-header">
216217
<div style="display:flex;gap:6px;align-items:center;flex-wrap:wrap;" id="summary-pills"></div>
217218
<div style="display:flex;gap:4px;">
218-
<button class="btn btn-blue" id="btn-render" onclick="renderAll()" style="display:none;">Render</button>
219-
<button class="btn btn-blue" id="btn-upload-all" onclick="uploadAll()" style="display:none;">Upload</button>
219+
<button class="btn btn-blue" id="btn-render" onclick="renderAll()" disabled>RENDER ALL</button>
220+
<button class="btn btn-blue" id="btn-upload-all" onclick="uploadAll()" disabled>UPLOAD</button>
220221
</div>
221222
</div>
222223
<div class="filter-bar">
@@ -403,6 +404,13 @@ <h2>Activity Log</h2>
403404

404405
// -- Papers --
405406

407+
function fileBadge(path, cls, label, openTitle, missingTitle) {
408+
if (path) {
409+
return `<a class="file-btn ${cls}" href="/api/file?path=${encodeURIComponent(path)}" target="_blank" onclick="event.stopPropagation()" title="${esc(openTitle)}">${label}</a>`;
410+
}
411+
return `<span class="file-btn ${cls} file-btn-ghost" title="${esc(missingTitle)}">${label}</span>`;
412+
}
413+
406414
function toggleFolderSort(){_folderSort=!_folderSort;renderPapers();}
407415
function renderPapers() {
408416
const tbody=document.getElementById('tbody'), empty=document.getElementById('empty'), tw=document.getElementById('table-wrap');
@@ -416,20 +424,22 @@ <h2>Activity Log</h2>
416424
return `<tr onclick="toggleDetail(${idx})" data-idx="${idx}">
417425
<td class="mono muted" style="width:24px;text-align:center;font-size:10px">${esc(''+(p.folder_idx||''))}</td>
418426
<td class="mono${p.intent==='ask'?' ask-paper':''}" style="padding-right:2px">${esc(p.doc_number)||'-'}${dirty}</td>
419-
<td style="width:30px;text-align:center;padding-left:0;padding-right:4px">${p.md_path?`<a class="file-btn file-btn-md" href="/api/file?path=${encodeURIComponent(p.md_path)}" target="_blank" onclick="event.stopPropagation()" title="Open Markdown">MD</a>`:''}</td>
420-
<td style="width:34px;text-align:center;padding-left:0;padding-right:4px">${p.pdf_path?`<a class="file-btn file-btn-pdf" href="/api/file?path=${encodeURIComponent(p.pdf_path)}" target="_blank" onclick="event.stopPropagation()" title="Open PDF">PDF</a>`:''}</td>
427+
<td style="width:30px;text-align:center;padding-left:0;padding-right:4px">${fileBadge(p.md_path,'file-btn-md','MD','Open Markdown','No markdown file')}</td>
428+
<td style="width:34px;text-align:center;padding-left:0;padding-right:4px">${fileBadge(p.pdf_path,'file-btn-pdf','PDF','Open PDF','No PDF')}</td>
421429
<td style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-left:16px">${esc(p.title)||''}</td>
422430
<td class="mono muted" style="white-space:nowrap">${esc(p.date)||''}</td>
423431
<td style="width:70px;text-align:center;overflow:hidden" onclick="event.stopPropagation()">${badgeHtml(p.status,idx)}</td>
424432
</tr>`;
425433
}).join('');
426434
const allMd=_papers.filter(p=>p.md_path).length;
427435
const rb=document.getElementById('btn-render');
428-
rb.textContent='RENDER ALL';
429-
rb.style.display=allMd>0?'inline-block':'none';
436+
rb.disabled=allMd===0;
437+
rb.title=allMd===0?'No markdown papers':`Render all ${allMd} papers`;
430438
const uploadCount=_papers.filter(p=>p.pdf_path&&p.remote&&p.status!=='mailed').length;
431439
const ub=document.getElementById('btn-upload-all');
432-
if(uploadCount>0){ub.textContent=`UPLOAD ${uploadCount}`;ub.style.display='inline-block';}else ub.style.display='none';
440+
ub.textContent=uploadCount>0?`UPLOAD ${uploadCount}`:'UPLOAD';
441+
ub.disabled=uploadCount===0||!_authenticated;
442+
ub.title=!_authenticated?'Not connected to isocpp.org':uploadCount===0?'No papers ready to upload':`Upload ${uploadCount} papers`;
433443
const restoreIdx=_expandedIdx;
434444
_expandedIdx=null;
435445
if(restoreIdx!==null) toggleDetail(restoreIdx);
@@ -452,13 +462,16 @@ <h2>Activity Log</h2>
452462
const uploadWk=busy?' working':'';
453463
const uploadTitle=!_authenticated?'Not connected to isocpp.org':!p.pdf_path?'No PDF available':!p.remote?'No remote entry on isocpp.org':'Force upload to isocpp.org';
454464
let acts='';
455-
if(p.md_path) acts+=`<button class="btn btn-blue${wk}" onclick="event.stopPropagation();renderSingle(${idx})"${dis}>RENDER</button>`;
465+
const renderDis=(!p.md_path||busy)?' disabled':'';
466+
const renderTitle=!p.md_path?'No markdown file':'';
467+
acts+=`<button class="btn btn-blue${p.md_path?wk:''}" onclick="event.stopPropagation();renderSingle(${idx})"${renderDis} title="${renderTitle}">RENDER</button>`;
456468
acts+=`<button class="btn btn-blue${uploadWk}" onclick="event.stopPropagation();submitUpload(${idx})"${uploadDis} title="${uploadTitle}">UPLOAD</button>`;
457469
d.innerHTML=`<td colspan="7"><div class="detail-content"><div class="detail-grid">
458470
<span class="dl">Document</span><span class="dv">${esc(p.doc_number)||'-'}</span>
459471
<span class="dl">Title</span><span class="dv">${esc(p.title)||'-'}</span>
460472
<span class="dl">Authors</span><span class="dv">${esc(p.authors)||'-'}</span>
461473
<span class="dl">Audience</span><span class="dv">${esc(p.audience)||'-'}</span>
474+
${p.intent?`<span class="dl">Intent</span><span class="dv">${esc({info:'Inform',ask:'Ask'}[p.intent]||p.intent)}</span>`:''}
462475
${p.md_path?`<span class="dl">Markdown</span><span class="dv" style="font-family:var(--mono);font-size:10px">${esc(p.md_path)}</span>`:''}
463476
${p.pdf_path?`<span class="dl">PDF</span><span class="dv" style="font-family:var(--mono);font-size:10px">${esc(p.pdf_path)}</span>`:''}
464477
${p.brutal_summary?`<span class="dl">Abstract</span><span class="dv">${esc(p.brutal_summary)}</span>`:''}
@@ -530,7 +543,9 @@ <h2>Activity Log</h2>
530543
function submitUpload(idx) {
531544
const p = _papers[idx];
532545
if (!p || !p.remote) return;
533-
submitJob(idx, '/api/upload', {form_id: p.remote.form_id, doc_number: p.doc_number, path: p.pdf_path, title: p.title, author: p.primary_author || '', abstract: p.brutal_summary || '', status: (p.remote && p.remote.status) || '', audience: p.audience || ''});
546+
const intentMap = {info: 'Info', ask: 'Ask'};
547+
const title = p.intent ? (intentMap[p.intent] || p.intent) + ': ' + (p.title || '') : (p.title || '');
548+
submitJob(idx, '/api/upload', {form_id: p.remote.form_id, doc_number: p.doc_number, path: p.pdf_path, title, author: p.primary_author || '', abstract: p.brutal_summary || '', status: (p.remote && p.remote.status) || '', audience: p.audience || '', intent: p.intent || ''});
534549
}
535550
function renderSingle(idx) {
536551
const p = _papers[idx];

0 commit comments

Comments
 (0)