Fossil SCM

fossil-scm / src / tktsetup.c
Source Blame History 1073 lines
d0305b3… aku 1 /*
c19f34c… drh 2 ** Copyright (c) 2007 D. Richard Hipp
d0305b3… aku 3 **
d0305b3… aku 4 ** This program is free software; you can redistribute it and/or
c06edd2… drh 5 ** modify it under the terms of the Simplified BSD License (also
c06edd2… drh 6 ** known as the "2-Clause License" or "FreeBSD License".)
c06edd2… drh 7
d0305b3… aku 8 ** This program is distributed in the hope that it will be useful,
c06edd2… drh 9 ** but without any warranty; without even the implied warranty of
c06edd2… drh 10 ** merchantability or fitness for a particular purpose.
d0305b3… aku 11 **
d0305b3… aku 12 ** Author contact information:
d0305b3… aku 13 ** [email protected]
d0305b3… aku 14 ** http://www.hwaci.com/drh/
d0305b3… aku 15 **
d0305b3… aku 16 *******************************************************************************
d0305b3… aku 17 **
d0305b3… aku 18 ** This file contains code to implement the ticket configuration
d0305b3… aku 19 ** setup screens.
d0305b3… aku 20 */
d0305b3… aku 21 #include "config.h"
d0305b3… aku 22 #include "tktsetup.h"
d0305b3… aku 23 #include <assert.h>
d0305b3… aku 24
d0305b3… aku 25 /*
ce277ca… drh 26 ** WEBPAGE: tktsetup
7ab0328… drh 27 ** Main sub-menu for configuring the ticketing system.
d0305b3… aku 28 */
d0305b3… aku 29 void tktsetup_page(void){
d0305b3… aku 30 login_check_credentials();
b344d3c… drh 31 if( !g.perm.Setup ){
653dd40… drh 32 login_needed(0);
653dd40… drh 33 return;
d0305b3… aku 34 }
d0305b3… aku 35
d0305b3… aku 36 style_header("Ticket Setup");
ce277ca… drh 37 @ <table border="0" cellspacing="20">
ce277ca… drh 38 setup_menu_entry("Table", "tktsetup_tab",
ce277ca… drh 39 "Specify the schema of the \"ticket\" table in the database.");
ac3f1f2… drh 40 setup_menu_entry("Timeline", "tktsetup_timeline",
ac3f1f2… drh 41 "How to display ticket status in the timeline");
ce277ca… drh 42 setup_menu_entry("Common", "tktsetup_com",
ce277ca… drh 43 "Common TH1 code run before all ticket processing.");
a905596… drh 44 setup_menu_entry("Change", "tktsetup_change",
a905596… drh 45 "The TH1 code run after a ticket is edited or created.");
ce277ca… drh 46 setup_menu_entry("New Ticket Page", "tktsetup_newpage",
ce277ca… drh 47 "HTML with embedded TH1 code for the \"new ticket\" webpage.");
ce277ca… drh 48 setup_menu_entry("View Ticket Page", "tktsetup_viewpage",
ce277ca… drh 49 "HTML with embedded TH1 code for the \"view ticket\" webpage.");
ce277ca… drh 50 setup_menu_entry("Edit Ticket Page", "tktsetup_editpage",
ce277ca… drh 51 "HTML with embedded TH1 code for the \"edit ticket\" webpage.");
14253e9… jeremy_c 52 setup_menu_entry("Report List Page", "tktsetup_reportlist",
14253e9… jeremy_c 53 "HTML with embedded TH1 code for the \"report list\" webpage.");
49380d5… drh 54 setup_menu_entry("Report Template", "tktsetup_rpttplt",
ce277ca… drh 55 "The default ticket report format.");
49380d5… drh 56 setup_menu_entry("Key Template", "tktsetup_keytplt",
49380d5… drh 57 "The default color key for reports.");
ce277ca… drh 58 @ </table>
112c713… drh 59 style_finish_page();
ce277ca… drh 60 }
ce277ca… drh 61
21326fb… drh 62 /*
21326fb… drh 63 ** NOTE: When changing the table definition below, also change the
21326fb… drh 64 ** equivalent definition found in schema.c.
21326fb… drh 65 */
ce277ca… drh 66 /* @-comment: ** */
86db6fa… drh 67 static const char zDefaultTicketTable[] =
ce277ca… drh 68 @ CREATE TABLE ticket(
ce277ca… drh 69 @ -- Do not change any column that begins with tkt_
ce277ca… drh 70 @ tkt_id INTEGER PRIMARY KEY,
fb8dc7d… drh 71 @ tkt_uuid TEXT UNIQUE,
ce277ca… drh 72 @ tkt_mtime DATE,
8554d3e… drh 73 @ tkt_ctime DATE,
4f8c897… drh 74 @ -- Add as many fields as required below this line
ce277ca… drh 75 @ type TEXT,
ce277ca… drh 76 @ status TEXT,
ce277ca… drh 77 @ subsystem TEXT,
ce277ca… drh 78 @ priority TEXT,
ce277ca… drh 79 @ severity TEXT,
ce277ca… drh 80 @ foundin TEXT,
21326fb… drh 81 @ private_contact TEXT,
ce277ca… drh 82 @ resolution TEXT,
ce277ca… drh 83 @ title TEXT,
fb8dc7d… drh 84 @ comment TEXT
fb8dc7d… drh 85 @ );
4f8c897… drh 86 @ CREATE TABLE ticketchng(
4f8c897… drh 87 @ -- Do not change any column that begins with tkt_
4f8c897… drh 88 @ tkt_id INTEGER REFERENCES ticket,
a18a49c… drh 89 @ tkt_rid INTEGER REFERENCES blob,
4f8c897… drh 90 @ tkt_mtime DATE,
cf00d07… george 91 @ tkt_user TEXT,
4f8c897… drh 92 @ -- Add as many fields as required below this line
4f8c897… drh 93 @ login TEXT,
4f8c897… drh 94 @ username TEXT,
4f8c897… drh 95 @ mimetype TEXT,
4f8c897… drh 96 @ icomment TEXT
4f8c897… drh 97 @ );
4f8c897… drh 98 @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);
ce277ca… drh 99 ;
86db6fa… drh 100
86db6fa… drh 101 /*
4cf8dbe… stephan 102 ** Return the ticket table definition in heap-allocated
4cf8dbe… stephan 103 ** memory owned by the caller.
86db6fa… drh 104 */
4cf8dbe… stephan 105 char *ticket_table_schema(void){
5b456cf… jan.nijtmans 106 return db_get("ticket-table", zDefaultTicketTable);
86db6fa… drh 107 }
ce277ca… drh 108
ce277ca… drh 109 /*
ce277ca… drh 110 ** Common implementation for the ticket setup editor pages.
ce277ca… drh 111 */
ce277ca… drh 112 static void tktsetup_generic(
ce277ca… drh 113 const char *zTitle, /* Page title */
ce277ca… drh 114 const char *zDbField, /* Configuration field being edited */
86db6fa… drh 115 const char *zDfltValue, /* Default text value */
ce277ca… drh 116 const char *zDesc, /* Description of this field */
db0c512… drh 117 char *(*xText)(const char*), /* Validity test or NULL */
db0c512… drh 118 void (*xRebuild)(void), /* Run after successful update */
ce277ca… drh 119 int height /* Height of the edit box */
ce277ca… drh 120 ){
ce277ca… drh 121 const char *z;
ce277ca… drh 122 int isSubmit;
3df526c… jan.nijtmans 123
ce277ca… drh 124 login_check_credentials();
b344d3c… drh 125 if( !g.perm.Setup ){
653dd40… drh 126 login_needed(0);
653dd40… drh 127 return;
ce277ca… drh 128 }
112c713… drh 129 style_set_current_feature("tktsetup");
fab9f00… jkosche 130 if( P("setup") ){
ce277ca… drh 131 cgi_redirect("tktsetup");
ce277ca… drh 132 }
ce277ca… drh 133 isSubmit = P("submit")!=0;
ce277ca… drh 134 z = P("x");
ce277ca… drh 135 if( z==0 ){
5b456cf… jan.nijtmans 136 z = db_get(zDbField, zDfltValue);
5b456cf… jan.nijtmans 137 }
112c713… drh 138 style_set_current_feature("tktsetup");
a40e8a0… drh 139 style_header("Edit %s", zTitle);
920ace1… drh 140 if( P("clear")!=0 && cgi_csrf_safe(2) ){
0a5d0e1… drh 141 db_unset(zDbField/*works-like:"x"*/, 0);
a40e8a0… drh 142 if( xRebuild ) xRebuild();
a40e8a0… drh 143 cgi_redirect("tktsetup");
920ace1… drh 144 }else if( isSubmit && cgi_csrf_safe(2) ){
a40e8a0… drh 145 char *zErr = 0;
a40e8a0… drh 146 if( xText && (zErr = xText(z))!=0 ){
a40e8a0… drh 147 @ <p class="tktsetupError">ERROR: %h(zErr)</p>
a40e8a0… drh 148 }else{
0a5d0e1… drh 149 db_set(zDbField/*works-like:"x"*/, z, 0);
a40e8a0… drh 150 if( xRebuild ) xRebuild();
a40e8a0… drh 151 cgi_redirect("tktsetup");
a40e8a0… drh 152 }
a40e8a0… drh 153 }
a40e8a0… drh 154 @ <form action="%R/%s(g.zPath)" method="post"><div>
a40e8a0… drh 155 login_insert_csrf_secret();
a40e8a0… drh 156 @ <p>%s(zDesc)</p>
a40e8a0… drh 157 @ <textarea name="x" rows="%d(height)" cols="80">%h(z)</textarea>
a40e8a0… drh 158 @ <blockquote><p>
f5482a0… wyoung 159 @ <input type="submit" name="submit" value="Apply Changes">
f5482a0… wyoung 160 @ <input type="submit" name="clear" value="Revert To Default">
f5482a0… wyoung 161 @ <input type="submit" name="setup" value="Cancel">
a40e8a0… drh 162 @ </p></blockquote>
a40e8a0… drh 163 @ </div></form>
f5482a0… wyoung 164 @ <hr>
a40e8a0… drh 165 @ <h2>Default %s(zTitle)</h2>
a40e8a0… drh 166 @ <blockquote><pre>
a40e8a0… drh 167 @ %h(zDfltValue)
a40e8a0… drh 168 @ </pre></blockquote>
fab9f00… jkosche 169 style_submenu_element("Back", "%R/tktsetup");
112c713… drh 170 style_finish_page();
7ab0328… drh 171 }
7ab0328… drh 172
7ab0328… drh 173 /*
7ab0328… drh 174 ** WEBPAGE: tktsetup_tab
7ab0328… drh 175 ** Administrative page for defining the "ticket" table used
7ab0328… drh 176 ** to hold ticket information.
ce277ca… drh 177 */
ce277ca… drh 178 void tktsetup_tab_page(void){
ce277ca… drh 179 static const char zDesc[] =
3243e63… drh 180 @ Enter a valid CREATE TABLE statement for the "ticket" table. The
ce277ca… drh 181 @ table must contain columns named "tkt_id", "tkt_uuid", and "tkt_mtime"
3243e63… drh 182 @ with an unique index on "tkt_uuid" and "tkt_mtime".
ce277ca… drh 183 ;
ce277ca… drh 184 tktsetup_generic(
ce277ca… drh 185 "Ticket Table Schema",
ce277ca… drh 186 "ticket-table",
86db6fa… drh 187 zDefaultTicketTable,
ce277ca… drh 188 zDesc,
86db6fa… drh 189 ticket_schema_check,
86db6fa… drh 190 ticket_rebuild,
ce277ca… drh 191 20
ce277ca… drh 192 );
ce277ca… drh 193 }
ce277ca… drh 194
86db6fa… drh 195 static const char zDefaultTicketCommon[] =
ce277ca… drh 196 @ set type_choices {
ce277ca… drh 197 @ Code_Defect
ce277ca… drh 198 @ Build_Problem
ce277ca… drh 199 @ Documentation
ce277ca… drh 200 @ Feature_Request
ce277ca… drh 201 @ Incident
ce277ca… drh 202 @ }
ce277ca… drh 203 @ set priority_choices {
ce277ca… drh 204 @ Immediate
ce277ca… drh 205 @ High
ce277ca… drh 206 @ Medium
ce277ca… drh 207 @ Low
ce277ca… drh 208 @ Zero
ce277ca… drh 209 @ }
ce277ca… drh 210 @ set severity_choices {
ce277ca… drh 211 @ Critical
ce277ca… drh 212 @ Severe
ce277ca… drh 213 @ Important
ce277ca… drh 214 @ Minor
ce277ca… drh 215 @ Cosmetic
ce277ca… drh 216 @ }
ce277ca… drh 217 @ set resolution_choices {
ce277ca… drh 218 @ Open
ce277ca… drh 219 @ Fixed
ce277ca… drh 220 @ Rejected
cdbc3ab… kejoki 221 @ Workaround
ce277ca… drh 222 @ Unable_To_Reproduce
ce277ca… drh 223 @ Works_As_Designed
ce277ca… drh 224 @ External_Bug
ce277ca… drh 225 @ Not_A_Bug
ce277ca… drh 226 @ Duplicate
ce277ca… drh 227 @ Overcome_By_Events
ce277ca… drh 228 @ Drive_By_Patch
cdbc3ab… kejoki 229 @ Misconfiguration
ce277ca… drh 230 @ }
ce277ca… drh 231 @ set status_choices {
ce277ca… drh 232 @ Open
ce277ca… drh 233 @ Verified
49380d5… drh 234 @ Review
ce277ca… drh 235 @ Deferred
ce277ca… drh 236 @ Fixed
ce277ca… drh 237 @ Tested
ce277ca… drh 238 @ Closed
ce277ca… drh 239 @ }
efb759a… drh 240 @ set subsystem_choices {
efb759a… drh 241 @ }
ce277ca… drh 242 ;
86db6fa… drh 243
86db6fa… drh 244 /*
86db6fa… drh 245 ** Return the ticket common code.
86db6fa… drh 246 */
86db6fa… drh 247 const char *ticket_common_code(void){
5b456cf… jan.nijtmans 248 return db_get("ticket-common", zDefaultTicketCommon);
86db6fa… drh 249 }
ce277ca… drh 250
ce277ca… drh 251 /*
ce277ca… drh 252 ** WEBPAGE: tktsetup_com
7ab0328… drh 253 ** Administrative page used to define TH1 script that is
7ab0328… drh 254 ** common to all ticket screens.
ce277ca… drh 255 */
ce277ca… drh 256 void tktsetup_com_page(void){
ce277ca… drh 257 static const char zDesc[] =
3243e63… drh 258 @ Enter TH1 script that initializes variables prior to generating
3243e63… drh 259 @ any of the ticket view, edit, or creation pages.
ce277ca… drh 260 ;
ce277ca… drh 261 tktsetup_generic(
ce277ca… drh 262 "Ticket Common Script",
ce277ca… drh 263 "ticket-common",
86db6fa… drh 264 zDefaultTicketCommon,
86db6fa… drh 265 zDesc,
86db6fa… drh 266 0,
86db6fa… drh 267 0,
86db6fa… drh 268 30
86db6fa… drh 269 );
86db6fa… drh 270 }
86db6fa… drh 271
a905596… drh 272 static const char zDefaultTicketChange[] =
a905596… drh 273 @ return
a905596… drh 274 ;
a905596… drh 275
a905596… drh 276 /*
a905596… drh 277 ** Return the ticket change code.
a905596… drh 278 */
a905596… drh 279 const char *ticket_change_code(void){
5b456cf… jan.nijtmans 280 return db_get("ticket-change", zDefaultTicketChange);
a905596… drh 281 }
a905596… drh 282
a905596… drh 283 /*
a905596… drh 284 ** WEBPAGE: tktsetup_change
26eef7f… rberteig 285 ** Administrative screen used to view or edit the TH1 script
7ab0328… drh 286 ** that shows ticket changes.
a905596… drh 287 */
a905596… drh 288 void tktsetup_change_page(void){
a905596… drh 289 static const char zDesc[] =
a905596… drh 290 @ Enter TH1 script that runs after processing the ticket editing
a905596… drh 291 @ and creation pages.
a905596… drh 292 ;
a905596… drh 293 tktsetup_generic(
a905596… drh 294 "Ticket Change Script",
a905596… drh 295 "ticket-change",
a905596… drh 296 zDefaultTicketChange,
a905596… drh 297 zDesc,
a905596… drh 298 0,
a905596… drh 299 0,
a905596… drh 300 30
a905596… drh 301 );
a905596… drh 302 }
a905596… drh 303
86db6fa… drh 304 static const char zDefaultNew[] =
ce277ca… drh 305 @ <th1>
16fb915… drh 306 @ if {![info exists mutype]} {set mutype Markdown}
271a6bd… jkosche 307 @ if {[info exists submit] || [info exists submitandnew]} {
ce277ca… drh 308 @ set status Open
4f8c897… drh 309 @ if {$mutype eq "HTML"} {
4f8c897… drh 310 @ set mimetype "text/html"
4f8c897… drh 311 @ } elseif {$mutype eq "Wiki"} {
4f8c897… drh 312 @ set mimetype "text/x-fossil-wiki"
16fb915… drh 313 @ } elseif {$mutype eq "Markdown"} {
16fb915… drh 314 @ set mimetype text/x-markdown
4f8c897… drh 315 @ } elseif {$mutype eq {[links only]}} {
4f8c897… drh 316 @ set mimetype "text/x-fossil-plain"
4f8c897… drh 317 @ } else {
4f8c897… drh 318 @ set mimetype "text/plain"
4f8c897… drh 319 @ }
ce277ca… drh 320 @ submit_ticket
28faff0… drh 321 @ set preview 1
ce277ca… drh 322 @ }
ce277ca… drh 323 @ </th1>
3243e63… drh 324 @ <h1 style="text-align: center;">Enter A New Ticket</h1>
ce277ca… drh 325 @ <table cellpadding="5">
ce277ca… drh 326 @ <tr>
4f8c897… drh 327 @ <td colspan="3">
f5482a0… wyoung 328 @ Enter a one-line summary of the ticket:<br>
f5482a0… wyoung 329 @ <input type="text" name="title" size="60" value="$<title>">
4f8c897… drh 330 @ </td>
4f8c897… drh 331 @ </tr>
3df526c… jan.nijtmans 332 @
4f8c897… drh 333 @ <tr>
4f8c897… drh 334 @ <td align="right">Type:</td>
4f8c897… drh 335 @ <td align="left"><th1>combobox type $type_choices 1</th1></td>
4f8c897… drh 336 @ <td align="left">What type of ticket is this?</td>
4f8c897… drh 337 @ </tr>
3df526c… jan.nijtmans 338 @
4f8c897… drh 339 @ <tr>
4f8c897… drh 340 @ <td align="right">Version:</td>
4f8c897… drh 341 @ <td align="left">
f5482a0… wyoung 342 @ <input type="text" name="foundin" size="20" value="$<foundin>">
4f8c897… drh 343 @ </td>
4f8c897… drh 344 @ <td align="left">In what version or build number do you observe
4f8c897… drh 345 @ the problem?</td>
4f8c897… drh 346 @ </tr>
3df526c… jan.nijtmans 347 @
4f8c897… drh 348 @ <tr>
4f8c897… drh 349 @ <td align="right">Severity:</td>
4f8c897… drh 350 @ <td align="left"><th1>combobox severity $severity_choices 1</th1></td>
4f8c897… drh 351 @ <td align="left">How debilitating is the problem? How badly does the problem
f3ce1c9… bharder 352 @ affect the operation of the product?</td>
f3ce1c9… bharder 353 @ </tr>
271a6bd… jkosche 354 @
271a6bd… jkosche 355 @ <th1>
271a6bd… jkosche 356 @ if {[capexpr {w}]} {
271a6bd… jkosche 357 @ html {<tr><td class="tktDspLabel">Priority:</td><td>}
271a6bd… jkosche 358 @ combobox priority $priority_choices 1
271a6bd… jkosche 359 @ html {
271a6bd… jkosche 360 @ <td align="left">How important is the affected functionality?</td>
271a6bd… jkosche 361 @ </td></tr>
271a6bd… jkosche 362 @ }
271a6bd… jkosche 363 @
271a6bd… jkosche 364 @ html {<tr><td class="tktDspLabel">Subsystem:</td><td>}
271a6bd… jkosche 365 @ combobox subsystem $subsystem_choices 1
271a6bd… jkosche 366 @ html {
271a6bd… jkosche 367 @ <td align="left">Which subsystem is affected?</td>
271a6bd… jkosche 368 @ </td></tr>
271a6bd… jkosche 369 @ }
271a6bd… jkosche 370 @ }
271a6bd… jkosche 371 @ </th1>
f5482a0… wyoung 372 @
f3ce1c9… bharder 373 @ <tr>
4f8c897… drh 374 @ <td align="right">EMail:</td>
4f8c897… drh 375 @ <td align="left">
f5482a0… wyoung 376 @ <input name="private_contact" value="$<private_contact>" size="30">
f3ce1c9… bharder 377 @ </td>
4f8c897… drh 378 @ <td align="left"><u>Not publicly visible</u>
3243e63… drh 379 @ Used by developers to contact you with questions.</td>
f3ce1c9… bharder 380 @ </tr>
3df526c… jan.nijtmans 381 @
f3ce1c9… bharder 382 @ <tr>
4f8c897… drh 383 @ <td colspan="3">
ce277ca… drh 384 @ Enter a detailed description of the problem.
ce277ca… drh 385 @ For code defects, be sure to provide details on exactly how
ce277ca… drh 386 @ the problem can be reproduced. Provide as much detail as
4f8c897… drh 387 @ possible. Format:
1fbd2e1… drh 388 @ <th1>combobox mutype {HTML {[links only]} Markdown {Plain Text} Wiki} 1</th1>
f5482a0… wyoung 389 @ <br>
ce277ca… drh 390 @ <th1>set nline [linecount $comment 50 10]</th1>
4f8c897… drh 391 @ <textarea name="icomment" cols="80" rows="$nline"
f5482a0… wyoung 392 @ wrap="virtual" class="wikiedit">$<icomment></textarea><br>
4f8c897… drh 393 @ </tr>
3df526c… jan.nijtmans 394 @
4f8c897… drh 395 @ <th1>enable_output [info exists preview]</th1>
4f8c897… drh 396 @ <tr><td colspan="3">
f5482a0… wyoung 397 @ Description Preview:<br><hr>
4f8c897… drh 398 @ <th1>
4f8c897… drh 399 @ if {$mutype eq "Wiki"} {
4f8c897… drh 400 @ wiki $icomment
4f8c897… drh 401 @ } elseif {$mutype eq "Plain Text"} {
4f8c897… drh 402 @ set r [randhex]
4f8c897… drh 403 @ wiki "<verbatim-$r>[string trimright $icomment]\n</verbatim-$r>"
16fb915… drh 404 @ } elseif {$mutype eq "Markdown"} {
16fb915… drh 405 @ html [lindex [markdown "$icomment\n"] 1]
4f8c897… drh 406 @ } elseif {$mutype eq {[links only]}} {
4f8c897… drh 407 @ set r [randhex]
4f8c897… drh 408 @ wiki "<verbatim-$r links>[string trimright $icomment]\n</verbatim-$r>"
4f8c897… drh 409 @ } else {
4f8c897… drh 410 @ wiki "<nowiki>$icomment\n</nowiki>"
4f8c897… drh 411 @ }
4f8c897… drh 412 @ </th1>
f5482a0… wyoung 413 @ <hr></td></tr>
4f8c897… drh 414 @ <th1>enable_output 1</th1>
3df526c… jan.nijtmans 415 @
4f8c897… drh 416 @ <tr>
4f8c897… drh 417 @ <td><td align="left">
f5482a0… wyoung 418 @ <input type="submit" name="preview" value="Preview">
4f8c897… drh 419 @ </td>
4f8c897… drh 420 @ <td align="left">See how the description will appear after formatting.</td>
ce277ca… drh 421 @ </tr>
3df526c… jan.nijtmans 422 @
ce277ca… drh 423 @ <th1>enable_output [info exists preview]</th1>
4f8c897… drh 424 @ <tr>
4f8c897… drh 425 @ <td><td align="left">
f5482a0… wyoung 426 @ <input type="submit" name="submit" value="Submit">
3df526c… jan.nijtmans 427 @ </td>
3df526c… jan.nijtmans 428 @ <td align="left">After filling in the information above, press this
271a6bd… jkosche 429 @ button to create the new ticket.</td>
271a6bd… jkosche 430 @ </tr>
271a6bd… jkosche 431 @
271a6bd… jkosche 432 @ <tr>
271a6bd… jkosche 433 @ <td><td align="left">
271a6bd… jkosche 434 @ <input type="submit" name="submitandnew" value="Submit and New">
271a6bd… jkosche 435 @ </td>
271a6bd… jkosche 436 @ <td align="left">Create the new ticket and start another
271a6bd… jkosche 437 @ ticket form with the inputs.</td>
27d2e6e… drh 438 @ </tr>
4f8c897… drh 439 @ <th1>enable_output 1</th1>
3df526c… jan.nijtmans 440 @
27d2e6e… drh 441 @ <tr>
4f8c897… drh 442 @ <td><td align="left">
f5482a0… wyoung 443 @ <input type="submit" name="cancel" value="Cancel">
27d2e6e… drh 444 @ </td>
271a6bd… jkosche 445 @ <td>Abandon and forget this ticket.</td>
ce277ca… drh 446 @ </tr>
ce277ca… drh 447 @ </table>
ce277ca… drh 448 ;
ce277ca… drh 449
ce277ca… drh 450 /*
86db6fa… drh 451 ** Return the code used to generate the new ticket page
86db6fa… drh 452 */
86db6fa… drh 453 const char *ticket_newpage_code(void){
5b456cf… jan.nijtmans 454 return db_get("ticket-newpage", zDefaultNew);
86db6fa… drh 455 }
86db6fa… drh 456
86db6fa… drh 457 /*
ce277ca… drh 458 ** WEBPAGE: tktsetup_newpage
7ab0328… drh 459 ** Administrative page used to view or edit the TH1 script used
7ab0328… drh 460 ** to enter new tickets.
ce277ca… drh 461 */
ce277ca… drh 462 void tktsetup_newpage_page(void){
ce277ca… drh 463 static const char zDesc[] =
3243e63… drh 464 @ Enter HTML with embedded TH1 script that will render the "new ticket"
3243e63… drh 465 @ page
ce277ca… drh 466 ;
ce277ca… drh 467 tktsetup_generic(
ce277ca… drh 468 "HTML For New Tickets",
ce277ca… drh 469 "ticket-newpage",
ce277ca… drh 470 zDefaultNew,
ce277ca… drh 471 zDesc,
86db6fa… drh 472 0,
86db6fa… drh 473 0,
ce277ca… drh 474 40
ce277ca… drh 475 );
ce277ca… drh 476 }
ce277ca… drh 477
86db6fa… drh 478 static const char zDefaultView[] =
ce277ca… drh 479 @ <table cellpadding="5">
8ad5e46… wyoung 480 @ <tr><td class="tktDspLabel">Ticket&nbsp;Hash:</td>
4f8c897… drh 481 @ <th1>
636c334… mistachkin 482 @ if {[info exists tkt_uuid]} {
6908832… drh 483 @ html "<td class='tktDspValue' colspan='3'>"
e055942… drh 484 @ copybtn hash-tk 0 $tkt_uuid 2
636c334… mistachkin 485 @ if {[hascap s]} {
2116238… drh 486 @ puts " ($tkt_id)"
636c334… mistachkin 487 @ }
6908832… drh 488 @ html "</td></tr>\n"
4f8c897… drh 489 @ } else {
636c334… mistachkin 490 @ if {[hascap s]} {
636c334… mistachkin 491 @ html "<td class='tktDspValue' colspan='3'>Deleted "
636c334… mistachkin 492 @ html "(0)</td></tr>\n"
636c334… mistachkin 493 @ } else {
636c334… mistachkin 494 @ html "<td class='tktDspValue' colspan='3'>Deleted</td></tr>\n"
636c334… mistachkin 495 @ }
271a6bd… jkosche 496 @ }
271a6bd… jkosche 497 @
271a6bd… jkosche 498 @ if {[capexpr {n}]} {
f0a3025… drh 499 @ submenu link "Copy Ticket" $baseurl/tktnew/$tkt_uuid
a884fbb… drh 500 @ }
a884fbb… drh 501 @ if {[capexpr {nk}]} {
f0a3025… drh 502 @ submenu link "Edit Wiki" $baseurl/wikiedit?name=ticket/$tkt_uuid
4f8c897… drh 503 @ }
4f8c897… drh 504 @ </th1>
3243e63… drh 505 @ <tr><td class="tktDspLabel">Title:</td>
3243e63… drh 506 @ <td class="tktDspValue" colspan="3">
4f8c897… drh 507 @ $<title>
3243e63… drh 508 @ </td></tr>
3243e63… drh 509 @ <tr><td class="tktDspLabel">Status:</td><td class="tktDspValue">
ce277ca… drh 510 @ $<status>
49380d5… drh 511 @ </td>
3243e63… drh 512 @ <td class="tktDspLabel">Type:</td><td class="tktDspValue">
ce277ca… drh 513 @ $<type>
ce277ca… drh 514 @ </td></tr>
3243e63… drh 515 @ <tr><td class="tktDspLabel">Severity:</td><td class="tktDspValue">
ce277ca… drh 516 @ $<severity>
49380d5… drh 517 @ </td>
3243e63… drh 518 @ <td class="tktDspLabel">Priority:</td><td class="tktDspValue">
ce277ca… drh 519 @ $<priority>
ce277ca… drh 520 @ </td></tr>
3243e63… drh 521 @ <tr><td class="tktDspLabel">Subsystem:</td><td class="tktDspValue">
49380d5… drh 522 @ $<subsystem>
49380d5… drh 523 @ </td>
3243e63… drh 524 @ <td class="tktDspLabel">Resolution:</td><td class="tktDspValue">
ce277ca… drh 525 @ $<resolution>
ce277ca… drh 526 @ </td></tr>
3243e63… drh 527 @ <tr><td class="tktDspLabel">Last&nbsp;Modified:</td><td class="tktDspValue">
636c334… mistachkin 528 @ <th1>
636c334… mistachkin 529 @ if {[info exists tkt_datetime]} {
2116238… drh 530 @ puts $tkt_datetime
fab9f00… jkosche 531 @ }
fab9f00… jkosche 532 @ if {[info exists tkt_mage]} {
2116238… drh 533 @ html "<br>[htmlize $tkt_mage] ago"
636c334… mistachkin 534 @ }
636c334… mistachkin 535 @ </th1>
49380d5… drh 536 @ </td>
fab9f00… jkosche 537 @ <td class="tktDspLabel">Created:</td><td class="tktDspValue">
fab9f00… jkosche 538 @ <th1>
fab9f00… jkosche 539 @ if {[info exists tkt_datetime_creation]} {
2116238… drh 540 @ puts $tkt_datetime_creation
fab9f00… jkosche 541 @ }
fab9f00… jkosche 542 @ if {[info exists tkt_cage]} {
2116238… drh 543 @ html "<br>[htmlize $tkt_cage] ago"
fab9f00… jkosche 544 @ }
fab9f00… jkosche 545 @ </th1>
fab9f00… jkosche 546 @ </td></tr>
ce277ca… drh 547 @ <th1>enable_output [hascap e]</th1>
fab9f00… jkosche 548 @ <tr>
fab9f00… jkosche 549 @ <td class="tktDspLabel">Contact:</td><td class="tktDspValue" colspan="3">
21326fb… drh 550 @ $<private_contact>
49380d5… drh 551 @ </td>
fab9f00… jkosche 552 @ </tr>
ce277ca… drh 553 @ <th1>enable_output 1</th1>
3243e63… drh 554 @ <tr><td class="tktDspLabel">Version&nbsp;Found&nbsp;In:</td>
3243e63… drh 555 @ <td colspan="3" valign="top" class="tktDspValue">
fab9f00… jkosche 556 @ <th1>
fab9f00… jkosche 557 @ set versionlink ""
fab9f00… jkosche 558 @ set urlfoundin [httpize $foundin]
fab9f00… jkosche 559 @ set tagpattern {^[-0-9A-Za-z_\\.]+$}
fab9f00… jkosche 560 @ if [regexp $tagpattern $foundin] {
fab9f00… jkosche 561 @ query {SELECT count(*) AS match FROM tag
fab9f00… jkosche 562 @ WHERE tagname=concat('sym-',$foundin)} {
f1db9ea… jkosche 563 @ if {$match} {set versionlink "timeline?t=$urlfoundin"}
fab9f00… jkosche 564 @ }
fab9f00… jkosche 565 @ }
fab9f00… jkosche 566 @ set hashpattern {^[0-9a-f]+$}
fab9f00… jkosche 567 @ if [regexp $hashpattern $foundin] {
fab9f00… jkosche 568 @ set pattern $foundin*
fab9f00… jkosche 569 @ query {SELECT count(*) AS match FROM blob WHERE uuid GLOB $pattern} {
f1db9ea… jkosche 570 @ if {$match} {set versionlink "info/$urlfoundin"}
fab9f00… jkosche 571 @ }
fab9f00… jkosche 572 @ }
fab9f00… jkosche 573 @ if {$versionlink eq ""} {
fab9f00… jkosche 574 @ puts $foundin
fab9f00… jkosche 575 @ } else {
fab9f00… jkosche 576 @ html "<a href=\""
fab9f00… jkosche 577 @ puts $versionlink
fab9f00… jkosche 578 @ html "\">"
fab9f00… jkosche 579 @ puts $foundin
fab9f00… jkosche 580 @ html "</a>"
fab9f00… jkosche 581 @ }
fab9f00… jkosche 582 @ </th1>
3243e63… drh 583 @ </td></tr>
25f43cc… stephan 584 @ </table>
25f43cc… stephan 585 @
25f43cc… stephan 586 @ <th1>
25f43cc… stephan 587 @ wiki_assoc "ticket" $tkt_uuid
25f43cc… stephan 588 @ </th1>
3df526c… jan.nijtmans 589 @
25f43cc… stephan 590 @ <table cellpadding="5" style="min-width:100%">
4f8c897… drh 591 @ <th1>
636c334… mistachkin 592 @ if {[info exists comment]} {
636c334… mistachkin 593 @ if {[string length $comment]>10} {
636c334… mistachkin 594 @ html {
636c334… mistachkin 595 @ <tr><td class="tktDspLabel">Description:</td></tr>
636c334… mistachkin 596 @ <tr><td colspan="5" class="tktDspValue">
636c334… mistachkin 597 @ }
636c334… mistachkin 598 @ if {[info exists plaintext]} {
636c334… mistachkin 599 @ set r [randhex]
636c334… mistachkin 600 @ wiki "<verbatim-$r links>\n$comment\n</verbatim-$r>"
636c334… mistachkin 601 @ } else {
636c334… mistachkin 602 @ wiki $comment
636c334… mistachkin 603 @ }
4f8c897… drh 604 @ }
4f8c897… drh 605 @ }
4f8c897… drh 606 @ set seenRow 0
4f8c897… drh 607 @ set alwaysPlaintext [info exists plaintext]
2a39681… stephan 608 @ query {SELECT datetime(tkt_mtime,toLocal()) AS xdate, login AS xlogin,
4f8c897… drh 609 @ mimetype as xmimetype, icomment AS xcomment,
4f8c897… drh 610 @ username AS xusername
4f8c897… drh 611 @ FROM ticketchng
ee40fcb… drh 612 @ WHERE tkt_id=$tkt_id AND length(icomment)>0} {
4f8c897… drh 613 @ if {$seenRow} {
f5482a0… wyoung 614 @ html "<hr>\n"
4f8c897… drh 615 @ } else {
fab9f00… jkosche 616 @ html "<tr><td class='tktDspLabel' style='text-align:left'>\n"
fab9f00… jkosche 617 @ html "User Comments:</td></tr>\n"
cc09064… stephan 618 @ html "<tr><td colspan='5' class='tktDspValue'><div class='tktCommentArea'>\n"
4f8c897… drh 619 @ set seenRow 1
4f8c897… drh 620 @ }
cc09064… stephan 621 @ html "<div class='tktCommentEntry'>"
9f53093… stephan 622 @ html "<span class='tktDspCommenter'>"
2116238… drh 623 @ puts $xlogin
4f8c897… drh 624 @ if {$xlogin ne $xusername && [string length $xusername]>0} {
2116238… drh 625 @ puts " (claiming to be $xusername)"
4f8c897… drh 626 @ }
2116238… drh 627 @ puts " added on $xdate:"
9f53093… stephan 628 @ html "</span>\n"
4f8c897… drh 629 @ if {$alwaysPlaintext || $xmimetype eq "text/plain"} {
4f8c897… drh 630 @ set r [randhex]
2116238… drh 631 @ if {$xmimetype ne "text/plain"} {puts "($xmimetype)\n"}
4f8c897… drh 632 @ wiki "<verbatim-$r>[string trimright $xcomment]</verbatim-$r>\n"
4f8c897… drh 633 @ } elseif {$xmimetype eq "text/x-fossil-wiki"} {
4f8c897… drh 634 @ wiki "<p>\n[string trimright $xcomment]\n</p>\n"
16fb915… drh 635 @ } elseif {$xmimetype eq "text/x-markdown"} {
16fb915… drh 636 @ html [lindex [markdown $xcomment] 1]
4f8c897… drh 637 @ } elseif {$xmimetype eq "text/html"} {
4f8c897… drh 638 @ wiki "<p><nowiki>\n[string trimright $xcomment]\n</nowiki>\n"
4f8c897… drh 639 @ } else {
4f8c897… drh 640 @ set r [randhex]
4f8c897… drh 641 @ wiki "<verbatim-$r links>[string trimright $xcomment]</verbatim-$r>\n"
4f8c897… drh 642 @ }
cc09064… stephan 643 @ html "</div>"; # .tktCommentEntry
4f8c897… drh 644 @ }
cc09064… stephan 645 @ if {$seenRow} {html "</div></td></tr>\n"}
4f8c897… drh 646 @ </th1>
ce277ca… drh 647 @ </table>
ce277ca… drh 648 ;
ce277ca… drh 649
ce277ca… drh 650
ce277ca… drh 651 /*
86db6fa… drh 652 ** Return the code used to generate the view ticket page
86db6fa… drh 653 */
86db6fa… drh 654 const char *ticket_viewpage_code(void){
5b456cf… jan.nijtmans 655 return db_get("ticket-viewpage", zDefaultView);
86db6fa… drh 656 }
86db6fa… drh 657
86db6fa… drh 658 /*
ce277ca… drh 659 ** WEBPAGE: tktsetup_viewpage
7ab0328… drh 660 ** Administrative page used to view or edit the TH1 script that
7ab0328… drh 661 ** displays individual tickets.
ce277ca… drh 662 */
ce277ca… drh 663 void tktsetup_viewpage_page(void){
ce277ca… drh 664 static const char zDesc[] =
3243e63… drh 665 @ Enter HTML with embedded TH1 script that will render the "view ticket" page
ce277ca… drh 666 ;
ce277ca… drh 667 tktsetup_generic(
ce277ca… drh 668 "HTML For Viewing Tickets",
ce277ca… drh 669 "ticket-viewpage",
ce277ca… drh 670 zDefaultView,
ce277ca… drh 671 zDesc,
86db6fa… drh 672 0,
86db6fa… drh 673 0,
ce277ca… drh 674 40
ce277ca… drh 675 );
ce277ca… drh 676 }
ce277ca… drh 677
86db6fa… drh 678 static const char zDefaultEdit[] =
ce277ca… drh 679 @ <th1>
16fb915… drh 680 @ if {![info exists mutype]} {set mutype Markdown}
4f8c897… drh 681 @ if {![info exists icomment]} {set icomment {}}
ce277ca… drh 682 @ if {![info exists username]} {set username $login}
ce277ca… drh 683 @ if {[info exists submit]} {
4f8c897… drh 684 @ if {$mutype eq "Wiki"} {
4f8c897… drh 685 @ set mimetype text/x-fossil-wiki
16fb915… drh 686 @ } elseif {$mutype eq "Markdown"} {
16fb915… drh 687 @ set mimetype text/x-markdown
4f8c897… drh 688 @ } elseif {$mutype eq "HTML"} {
4f8c897… drh 689 @ set mimetype text/html
4f8c897… drh 690 @ } elseif {$mutype eq {[links only]}} {
4f8c897… drh 691 @ set mimetype text/x-fossil-plain
4f8c897… drh 692 @ } else {
4f8c897… drh 693 @ set mimetype text/plain
ce277ca… drh 694 @ }
ce277ca… drh 695 @ submit_ticket
28faff0… drh 696 @ set preview 1
ce277ca… drh 697 @ }
ce277ca… drh 698 @ </th1>
ce277ca… drh 699 @ <table cellpadding="5">
3243e63… drh 700 @ <tr><td class="tktDspLabel">Title:</td><td>
f5482a0… wyoung 701 @ <input type="text" name="title" value="$<title>" size="60">
ce277ca… drh 702 @ </td></tr>
3df526c… jan.nijtmans 703 @
3243e63… drh 704 @ <tr><td class="tktDspLabel">Status:</td><td>
ce277ca… drh 705 @ <th1>combobox status $status_choices 1</th1>
ce277ca… drh 706 @ </td></tr>
3df526c… jan.nijtmans 707 @
3243e63… drh 708 @ <tr><td class="tktDspLabel">Type:</td><td>
ce277ca… drh 709 @ <th1>combobox type $type_choices 1</th1>
ce277ca… drh 710 @ </td></tr>
3df526c… jan.nijtmans 711 @
3243e63… drh 712 @ <tr><td class="tktDspLabel">Severity:</td><td>
ce277ca… drh 713 @ <th1>combobox severity $severity_choices 1</th1>
ce277ca… drh 714 @ </td></tr>
3df526c… jan.nijtmans 715 @
3243e63… drh 716 @ <tr><td class="tktDspLabel">Priority:</td><td>
ce277ca… drh 717 @ <th1>combobox priority $priority_choices 1</th1>
ce277ca… drh 718 @ </td></tr>
3df526c… jan.nijtmans 719 @
3243e63… drh 720 @ <tr><td class="tktDspLabel">Resolution:</td><td>
ce277ca… drh 721 @ <th1>combobox resolution $resolution_choices 1</th1>
ce277ca… drh 722 @ </td></tr>
3df526c… jan.nijtmans 723 @
3243e63… drh 724 @ <tr><td class="tktDspLabel">Subsystem:</td><td>
ce277ca… drh 725 @ <th1>combobox subsystem $subsystem_choices 1</th1>
ce277ca… drh 726 @ </td></tr>
3df526c… jan.nijtmans 727 @
ce277ca… drh 728 @ <th1>enable_output [hascap e]</th1>
3243e63… drh 729 @ <tr><td class="tktDspLabel">Contact:</td><td>
21326fb… drh 730 @ <input type="text" name="private_contact" size="40"
f5482a0… wyoung 731 @ value="$<private_contact>">
4f8c897… drh 732 @ </td></tr>
4f8c897… drh 733 @ <th1>enable_output 1</th1>
3df526c… jan.nijtmans 734 @
4f8c897… drh 735 @ <tr><td class="tktDspLabel">Version&nbsp;Found&nbsp;In:</td><td>
f5482a0… wyoung 736 @ <input type="text" name="foundin" size="50" value="$<foundin>">
4f8c897… drh 737 @ </td></tr>
3df526c… jan.nijtmans 738 @
4f8c897… drh 739 @ <tr><td colspan="2">
4f8c897… drh 740 @ Append Remark with format
16fb915… drh 741 @ <th1>combobox mutype {HTML {[links only]} Markdown {Plain Text} Wiki} 1</th1>
4f8c897… drh 742 @ from
f5482a0… wyoung 743 @ <input type="text" name="username" value="$<username>" size="30">:<br>
4f8c897… drh 744 @ <textarea name="icomment" cols="80" rows="15"
4f8c897… drh 745 @ wrap="virtual" class="wikiedit">$<icomment></textarea>
4f8c897… drh 746 @ </td></tr>
3df526c… jan.nijtmans 747 @
4f8c897… drh 748 @ <th1>enable_output [info exists preview]</th1>
4f8c897… drh 749 @ <tr><td colspan="2">
f5482a0… wyoung 750 @ Description Preview:<br><hr>
4f8c897… drh 751 @ <th1>
4f8c897… drh 752 @ if {$mutype eq "Wiki"} {
4f8c897… drh 753 @ wiki $icomment
4f8c897… drh 754 @ } elseif {$mutype eq "Plain Text"} {
4f8c897… drh 755 @ set r [randhex]
4f8c897… drh 756 @ wiki "<verbatim-$r>\n[string trimright $icomment]\n</verbatim-$r>"
16fb915… drh 757 @ } elseif {$mutype eq "Markdown"} {
16fb915… drh 758 @ html [lindex [markdown "$icomment\n"] 1]
4f8c897… drh 759 @ } elseif {$mutype eq {[links only]}} {
4f8c897… drh 760 @ set r [randhex]
4f8c897… drh 761 @ wiki "<verbatim-$r links>\n[string trimright $icomment]</verbatim-$r>"
4f8c897… drh 762 @ } else {
4f8c897… drh 763 @ wiki "<nowiki>\n[string trimright $icomment]\n</nowiki>"
4f8c897… drh 764 @ }
4f8c897… drh 765 @ </th1>
f5482a0… wyoung 766 @ <hr>
4f8c897… drh 767 @ </td></tr>
4f8c897… drh 768 @ <th1>enable_output 1</th1>
3df526c… jan.nijtmans 769 @
4f8c897… drh 770 @ <tr>
4f8c897… drh 771 @ <td align="right">
f5482a0… wyoung 772 @ <input type="submit" name="preview" value="Preview">
4f8c897… drh 773 @ </td>
4f8c897… drh 774 @ <td align="left">See how the description will appear after formatting.</td>
4f8c897… drh 775 @ </tr>
3df526c… jan.nijtmans 776 @
4f8c897… drh 777 @ <th1>enable_output [info exists preview]</th1>
4f8c897… drh 778 @ <tr>
4f8c897… drh 779 @ <td align="right">
f5482a0… wyoung 780 @ <input type="submit" name="submit" value="Submit">
4f8c897… drh 781 @ </td>
4f8c897… drh 782 @ <td align="left">Apply the changes shown above</td>
4f8c897… drh 783 @ </tr>
4f8c897… drh 784 @ <th1>enable_output 1</th1>
3df526c… jan.nijtmans 785 @
4f8c897… drh 786 @ <tr>
4f8c897… drh 787 @ <td align="right">
f5482a0… wyoung 788 @ <input type="submit" name="cancel" value="Cancel">
4f8c897… drh 789 @ </td>
4f8c897… drh 790 @ <td>Abandon this edit</td>
4f8c897… drh 791 @ </tr>
f5482a0… wyoung 792 @
fab9f00… jkosche 793 @ <th1>
fab9f00… jkosche 794 @ set seenRow 0
fab9f00… jkosche 795 @ set alwaysPlaintext [info exists plaintext]
2a39681… stephan 796 @ query {SELECT datetime(tkt_mtime,toLocal()) AS xdate, login AS xlogin,
fab9f00… jkosche 797 @ mimetype as xmimetype, icomment AS xcomment,
fab9f00… jkosche 798 @ username AS xusername
fab9f00… jkosche 799 @ FROM ticketchng
fab9f00… jkosche 800 @ WHERE tkt_id=$tkt_id AND length(icomment)>0} {
fab9f00… jkosche 801 @ if {$seenRow} {
fab9f00… jkosche 802 @ html "<hr>\n"
fab9f00… jkosche 803 @ } else {
fab9f00… jkosche 804 @ html "<tr><td colspan='2'><hr></td></tr>\n"
fab9f00… jkosche 805 @ html "<tr><td colspan='2' class='tktDspLabel' style='text-align:left'>\n"
fab9f00… jkosche 806 @ html "Previous User Comments:</td></tr>\n"
cc09064… stephan 807 @ html "<tr><td colspan='2' class='tktDspValue'><div class='tktCommentArea'>\n"
fab9f00… jkosche 808 @ set seenRow 1
fab9f00… jkosche 809 @ }
cc09064… stephan 810 @ html "<div class='tktCommentEntry'>"
fab9f00… jkosche 811 @ html "<span class='tktDspCommenter'>"
2116238… drh 812 @ puts $xlogin
fab9f00… jkosche 813 @ if {$xlogin ne $xusername && [string length $xusername]>0} {
2116238… drh 814 @ puts " (claiming to be $xusername)"
fab9f00… jkosche 815 @ }
2116238… drh 816 @ puts " added on $xdate:"
fab9f00… jkosche 817 @ html "</span>\n"
fab9f00… jkosche 818 @ if {$alwaysPlaintext || $xmimetype eq "text/plain"} {
fab9f00… jkosche 819 @ set r [randhex]
2116238… drh 820 @ if {$xmimetype ne "text/plain"} {puts "($xmimetype)\n"}
fab9f00… jkosche 821 @ wiki "<verbatim-$r>[string trimright $xcomment]</verbatim-$r>\n"
fab9f00… jkosche 822 @ } elseif {$xmimetype eq "text/x-fossil-wiki"} {
fab9f00… jkosche 823 @ wiki "<p>\n[string trimright $xcomment]\n</p>\n"
fab9f00… jkosche 824 @ } elseif {$xmimetype eq "text/x-markdown"} {
fab9f00… jkosche 825 @ html [lindex [markdown $xcomment] 1]
fab9f00… jkosche 826 @ } elseif {$xmimetype eq "text/html"} {
fab9f00… jkosche 827 @ wiki "<p><nowiki>\n[string trimright $xcomment]\n</nowiki>\n"
fab9f00… jkosche 828 @ } else {
fab9f00… jkosche 829 @ set r [randhex]
fab9f00… jkosche 830 @ wiki "<verbatim-$r links>[string trimright $xcomment]</verbatim-$r>\n"
fab9f00… jkosche 831 @ }
cc09064… stephan 832 @ html "</div>"; # .tktCommentEntry
fab9f00… jkosche 833 @ }
cc09064… stephan 834 @ if {$seenRow} {html "</div></td></tr>\n"}
fab9f00… jkosche 835 @ </th1>
fab9f00… jkosche 836 @
ce277ca… drh 837 @ </table>
ce277ca… drh 838 ;
ce277ca… drh 839
ce277ca… drh 840 /*
86db6fa… drh 841 ** Return the code used to generate the edit ticket page
86db6fa… drh 842 */
86db6fa… drh 843 const char *ticket_editpage_code(void){
5b456cf… jan.nijtmans 844 return db_get("ticket-editpage", zDefaultEdit);
86db6fa… drh 845 }
86db6fa… drh 846
86db6fa… drh 847 /*
ce277ca… drh 848 ** WEBPAGE: tktsetup_editpage
7ab0328… drh 849 ** Administrative page for viewing or editing the TH1 script that
7ab0328… drh 850 ** drives the ticket editing page.
ce277ca… drh 851 */
ce277ca… drh 852 void tktsetup_editpage_page(void){
ce277ca… drh 853 static const char zDesc[] =
3243e63… drh 854 @ Enter HTML with embedded TH1 script that will render the "edit ticket" page
ce277ca… drh 855 ;
ce277ca… drh 856 tktsetup_generic(
ce277ca… drh 857 "HTML For Editing Tickets",
ce277ca… drh 858 "ticket-editpage",
ce277ca… drh 859 zDefaultEdit,
ce277ca… drh 860 zDesc,
86db6fa… drh 861 0,
86db6fa… drh 862 0,
86db6fa… drh 863 40
86db6fa… drh 864 );
49380d5… drh 865 }
49380d5… drh 866
49380d5… drh 867 /*
14253e9… jeremy_c 868 ** The default report list page
14253e9… jeremy_c 869 */
14253e9… jeremy_c 870 static const char zDefaultReportList[] =
14253e9… jeremy_c 871 @ <th1>
653dd40… drh 872 @ if {[anoncap n]} {
14253e9… jeremy_c 873 @ html "<p>Enter a new ticket:</p>"
14253e9… jeremy_c 874 @ html "<ul><li><a href='tktnew'>New ticket</a></li></ul>"
14253e9… jeremy_c 875 @ }
14253e9… jeremy_c 876 @ </th1>
3df526c… jan.nijtmans 877 @
14253e9… jeremy_c 878 @ <p>Choose a report format from the following list:</p>
14253e9… jeremy_c 879 @ <ol>
14253e9… jeremy_c 880 @ <th1>html $report_items</th1>
14253e9… jeremy_c 881 @ </ol>
3df526c… jan.nijtmans 882 @
14253e9… jeremy_c 883 @ <th1>
653dd40… drh 884 @ if {[anoncap t q]} {
ba418ee… drh 885 @ html "<p>Other options:</p>\n<ul>\n"
653dd40… drh 886 @ if {[anoncap t]} {
ba418ee… drh 887 @ html "<li><a href='rptnew'>New report format</a></li>\n"
ba418ee… drh 888 @ }
653dd40… drh 889 @ if {[anoncap q]} {
ba418ee… drh 890 @ html "<li><a href='modreq'>Tend to pending moderation requests</a></li>\n"
ba418ee… drh 891 @ }
14253e9… jeremy_c 892 @ }
14253e9… jeremy_c 893 @ </th1>
14253e9… jeremy_c 894 ;
14253e9… jeremy_c 895
14253e9… jeremy_c 896 /*
14253e9… jeremy_c 897 ** Return the code used to generate the report list
14253e9… jeremy_c 898 */
14253e9… jeremy_c 899 const char *ticket_reportlist_code(void){
5b456cf… jan.nijtmans 900 return db_get("ticket-reportlist", zDefaultReportList);
14253e9… jeremy_c 901 }
14253e9… jeremy_c 902
14253e9… jeremy_c 903 /*
14253e9… jeremy_c 904 ** WEBPAGE: tktsetup_reportlist
7ab0328… drh 905 ** Administrative page used to view or edit the TH1 script that
7ab0328… drh 906 ** defines the "report list" page.
14253e9… jeremy_c 907 */
14253e9… jeremy_c 908 void tktsetup_reportlist(void){
14253e9… jeremy_c 909 static const char zDesc[] =
3243e63… drh 910 @ Enter HTML with embedded TH1 script that will render the "report list" page
14253e9… jeremy_c 911 ;
14253e9… jeremy_c 912 tktsetup_generic(
14253e9… jeremy_c 913 "HTML For Report List",
14253e9… jeremy_c 914 "ticket-reportlist",
14253e9… jeremy_c 915 zDefaultReportList,
14253e9… jeremy_c 916 zDesc,
14253e9… jeremy_c 917 0,
14253e9… jeremy_c 918 0,
14253e9… jeremy_c 919 40
14253e9… jeremy_c 920 );
14253e9… jeremy_c 921 }
14253e9… jeremy_c 922
14253e9… jeremy_c 923 /*
49380d5… drh 924 ** The default template ticket report format:
49380d5… drh 925 */
3df526c… jan.nijtmans 926 static char zDefaultReport[] =
49380d5… drh 927 @ SELECT
49380d5… drh 928 @ CASE WHEN status IN ('Open','Verified') THEN '#f2dcdc'
49380d5… drh 929 @ WHEN status='Review' THEN '#e8e8e8'
49380d5… drh 930 @ WHEN status='Fixed' THEN '#cfe8bd'
49380d5… drh 931 @ WHEN status='Tested' THEN '#bde5d6'
49380d5… drh 932 @ WHEN status='Deferred' THEN '#cacae5'
49380d5… drh 933 @ ELSE '#c8c8c8' END AS 'bgcolor',
49380d5… drh 934 @ substr(tkt_uuid,1,10) AS '#',
2a39681… stephan 935 @ datetime(tkt_ctime,toLocal()) AS 'created',
2a39681… stephan 936 @ datetime(tkt_mtime,toLocal()) AS 'modified',
49380d5… drh 937 @ type,
49380d5… drh 938 @ status,
49380d5… drh 939 @ subsystem,
49380d5… drh 940 @ title,
49380d5… drh 941 @ comment AS '_comments'
49380d5… drh 942 @ FROM ticket
49380d5… drh 943 ;
49380d5… drh 944
49380d5… drh 945
49380d5… drh 946 /*
49380d5… drh 947 ** Return the template ticket report format:
49380d5… drh 948 */
49380d5… drh 949 char *ticket_report_template(void){
49380d5… drh 950 return db_get("ticket-report-template", zDefaultReport);
49380d5… drh 951 }
49380d5… drh 952
49380d5… drh 953 /*
49380d5… drh 954 ** WEBPAGE: tktsetup_rpttplt
7ab0328… drh 955 **
7ab0328… drh 956 ** Administrative page used to view or edit the ticket report
7ab0328… drh 957 ** template.
49380d5… drh 958 */
49380d5… drh 959 void tktsetup_rpttplt_page(void){
49380d5… drh 960 static const char zDesc[] =
3243e63… drh 961 @ Enter the default ticket report format template. This is the
b00e462… andreask 962 @ template report format that initially appears when creating a
3243e63… drh 963 @ new ticket summary report.
49380d5… drh 964 ;
49380d5… drh 965 tktsetup_generic(
49380d5… drh 966 "Default Report Template",
49380d5… drh 967 "ticket-report-template",
49380d5… drh 968 zDefaultReport,
49380d5… drh 969 zDesc,
49380d5… drh 970 0,
49380d5… drh 971 0,
49380d5… drh 972 20
49380d5… drh 973 );
49380d5… drh 974 }
49380d5… drh 975
49380d5… drh 976 /*
49380d5… drh 977 ** The default template ticket key:
49380d5… drh 978 */
3df526c… jan.nijtmans 979 static const char zDefaultKey[] =
49380d5… drh 980 @ #ffffff Key:
49380d5… drh 981 @ #f2dcdc Active
49380d5… drh 982 @ #e8e8e8 Review
49380d5… drh 983 @ #cfe8bd Fixed
49380d5… drh 984 @ #bde5d6 Tested
49380d5… drh 985 @ #cacae5 Deferred
49380d5… drh 986 @ #c8c8c8 Closed
49380d5… drh 987 ;
49380d5… drh 988
49380d5… drh 989
49380d5… drh 990 /*
49380d5… drh 991 ** Return the template ticket report format:
49380d5… drh 992 */
49380d5… drh 993 const char *ticket_key_template(void){
5b456cf… jan.nijtmans 994 return db_get("ticket-key-template", zDefaultKey);
49380d5… drh 995 }
49380d5… drh 996
49380d5… drh 997 /*
49380d5… drh 998 ** WEBPAGE: tktsetup_keytplt
7ab0328… drh 999 **
7ab0328… drh 1000 ** Administrative page used to view or edit the Key template
7ab0328… drh 1001 ** for tickets.
49380d5… drh 1002 */
49380d5… drh 1003 void tktsetup_keytplt_page(void){
49380d5… drh 1004 static const char zDesc[] =
3243e63… drh 1005 @ Enter the default ticket report color-key template. This is the
b7588eb… drh 1006 @ the color-key that initially appears when creating a
3243e63… drh 1007 @ new ticket summary report.
49380d5… drh 1008 ;
49380d5… drh 1009 tktsetup_generic(
b7588eb… drh 1010 "Default Report Color-Key Template",
b7588eb… drh 1011 "ticket-key-template",
b7588eb… drh 1012 zDefaultKey,
49380d5… drh 1013 zDesc,
49380d5… drh 1014 0,
49380d5… drh 1015 0,
b7588eb… drh 1016 10
49380d5… drh 1017 );
ac3f1f2… drh 1018 }
ac3f1f2… drh 1019
ac3f1f2… drh 1020 /*
ac3f1f2… drh 1021 ** WEBPAGE: tktsetup_timeline
7ab0328… drh 1022 **
e2bdc10… danield 1023 ** Administrative page used to configure how tickets are
7ab0328… drh 1024 ** rendered on timeline views.
ac3f1f2… drh 1025 */
ac3f1f2… drh 1026 void tktsetup_timeline_page(void){
ac3f1f2… drh 1027 login_check_credentials();
b344d3c… drh 1028 if( !g.perm.Setup ){
653dd40… drh 1029 login_needed(0);
653dd40… drh 1030 return;
ac3f1f2… drh 1031 }
ac3f1f2… drh 1032
ac3f1f2… drh 1033 if( P("setup") ){
ac3f1f2… drh 1034 cgi_redirect("tktsetup");
ac3f1f2… drh 1035 }
112c713… drh 1036 style_set_current_feature("tktsetup");
ac3f1f2… drh 1037 style_header("Ticket Display On Timelines");
e1962ef… drh 1038 db_begin_transaction();
a40e8a0… drh 1039 @ <form action="%R/tktsetup_timeline" method="post"><div>
0be5482… drh 1040 login_insert_csrf_secret();
0be5482… drh 1041
f5482a0… wyoung 1042 @ <hr>
10d8abc… jan.nijtmans 1043 entry_attribute("Ticket Title", 40, "ticket-title-expr", "t",
10d8abc… jan.nijtmans 1044 "title", 0);
0be5482… drh 1045 @ <p>An SQL expression in a query against the TICKET table that will
d725f61… drh 1046 @ return the title of the ticket for display purposes.
d725f61… drh 1047 @ (Property: ticket-title-expr)</p>
f0c8693… drh 1048
f5482a0… wyoung 1049 @ <hr>
10d8abc… jan.nijtmans 1050 entry_attribute("Ticket Status", 40, "ticket-status-column", "s",
10d8abc… jan.nijtmans 1051 "status", 0);
f0c8693… drh 1052 @ <p>The name of the column in the TICKET table that contains the ticket
d725f61… drh 1053 @ status in human-readable form. Case sensitive.
d725f61… drh 1054 @ (Property: ticket-status-column)</p>
ac3f1f2… drh 1055
f5482a0… wyoung 1056 @ <hr>
ac3f1f2… drh 1057 entry_attribute("Ticket Closed", 40, "ticket-closed-expr", "c",
10d8abc… jan.nijtmans 1058 "status='Closed'", 0);
10d8abc… jan.nijtmans 1059 @ <p>An SQL expression that evaluates to true in a TICKET table query if
d725f61… drh 1060 @ the ticket is closed.
d725f61… drh 1061 @ (Property: ticket-closed-expr)</p>
10d8abc… jan.nijtmans 1062
f5482a0… wyoung 1063 @ <hr>
10d8abc… jan.nijtmans 1064 @ <p>
f5482a0… wyoung 1065 @ <input type="submit" name="submit" value="Apply Changes">
f5482a0… wyoung 1066 @ <input type="submit" name="setup" value="Cancel">
ac3f1f2… drh 1067 @ </p>
3243e63… drh 1068 @ </div></form>
ac3f1f2… drh 1069 db_end_transaction(0);
fab9f00… jkosche 1070 style_submenu_element("Back", "%R/tktsetup");
112c713… drh 1071 style_finish_page();
3df526c… jan.nijtmans 1072
d0305b3… aku 1073 }

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button