<div class="tkt-shell">
<th1>
set q [getParameter q ""]
set st [getParameter st "open"]
set tp [getParameter tp ""]
set pr [getParameter pr ""]
set qclean [string trim $q]
set qpat "%$qclean%"
</th1>
<form class="tkt-toolbar" method="get" action="reportlist">
<label class="tkt-search" aria-label="Search tickets">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></svg>
<input type="text" name="q" value="$<q>" placeholder="Filter title, subsystem, hash...">
</label>
<input type="hidden" name="st" value="$<st>">
<th1>
if {$tp ne ""} { html "<input type='hidden' name='tp' value='[htmlize $tp]'>" }
if {$pr ne ""} { html "<input type='hidden' name='pr' value='[htmlize $pr]'>" }
</th1>
<button type="submit" class="tkt-btn">Filter</button>
<th1>
if {[capexpr {n}]} {
html "<a class='tkt-btn tkt-btn-primary' href='tktnew'>"
html "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' aria-hidden='true'><path d='M12 5v14M5 12h14'/></svg>"
html "New ticket</a>"
}
</th1>
</form>
<div class="tkt-presets" role="navigation" aria-label="Ticket filters">
<th1>
set qarg ""
if {$qclean ne ""} { set qarg "&q=[httpize $qclean]" }
set c_open ""
set c_all ""
set c_rev ""
set c_cls ""
set c_bug ""
set c_feat ""
set c_hi ""
if {$st eq "open" && $tp eq "" && $pr eq ""} { set c_open " is-active" }
if {$st eq "all" && $tp eq "" && $pr eq ""} { set c_all " is-active" }
if {$st eq "review"} { set c_rev " is-active" }
if {$st eq "closed"} { set c_cls " is-active" }
if {$tp eq "Code_Defect"} { set c_bug " is-active" }
if {$tp eq "Feature_Request"} { set c_feat " is-active" }
if {$pr eq "high"} { set c_hi " is-active" }
html "<a class='tkt-preset$c_open' href='reportlist?st=open$qarg'>Open</a>\n"
html "<a class='tkt-preset$c_all' href='reportlist?st=all$qarg'>All</a>\n"
html "<a class='tkt-preset$c_rev' href='reportlist?st=review$qarg'>Review</a>\n"
html "<a class='tkt-preset$c_cls' href='reportlist?st=closed$qarg'>Fixed & Closed</a>\n"
html "<a class='tkt-preset$c_bug' href='reportlist?st=open&tp=Code_Defect$qarg'>Bugs</a>\n"
html "<a class='tkt-preset$c_feat' href='reportlist?st=open&tp=Feature_Request$qarg'>Features</a>\n"
html "<a class='tkt-preset$c_hi' href='reportlist?st=open&pr=high$qarg'>High priority</a>\n"
</th1>
</div>
<th1>
if {[capexpr {r}]} {
set shown 0
html "<div class='tkt-list'>\n"
query {
SELECT substr(t.tkt_uuid,1,10) AS xid,
t.tkt_uuid AS xuuid,
coalesce(t.title,'(untitled)') AS xtitle,
coalesce(t.status,'Open') AS xstatus,
coalesce(t.type,'') AS xtype,
coalesce(t.priority,'') AS xprio,
coalesce(t.severity,'') AS xsev,
coalesce(t.subsystem,'') AS xsub,
coalesce(t.resolution,'') AS xres,
datetime(t.tkt_mtime, toLocal()) AS xmod,
(SELECT count(*) FROM ticketchng c
WHERE c.tkt_id=t.tkt_id AND length(c.icomment)>0) AS xmsgs,
(SELECT count(*) FROM backlink b
WHERE b.srctype=0 AND b.target=substr(t.tkt_uuid,1,10)) AS xcis
FROM ticket t
WHERE (
($st='all')
OR ($st='open' AND coalesce(t.status,'Open') IN ('Open','Verified','Review',''))
OR ($st='review' AND t.status='Review')
OR ($st='closed' AND t.status IN ('Fixed','Tested','Closed','Deferred'))
)
AND ($tp='' OR t.type=$tp)
AND ($pr='' OR ($pr='high' AND t.priority IN ('Immediate','High')))
AND ($qclean=''
OR t.title LIKE $qpat
OR coalesce(t.subsystem,'') LIKE $qpat
OR coalesce(t.type,'') LIKE $qpat
OR t.tkt_uuid LIKE $qpat)
ORDER BY t.tkt_mtime DESC
LIMIT 200
} {
set shown [expr {$shown + 1}]
set icoCls "tkt-state-open"
set icoSvg "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' aria-hidden='true'><circle cx='12' cy='12' r='8'/><circle cx='12' cy='12' r='2.5' fill='currentColor'/></svg>"
if {$xstatus eq "Review"} {
set icoCls "tkt-state-review"
set icoSvg "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' aria-hidden='true'><circle cx='12' cy='12' r='8'/><path d='M12 8v4l3 2'/></svg>"
} elseif {$xstatus eq "Fixed" || $xstatus eq "Tested" || $xstatus eq "Closed" || $xstatus eq "Deferred"} {
set icoCls "tkt-state-closed"
set icoSvg "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' aria-hidden='true'><circle cx='12' cy='12' r='8'/><path d='M8.5 12.5l2.2 2.2 4.8-5'/></svg>"
}
html "<div class='tkt-row'>\n"
html "<span class='tkt-state-ico $icoCls' title='[htmlize $xstatus]'>$icoSvg</span>\n"
html "<div class='tkt-row-main'>\n"
html "<div class='tkt-row-titleline'>"
html "<a class='tkt-row-title' href='tktview/[httpize $xid]'>[htmlize $xtitle]</a>"
if {$xprio eq "Immediate" || $xprio eq "High"} {
html "<span class='tkt-tag tkt-tag-crit'>[htmlize $xprio]</span>"
} elseif {$xprio ne ""} {
html "<span class='tkt-tag'>[htmlize $xprio]</span>"
}
if {$xsub ne ""} {
html "<span class='tkt-tag'>[htmlize $xsub]</span>"
}
if {$xstatus ne "Open" && $xstatus ne ""} {
set scls "tkt-tag"
if {$xstatus eq "Review"} { set scls "tkt-tag tkt-tag-warn" }
if {$xstatus eq "Fixed" || $xstatus eq "Tested"} { set scls "tkt-tag tkt-tag-ok" }
html "<span class='$scls'>[htmlize $xstatus]</span>"
}
html "</div>\n"
html "<div class='tkt-row-meta'>"
html "<code>[htmlize $xid]</code>"
if {$xtype ne ""} { html "<span>[htmlize $xtype]</span>" }
if {$xsev ne ""} { html "<span>[htmlize $xsev]</span>" }
html "<span>Updated [htmlize $xmod]</span>"
html "</div>\n"
html "</div>\n"
html "<div class='tkt-row-right'>"
if {$xmsgs > 0} { html "<span>[htmlize $xmsgs] msg</span>" }
if {$xcis > 0} { html "<span>[htmlize $xcis] ci</span>" }
html "</div>\n"
html "</div>\n"
}
if {$shown == 0} {
html "<div class='tkt-empty'>No tickets match this filter. Try <a href='reportlist?st=all'>All tickets</a> or clear the search box.</div>\n"
}
html "</div>\n"
html "<div class='tkt-count-bar'><span>Showing $shown ticket"
if {$shown != 1} { html "s" }
html "</span>"
if {$qclean ne "" || $st ne "open" || $tp ne "" || $pr ne ""} {
html "<a href='reportlist'>Reset filters</a>"
}
html "</div>\n"
}
</th1>
<details class="tkt-drawer">
<summary>Saved SQL reports</summary>
<ol>
<th1>html $report_items</th1>
</ol>
<div class="tkt-drawer-actions">
<th1>
if {[capexpr {t}]} {
html "<a href='rptnew'>New report format</a>"
}
if {[capexpr {q}]} {
html "<a href='modreq'>Pending moderation requests</a>"
}
</th1>
</div>
</details>
</div>