Artifact 1a6fe18ea052e367d0391c708eed12ae83b1c40c9009146345f49e074db1fe74:
- File
skin/tickets/reportlist.th1
— part of check-in
[c9963a4ee9]
at
2026-12-01 13:24:45
on branch trunk
— Add queue-first ticket workbench, assignee board, and pagination
- Probe optional assignee, submitter, and closedate columns with query -nocomplain - Add quick-queue pill strip (Mine, Involved, Unassigned, Active 30d, Pending) - Add assignee facet, table column, row/card owner badges, and group=assignee board - Default sort to recent when open tickets exceed 100 and hide closed board columns on st=open - Move Saved SQL reports to a top-bar popover, add Pending reply/stale cues, foundin/assignee search, tktsrch button, and 200-row pagination (user: dmestas, size: 70686) [annotate] [blame] [check-ins using]
<th1> set q [getParameter q ""] set st [getParameter st "open"] set view [getParameter view "list"] set sortParam [getParameter sort ""] set grpParam [getParameter group ""] set tcol [getParameter tcol "updated"] set tdir [getParameter tdir "desc"] set ftype [getParameter tp ""] set fprio [getParameter pr ""] set fsev [getParameter sv ""] set fsub [getParameter sb ""] set fstat [getParameter fs ""] set fscope [getParameter scope ""] set fas [getParameter as ""] set fage [getParameter age ""] set pgParam [getParameter pg "1"] set qclean [string trim $q] set qpat "%$qclean%" if {$st ne "open" && $st ne "closed" && $st ne "all"} { set st "open" } if {$view ne "list" && $view ne "table" && $view ne "board"} { set view "list" } if {$tdir ne "asc" && $tdir ne "desc"} { set tdir "desc" } if {$fscope ne "" && $fscope ne "mine" && $fscope ne "involved" && $fscope ne "unassigned"} { set fscope "" } if {$fage ne "" && $fage ne "30" && $fage ne "180"} { set fage "" } set pg 1 if {[regexp {^[1-9][0-9]*$} $pgParam]} { set pg [expr {$pgParam + 0}] } if {$pg > 500} { set pg 500 } set offset [expr {($pg - 1) * 200}] set hasLogin 0 set curUser "" if {[info exists login]} { if {$login ne "" && $login ne "nobody" && $login ne "anonymous"} { set hasLogin 1 set curUser $login } } set hasAssignee 0 set hasSubmitter 0 set hasClosedate 0 if {[capexpr {r}]} { query -nocomplain {SELECT count(assignee) AS _x FROM ticket} { set hasAssignee 1 } query -nocomplain {SELECT count(submitter) AS _x FROM ticket} { set hasSubmitter 1 } query -nocomplain {SELECT count(closedate) AS _x FROM ticket} { set hasClosedate 1 } } if {!$hasAssignee} { if {$fscope eq "mine" || $fscope eq "unassigned"} { set fscope "" } set fas "" } if {!$hasLogin} { if {$fscope eq "mine" || $fscope eq "involved"} { set fscope "" } } set nopen 0 set nclosed 0 set nall 0 set nact30 0 set npend 0 set nunassigned 0 set nmine 0 set ninvolved 0 if {[capexpr {r}]} { query { SELECT sum(CASE WHEN coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 0 ELSE 1 END) AS xo, sum(CASE WHEN coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 1 ELSE 0 END) AS xc, count(*) AS xa, sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') AND julianday('now') - tkt_mtime <= 30 THEN 1 ELSE 0 END) AS xact, sum(CASE WHEN status='Pending' THEN 1 ELSE 0 END) AS xpend FROM ticket } { if {$xo ne ""} { set nopen $xo } if {$xc ne ""} { set nclosed $xc } if {$xa ne ""} { set nall $xa } if {$xact ne ""} { set nact30 $xact } if {$xpend ne ""} { set npend $xpend } } if {$hasAssignee} { query -nocomplain { SELECT sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') AND coalesce(assignee,'') IN ('','nobody') THEN 1 ELSE 0 END) AS xun, sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') AND assignee = user() THEN 1 ELSE 0 END) AS xmine FROM ticket } { if {$xun ne ""} { set nunassigned $xun } if {$xmine ne ""} { set nmine $xmine } } } if {$hasLogin} { if {$hasAssignee && $hasSubmitter} { query -nocomplain { SELECT count(*) AS xinv FROM ticket t WHERE coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') AND (t.assignee = user() OR t.submitter = user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())) } { if {$xinv ne ""} { set ninvolved $xinv } } } elseif {$hasAssignee} { query -nocomplain { SELECT count(*) AS xinv FROM ticket t WHERE coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') AND (t.assignee = user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())) } { if {$xinv ne ""} { set ninvolved $xinv } } } else { query { SELECT count(*) AS xinv FROM ticket t WHERE coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') AND EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user()) } { if {$xinv ne ""} { set ninvolved $xinv } } } } } set defaultSort "priority" if {$nopen > 100} { set defaultSort "recent" } set sort $sortParam if {$sort ne "priority" && $sort ne "recent"} { set sort $defaultSort } set defaultGrp "status" if {$hasAssignee && $st eq "open"} { set defaultGrp "assignee" } set grp $grpParam if {$grp ne "status" && $grp ne "priority" && $grp ne "subsystem" && !($hasAssignee && $grp eq "assignee")} { set grp $defaultGrp } proc tkt_url {st view sort grp qclean ftype fprio fsev fsub fstat tcol tdir fscope fas fage pg defaultSort defaultGrp} { set u "reportlist?st=[httpize $st]" if {$view ne "list"} { set u "$u&view=[httpize $view]" } if {$sort ne $defaultSort} { set u "$u&sort=[httpize $sort]" } if {$view eq "board" && $grp ne $defaultGrp} { set u "$u&group=[httpize $grp]" } if {$view eq "table" && $tcol ne "updated"} { set u "$u&tcol=[httpize $tcol]&tdir=[httpize $tdir]" } if {$qclean ne ""} { set u "$u&q=[httpize $qclean]" } if {$ftype ne ""} { set u "$u&tp=[httpize $ftype]" } if {$fprio ne ""} { set u "$u&pr=[httpize $fprio]" } if {$fsev ne ""} { set u "$u&sv=[httpize $fsev]" } if {$fsub ne ""} { set u "$u&sb=[httpize $fsub]" } if {$fstat ne ""} { set u "$u&fs=[httpize $fstat]" } if {$fscope ne ""} { set u "$u&scope=[httpize $fscope]" } if {$fas ne ""} { set u "$u&as=[httpize $fas]" } if {$fage ne ""} { set u "$u&age=[httpize $fage]" } if {$pg > 1} { set u "$u&pg=$pg" } return $u } html "<div class='tkt-shell' data-tkt-page='reportlist'>\n" </th1> <div class="tkt-head-bar"> <nav class="tkt-seg" aria-label="Ticket state"> <th1> set u_open [tkt_url open $view $sort $grp $qclean $ftype $fprio $fsev $fsub "" $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] set u_cls [tkt_url closed $view $sort $grp $qclean $ftype $fprio $fsev $fsub "" $tcol $tdir "" $fas $fage 1 $defaultSort $defaultGrp] set u_all [tkt_url all $view $sort $grp $qclean $ftype $fprio $fsev $fsub "" $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] set c_o ""; set c_c ""; set c_a "" if {$st eq "open"} { set c_o " is-active" } if {$st eq "closed"} { set c_c " is-active" } if {$st eq "all"} { set c_a " is-active" } html "<a class='$c_o' href='$u_open'><svg class='tkt-state-open' 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>Open <span class='tkt-cnt'>[htmlize $nopen]</span></a>\n" html "<a class='$c_c' href='$u_cls'><svg class='tkt-state-closed' 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>Closed <span class='tkt-cnt'>[htmlize $nclosed]</span></a>\n" html "<a class='$c_a' href='$u_all'>All <span class='tkt-cnt'>[htmlize $nall]</span></a>\n" </th1> </nav> <div class="tkt-head-tools"> <nav class="tkt-seg" aria-label="Display mode"> <th1> set u_vl [tkt_url $st list $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] set u_vt [tkt_url $st table $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] set u_vb [tkt_url $st board $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] set vl ""; set vt ""; set vb "" if {$view eq "list"} { set vl " is-active" } if {$view eq "table"} { set vt " is-active" } if {$view eq "board"} { set vb " is-active" } html "<a class='$vl' href='$u_vl'>list</a>\n" html "<a class='$vt' href='$u_vt'>table</a>\n" html "<a class='$vb' href='$u_vb'>board</a>\n" </th1> </nav> <nav class="tkt-seg" aria-label="Sort order"> <th1> set u_sp [tkt_url $st $view priority $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] set u_sr [tkt_url $st $view recent $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] set sp ""; set sr "" if {$sort eq "priority"} { set sp " is-active" } if {$sort eq "recent"} { set sr " is-active" } html "<a class='$sp' href='$u_sp'>priority</a>\n" html "<a class='$sr' href='$u_sr'>recent</a>\n" </th1> </nav> <details class="tkt-rpt-pop" data-tkt-popover="1"> <summary class="tkt-btn">Reports</summary> <div class="tkt-rpt-menu"> <div class="tkt-rpt-hdr">Saved SQL reports</div> <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</a>" } </th1> </div> </div> </details> <th1> if {[capexpr {n}]} { html "<a class='tkt-btn tkt-btn-primary' href='tktnew'><svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' aria-hidden='true'><path d='M12 5v14M5 12h14'/></svg>New ticket</a>\n" } </th1> </div> </div> <th1> if {[capexpr {r}] && $nall > 0} { html "<nav class='tkt-queues' aria-label='Quick queues'>\n" if {$hasLogin && $hasAssignee} { set nextSc "mine"; set qcls "tkt-qpill" if {$fscope eq "mine"} { set nextSc ""; set qcls "tkt-qpill is-on" } set u_qm [tkt_url open $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $nextSc "" $fage 1 $defaultSort $defaultGrp] html "<a class='$qcls' href='$u_qm'>Mine (@[htmlize $curUser]) <span class='tkt-cnt'>[htmlize $nmine]</span></a>\n" } if {$hasLogin} { set nextSc "involved"; set qcls "tkt-qpill" if {$fscope eq "involved"} { set nextSc ""; set qcls "tkt-qpill is-on" } set u_qi [tkt_url open $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $nextSc "" $fage 1 $defaultSort $defaultGrp] html "<a class='$qcls' href='$u_qi'>Involved <span class='tkt-cnt'>[htmlize $ninvolved]</span></a>\n" } if {$hasAssignee} { set nextSc "unassigned"; set qcls "tkt-qpill" if {$fscope eq "unassigned"} { set nextSc ""; set qcls "tkt-qpill is-on" } set u_qu [tkt_url open $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $nextSc "" $fage 1 $defaultSort $defaultGrp] html "<a class='$qcls' href='$u_qu'>Unassigned <span class='tkt-cnt'>[htmlize $nunassigned]</span></a>\n" } set nextAge "30"; set acls "tkt-qpill" if {$fage eq "30"} { set nextAge ""; set acls "tkt-qpill is-on" } set u_qa [tkt_url open $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $nextAge 1 $defaultSort $defaultGrp] html "<a class='$acls' href='$u_qa'>Active 30d <span class='tkt-cnt'>[htmlize $nact30]</span></a>\n" if {$npend > 0} { set nextFs "Pending"; set pcls "tkt-qpill" if {$fstat eq "Pending"} { set nextFs ""; set pcls "tkt-qpill is-on" } set u_qp [tkt_url open $view $sort $grp $qclean $ftype $fprio $fsev $fsub $nextFs $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] html "<a class='$pcls' href='$u_qp'>Pending <span class='tkt-cnt'>[htmlize $npend]</span></a>\n" } html "</nav>\n" } </th1> <form class="tkt-toolbar" method="get" action="reportlist"> <label class="tkt-search" aria-label="Filter 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> <th1> set sph "Filter title, subsystem, version, hash..." if {$hasAssignee} { set sph "Filter title, subsystem, assignee, version, hash..." } html "<input type='search' name='q' value='[htmlize $q]' placeholder='$sph' data-tkt-search='1'>" if {$qclean ne ""} { set u_clrq [tkt_url $st $view $sort $grp "" $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp] html "<a class='tkt-search-clear' href='$u_clrq' aria-label='Clear search' title='Clear search'><svg viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.8' aria-hidden='true'><path d='M4 4l8 8M12 4l-8 8'/></svg></a>" } </th1> </label> <input type="hidden" name="st" value="$<st>"> <th1> if {$view ne "list"} { html "<input type='hidden' name='view' value='[htmlize $view]'>" } if {$sort ne $defaultSort} { html "<input type='hidden' name='sort' value='[htmlize $sort]'>" } if {$grp ne $defaultGrp} { html "<input type='hidden' name='group' value='[htmlize $grp]'>" } if {$ftype ne ""} { html "<input type='hidden' name='tp' value='[htmlize $ftype]'>" } if {$fprio ne ""} { html "<input type='hidden' name='pr' value='[htmlize $fprio]'>" } if {$fsev ne ""} { html "<input type='hidden' name='sv' value='[htmlize $fsev]'>" } if {$fsub ne ""} { html "<input type='hidden' name='sb' value='[htmlize $fsub]'>" } if {$fstat ne ""} { html "<input type='hidden' name='fs' value='[htmlize $fstat]'>" } if {$fscope ne ""} { html "<input type='hidden' name='scope' value='[htmlize $fscope]'>" } if {$fas ne ""} { html "<input type='hidden' name='as' value='[htmlize $fas]'>" } if {$fage ne ""} { html "<input type='hidden' name='age' value='[htmlize $fage]'>" } </th1> <button type="submit" class="tkt-btn">Filter</button> <th1> set u_fts "tktsrch" if {$qclean ne ""} { set u_fts "tktsrch?s=[httpize $qclean]" } html "<a class='tkt-btn' href='$u_fts' title='Full-text search descriptions and comments'>Full-text</a>" </th1> </form> <th1> if {[capexpr {r}]} { html "<form class='tkt-facets' method='get' action='reportlist' data-tkt-auto-submit='1'>\n" html "<input type='hidden' name='st' value='[htmlize $st]'>\n" if {$view ne "list"} { html "<input type='hidden' name='view' value='[htmlize $view]'>\n" } if {$sort ne $defaultSort} { html "<input type='hidden' name='sort' value='[htmlize $sort]'>\n" } if {$grp ne $defaultGrp} { html "<input type='hidden' name='group' value='[htmlize $grp]'>\n" } if {$qclean ne ""} { html "<input type='hidden' name='q' value='[htmlize $qclean]'>\n" } if {$fscope ne ""} { html "<input type='hidden' name='scope' value='[htmlize $fscope]'>\n" } if {$fage ne ""} { html "<input type='hidden' name='age' value='[htmlize $fage]'>\n" } if {$hasAssignee} { set cls_as "tkt-facet"; if {$fas ne ""} { set cls_as "tkt-facet is-on" } html "<label class='$cls_as'><span>assignee</span><select name='as'><option value=''>any</option>" set selu ""; if {$fas eq "__unassigned__"} { set selu " selected" } html "<option value='__unassigned__'$selu>(unassigned)</option>" query -nocomplain { SELECT assignee AS v, sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 1 ELSE 0 END) AS oc FROM ticket WHERE length(assignee)>0 AND assignee<>'nobody' GROUP BY assignee ORDER BY oc DESC, assignee ASC } { set sel ""; if {$v eq $fas} { set sel " selected" } if {$oc > 0} { html "<option value='[htmlize $v]'$sel>[htmlize $v] ([htmlize $oc])</option>" } else { html "<option value='[htmlize $v]'$sel>[htmlize $v]</option>" } } html "</select></label>\n" } set cls_tp "tkt-facet"; if {$ftype ne ""} { set cls_tp "tkt-facet is-on" } html "<label class='$cls_tp'><span>type</span><select name='tp'><option value=''>any</option>" query {SELECT DISTINCT type AS v, replace(type,'_',' ') AS lbl FROM ticket WHERE length(type)>0 ORDER BY type} { set sel ""; if {$v eq $ftype} { set sel " selected" } html "<option value='[htmlize $v]'$sel>[htmlize $lbl]</option>" } html "</select></label>\n" set cls_pr "tkt-facet"; if {$fprio ne ""} { set cls_pr "tkt-facet is-on" } html "<label class='$cls_pr'><span>priority</span><select name='pr'><option value=''>any</option>" query { SELECT DISTINCT priority AS v FROM ticket WHERE length(priority)>0 ORDER BY CASE WHEN priority IN ('Immediate','9 Immediate') OR priority GLOB '9*' THEN 1 WHEN priority GLOB '8*' THEN 2 WHEN priority IN ('High','7 High') OR priority GLOB '7*' THEN 3 WHEN priority GLOB '6*' THEN 4 WHEN priority IN ('Medium','5 Medium') OR priority GLOB '5*' THEN 5 WHEN priority GLOB '4*' THEN 6 WHEN priority IN ('Low','3 Low') OR priority GLOB '3*' THEN 7 WHEN priority GLOB '2*' THEN 8 WHEN priority IN ('Zero','1 Zero') OR priority GLOB '1*' THEN 9 ELSE 10 END, priority } { set sel ""; if {$v eq $fprio} { set sel " selected" } html "<option value='[htmlize $v]'$sel>[htmlize $v]</option>" } html "</select></label>\n" set cls_sb "tkt-facet"; if {$fsub ne ""} { set cls_sb "tkt-facet is-on" } html "<label class='$cls_sb'><span>subsystem</span><select name='sb'><option value=''>any</option>" query {SELECT DISTINCT subsystem AS v FROM ticket WHERE length(subsystem)>0 ORDER BY subsystem} { set sel ""; if {$v eq $fsub} { set sel " selected" } html "<option value='[htmlize $v]'$sel>[htmlize $v]</option>" } html "</select></label>\n" set cls_fs "tkt-facet"; if {$fstat ne ""} { set cls_fs "tkt-facet is-on" } html "<label class='$cls_fs'><span>status</span><select name='fs'><option value=''>any</option>" query {SELECT DISTINCT status AS v FROM ticket WHERE length(status)>0 ORDER BY status} { set sel ""; if {$v eq $fstat} { set sel " selected" } html "<option value='[htmlize $v]'$sel>[htmlize $v]</option>" } html "</select></label>\n" set cls_sv "tkt-facet"; if {$fsev ne ""} { set cls_sv "tkt-facet is-on" } html "<label class='$cls_sv'><span>severity</span><select name='sv'><option value=''>any</option>" query { SELECT DISTINCT severity AS v FROM ticket WHERE length(severity)>0 ORDER BY CASE severity WHEN 'Critical' THEN 1 WHEN 'Severe' THEN 2 WHEN 'Important' THEN 3 WHEN 'Minor' THEN 4 WHEN 'Cosmetic' THEN 5 ELSE 9 END, severity } { set sel ""; if {$v eq $fsev} { set sel " selected" } html "<option value='[htmlize $v]'$sel>[htmlize $v]</option>" } html "</select></label>\n" html "<noscript><button type='submit' class='tkt-btn'>Apply</button></noscript>\n" if {$qclean ne "" || $ftype ne "" || $fprio ne "" || $fsev ne "" || $fsub ne "" || $fstat ne "" || $fscope ne "" || $fas ne "" || $fage ne ""} { set u_clr [tkt_url $st $view $sort $grp "" "" "" "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp] html "<a class='tkt-clear-btn' href='$u_clr'>Clear filters</a>\n" } html "</form>\n" set dom_prio "" set dom_stat "" set nmatch 0 if {$view eq "list" || $view eq "table"} { if {$hasAssignee} { query -nocomplain { SELECT count(*) AS nm FROM ticket t WHERE (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fas='' OR ($fas='__unassigned__' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$fas) AND ($fscope='' OR ($fscope='mine' AND t.assignee=user()) OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody')) OR ($fscope='involved' AND (t.assignee=user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.assignee,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) } { set nmatch $nm } } else { query { SELECT count(*) AS nm FROM ticket t WHERE (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fscope='' OR ($fscope='involved' AND EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user()))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) } { set nmatch $nm } } if {$view eq "list" && $nmatch >= 5} { set thresh [expr {($nmatch * 7 + 9) / 10}] query { SELECT t.priority AS dv, count(*) AS dc FROM ticket t WHERE length(t.priority)>0 AND (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) GROUP BY t.priority ORDER BY dc DESC LIMIT 1 } { if {$dc >= $thresh} { set dom_prio $dv } } query { SELECT coalesce(t.status,'Open') AS dv, count(*) AS dc FROM ticket t WHERE (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) GROUP BY dv ORDER BY dc DESC LIMIT 1 } { if {$dc >= $thresh} { set dom_stat $dv } } } } proc tkt_render_list_row {xid xtitle xstatus xtypelbl xprio xsev xsub xmod xmsgs xcis xas xpcue hasAssignee dom_prio dom_stat} { 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" || $xstatus eq "Pending"} { 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" || $xstatus eq "Deleted" || $xstatus eq "Rejected"} { 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 ne "" && $xprio ne $dom_prio} { if {$xprio eq "Immediate" || $xprio eq "High" || [string match 9* $xprio] || [string match 8* $xprio] || [string match 7* $xprio]} { html "<span class='tkt-tag tkt-tag-crit'>[htmlize $xprio]</span>" } else { html "<span class='tkt-tag'>[htmlize $xprio]</span>" } } if {$xsub ne "" && $xsub ne "None"} { html "<span class='tkt-tag'>[htmlize $xsub]</span>" } if {$xstatus ne "Open" && $xstatus ne "" && $xstatus ne $dom_stat} { set scls "tkt-tag" if {$xstatus eq "Review" || $xstatus eq "Pending"} { 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>" } if {$xpcue eq "reply"} { html "<span class='tkt-tag tkt-tag-ok'>reply waiting</span>" } elseif {$xpcue eq "stale"} { html "<span class='tkt-tag'>stale >14d</span>" } html "</div>\n" html "<div class='tkt-row-meta'>" html "<code>[htmlize $xid]</code>" if {$xtypelbl ne ""} { html "<span>[htmlize $xtypelbl]</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 {$hasAssignee} { if {$xas eq "" || $xas eq "nobody"} { html "<span class='tkt-owner is-unassigned'>unassigned</span>" } else { html "<span class='tkt-owner'>@[htmlize $xas]</span>" } } if {$xmsgs > 0} { html "<span>[htmlize $xmsgs] msg</span>" } if {$xcis > 0} { html "<span>[htmlize $xcis] ci</span>" } html "</div>\n" html "</div>\n" } set shown 0 if {$view eq "list"} { html "<div class='tkt-list'>\n" if {$hasAssignee && $hasClosedate} { query -nocomplain { SELECT substr(t.tkt_uuid,1,10) AS xid, coalesce(t.title,'(untitled)') AS xtitle, coalesce(t.status,'Open') AS xstatus, replace(coalesce(t.type,''),'_',' ') AS xtypelbl, coalesce(t.priority,'') AS xprio, coalesce(t.severity,'') AS xsev, coalesce(t.subsystem,'') AS xsub, coalesce(t.assignee,'') AS xas, CASE WHEN t.status='Pending' AND t.closedate IS NOT NULL AND t.closedate<>'' AND julianday(t.tkt_mtime) > julianday(t.closedate) + 0.05 THEN 'reply' WHEN t.status='Pending' AND julianday('now') - t.tkt_mtime > 14 THEN 'stale' ELSE '' END AS xpcue, 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') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fas='' OR ($fas='__unassigned__' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$fas) AND ($fscope='' OR ($fscope='mine' AND t.assignee=user()) OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody')) OR ($fscope='involved' AND (t.assignee=user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.assignee,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) ORDER BY CASE WHEN $sort='priority' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END ELSE 0 END ASC, CASE WHEN $sort='priority' THEN CASE t.severity WHEN 'Critical' THEN 1 WHEN 'Severe' THEN 2 WHEN 'Important' THEN 3 WHEN 'Minor' THEN 4 WHEN 'Cosmetic' THEN 5 ELSE 6 END ELSE 0 END ASC, t.tkt_mtime DESC LIMIT 200 OFFSET $offset } { set shown [expr {$shown + 1}] tkt_render_list_row $xid $xtitle $xstatus $xtypelbl $xprio $xsev $xsub $xmod $xmsgs $xcis $xas $xpcue 1 $dom_prio $dom_stat } } elseif {$hasAssignee} { query -nocomplain { SELECT substr(t.tkt_uuid,1,10) AS xid, coalesce(t.title,'(untitled)') AS xtitle, coalesce(t.status,'Open') AS xstatus, replace(coalesce(t.type,''),'_',' ') AS xtypelbl, coalesce(t.priority,'') AS xprio, coalesce(t.severity,'') AS xsev, coalesce(t.subsystem,'') AS xsub, coalesce(t.assignee,'') AS xas, CASE WHEN t.status='Pending' AND julianday('now') - t.tkt_mtime > 14 THEN 'stale' ELSE '' END AS xpcue, 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') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fas='' OR ($fas='__unassigned__' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$fas) AND ($fscope='' OR ($fscope='mine' AND t.assignee=user()) OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody')) OR ($fscope='involved' AND (t.assignee=user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.assignee,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) ORDER BY CASE WHEN $sort='priority' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END ELSE 0 END ASC, CASE WHEN $sort='priority' THEN CASE t.severity WHEN 'Critical' THEN 1 WHEN 'Severe' THEN 2 WHEN 'Important' THEN 3 WHEN 'Minor' THEN 4 WHEN 'Cosmetic' THEN 5 ELSE 6 END ELSE 0 END ASC, t.tkt_mtime DESC LIMIT 200 OFFSET $offset } { set shown [expr {$shown + 1}] tkt_render_list_row $xid $xtitle $xstatus $xtypelbl $xprio $xsev $xsub $xmod $xmsgs $xcis $xas $xpcue 1 $dom_prio $dom_stat } } else { query { SELECT substr(t.tkt_uuid,1,10) AS xid, coalesce(t.title,'(untitled)') AS xtitle, coalesce(t.status,'Open') AS xstatus, replace(coalesce(t.type,''),'_',' ') AS xtypelbl, coalesce(t.priority,'') AS xprio, coalesce(t.severity,'') AS xsev, coalesce(t.subsystem,'') AS xsub, 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') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fscope='' OR ($fscope='involved' AND EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user()))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) ORDER BY CASE WHEN $sort='priority' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END ELSE 0 END ASC, CASE WHEN $sort='priority' THEN CASE t.severity WHEN 'Critical' THEN 1 WHEN 'Severe' THEN 2 WHEN 'Important' THEN 3 WHEN 'Minor' THEN 4 WHEN 'Cosmetic' THEN 5 ELSE 6 END ELSE 0 END ASC, t.tkt_mtime DESC LIMIT 200 OFFSET $offset } { set shown [expr {$shown + 1}] tkt_render_list_row $xid $xtitle $xstatus $xtypelbl $xprio $xsev $xsub $xmod $xmsgs $xcis "" "" 0 $dom_prio $dom_stat } } if {$shown == 0} { set u_clr_e [tkt_url $st $view $sort $grp "" "" "" "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp] set u_all_q [tkt_url all $view $sort $grp $qclean $ftype $fprio $fsev $fsub "" $tcol $tdir "" $fas "" 1 $defaultSort $defaultGrp] html "<div class='tkt-empty'>" if {$qclean ne ""} { html "No tickets match <strong>[htmlize $qclean]</strong> in this view. " html "<a href='$u_all_q'>Search all [htmlize $nall] tickets</a>, " html "<a href='tktsrch?s=[httpize $qclean]'>full-text search descriptions</a>, or " html "<a href='$u_clr_e'>clear filters</a>." } else { html "No tickets match this filter. " html "<a href='$u_clr_e'>Clear filters</a> or " html "<a href='reportlist?st=all'>view all [htmlize $nall] tickets</a>." } html "</div>\n" } html "</div>\n" } elseif {$view eq "table"} { html "<div class='tkt-tw'><table class='tkt-table'><thead><tr>" set cols {id ID title Title status Status type Type priority Priority subsystem Subsystem updated Updated} if {$hasAssignee} { set cols {id ID title Title assignee Assignee status Status type Type priority Priority subsystem Subsystem updated Updated} } foreach {ck clbl} $cols { set ndir "asc" set mark "" if {$tcol eq $ck} { if {$tdir eq "asc"} { set ndir "desc"; set mark " (asc)" } else { set ndir "asc"; set mark " (desc)" } } set u_col [tkt_url $st table $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $ck $ndir $fscope $fas $fage 1 $defaultSort $defaultGrp] html "<th><a href='$u_col'>$clbl$mark</a></th>" } html "</tr></thead><tbody>\n" proc tkt_render_table_row {xid xtitle xas xstatus xtypelbl xprio xsub xmod hasAssignee} { 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" || $xstatus eq "Pending"} { 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" || $xstatus eq "Deleted" || $xstatus eq "Rejected"} { 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 "<tr>" html "<td class='c-id'><span class='tkt-state-ico $icoCls' title='[htmlize $xstatus]'>$icoSvg</span><a href='tktview/[httpize $xid]'>[htmlize $xid]</a></td>" html "<td class='c-title'><a href='tktview/[httpize $xid]'>[htmlize $xtitle]</a></td>" if {$hasAssignee} { if {$xas eq "" || $xas eq "nobody"} { html "<td class='c-muted'>unassigned</td>" } else { html "<td>@[htmlize $xas]</td>" } } html "<td>[htmlize $xstatus]</td>" html "<td class='c-muted'>[htmlize $xtypelbl]</td>" html "<td>[htmlize $xprio]</td>" html "<td class='c-muted'>[htmlize $xsub]</td>" html "<td class='c-muted'>[htmlize $xmod]</td>" html "</tr>\n" } if {$hasAssignee} { query -nocomplain { SELECT substr(t.tkt_uuid,1,10) AS xid, coalesce(t.title,'(untitled)') AS xtitle, coalesce(t.assignee,'') AS xas, coalesce(t.status,'Open') AS xstatus, replace(coalesce(t.type,''),'_',' ') AS xtypelbl, coalesce(t.priority,'') AS xprio, coalesce(t.subsystem,'') AS xsub, datetime(t.tkt_mtime, toLocal()) AS xmod FROM ticket t WHERE (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fas='' OR ($fas='__unassigned__' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$fas) AND ($fscope='' OR ($fscope='mine' AND t.assignee=user()) OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody')) OR ($fscope='involved' AND (t.assignee=user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.assignee,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) ORDER BY CASE WHEN $tcol='id' AND $tdir='asc' THEN t.tkt_uuid END ASC, CASE WHEN $tcol='id' AND $tdir='desc' THEN t.tkt_uuid END DESC, CASE WHEN $tcol='title' AND $tdir='asc' THEN lower(t.title) END ASC, CASE WHEN $tcol='title' AND $tdir='desc' THEN lower(t.title) END DESC, CASE WHEN $tcol='assignee' AND $tdir='asc' THEN lower(coalesce(t.assignee,'zzzz')) END ASC, CASE WHEN $tcol='assignee' AND $tdir='desc' THEN lower(coalesce(t.assignee,'')) END DESC, CASE WHEN $tcol='status' AND $tdir='asc' THEN t.status END ASC, CASE WHEN $tcol='status' AND $tdir='desc' THEN t.status END DESC, CASE WHEN $tcol='type' AND $tdir='asc' THEN t.type END ASC, CASE WHEN $tcol='type' AND $tdir='desc' THEN t.type END DESC, CASE WHEN $tcol='priority' AND $tdir='asc' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END END ASC, CASE WHEN $tcol='priority' AND $tdir='desc' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END END DESC, CASE WHEN $tcol='subsystem' AND $tdir='asc' THEN t.subsystem END ASC, CASE WHEN $tcol='subsystem' AND $tdir='desc' THEN t.subsystem END DESC, CASE WHEN $tcol='updated' AND $tdir='asc' THEN t.tkt_mtime END ASC, t.tkt_mtime DESC LIMIT 200 OFFSET $offset } { set shown [expr {$shown + 1}] tkt_render_table_row $xid $xtitle $xas $xstatus $xtypelbl $xprio $xsub $xmod 1 } } else { query { SELECT substr(t.tkt_uuid,1,10) AS xid, coalesce(t.title,'(untitled)') AS xtitle, coalesce(t.status,'Open') AS xstatus, replace(coalesce(t.type,''),'_',' ') AS xtypelbl, coalesce(t.priority,'') AS xprio, coalesce(t.subsystem,'') AS xsub, datetime(t.tkt_mtime, toLocal()) AS xmod FROM ticket t WHERE (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fscope='' OR ($fscope='involved' AND EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user()))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) ORDER BY CASE WHEN $tcol='id' AND $tdir='asc' THEN t.tkt_uuid END ASC, CASE WHEN $tcol='id' AND $tdir='desc' THEN t.tkt_uuid END DESC, CASE WHEN $tcol='title' AND $tdir='asc' THEN lower(t.title) END ASC, CASE WHEN $tcol='title' AND $tdir='desc' THEN lower(t.title) END DESC, CASE WHEN $tcol='status' AND $tdir='asc' THEN t.status END ASC, CASE WHEN $tcol='status' AND $tdir='desc' THEN t.status END DESC, CASE WHEN $tcol='type' AND $tdir='asc' THEN t.type END ASC, CASE WHEN $tcol='type' AND $tdir='desc' THEN t.type END DESC, CASE WHEN $tcol='priority' AND $tdir='asc' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END END ASC, CASE WHEN $tcol='priority' AND $tdir='desc' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END END DESC, CASE WHEN $tcol='subsystem' AND $tdir='asc' THEN t.subsystem END ASC, CASE WHEN $tcol='subsystem' AND $tdir='desc' THEN t.subsystem END DESC, CASE WHEN $tcol='updated' AND $tdir='asc' THEN t.tkt_mtime END ASC, t.tkt_mtime DESC LIMIT 200 OFFSET $offset } { set shown [expr {$shown + 1}] tkt_render_table_row $xid $xtitle "" $xstatus $xtypelbl $xprio $xsub $xmod 0 } } if {$shown == 0} { set csp 7; if {$hasAssignee} { set csp 8 } set u_clr_t [tkt_url $st table $sort $grp "" "" "" "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp] set u_all_t [tkt_url all table $sort $grp $qclean $ftype $fprio $fsev $fsub "" $tcol $tdir "" $fas "" 1 $defaultSort $defaultGrp] html "<tr><td colspan='$csp' class='tkt-empty'>No tickets match this filter. <a href='$u_clr_t'>Clear filters</a> or <a href='$u_all_t'>search all [htmlize $nall] tickets</a>.</td></tr>\n" } html "</tbody></table></div>\n" } else { html "<form class='tkt-board-bar' method='get' action='reportlist' data-tkt-auto-submit='1'>\n" html "<input type='hidden' name='st' value='[htmlize $st]'>\n" html "<input type='hidden' name='view' value='board'>\n" if {$sort ne $defaultSort} { html "<input type='hidden' name='sort' value='[htmlize $sort]'>\n" } if {$qclean ne ""} { html "<input type='hidden' name='q' value='[htmlize $qclean]'>\n" } if {$ftype ne ""} { html "<input type='hidden' name='tp' value='[htmlize $ftype]'>\n" } if {$fprio ne ""} { html "<input type='hidden' name='pr' value='[htmlize $fprio]'>\n" } if {$fsev ne ""} { html "<input type='hidden' name='sv' value='[htmlize $fsev]'>\n" } if {$fsub ne ""} { html "<input type='hidden' name='sb' value='[htmlize $fsub]'>\n" } if {$fstat ne ""} { html "<input type='hidden' name='fs' value='[htmlize $fstat]'>\n" } if {$fscope ne ""} { html "<input type='hidden' name='scope' value='[htmlize $fscope]'>\n" } if {$fas ne ""} { html "<input type='hidden' name='as' value='[htmlize $fas]'>\n" } if {$fage ne ""} { html "<input type='hidden' name='age' value='[htmlize $fage]'>\n" } html "<label class='tkt-facet'><span>columns</span><select name='group'>" set gopts {status priority subsystem} if {$hasAssignee} { set gopts {assignee status priority subsystem} } foreach gopt $gopts { set gsel ""; if {$grp eq $gopt} { set gsel " selected" } html "<option value='$gopt'$gsel>$gopt</option>" } html "</select></label><noscript><button type='submit' class='tkt-btn'>Apply</button></noscript>" if {[capexpr {w}]} { if {$grp eq "assignee"} { html "<span class='tkt-help'>Drag cards between columns to reassign ownership, or open Move on any card.</span>" } else { html "<span class='tkt-help'>Drag cards between columns or open Move on any card.</span>" } } html "</form>\n" html "<div class='tkt-moved-banner' id='tkt-moved-banner' hidden role='status'></div>\n" set colList {} if {$grp eq "assignee" && $hasAssignee} { if {$fas ne ""} { if {$fas eq "__unassigned__"} { lappend colList nobody } else { lappend colList $fas } } else { if {$hasLogin} { lappend colList $curUser } lappend colList nobody query -nocomplain { SELECT assignee AS av, count(*) AS ac FROM ticket WHERE length(assignee)>0 AND assignee<>'nobody' AND (($st='all') OR ($st='open' AND coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($fage='' OR julianday('now') - tkt_mtime <= CAST($fage AS REAL)) GROUP BY assignee ORDER BY ac DESC, assignee ASC LIMIT 8 } { if {$av ne $curUser && [llength $colList] < 8} { lappend colList $av } } } } elseif {$grp eq "status"} { set rawCols {Open Review Fixed Closed} if {[info exists status_choices]} { if {[llength $status_choices] > 0 && [llength $status_choices] <= 5} { set rawCols $status_choices } } foreach sc $rawCols { set isCls 0 if {$sc eq "Fixed" || $sc eq "Tested" || $sc eq "Closed" || $sc eq "Deferred" || $sc eq "Deleted" || $sc eq "Rejected"} { set isCls 1 } if {$st eq "open" && !$isCls} { lappend colList $sc } elseif {$st eq "closed" && $isCls && ($sc ne "Deleted" || $fstat eq "Deleted")} { lappend colList $sc } elseif {$st eq "all" && ($sc ne "Deleted" || $fstat eq "Deleted")} { lappend colList $sc } } if {[llength $colList] == 0} { set colList $rawCols } } elseif {$grp eq "priority"} { query { SELECT DISTINCT priority AS pv FROM ticket WHERE length(priority)>0 ORDER BY CASE WHEN priority IN ('Immediate','9 Immediate') OR priority GLOB '9*' THEN 1 WHEN priority GLOB '8*' THEN 2 WHEN priority IN ('High','7 High') OR priority GLOB '7*' THEN 3 WHEN priority GLOB '6*' THEN 4 WHEN priority IN ('Medium','5 Medium') OR priority GLOB '5*' THEN 5 WHEN priority GLOB '4*' THEN 6 WHEN priority IN ('Low','3 Low') OR priority GLOB '3*' THEN 7 WHEN priority GLOB '2*' THEN 8 WHEN priority IN ('Zero','1 Zero') OR priority GLOB '1*' THEN 9 ELSE 10 END, priority LIMIT 9 } { lappend colList $pv } if {[llength $colList] == 0} { set colList {Immediate High Medium Low Zero} } } elseif {$grp eq "subsystem"} { if {$fsub ne ""} { lappend colList $fsub } else { query { SELECT subsystem AS sv, count(*) AS sc FROM ticket WHERE length(subsystem)>0 AND subsystem<>'None' AND (($st='all') OR ($st='open' AND coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($fage='' OR julianday('now') - tkt_mtime <= CAST($fage AS REAL)) GROUP BY subsystem ORDER BY sc DESC, subsystem ASC LIMIT 8 } { lappend colList $sv } if {[llength $colList] == 0} { set colList {{(none)}} } } } set canWrite [capexpr {w}] html "<div class='tkt-board' data-tkt-board='1' data-tkt-group='[htmlize $grp]' data-tkt-writable='$canWrite'>\n" foreach colVal $colList { set colLbl $colVal if {$grp eq "assignee"} { if {$colVal eq "nobody"} { set colLbl "Unassigned" } elseif {$hasLogin && $colVal eq $curUser} { set colLbl "@$colVal (me)" } else { set colLbl "@$colVal" } } set colCnt 0 if {$hasAssignee} { query -nocomplain { SELECT count(*) AS nc FROM ticket t WHERE (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fas='' OR ($fas='__unassigned__' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$fas) AND ($fscope='' OR ($fscope='mine' AND t.assignee=user()) OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody')) OR ($fscope='involved' AND (t.assignee=user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.assignee,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) AND (($grp='status' AND coalesce(t.status,'Open')=$colVal) OR ($grp='priority' AND coalesce(t.priority,'')=$colVal) OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal) OR ($grp='assignee' AND (($colVal='nobody' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$colVal))) } { set colCnt $nc } } else { query { SELECT count(*) AS nc FROM ticket t WHERE (($st='all') OR ($st='open' AND coalesce(t.status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fscope='' OR ($fscope='involved' AND EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user()))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) AND (($grp='status' AND coalesce(t.status,'Open')=$colVal) OR ($grp='priority' AND coalesce(t.priority,'')=$colVal) OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal)) } { set colCnt $nc } } html "<section class='tkt-col' data-drop-col='[htmlize $colVal]' data-col-total='[htmlize $colCnt]'>\n" html "<div class='tkt-col-hdr'><span class='tkt-col-hdr-l'>[htmlize $colLbl] <span class='tkt-col-cnt'>[htmlize $colCnt]</span></span></div>\n" set colRendered 0 proc tkt_render_board_card {xid xtitle xstatus xtypelbl xprio xsub xmod xmsgs xcis xas grp colVal colList canWrite hasAssignee} { set dragAttr "" if {$canWrite} { set dragAttr " draggable='true'" } html "<article class='tkt-bcard' data-card-id='[htmlize $xid]'$dragAttr>" html "<a class='tkt-bcard-title' href='tktview/[httpize $xid]'>[htmlize $xtitle]</a>" if {($grp ne "priority" && $xprio ne "") || ($grp ne "subsystem" && $xsub ne "" && $xsub ne "None") || ($grp ne "status" && ($xstatus eq "Pending" || $xstatus eq "Review"))} { html "<div class='tkt-bcard-tags'>" if {$grp ne "priority" && $xprio ne ""} { set pcls "tkt-tag" if {$xprio eq "Immediate" || $xprio eq "High" || [string match 9* $xprio] || [string match 8* $xprio] || [string match 7* $xprio]} { set pcls "tkt-tag tkt-tag-crit" } html "<span class='$pcls'>[htmlize $xprio]</span>" } if {$grp ne "subsystem" && $xsub ne "" && $xsub ne "None"} { html "<span class='tkt-tag'>[htmlize $xsub]</span>" } if {$grp ne "status" && ($xstatus eq "Pending" || $xstatus eq "Review")} { html "<span class='tkt-tag tkt-tag-warn'>[htmlize $xstatus]</span>" } html "</div>" } html "<div class='tkt-bcard-foot'><span class='tkt-bcard-meta'>[htmlize $xid]" if {$xtypelbl ne ""} { html " · [htmlize $xtypelbl]" } html " · [htmlize $xmod]" if {$xmsgs > 0} { html " · [htmlize $xmsgs]m" } if {$xcis > 0} { html " · [htmlize $xcis]ci" } html "</span><span class='tkt-bcard-act'>" if {$hasAssignee && $grp ne "assignee"} { if {$xas eq "" || $xas eq "nobody"} { html "<span class='tkt-owner is-unassigned'>unassigned</span>" } else { html "<span class='tkt-owner'>@[htmlize $xas]</span>" } } if {$canWrite} { html "<details class='tkt-mv-wrap'><summary class='tkt-mv-btn'>Move</summary><div class='tkt-mv-menu'>" foreach dst $colList { if {$dst ne $colVal && $dst ne "(none)"} { set dstLbl $dst if {$grp eq "assignee"} { if {$dst eq "nobody"} { set dstLbl "Unassigned" } else { set dstLbl "@$dst" } } html "<form method='post' action='tktedit/[httpize $xid]' data-tkt-move-form='1' data-tkt-card='[htmlize $xid]' data-tkt-from='[htmlize $colVal]' data-tkt-to='[htmlize $dst]'>" insertCsrf html "<input type='hidden' name='submit' value='1'>" html "<input type='hidden' name='[htmlize $grp]' value='[htmlize $dst]'>" html "<button type='submit'>[htmlize $dstLbl]</button></form>" } } html "</div></details>" } html "</span></div></article>\n" } if {$hasAssignee} { query -nocomplain { SELECT substr(t.tkt_uuid,1,10) AS xid, coalesce(t.title,'(untitled)') AS xtitle, coalesce(t.status,'Open') AS xstatus, replace(coalesce(t.type,''),'_',' ') AS xtypelbl, coalesce(t.priority,'') AS xprio, coalesce(t.subsystem,'') AS xsub, coalesce(t.assignee,'') AS xas, substr(datetime(t.tkt_mtime, toLocal()),1,10) 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') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fas='' OR ($fas='__unassigned__' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$fas) AND ($fscope='' OR ($fscope='mine' AND t.assignee=user()) OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody')) OR ($fscope='involved' AND (t.assignee=user() OR EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user())))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.assignee,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) AND (($grp='status' AND coalesce(t.status,'Open')=$colVal) OR ($grp='priority' AND coalesce(t.priority,'')=$colVal) OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal) OR ($grp='assignee' AND (($colVal='nobody' AND coalesce(t.assignee,'') IN ('','nobody')) OR t.assignee=$colVal))) ORDER BY CASE WHEN $sort='priority' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END ELSE 0 END ASC, t.tkt_mtime DESC LIMIT 60 } { set colRendered [expr {$colRendered + 1}] set shown [expr {$shown + 1}] tkt_render_board_card $xid $xtitle $xstatus $xtypelbl $xprio $xsub $xmod $xmsgs $xcis $xas $grp $colVal $colList $canWrite 1 } } else { query { SELECT substr(t.tkt_uuid,1,10) AS xid, coalesce(t.title,'(untitled)') AS xtitle, coalesce(t.status,'Open') AS xstatus, replace(coalesce(t.type,''),'_',' ') AS xtypelbl, coalesce(t.priority,'') AS xprio, coalesce(t.subsystem,'') AS xsub, substr(datetime(t.tkt_mtime, toLocal()),1,10) 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') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected')) OR ($st='closed' AND coalesce(t.status,'Open') IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected'))) AND ($ftype='' OR t.type=$ftype) AND ($fprio='' OR t.priority=$fprio) AND ($fsev='' OR t.severity=$fsev) AND ($fsub='' OR t.subsystem=$fsub) AND ($fstat='' OR t.status=$fstat) AND ($fscope='' OR ($fscope='involved' AND EXISTS (SELECT 1 FROM ticketchng c WHERE c.tkt_id=t.tkt_id AND c.login=user()))) AND ($fage='' OR julianday('now') - t.tkt_mtime <= CAST($fage AS REAL)) AND ($qclean='' OR t.title LIKE $qpat OR coalesce(t.subsystem,'') LIKE $qpat OR coalesce(t.type,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat) AND (($grp='status' AND coalesce(t.status,'Open')=$colVal) OR ($grp='priority' AND coalesce(t.priority,'')=$colVal) OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal)) ORDER BY CASE WHEN $sort='priority' THEN CASE WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN 1 WHEN t.priority GLOB '8*' THEN 2 WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN 3 WHEN t.priority GLOB '6*' THEN 4 WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN 5 WHEN t.priority GLOB '4*' THEN 6 WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN 7 WHEN t.priority GLOB '2*' THEN 8 WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN 9 ELSE 10 END ELSE 0 END ASC, t.tkt_mtime DESC LIMIT 60 } { set colRendered [expr {$colRendered + 1}] set shown [expr {$shown + 1}] tkt_render_board_card $xid $xtitle $xstatus $xtypelbl $xprio $xsub $xmod $xmsgs $xcis "" $grp $colVal $colList $canWrite 0 } } if {$colRendered == 0} { html "<div class='tkt-empty tkt-col-empty'>No tickets</div>\n" } elseif {$colCnt > $colRendered} { html "<div class='tkt-col-foot'>Showing [htmlize $colRendered] of [htmlize $colCnt] — narrow with Active 30d or subsystem</div>\n" } html "</section>\n" } html "</div>\n" if {$canWrite} { html "<form id='tkt-board-csrf' hidden>" insertCsrf html "</form>\n" } } html "<div class='tkt-count-bar'><span>" if {$view ne "board" && $nmatch > 0} { set rStart [expr {$offset + 1}] set rEnd [expr {$offset + $shown}] if {$nmatch > $shown || $pg > 1} { html "Showing [htmlize $rStart]–[htmlize $rEnd] of [htmlize $nmatch] matching tickets" } else { html "Showing [htmlize $shown] ticket" if {$shown != 1} { html "s" } } } else { html "Showing [htmlize $shown] ticket" if {$shown != 1} { html "s" } } html "</span><span class='tkt-pager'>" if {$view ne "board" && $pg > 1} { set prevPg [expr {$pg - 1}] set u_prev [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage $prevPg $defaultSort $defaultGrp] html "<a class='tkt-btn' href='$u_prev'>← Previous 200</a>" } if {$view ne "board" && ($offset + $shown) < $nmatch} { set nextPg [expr {$pg + 1}] set u_next [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage $nextPg $defaultSort $defaultGrp] html "<a class='tkt-btn' href='$u_next'>Next 200 →</a>" } if {$qclean ne "" || $st ne "open" || $ftype ne "" || $fprio ne "" || $fsev ne "" || $fsub ne "" || $fstat ne "" || $fscope ne "" || $fas ne "" || $fage ne ""} { html "<a href='reportlist'>Reset filters</a>" } html "</span></div>\n" } </th1> </div>