<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 doneParam [getParameter done ""]
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" && $view ne "summary"} { set view "list" }
if {$tdir ne "asc" && $tdir ne "desc"} { set tdir "desc" }
if {$fscope ne "" && $fscope ne "mine" && $fscope ne "submitted" && $fscope ne "mine_or_sub" && $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 "" }
if {$fscope eq "mine_or_sub"} {
if {$hasSubmitter} { set fscope "submitted" } else { set fscope "" }
}
set fas ""
}
if {!$hasSubmitter} {
if {$fscope eq "submitted"} { set fscope "" }
if {$fscope eq "mine_or_sub"} {
if {$hasAssignee} { set fscope "mine" } else { set fscope "" }
}
}
if {!$hasLogin} {
if {$fscope eq "mine" || $fscope eq "submitted" || $fscope eq "mine_or_sub" || $fscope eq "involved"} {
set fscope ""
}
}
proc tkt_prio_tier {p} {
if {$p eq ""} { return "" }
if {$p eq "Immediate" || [string match 9* $p]} { return "9" }
if {[string match 8* $p]} { return "8" }
if {$p eq "High" || [string match 7* $p]} { return "7" }
if {[string match 6* $p]} { return "6" }
if {$p eq "Medium" || [string match 5* $p]} { return "5" }
if {[string match 4* $p]} { return "4" }
if {$p eq "Low" || [string match 3* $p]} { return "3" }
if {[string match 2* $p]} { return "2" }
if {$p eq "Zero" || [string match 1* $p]} { return "1" }
return $p
}
set fprioTier [tkt_prio_tier $fprio]
set unAliasList {}
if {[info exists tkt_unassigned_aliases]} {
foreach ua $tkt_unassigned_aliases {
set ua [string trim $ua]
if {$ua ne "" && $ua ne "nobody"} {
lappend unAliasList $ua
}
}
}
set unAlias1 "nobody"; set unAlias2 "nobody"; set unAlias3 "nobody"; set unAlias4 "nobody"
set unAlias5 "nobody"; set unAlias6 "nobody"; set unAlias7 "nobody"; set unAlias8 "nobody"
set uai 1
foreach ua $unAliasList {
if {$uai == 1} { set unAlias1 $ua }
if {$uai == 2} { set unAlias2 $ua }
if {$uai == 3} { set unAlias3 $ua }
if {$uai == 4} { set unAlias4 $ua }
if {$uai == 5} { set unAlias5 $ua }
if {$uai == 6} { set unAlias6 $ua }
if {$uai == 7} { set unAlias7 $ua }
if {$uai == 8} { set unAlias8 $ua }
set uai [expr {$uai + 1}]
}
proc tkt_is_unassigned_alias {name aliasList} {
if {$name eq "" || $name eq "nobody"} { return 0 }
foreach a $aliasList {
if {$a eq $name} { return 1 }
}
return 0
}
set savedViews {}
if {[info exists tkt_saved_views]} {
if {[llength $tkt_saved_views] >= 2} {
set savedViews $tkt_saved_views
}
}
set nopen 0
set nclosed 0
set ndel 0
set nall 0
set nact30 0
set npend 0
set nunassigned 0
set nmine 0
set nsubmitted 0
set nmineOrSub 0
set ninvolved 0
if {[capexpr {r}]} {
query {
SELECT sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 1 ELSE 0 END) AS xo,
sum(CASE WHEN coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Rejected') THEN 1 ELSE 0 END) AS xc,
sum(CASE WHEN status='Deleted' THEN 1 ELSE 0 END) AS xd,
sum(CASE WHEN (($st='all' AND coalesce(status,'Open')<>'Deleted')
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','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 {$xd ne ""} { set ndel $xd }
if {$xact ne ""} { set nact30 $xact }
if {$xpend ne ""} { set npend $xpend }
}
set nall [expr {$nopen + $nclosed}]
if {$hasAssignee && $hasSubmitter} {
query -nocomplain {
SELECT sum(CASE WHEN coalesce(assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8) THEN 1 ELSE 0 END) AS xun,
sum(CASE WHEN assignee = user() THEN 1 ELSE 0 END) AS xmine,
sum(CASE WHEN submitter = user() THEN 1 ELSE 0 END) AS xsub,
sum(CASE WHEN assignee = user() OR submitter = user() THEN 1 ELSE 0 END) AS xms
FROM ticket
WHERE (($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
} {
if {$xun ne ""} { set nunassigned $xun }
if {$xmine ne ""} { set nmine $xmine }
if {$xsub ne ""} { set nsubmitted $xsub }
if {$xms ne ""} { set nmineOrSub $xms }
}
} elseif {$hasAssignee} {
query -nocomplain {
SELECT sum(CASE WHEN coalesce(assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8) THEN 1 ELSE 0 END) AS xun,
sum(CASE WHEN assignee = user() THEN 1 ELSE 0 END) AS xmine
FROM ticket
WHERE (($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
} {
if {$xun ne ""} { set nunassigned $xun }
if {$xmine ne ""} { set nmine $xmine }
}
} elseif {$hasSubmitter} {
query -nocomplain {
SELECT sum(CASE WHEN submitter = user() THEN 1 ELSE 0 END) AS xsub
FROM ticket
WHERE (($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
} {
if {$xsub ne ""} { set nsubmitted $xsub }
}
}
if {$hasLogin} {
if {$hasAssignee && $hasSubmitter} {
query -nocomplain {
SELECT count(*) AS xinv FROM ticket t
WHERE (($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','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 (($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','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 }
}
} elseif {$hasSubmitter} {
query -nocomplain {
SELECT count(*) AS xinv FROM ticket t
WHERE (($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND (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 }
}
} else {
query {
SELECT count(*) AS xinv FROM ticket t
WHERE (($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','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" && $sort ne "oldest"} { 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
}
set defaultDone "14"
if {$st ne "open" || $qclean ne "" || $fsub ne ""} { set defaultDone "all" }
set fdone $doneParam
if {$fdone ne "14" && $fdone ne "30" && $fdone ne "all" && $fdone ne "0"} {
set fdone $defaultDone
}
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
}
proc tkt_state_svg {kind extraCls} {
set ca ""
if {$extraCls ne ""} { set ca " class='$extraCls'" }
if {$kind eq "review"} {
return "<svg$ca viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.65' aria-hidden='true'><rect x='2.5' y='2.5' width='11' height='11' rx='2.5'/><path d='M5.5 8h5'/></svg>"
}
if {$kind eq "closed"} {
return "<svg$ca viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.65' aria-hidden='true'><rect x='2.5' y='2.5' width='11' height='11' rx='2.5'/><path d='M5.2 8.2l1.9 1.9 3.8-4'/></svg>"
}
return "<svg$ca viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.65' aria-hidden='true'><rect x='2.5' y='2.5' width='11' height='11' rx='2.5'/></svg>"
}
proc tkt_chev_svg {} {
return "<svg viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.8' aria-hidden='true'><path d='M4.5 6.2L8 9.8l3.5-3.6'/></svg>"
}
proc tkt_note_svg {} {
return "<svg viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.5' aria-hidden='true'><path d='M2.5 3.5h11v7.5H6.8L3.5 13.5V11h-1z'/></svg>"
}
proc tkt_ci_svg {} {
return "<svg viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.5' aria-hidden='true'><circle cx='8' cy='8' r='2.6'/><path d='M1.5 8h3.9M10.6 8h3.9'/></svg>"
}
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 $fscope $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'>[tkt_state_svg open tkt-state-open]Open <span class='tkt-cnt'>[htmlize $nopen]</span></a>\n"
html "<a class='$c_c' href='$u_cls'>[tkt_state_svg closed tkt-state-closed]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 u_vs [tkt_url $st summary $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set vl ""; set vt ""; set vb ""; set vs ""
if {$view eq "list"} { set vl " is-active" }
if {$view eq "table"} { set vt " is-active" }
if {$view eq "board"} { set vb " is-active" }
if {$view eq "summary"} { set vs " 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"
html "<a class='$vs' href='$u_vs'>summary</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 u_so [tkt_url $st $view oldest $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set sp ""; set sr ""; set so ""
if {$sort eq "priority"} { set sp " is-active" }
if {$sort eq "recent"} { set sr " is-active" }
if {$sort eq "oldest"} { set so " is-active" }
html "<a class='$sp' href='$u_sp'>priority</a>\n"
html "<a class='$sr' href='$u_sr'>recent</a>\n"
html "<a class='$so' href='$u_so'>oldest</a>\n"
</th1>
</nav>
<details class="tkt-rpt-pop" data-tkt-popover="1">
<summary class="tkt-btn">Reports</summary>
<div class="tkt-rpt-menu">
<th1>
if {[llength $savedViews] >= 2} {
html "<div class='tkt-rpt-hdr'>Pinned views</div>\n"
html "<div class='tkt-rpt-list'>\n"
foreach {svLbl svQ} $savedViews {
set svClean [string trim $svQ]
if {[string range $svClean 0 0] eq "?"} { set svClean [string range $svClean 1 end] }
if {$svLbl ne "" && $svClean ne ""} {
html "<a class='tkt-fpop-item' href='reportlist?[htmlize $svClean]'><span>[htmlize $svLbl]</span><span class='tkt-fpop-cnt'>view</span></a>\n"
}
}
html "</div>\n"
}
</th1>
<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 || $ndel > 0)} {
set qView $view
if {$qView eq "summary"} { set qView "list" }
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 $st $qView $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 && $hasSubmitter} {
set nextSc "submitted"; set qcls "tkt-qpill"
if {$fscope eq "submitted"} { set nextSc ""; set qcls "tkt-qpill is-on" }
set u_qs [tkt_url $st $qView $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $nextSc "" $fage 1 $defaultSort $defaultGrp]
html "<a class='$qcls' href='$u_qs'>Submitted <span class='tkt-cnt'>[htmlize $nsubmitted]</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 $st $qView $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 $st $qView $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 $st $qView $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 $qView $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"
}
if {[llength $savedViews] >= 2} {
set svShown 0
foreach {svLbl svQ} $savedViews {
if {$svShown >= 3} { break }
set svClean [string trim $svQ]
if {[string range $svClean 0 0] eq "?"} { set svClean [string range $svClean 1 end] }
if {$svLbl ne "" && $svClean ne ""} {
html "<a class='tkt-qpill is-saved' href='reportlist?[htmlize $svClean]'>[htmlize $svLbl]</a>\n"
set svShown [expr {$svShown + 1}]
}
}
}
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" && $view ne "summary"} { 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}]} {
set stTotal $nall
if {$st eq "open"} { set stTotal $nopen }
if {$st eq "closed"} { set stTotal $nclosed }
if {$view ne "summary"} {
html "<div class='tkt-facets' role='group' aria-label='Filter facets'>\n"
if {$hasLogin || $hasAssignee} {
set cls_sc "tkt-fpop"; set lbl_sc "any"
if {$fscope eq "mine"} { set cls_sc "tkt-fpop is-on"; set lbl_sc "assigned to me" }
if {$fscope eq "submitted"} { set cls_sc "tkt-fpop is-on"; set lbl_sc "submitted by me" }
if {$fscope eq "mine_or_sub"} { set cls_sc "tkt-fpop is-on"; set lbl_sc "assigned or submitted" }
if {$fscope eq "involved"} { set cls_sc "tkt-fpop is-on"; set lbl_sc "involved" }
if {$fscope eq "unassigned"} { set cls_sc "tkt-fpop is-on"; set lbl_sc "unassigned" }
set u_any_sc [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "" $fas $fage 1 $defaultSort $defaultGrp]
set cur_any_sc ""; if {$fscope eq ""} { set cur_any_sc " is-cur" }
html "<details class='$cls_sc' data-tkt-popover='1'><summary><span>role</span><strong>[htmlize $lbl_sc]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
html "<a class='tkt-fpop-item$cur_any_sc' href='$u_any_sc'><span>any</span><span class='tkt-fpop-cnt'>[htmlize $stTotal]</span></a>\n"
if {$hasLogin && $hasAssignee} {
set cur ""; if {$fscope eq "mine"} { set cur " is-cur" }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "mine" "" $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>assigned to me</span><span class='tkt-fpop-cnt'>[htmlize $nmine]</span></a>\n"
}
if {$hasLogin && $hasSubmitter} {
set cur ""; if {$fscope eq "submitted"} { set cur " is-cur" }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "submitted" "" $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>submitted by me</span><span class='tkt-fpop-cnt'>[htmlize $nsubmitted]</span></a>\n"
}
if {$hasLogin && $hasAssignee && $hasSubmitter} {
set cur ""; if {$fscope eq "mine_or_sub"} { set cur " is-cur" }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "mine_or_sub" "" $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>assigned or submitted</span><span class='tkt-fpop-cnt'>[htmlize $nmineOrSub]</span></a>\n"
}
if {$hasLogin} {
set cur ""; if {$fscope eq "involved"} { set cur " is-cur" }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "involved" "" $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>involved</span><span class='tkt-fpop-cnt'>[htmlize $ninvolved]</span></a>\n"
}
if {$hasAssignee} {
set cur ""; if {$fscope eq "unassigned"} { set cur " is-cur" }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "unassigned" "" $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>unassigned</span><span class='tkt-fpop-cnt'>[htmlize $nunassigned]</span></a>\n"
}
html "</div></details>\n"
}
if {$hasAssignee} {
set cls_as "tkt-fpop"; set lbl_as "any"
if {$fas eq "__unassigned__"} {
set cls_as "tkt-fpop is-on"; set lbl_as "(unassigned)"
} elseif {$fas ne ""} {
set cls_as "tkt-fpop is-on"; set lbl_as "@$fas"
}
set u_any_as [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope "" $fage 1 $defaultSort $defaultGrp]
set cur_any_as ""; if {$fas eq ""} { set cur_any_as " is-cur" }
set u_un_as [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "" "__unassigned__" $fage 1 $defaultSort $defaultGrp]
set cur_un_as ""; if {$fas eq "__unassigned__"} { set cur_un_as " is-cur" }
html "<details class='$cls_as' data-tkt-popover='1'><summary><span>assignee</span><strong>[htmlize $lbl_as]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
html "<a class='tkt-fpop-item$cur_any_as' href='$u_any_as'><span>any</span><span class='tkt-fpop-cnt'>[htmlize $stTotal]</span></a>\n"
html "<a class='tkt-fpop-item$cur_un_as' href='$u_un_as'><span>(unassigned)</span><span class='tkt-fpop-cnt'>[htmlize $nunassigned]</span></a>\n"
set seen_as 0
query -nocomplain {
SELECT assignee AS v, count(*) AS cnt
FROM ticket
WHERE length(assignee)>0 AND assignee<>'nobody'
AND (($fstat='Deleted' AND status='Deleted')
OR ($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
GROUP BY assignee
ORDER BY cnt DESC, assignee ASC
} {
set cur ""; if {$v eq $fas} { set cur " is-cur"; set seen_as 1 }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "" $v $fage 1 $defaultSort $defaultGrp]
set aDisp "@[htmlize $v]"
if {[tkt_is_unassigned_alias $v $unAliasList]} { set aDisp "@[htmlize $v] (alias)" }
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>$aDisp</span><span class='tkt-fpop-cnt'>[htmlize $cnt]</span></a>\n"
}
if {$fas ne "" && $fas ne "__unassigned__" && !$seen_as} {
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir "" $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item is-cur' href='$u_v'><span>@[htmlize $fas]</span><span class='tkt-fpop-cnt'>0</span></a>\n"
}
html "</div></details>\n"
}
set cls_tp "tkt-fpop"; set lbl_tp "any"
if {$ftype ne ""} {
set cls_tp "tkt-fpop is-on"
set lbl_tp $ftype
query {SELECT replace($ftype,'_',' ') AS lt} { set lbl_tp $lt }
}
set u_any_tp [tkt_url $st $view $sort $grp $qclean "" $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set cur_any_tp ""; if {$ftype eq ""} { set cur_any_tp " is-cur" }
html "<details class='$cls_tp' data-tkt-popover='1'><summary><span>type</span><strong>[htmlize $lbl_tp]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
html "<a class='tkt-fpop-item$cur_any_tp' href='$u_any_tp'><span>any</span><span class='tkt-fpop-cnt'>[htmlize $stTotal]</span></a>\n"
set seen_tp 0
query {
SELECT type AS v, replace(type,'_',' ') AS lbl, count(*) AS cnt
FROM ticket
WHERE length(type)>0
AND (($fstat='Deleted' AND status='Deleted')
OR ($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
GROUP BY type ORDER BY type
} {
set cur ""; if {$v eq $ftype} { set cur " is-cur"; set seen_tp 1 }
set u_v [tkt_url $st $view $sort $grp $qclean $v $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>[htmlize $lbl]</span><span class='tkt-fpop-cnt'>[htmlize $cnt]</span></a>\n"
}
if {$ftype ne "" && !$seen_tp} {
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item is-cur' href='$u_v'><span>[htmlize $lbl_tp]</span><span class='tkt-fpop-cnt'>0</span></a>\n"
}
html "</div></details>\n"
set cls_pr "tkt-fpop"; set lbl_pr "any"
if {$fprio ne ""} { set cls_pr "tkt-fpop is-on"; set lbl_pr $fprio }
set u_any_pr [tkt_url $st $view $sort $grp $qclean $ftype "" $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set cur_any_pr ""; if {$fprio eq ""} { set cur_any_pr " is-cur" }
set prMenuHtml "<a class='tkt-fpop-item$cur_any_pr' href='$u_any_pr'><span>any</span><span class='tkt-fpop-cnt'>[htmlize $stTotal]</span></a>\n"
set seen_pr 0
query {
SELECT (CASE
WHEN priority IN ('Immediate','9 Immediate') OR priority GLOB '9*' THEN '9'
WHEN priority GLOB '8*' THEN '8'
WHEN priority IN ('High','7 High') OR priority GLOB '7*' THEN '7'
WHEN priority GLOB '6*' THEN '6'
WHEN priority IN ('Medium','5 Medium') OR priority GLOB '5*' THEN '5'
WHEN priority GLOB '4*' THEN '4'
WHEN priority IN ('Low','3 Low') OR priority GLOB '3*' THEN '3'
WHEN priority GLOB '2*' THEN '2'
WHEN priority IN ('Zero','1 Zero') OR priority GLOB '1*' THEN '1'
ELSE priority END) AS tier,
substr(max(CASE WHEN priority GLOB '[1-9] *' THEN '1'||priority ELSE '0'||priority END), 2) AS v,
count(*) AS cnt
FROM ticket
WHERE length(priority)>0
AND (($fstat='Deleted' AND status='Deleted')
OR ($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
GROUP BY tier
ORDER BY CASE tier
WHEN '9' THEN 1 WHEN '8' THEN 2 WHEN '7' THEN 3 WHEN '6' THEN 4 WHEN '5' THEN 5
WHEN '4' THEN 6 WHEN '3' THEN 7 WHEN '2' THEN 8 WHEN '1' THEN 9 ELSE 10 END, v
} {
set cur ""
if {$fprioTier ne "" && $tier eq $fprioTier} {
set cur " is-cur"
set seen_pr 1
set lbl_pr $v
}
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $v $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set prMenuHtml "$prMenuHtml<a class='tkt-fpop-item$cur' href='$u_v'><span>[htmlize $v]</span><span class='tkt-fpop-cnt'>[htmlize $cnt]</span></a>\n"
}
if {$fprio ne "" && !$seen_pr} {
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set prMenuHtml "$prMenuHtml<a class='tkt-fpop-item is-cur' href='$u_v'><span>[htmlize $fprio]</span><span class='tkt-fpop-cnt'>0</span></a>\n"
}
html "<details class='$cls_pr' data-tkt-popover='1'><summary><span>priority</span><strong>[htmlize $lbl_pr]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n$prMenuHtml</div></details>\n"
set cls_sb "tkt-fpop"; set lbl_sb "any"
if {$fsub ne ""} { set cls_sb "tkt-fpop is-on"; set lbl_sb $fsub }
set u_any_sb [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev "" $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set cur_any_sb ""; if {$fsub eq ""} { set cur_any_sb " is-cur" }
html "<details class='$cls_sb' data-tkt-popover='1'><summary><span>subsystem</span><strong>[htmlize $lbl_sb]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
html "<a class='tkt-fpop-item$cur_any_sb' href='$u_any_sb'><span>any</span><span class='tkt-fpop-cnt'>[htmlize $stTotal]</span></a>\n"
set seen_sb 0
query {
SELECT subsystem AS v, count(*) AS cnt FROM ticket
WHERE length(subsystem)>0
AND (($fstat='Deleted' AND status='Deleted')
OR ($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
GROUP BY subsystem ORDER BY subsystem
} {
set cur ""; if {$v eq $fsub} { set cur " is-cur"; set seen_sb 1 }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $v $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>[htmlize $v]</span><span class='tkt-fpop-cnt'>[htmlize $cnt]</span></a>\n"
}
if {$fsub ne "" && !$seen_sb} {
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item is-cur' href='$u_v'><span>[htmlize $fsub]</span><span class='tkt-fpop-cnt'>0</span></a>\n"
}
html "</div></details>\n"
set cls_fs "tkt-fpop"; set lbl_fs "any"
if {$fstat ne ""} { set cls_fs "tkt-fpop is-on"; set lbl_fs $fstat }
set u_any_fs [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub "" $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set cur_any_fs ""; if {$fstat eq ""} { set cur_any_fs " is-cur" }
html "<details class='$cls_fs' data-tkt-popover='1'><summary><span>status</span><strong>[htmlize $lbl_fs]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
html "<a class='tkt-fpop-item$cur_any_fs' href='$u_any_fs'><span>any</span><span class='tkt-fpop-cnt'>[htmlize $stTotal]</span></a>\n"
set seen_fs 0
query {
SELECT status AS v, count(*) AS cnt FROM ticket
WHERE length(status)>0
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')))
GROUP BY status ORDER BY CASE WHEN status='Deleted' THEN 2 ELSE 1 END, status
} {
set cur ""; if {$v eq $fstat} { set cur " is-cur"; set seen_fs 1 }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $v $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set sDisp [htmlize $v]
if {$v eq "Deleted"} { set sDisp "Deleted (hidden)" }
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>$sDisp</span><span class='tkt-fpop-cnt'>[htmlize $cnt]</span></a>\n"
}
if {$fstat ne "" && !$seen_fs} {
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item is-cur' href='$u_v'><span>[htmlize $fstat]</span><span class='tkt-fpop-cnt'>0</span></a>\n"
}
html "</div></details>\n"
set cls_sv "tkt-fpop"; set lbl_sv "any"
if {$fsev ne ""} { set cls_sv "tkt-fpop is-on"; set lbl_sv $fsev }
set u_any_sv [tkt_url $st $view $sort $grp $qclean $ftype $fprio "" $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
set cur_any_sv ""; if {$fsev eq ""} { set cur_any_sv " is-cur" }
html "<details class='$cls_sv' data-tkt-popover='1'><summary><span>severity</span><strong>[htmlize $lbl_sv]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
html "<a class='tkt-fpop-item$cur_any_sv' href='$u_any_sv'><span>any</span><span class='tkt-fpop-cnt'>[htmlize $stTotal]</span></a>\n"
set seen_sv 0
query {
SELECT severity AS v, count(*) AS cnt FROM ticket
WHERE length(severity)>0
AND (($fstat='Deleted' AND status='Deleted')
OR ($st='all' AND coalesce(status,'Open')<>'Deleted')
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','Rejected')))
GROUP BY severity
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 cur ""; if {$v eq $fsev} { set cur " is-cur"; set seen_sv 1 }
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $v $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$cur' href='$u_v'><span>[htmlize $v]</span><span class='tkt-fpop-cnt'>[htmlize $cnt]</span></a>\n"
}
if {$fsev ne "" && !$seen_sv} {
set u_v [tkt_url $st $view $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item is-cur' href='$u_v'><span>[htmlize $fsev]</span><span class='tkt-fpop-cnt'>0</span></a>\n"
}
html "</div></details>\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 "</div>\n"
}
set dom_prio ""
set dom_stat ""
set nmatch 0
if {$view eq "list" || $view eq "table"} {
if {$hasAssignee && $hasSubmitter} {
query -nocomplain {
SELECT count(*) AS nm FROM ticket t
WHERE (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='mine_or_sub' AND (t.assignee=user() OR t.submitter=user()))
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
OR ($fscope='involved' 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()))))
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.submitter,'') LIKE $qpat OR coalesce(t.foundin,'') LIKE $qpat OR t.tkt_uuid LIKE $qpat)
} {
set nmatch $nm
}
} elseif {$hasAssignee} {
query -nocomplain {
SELECT count(*) AS nm FROM ticket t
WHERE (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
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
}
} elseif {$hasSubmitter} {
query -nocomplain {
SELECT count(*) AS nm FROM ticket t
WHERE (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
AND ($fsev='' OR t.severity=$fsev)
AND ($fsub='' OR t.subsystem=$fsub)
AND ($fstat='' OR t.status=$fstat)
AND ($fscope=''
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='involved' AND (t.submitter=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.submitter,'') 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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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_utc xcre_utc xmod_day xmsgs xcis xas xsubm xpcue hasAssignee hasSubmitter dom_prio dom_stat unAliasList} {
set icoCls "tkt-state-open"
set icoSvg [tkt_state_svg open ""]
if {$xstatus eq "Review" || $xstatus eq "Pending"} {
set icoCls "tkt-state-review"
set icoSvg [tkt_state_svg review ""]
} 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 [tkt_state_svg closed ""]
}
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>" }
if {$hasSubmitter && $xsubm ne "" && $xsubm ne "nobody"} {
html "<span>by [htmlize $xsubm]</span>"
}
html "<button type='button' class='tkt-time-btn' data-tkt-time='1' data-tkt-mod='[htmlize $xmod_utc]' data-tkt-cre='[htmlize $xcre_utc]' data-tkt-kind='list' title='Updated [htmlize $xmod_utc] UTC'>Updated [htmlize $xmod_day]</button>"
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>"
} elseif {[tkt_is_unassigned_alias $xas $unAliasList]} {
html "<span class='tkt-owner is-orphan' title='Unassigned alias — needs reassignment'>@[htmlize $xas] · reassign</span>"
} else {
html "<span class='tkt-owner'>@[htmlize $xas]</span>"
}
}
if {$xmsgs > 0} {
set mtip "$xmsgs comment"
if {$xmsgs != 1} { set mtip "$xmsgs comments" }
html "<span class='tkt-cnt-slot' title='[htmlize $mtip]'>[tkt_note_svg]<span>[htmlize $xmsgs]</span></span>"
} else {
html "<span class='tkt-cnt-slot'></span>"
}
if {$xcis > 0} {
set ctip "$xcis linked check-in"
if {$xcis != 1} { set ctip "$xcis linked check-ins" }
html "<span class='tkt-cnt-slot is-ci' title='[htmlize $ctip]'>[tkt_ci_svg]<span>[htmlize $xcis]</span></span>"
} else {
html "<span class='tkt-cnt-slot is-ci'></span>"
}
html "</div>\n"
html "</div>\n"
}
set shown 0
if {$view eq "list"} {
html "<div class='tkt-list'>\n"
if {$hasAssignee && $hasSubmitter && $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,
coalesce(t.submitter,'') AS xsubm,
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) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='mine_or_sub' AND (t.assignee=user() OR t.submitter=user()))
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
OR ($fscope='involved' 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()))))
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.submitter,'') 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,
CASE WHEN $sort='oldest' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis $xas $xsubm $xpcue 1 1 $dom_prio $dom_stat $unAliasList
}
} elseif {$hasAssignee && $hasSubmitter} {
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,
coalesce(t.submitter,'') AS xsubm,
CASE WHEN t.status='Pending' AND julianday('now') - t.tkt_mtime > 14 THEN 'stale' ELSE '' END AS xpcue,
datetime(t.tkt_mtime) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='mine_or_sub' AND (t.assignee=user() OR t.submitter=user()))
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
OR ($fscope='involved' 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()))))
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.submitter,'') 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,
CASE WHEN $sort='oldest' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis $xas $xsubm $xpcue 1 1 $dom_prio $dom_stat $unAliasList
}
} 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) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
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,
CASE WHEN $sort='oldest' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis $xas "" $xpcue 1 0 $dom_prio $dom_stat $unAliasList
}
} elseif {$hasSubmitter} {
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.submitter,'') AS xsubm,
datetime(t.tkt_mtime) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
AND ($fsev='' OR t.severity=$fsev)
AND ($fsub='' OR t.subsystem=$fsub)
AND ($fstat='' OR t.status=$fstat)
AND ($fscope=''
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='involved' AND (t.submitter=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.submitter,'') 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,
CASE WHEN $sort='oldest' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis "" $xsubm "" 0 1 $dom_prio $dom_stat $unAliasList
}
} 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) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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,
CASE WHEN $sort='oldest' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis "" "" "" 0 0 $dom_prio $dom_stat $unAliasList
}
}
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]
if {$ck eq "updated"} {
html "<th><a href='$u_col' data-tkt-date-hdr='1' data-tkt-sort-mark='[htmlize $mark]'>$clbl$mark</a></th>"
} else {
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_utc xcre_utc xmod_day hasAssignee unAliasList} {
set icoCls "tkt-state-open"
set icoSvg [tkt_state_svg open ""]
if {$xstatus eq "Review" || $xstatus eq "Pending"} {
set icoCls "tkt-state-review"
set icoSvg [tkt_state_svg review ""]
} 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 [tkt_state_svg closed ""]
}
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 c-as'>unassigned</td>"
} elseif {[tkt_is_unassigned_alias $xas $unAliasList]} {
html "<td class='c-as' title='@[htmlize $xas] (unassigned alias — needs reassignment)'><span class='tkt-owner is-orphan'>@[htmlize $xas]</span></td>"
} else {
html "<td class='c-as' title='@[htmlize $xas]'>@[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 c-sub' title='[htmlize $xsub]'>[htmlize $xsub]</td>"
html "<td class='c-muted'><button type='button' class='tkt-time-btn' data-tkt-time='1' data-tkt-mod='[htmlize $xmod_utc]' data-tkt-cre='[htmlize $xcre_utc]' data-tkt-kind='table' title='Updated [htmlize $xmod_utc] UTC'>[htmlize $xmod_day]</button></td>"
html "</tr>\n"
}
if {$hasAssignee && $hasSubmitter} {
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) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day
FROM ticket t
WHERE (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='mine_or_sub' AND (t.assignee=user() OR t.submitter=user()))
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
OR ($fscope='involved' 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()))))
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.submitter,'') 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_utc $xcre_utc $xmod_day 1 $unAliasList
}
} elseif {$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) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day
FROM ticket t
WHERE (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
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_utc $xcre_utc $xmod_day 1 $unAliasList
}
} elseif {$hasSubmitter} {
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,
datetime(t.tkt_mtime) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day
FROM ticket t
WHERE (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
AND ($fsev='' OR t.severity=$fsev)
AND ($fsub='' OR t.subsystem=$fsub)
AND ($fstat='' OR t.status=$fstat)
AND ($fscope=''
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='involved' AND (t.submitter=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.submitter,'') 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_utc $xcre_utc $xmod_day 0 $unAliasList
}
} 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) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day
FROM ticket t
WHERE (($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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_utc $xcre_utc $xmod_day 0 $unAliasList
}
}
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"
} elseif {$view eq "summary"} {
set grandTotal [expr {$nall + $ndel}]
html "<div class='tkt-summary-grid'>\n"
html "<section class='tkt-sum-card'>\n"
html "<div class='tkt-sum-hdr'><strong>By State</strong><span>[htmlize $grandTotal] total</span></div>\n"
html "<table class='tkt-sum-table'><thead><tr><th>Status</th><th class='num'>Count</th><th class='num'>Share</th></tr></thead><tbody>\n"
set sumRows 0
query {
SELECT coalesce(status,'Open') AS v,
count(*) AS cnt,
printf('%.1f%%', 100.0 * count(*) / (SELECT max(1, count(*)) FROM ticket)) AS pct
FROM ticket
GROUP BY coalesce(status,'Open')
ORDER BY CASE coalesce(status,'Open')
WHEN 'Open' THEN 1 WHEN 'Verified' THEN 2 WHEN 'Review' THEN 3 WHEN 'Pending' THEN 4
WHEN 'Fixed' THEN 5 WHEN 'Tested' THEN 6 WHEN 'Closed' THEN 7 WHEN 'Deferred' THEN 8
WHEN 'Rejected' THEN 9 WHEN 'Deleted' THEN 10 ELSE 11 END, v
} {
set sumRows [expr {$sumRows + 1}]
set sSt "open"; set icoCls "tkt-state-open"; set icoSvg [tkt_state_svg open ""]
if {$v eq "Review" || $v eq "Pending"} {
set icoCls "tkt-state-review"; set icoSvg [tkt_state_svg review ""]
} elseif {$v eq "Deleted"} {
set sSt "all"; set icoCls "tkt-state-closed"; set icoSvg [tkt_state_svg closed ""]
} elseif {$v eq "Fixed" || $v eq "Tested" || $v eq "Closed" || $v eq "Deferred" || $v eq "Rejected"} {
set sSt "closed"; set icoCls "tkt-state-closed"; set icoSvg [tkt_state_svg closed ""]
}
set u_s [tkt_url $sSt list $sort $grp "" "" "" "" "" $v $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set note ""
if {$v eq "Deleted"} { set note " <span class='tkt-sum-muted'>(hidden)</span>" }
html "<tr><td><a class='tkt-sum-link' href='$u_s'><span class='tkt-state-ico $icoCls'>$icoSvg</span>[htmlize $v]$note</a></td><td class='num'><a href='$u_s'>[htmlize $cnt]</a></td><td class='num tkt-sum-muted'>[htmlize $pct]</td></tr>\n"
}
if {$sumRows == 0} {
html "<tr><td colspan='3' class='tkt-empty'>No tickets yet</td></tr>\n"
}
html "</tbody></table></section>\n"
html "<section class='tkt-sum-card'>\n"
html "<div class='tkt-sum-hdr'><strong>By Type</strong><span>excl. Deleted</span></div>\n"
html "<table class='tkt-sum-table'><thead><tr><th>Type</th><th class='num'>Open</th><th class='num'>Closed</th><th class='num'>Total</th><th class='num'>Open %</th></tr></thead><tbody>\n"
set sumRows 0
query {
SELECT coalesce(nullif(type,''),'(unset)') AS v,
replace(coalesce(nullif(type,''),'(unset)'),'_',' ') AS lbl,
sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 1 ELSE 0 END) AS op,
sum(CASE WHEN coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Rejected') THEN 1 ELSE 0 END) AS cl,
count(*) AS tot,
printf('%.0f', 100.0 * sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 1 ELSE 0 END) / max(1, count(*))) AS opPct
FROM ticket
WHERE coalesce(status,'Open')<>'Deleted'
GROUP BY coalesce(nullif(type,''),'(unset)')
ORDER BY op DESC, tot DESC, v ASC
} {
set sumRows [expr {$sumRows + 1}]
if {$v eq "(unset)"} {
html "<tr><td class='tkt-sum-muted'>(unset)</td><td class='num'>[htmlize $op]</td><td class='num tkt-sum-muted'>[htmlize $cl]</td><td class='num'>[htmlize $tot]</td><td class='num'><span class='tkt-sum-pct'><span>[htmlize $opPct]%</span><span class='tkt-sum-bar'><i style='width:[htmlize $opPct]%'></i></span></span></td></tr>\n"
} else {
set u_to [tkt_url open list $sort $grp "" $v "" "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set u_tc [tkt_url closed list $sort $grp "" $v "" "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set u_ta [tkt_url all list $sort $grp "" $v "" "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
html "<tr><td><a class='tkt-sum-link' href='$u_to'>[htmlize $lbl]</a></td><td class='num'><a href='$u_to'>[htmlize $op]</a></td><td class='num tkt-sum-muted'><a href='$u_tc'>[htmlize $cl]</a></td><td class='num'><a href='$u_ta'>[htmlize $tot]</a></td><td class='num'><span class='tkt-sum-pct'><span>[htmlize $opPct]%</span><span class='tkt-sum-bar'><i style='width:[htmlize $opPct]%'></i></span></span></td></tr>\n"
}
}
if {$sumRows == 0} {
html "<tr><td colspan='5' class='tkt-empty'>No tickets yet</td></tr>\n"
}
html "</tbody></table></section>\n"
html "<section class='tkt-sum-card'>\n"
html "<div class='tkt-sum-hdr'><strong>By Priority Tier</strong><span>normalized · excl. Deleted</span></div>\n"
html "<table class='tkt-sum-table'><thead><tr><th>Priority</th><th class='num'>Open</th><th class='num'>Closed</th><th class='num'>Total</th></tr></thead><tbody>\n"
set sumRows 0
query {
SELECT (CASE
WHEN priority IN ('Immediate','9 Immediate') OR priority GLOB '9*' THEN '9'
WHEN priority GLOB '8*' THEN '8'
WHEN priority IN ('High','7 High') OR priority GLOB '7*' THEN '7'
WHEN priority GLOB '6*' THEN '6'
WHEN priority IN ('Medium','5 Medium') OR priority GLOB '5*' THEN '5'
WHEN priority GLOB '4*' THEN '4'
WHEN priority IN ('Low','3 Low') OR priority GLOB '3*' THEN '3'
WHEN priority GLOB '2*' THEN '2'
WHEN priority IN ('Zero','1 Zero') OR priority GLOB '1*' THEN '1'
ELSE coalesce(nullif(priority,''),'(unset)') END) AS tier,
substr(max(CASE WHEN priority GLOB '[1-9] *' THEN '1'||priority ELSE '0'||coalesce(nullif(priority,''),'(unset)') END), 2) AS lbl,
sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 1 ELSE 0 END) AS op,
sum(CASE WHEN coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Rejected') THEN 1 ELSE 0 END) AS cl,
count(*) AS tot
FROM ticket
WHERE coalesce(status,'Open')<>'Deleted'
GROUP BY tier
ORDER BY CASE tier
WHEN '9' THEN 1 WHEN '8' THEN 2 WHEN '7' THEN 3 WHEN '6' THEN 4 WHEN '5' THEN 5
WHEN '4' THEN 6 WHEN '3' THEN 7 WHEN '2' THEN 8 WHEN '1' THEN 9 ELSE 10 END, lbl
} {
set sumRows [expr {$sumRows + 1}]
if {$lbl eq "(unset)"} {
html "<tr><td class='tkt-sum-muted'>(unset)</td><td class='num'>[htmlize $op]</td><td class='num tkt-sum-muted'>[htmlize $cl]</td><td class='num'>[htmlize $tot]</td></tr>\n"
} else {
set u_po [tkt_url open list $sort $grp "" "" $lbl "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set u_pc [tkt_url closed list $sort $grp "" "" $lbl "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set u_pa [tkt_url all list $sort $grp "" "" $lbl "" "" "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set ptag ""
if {$tier eq "9" || $tier eq "8" || $tier eq "7"} {
set ptag "<span class='tkt-tag tkt-tag-crit'>[htmlize $lbl]</span>"
} else {
set ptag "[htmlize $lbl]"
}
html "<tr><td><a class='tkt-sum-link' href='$u_po'>$ptag</a></td><td class='num'><a href='$u_po'>[htmlize $op]</a></td><td class='num tkt-sum-muted'><a href='$u_pc'>[htmlize $cl]</a></td><td class='num'><a href='$u_pa'>[htmlize $tot]</a></td></tr>\n"
}
}
if {$sumRows == 0} {
html "<tr><td colspan='4' class='tkt-empty'>No tickets yet</td></tr>\n"
}
html "</tbody></table></section>\n"
html "<section class='tkt-sum-card'>\n"
html "<div class='tkt-sum-hdr'><strong>By Subsystem</strong><span>sorted by open · excl. Deleted</span></div>\n"
html "<div class='tkt-sum-scroll'><table class='tkt-sum-table'><thead><tr><th>Subsystem</th><th class='num'>Open</th><th class='num'>Closed</th><th class='num'>Total</th></tr></thead><tbody>\n"
set sumRows 0
query {
SELECT coalesce(nullif(subsystem,''),'(none)') AS v,
sum(CASE WHEN coalesce(status,'Open') NOT IN ('Fixed','Tested','Closed','Deferred','Deleted','Rejected') THEN 1 ELSE 0 END) AS op,
sum(CASE WHEN coalesce(status,'Open') IN ('Fixed','Tested','Closed','Deferred','Rejected') THEN 1 ELSE 0 END) AS cl,
count(*) AS tot
FROM ticket
WHERE coalesce(status,'Open')<>'Deleted'
GROUP BY coalesce(nullif(subsystem,''),'(none)')
ORDER BY op DESC, tot DESC, v ASC
} {
set sumRows [expr {$sumRows + 1}]
if {$v eq "(none)"} {
html "<tr><td class='tkt-sum-muted'>(none)</td><td class='num'>[htmlize $op]</td><td class='num tkt-sum-muted'>[htmlize $cl]</td><td class='num'>[htmlize $tot]</td></tr>\n"
} else {
set u_so [tkt_url open list $sort $grp "" "" "" "" $v "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set u_sc [tkt_url closed list $sort $grp "" "" "" "" $v "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
set u_sa [tkt_url all list $sort $grp "" "" "" "" $v "" $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
html "<tr><td><a class='tkt-sum-link' href='$u_so'>[htmlize $v]</a></td><td class='num'><a href='$u_so'>[htmlize $op]</a></td><td class='num tkt-sum-muted'><a href='$u_sc'>[htmlize $cl]</a></td><td class='num'><a href='$u_sa'>[htmlize $tot]</a></td></tr>\n"
}
}
if {$sumRows == 0} {
html "<tr><td colspan='4' class='tkt-empty'>No tickets yet</td></tr>\n"
}
html "</tbody></table></div></section>\n"
html "</div>\n"
} else {
html "<div class='tkt-board-bar'>\n"
html "<div class='tkt-board-ctrls'>\n"
html "<details class='tkt-fpop' data-tkt-popover='1'><summary><span>columns</span><strong>[htmlize $grp]</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
set gopts {status priority subsystem}
if {$hasAssignee} { set gopts {assignee status priority subsystem} }
foreach gopt $gopts {
set gcur ""; set gchk ""
if {$grp eq $gopt} { set gcur " is-cur"; set gchk "<span class='tkt-fpop-cnt'>✓</span>" }
set u_grp [tkt_url $st board $sort $gopt $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
html "<a class='tkt-fpop-item$gcur' href='$u_grp'><span>$gopt</span>$gchk</a>\n"
}
html "</div></details>\n"
set u_done_base [tkt_url $st board $sort $grp $qclean $ftype $fprio $fsev $fsub $fstat $tcol $tdir $fscope $fas $fage 1 $defaultSort $defaultGrp]
if {$grp eq "status" && $st eq "open"} {
set doneLbl "last 14d"
if {$fdone eq "30"} { set doneLbl "last 30d" }
if {$fdone eq "all"} { set doneLbl "all" }
if {$fdone eq "0"} { set doneLbl "drop only" }
set dOnCls ""; if {$fdone ne $defaultDone} { set dOnCls " is-on" }
html "<details class='tkt-fpop$dOnCls' data-tkt-popover='1'><summary><span>closed</span><strong>$doneLbl</strong>[tkt_chev_svg]</summary><div class='tkt-fpop-menu'>\n"
foreach {dk dlbl} {14 {last 14d} 30 {last 30d} all {all} 0 {drop only}} {
set dcur ""; set dchk ""
if {$fdone eq $dk} { set dcur " is-cur"; set dchk "<span class='tkt-fpop-cnt'>✓</span>" }
set u_d "$u_done_base&done=$dk"
if {$dk eq $defaultDone} { set u_d $u_done_base }
html "<a class='tkt-fpop-item$dcur' href='$u_d'><span>$dlbl</span>$dchk</a>\n"
}
html "</div></details>\n"
}
html "</div>\n"
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 "</div>\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 NOT IN ('nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)
AND (($fstat='Deleted' AND status='Deleted')
OR ($st='all' AND coalesce(status,'Open')<>'Deleted')
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','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"} {
if {($sc ne "Deleted" && $sc ne "Rejected") || $fstat eq $sc} {
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 (CASE
WHEN priority IN ('Immediate','9 Immediate') OR priority GLOB '9*' THEN '9'
WHEN priority GLOB '8*' THEN '8'
WHEN priority IN ('High','7 High') OR priority GLOB '7*' THEN '7'
WHEN priority GLOB '6*' THEN '6'
WHEN priority IN ('Medium','5 Medium') OR priority GLOB '5*' THEN '5'
WHEN priority GLOB '4*' THEN '4'
WHEN priority IN ('Low','3 Low') OR priority GLOB '3*' THEN '3'
WHEN priority GLOB '2*' THEN '2'
WHEN priority IN ('Zero','1 Zero') OR priority GLOB '1*' THEN '1'
ELSE priority END) AS tier,
substr(max(CASE WHEN priority GLOB '[1-9] *' THEN '1'||priority ELSE '0'||priority END), 2) AS pv
FROM ticket
WHERE length(priority)>0
AND coalesce(status,'Open')<>'Deleted'
GROUP BY tier
ORDER BY CASE tier
WHEN '9' THEN 1 WHEN '8' THEN 2 WHEN '7' THEN 3 WHEN '6' THEN 4 WHEN '5' THEN 5
WHEN '4' THEN 6 WHEN '3' THEN 7 WHEN '2' THEN 8 WHEN '1' THEN 9 ELSE 10 END, pv
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 (($fstat='Deleted' AND status='Deleted')
OR ($st='all' AND coalesce(status,'Open')<>'Deleted')
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','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
set colTier [tkt_prio_tier $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 colIsClosed 0
if {$colVal eq "Fixed" || $colVal eq "Tested" || $colVal eq "Closed" || $colVal eq "Deferred" || $colVal eq "Deleted" || $colVal eq "Rejected"} {
set colIsClosed 1
}
set useDoneWin 0
if {$st eq "open" && $grp eq "status" && $colIsClosed} { set useDoneWin 1 }
set colCnt 0
set colAllCnt 0
if {$hasAssignee && $hasSubmitter} {
query -nocomplain {
SELECT count(*) AS nc,
coalesce(sum(CASE
WHEN $useDoneWin='0' THEN 1
WHEN $fdone='0' THEN 0
WHEN $fdone='all' THEN 1
WHEN julianday('now') - t.tkt_mtime <= CAST($fdone AS REAL) THEN 1
ELSE 0 END), 0) AS nwin
FROM ticket t
WHERE (($useDoneWin='1')
OR ($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='mine_or_sub' AND (t.assignee=user() OR t.submitter=user()))
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
OR ($fscope='involved' 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()))))
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.submitter,'') 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 (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$colTier)
OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal)
OR ($grp='assignee' AND (($colVal='nobody' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$colVal)))
} {
set colAllCnt $nc
set colCnt $nwin
}
} elseif {$hasAssignee} {
query -nocomplain {
SELECT count(*) AS nc,
coalesce(sum(CASE
WHEN $useDoneWin='0' THEN 1
WHEN $fdone='0' THEN 0
WHEN $fdone='all' THEN 1
WHEN julianday('now') - t.tkt_mtime <= CAST($fdone AS REAL) THEN 1
ELSE 0 END), 0) AS nwin
FROM ticket t
WHERE (($useDoneWin='1')
OR ($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
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 (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$colTier)
OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal)
OR ($grp='assignee' AND (($colVal='nobody' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$colVal)))
} {
set colAllCnt $nc
set colCnt $nwin
}
} else {
query {
SELECT count(*) AS nc,
coalesce(sum(CASE
WHEN $useDoneWin='0' THEN 1
WHEN $fdone='0' THEN 0
WHEN $fdone='all' THEN 1
WHEN julianday('now') - t.tkt_mtime <= CAST($fdone AS REAL) THEN 1
ELSE 0 END), 0) AS nwin
FROM ticket t
WHERE (($useDoneWin='1')
OR ($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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 (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$colTier)
OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal))
} {
set colAllCnt $nc
set colCnt $nwin
}
}
set colCls "tkt-col"
if {$useDoneWin} { set colCls "tkt-col is-terminal" }
set winBadge ""
if {$useDoneWin} {
if {$fdone eq "14" || $fdone eq "30"} {
set winBadge "<span class='tkt-col-win'>[htmlize $fdone]d</span>"
} elseif {$fdone eq "0"} {
set winBadge "<span class='tkt-col-win'>drop</span>"
}
}
html "<section class='$colCls' 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>$winBadge</div>\n"
set colRendered 0
proc tkt_render_board_card {xid xtitle xstatus xtypelbl xprio xsub xmod_utc xcre_utc xmod_day xmsgs xcis xas grp colVal colList canWrite hasAssignee unAliasList} {
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'><code class='tkt-bcard-id'>[[htmlize $xid]]</code>"
if {$xtypelbl ne ""} { html " · [htmlize $xtypelbl]" }
html " · <button type='button' class='tkt-time-btn' data-tkt-time='1' data-tkt-mod='[htmlize $xmod_utc]' data-tkt-cre='[htmlize $xcre_utc]' data-tkt-kind='board' title='Updated [htmlize $xmod_utc] UTC'>[htmlize $xmod_day]</button>"
if {$xmsgs > 0} {
set mtip "$xmsgs comment"
if {$xmsgs != 1} { set mtip "$xmsgs comments" }
html " · <span class='tkt-bcard-cnt' title='[htmlize $mtip]'>[tkt_note_svg][htmlize $xmsgs]</span>"
}
if {$xcis > 0} {
set ctip "$xcis linked check-in"
if {$xcis != 1} { set ctip "$xcis linked check-ins" }
html " · <span class='tkt-bcard-cnt' title='[htmlize $ctip]'>[tkt_ci_svg][htmlize $xcis]</span>"
}
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>"
} elseif {[tkt_is_unassigned_alias $xas $unAliasList]} {
html "<span class='tkt-owner is-orphan' title='Unassigned alias — needs reassignment'>@[htmlize $xas] · reassign</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 {$colCnt > 0 && !($useDoneWin && $fdone eq "0")} {
if {$hasAssignee && $hasSubmitter} {
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,
datetime(t.tkt_mtime) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($useDoneWin='1' AND ($fdone='all' OR ($fdone<>'0' AND julianday('now') - t.tkt_mtime <= CAST($fdone AS REAL))))
OR ($useDoneWin='0' AND (
($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='submitted' AND t.submitter=user())
OR ($fscope='mine_or_sub' AND (t.assignee=user() OR t.submitter=user()))
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
OR ($fscope='involved' 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()))))
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.submitter,'') 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 (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$colTier)
OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal)
OR ($grp='assignee' AND (($colVal='nobody' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$colVal)))
ORDER BY
CASE WHEN $sort='priority' AND $useDoneWin='0' 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='oldest' AND $useDoneWin='0' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis $xas $grp $colVal $colList $canWrite 1 $unAliasList
}
} 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.subsystem,'') AS xsub,
coalesce(t.assignee,'') AS xas,
datetime(t.tkt_mtime) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($useDoneWin='1' AND ($fdone='all' OR ($fdone<>'0' AND julianday('now') - t.tkt_mtime <= CAST($fdone AS REAL))))
OR ($useDoneWin='0' AND (
($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$fas)
AND ($fscope=''
OR ($fscope='mine' AND t.assignee=user())
OR ($fscope='unassigned' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8))
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 (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$colTier)
OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal)
OR ($grp='assignee' AND (($colVal='nobody' AND coalesce(t.assignee,'') IN ('','nobody',$unAlias1,$unAlias2,$unAlias3,$unAlias4,$unAlias5,$unAlias6,$unAlias7,$unAlias8)) OR t.assignee=$colVal)))
ORDER BY
CASE WHEN $sort='priority' AND $useDoneWin='0' 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='oldest' AND $useDoneWin='0' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis $xas $grp $colVal $colList $canWrite 1 $unAliasList
}
} 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) AS xmod_utc,
datetime(t.tkt_ctime) AS xcre_utc,
substr(datetime(t.tkt_mtime),1,10) AS xmod_day,
(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 (($useDoneWin='1' AND ($fdone='all' OR ($fdone<>'0' AND julianday('now') - t.tkt_mtime <= CAST($fdone AS REAL))))
OR ($useDoneWin='0' AND (
($fstat='Deleted' AND t.status='Deleted')
OR ($st='all' AND coalesce(t.status,'Open')<>'Deleted')
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','Rejected')))))
AND ($ftype='' OR t.type=$ftype)
AND ($fprioTier='' OR (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$fprioTier)
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 (CASE
WHEN t.priority IN ('Immediate','9 Immediate') OR t.priority GLOB '9*' THEN '9'
WHEN t.priority GLOB '8*' THEN '8'
WHEN t.priority IN ('High','7 High') OR t.priority GLOB '7*' THEN '7'
WHEN t.priority GLOB '6*' THEN '6'
WHEN t.priority IN ('Medium','5 Medium') OR t.priority GLOB '5*' THEN '5'
WHEN t.priority GLOB '4*' THEN '4'
WHEN t.priority IN ('Low','3 Low') OR t.priority GLOB '3*' THEN '3'
WHEN t.priority GLOB '2*' THEN '2'
WHEN t.priority IN ('Zero','1 Zero') OR t.priority GLOB '1*' THEN '1'
ELSE coalesce(t.priority,'') END)=$colTier)
OR ($grp='subsystem' AND coalesce(t.subsystem,'(none)')=$colVal))
ORDER BY
CASE WHEN $sort='priority' AND $useDoneWin='0' 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='oldest' AND $useDoneWin='0' THEN t.tkt_mtime 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_utc $xcre_utc $xmod_day $xmsgs $xcis "" $grp $colVal $colList $canWrite 0 $unAliasList
}
}
}
set hiddenOlder [expr {$colAllCnt - $colCnt}]
set u_showall "$u_done_base&done=all"
if {$colRendered == 0} {
if {$useDoneWin && $fdone eq "0"} {
html "<div class='tkt-empty tkt-col-empty'>Drop here to mark [htmlize $colVal]</div>\n"
if {$colAllCnt > 0} {
html "<div class='tkt-col-foot'>[htmlize $colAllCnt] total · <a href='$u_showall'>Show all</a></div>\n"
}
} elseif {$useDoneWin && $hiddenOlder > 0} {
html "<div class='tkt-empty tkt-col-empty'>None in last [htmlize $fdone]d</div>\n"
html "<div class='tkt-col-foot'>[htmlize $hiddenOlder] older · <a href='$u_showall'>Show all</a></div>\n"
} else {
html "<div class='tkt-empty tkt-col-empty'>No tickets</div>\n"
}
} elseif {$useDoneWin && $hiddenOlder > 0} {
html "<div class='tkt-col-foot'>Last [htmlize $fdone]d · [htmlize $hiddenOlder] older · <a href='$u_showall'>Show all</a></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 eq "summary"} {
html "Summary across [htmlize $nall] active ticket"
if {$nall != 1} { html "s" }
if {$ndel > 0} {
set u_del [tkt_url all list $sort $grp "" "" "" "" "" Deleted $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
html " · [htmlize $ndel] Deleted (<a href='$u_del'>view</a>)"
}
} elseif {$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" }
}
if {$view ne "summary" && $st eq "all" && $ndel > 0 && $fstat ne "Deleted"} {
set u_del [tkt_url all $view $sort $grp "" "" "" "" "" Deleted $tcol $tdir "" "" "" 1 $defaultSort $defaultGrp]
html " · [htmlize $ndel] Deleted hidden (<a href='$u_del'>show</a>)"
}
html "</span><span class='tkt-pager'>"
if {$view ne "board" && $view ne "summary" && $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" && $view ne "summary" && ($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>