<th1>
if {![info exists mutype]} { set mutype Markdown }
if {![info exists icomment]} { set icomment {} }
if {![info exists username]} { set username $login }
if {[info exists submit]} {
if {$mutype eq "Wiki"} {
set mimetype text/x-fossil-wiki
} elseif {$mutype eq "Markdown"} {
set mimetype text/x-markdown
} elseif {$mutype eq "HTML"} {
set mimetype text/html
} elseif {$mutype eq {[links only]}} {
set mimetype text/x-fossil-plain
} else {
set mimetype text/plain
}
submit_ticket
set preview 1
}
</th1>
<div class="tkt-shell">
<div class="tkt-layout">
<div class="tkt-main">
<div class="tkt-card">
<div class="tkt-card-hdr">
<strong>Edit ticket</strong>
<span>Format: <th1>combobox mutype {Markdown Wiki {Plain Text} {[links only]} HTML} 1</th1></span>
</div>
<div class="tkt-form-stack">
<div class="tkt-field">
<label class="tkt-field-label" for="tkt-edit-title">Title</label>
<input id="tkt-edit-title" type="text" name="title" value="$<title>">
</div>
<div class="tkt-field">
<label class="tkt-field-label" for="tkt-edit-comment">Add comment</label>
<textarea id="tkt-edit-comment" name="icomment" rows="10" class="wikiedit" placeholder="Optional Markdown remark...">$<icomment></textarea>
</div>
<div class="tkt-form-actions">
<span class="tkt-help">Posting as <strong>$<username></strong><input type="hidden" name="username" value="$<username>"></span>
<div class="tkt-form-btns">
<input type="submit" name="cancel" value="Cancel" class="tkt-btn">
<input type="submit" name="preview" value="Preview" class="tkt-btn">
<input type="submit" name="submit" value="Save changes" class="tkt-btn tkt-btn-primary">
</div>
</div>
</div>
</div>
<th1>enable_output [info exists preview]</th1>
<div class="tkt-preview-box">
<h3>Comment preview</h3>
<th1>
if {$mutype eq "Wiki"} {
wiki $icomment
} elseif {$mutype eq "Plain Text"} {
set r [randhex]
wiki "<verbatim-$r>\n[string trimright $icomment]\n</verbatim-$r>"
} elseif {$mutype eq "Markdown"} {
html [lindex [markdown "$icomment\n"] 1]
} elseif {$mutype eq {[links only]}} {
set r [randhex]
wiki "<verbatim-$r links>\n[string trimright $icomment]</verbatim-$r>"
} else {
wiki "<nowiki>\n[string trimright $icomment]\n</nowiki>"
}
</th1>
</div>
<th1>enable_output 1</th1>
<th1>
set seenRow 0
set alwaysPlaintext [info exists plaintext]
query {SELECT datetime(tkt_mtime,toLocal()) AS xdate, login AS xlogin,
mimetype AS xmimetype, icomment AS xcomment,
username AS xusername
FROM ticketchng
WHERE tkt_id=$tkt_id AND length(icomment)>0
ORDER BY tkt_mtime ASC} {
if {!$seenRow} {
set seenRow 1
html "<h3 style='margin:0.5rem 0 0; font-size:0.95em; color:var(--muted);'>Previous comments</h3>\n"
}
html "<div class='tkt-card tktCommentEntry'>"
html "<div class='tkt-card-hdr'><span class='tktDspCommenter'><strong>[htmlize $xlogin]</strong>"
if {$xlogin ne $xusername && [string length $xusername] > 0} {
html " (claiming to be [htmlize $xusername])"
}
html "</span><span>[htmlize $xdate]</span></div>"
html "<div class='tkt-card-body'>"
if {$alwaysPlaintext || $xmimetype eq "text/plain"} {
set r [randhex]
if {$xmimetype ne "text/plain"} { puts "($xmimetype)\n" }
wiki "<verbatim-$r>[string trimright $xcomment]</verbatim-$r>\n"
} elseif {$xmimetype eq "text/x-fossil-wiki"} {
wiki "<p>\n[string trimright $xcomment]\n</p>\n"
} elseif {$xmimetype eq "text/x-markdown"} {
html [lindex [markdown $xcomment] 1]
} elseif {$xmimetype eq "text/html"} {
wiki "<p><nowiki>\n[string trimright $xcomment]\n</nowiki>\n"
} else {
set r [randhex]
wiki "<verbatim-$r links>[string trimright $xcomment]</verbatim-$r>\n"
}
html "</div></div>\n"
}
</th1>
</div>
<aside class="tkt-sidebar" aria-label="Ticket properties">
<div class="tkt-field"><span class="tkt-field-label">Status</span><th1>combobox status $status_choices 1</th1></div>
<div class="tkt-field"><span class="tkt-field-label">Type</span><th1>combobox type $type_choices 1</th1></div>
<div class="tkt-field"><span class="tkt-field-label">Severity</span><th1>combobox severity $severity_choices 1</th1></div>
<div class="tkt-field"><span class="tkt-field-label">Priority</span><th1>combobox priority $priority_choices 1</th1></div>
<div class="tkt-field"><span class="tkt-field-label">Resolution</span><th1>combobox resolution $resolution_choices 1</th1></div>
<div class="tkt-field"><span class="tkt-field-label">Subsystem</span><th1>combobox subsystem $subsystem_choices 1</th1></div>
<div class="tkt-field">
<label class="tkt-field-label" for="tkt-edit-foundin">Version found in</label>
<input id="tkt-edit-foundin" type="text" name="foundin" value="$<foundin>">
</div>
<th1>
if {[hascap e]} {
html "<div class='tkt-field'><label class='tkt-field-label' for='tkt-edit-contact'>Contact</label>"
html "<input id='tkt-edit-contact' type='text' name='private_contact' value='[htmlize $private_contact]'></div>"
}
</th1>
</aside>
</div>
</div>