ticket_alert_manage db user_idWhat it does:
generate a list of ticket watches with links to disable. mostly intended for /pvt/alerts.tcl and the settings screen.Defined in: /web/philip/tcl/ticket-defs.tcl
Source code:
set selection [ns_db select $db "select tea.alert_id, tea.msg_id, tea.domain_id, tea.project_id, tea.active_p, ti.one_line, ti.status_long, tp.title_long as project_title, td.title_long as domain_title from ticket_email_alerts tea, ticket_issues ti, ticket_projects tp, ticket_domains td where tea.user_id = $user_id and tea.msg_id = ti.msg_id (+) and (tea.project_id = tp.project_id or ti.project_id = tp.project_id) and (tea.domain_id = td.domain_id or ti.domain_id = td.domain_id)"] set out "<h3>[ticket_system_name] alerts</h3><ul>\[ <a href=\"/ticket/ticket-alert-manage?what=enable_all&alert_id=0\">enable all</a> | <a href=\"/ticket/ticket-alert-manage?what=disable_all&alert_id=0\">disable all</a> | <a href=\"/ticket/ticket-alert-manage?what=delete_all&alert_id=0\">delete all</a> \]<br><br>" set counter 0 set act(t) disable set act(f) enable set msg(t) {<font color=red>enabled</font>} set msg(f) {disabled} while {[ns_db getrow $db $selection]} { set_variables_after_query incr counter if { [empty_string_p $msg_id]} { append out "\n<li> All ticket in project $project_title: $domain_title" } else { append out "\n<li> <a href=\"/ticket/issue-view?msg_id=$msg_id\">\#$msg_id $one_line</a> in <em>$project_title: $domain_title</em> $msg($active_p)" } append out " (<a href=\"/ticket/ticket-alert-manage?alert_id=$alert_id\&what=$act($active_p)\">$act($active_p)</a> | <a href=\"/ticket/ticket-alert-manage?alert_id=$alert_id\&what=delete\">remove</a>)" } if $counter { append out {</ul>} } else { set out {} } return $out