Fossil SCM

Incremental work on tickets and especially ticket configuration.

drh 2008-05-25 19:36 trunk
Commit ce277caddac488a112e53841b93cc31bdcfd7468
3 files changed +19 -17 +1 -1 +412 -2
+19 -17
--- src/report.c
+++ src/report.c
@@ -676,11 +676,11 @@
676676
char **azArg, /* Text of data in all columns */
677677
char **azName /* Names of the columns */
678678
){
679679
struct GenerateHTML *pState = (struct GenerateHTML*)pUser;
680680
int i;
681
- int tn; /* Ticket number. (value of column named '#') */
681
+ const char *zTid; /* Ticket UUID. (value of column named '#') */
682682
int rn; /* Report number */
683683
char *zBg = 0; /* Use this background color */
684684
char zPage[30]; /* Text version of the ticket number */
685685
686686
/* Get the report number
@@ -717,30 +717,29 @@
717717
}
718718
719719
/* The first time this routine is called, output a table header
720720
*/
721721
@ <tr>
722
- tn = -1;
722
+ zTid = 0;
723723
for(i=0; i<nArg; i++){
724724
char *zName = azName[i];
725725
if( i==pState->iBg ) continue;
726726
if( pState->iNewRow>=0 && i>=pState->iNewRow ){
727
- if( g.okWrite && tn>=0 ){
727
+ if( g.okWrite && zTid ){
728728
@ <th>&nbsp;</th>
729
- tn = -1;
729
+ zTid = 0;
730730
}
731731
if( zName[0]=='_' ) zName++;
732732
@ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
733733
}else{
734734
if( zName[0]=='#' ){
735
- tn = i;
736
- }else{
737
- @ <th>%h(zName)</th>
735
+ zTid = zName;
738736
}
737
+ @ <th>%h(zName)</th>
739738
}
740739
}
741
- if( g.okWrite && tn>=0 ){
740
+ if( g.okWrite && zTid ){
742741
@ <th>&nbsp;</th>
743742
}
744743
@ </tr>
745744
}
746745
if( azArg==0 ){
@@ -761,39 +760,42 @@
761760
/* Output the data for this entry from the database
762761
*/
763762
zBg = pState->iBg>=0 ? azArg[pState->iBg] : 0;
764763
if( zBg==0 ) zBg = "white";
765764
@ <tr bgcolor="%h(zBg)">
766
- tn = 0;
765
+ zTid = 0;
767766
zPage[0] = 0;
768767
for(i=0; i<nArg; i++){
769768
char *zData;
770769
if( i==pState->iBg ) continue;
771770
zData = azArg[i];
772771
if( zData==0 ) zData = "";
773772
if( pState->iNewRow>=0 && i>=pState->iNewRow ){
774
- if( tn>0 && g.okWrite ){
775
- @ <td valign="top"><a href="tktedit?tn=%d(tn),%d(rn)">edit</a></td>
776
- tn = 0;
773
+ if( zTid && g.okWrite ){
774
+ @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
775
+ zTid = 0;
777776
}
778777
if( zData[0] ){
778
+ Blob content;
779779
@ </tr><tr bgcolor="%h(zBg)"><td colspan=%d(pState->nCol)>
780
- @ %h(zData)
780
+ blob_init(&content, zData, -1);
781
+ wiki_convert(&content, 0, 0);
782
+ blob_reset(&content);
781783
}
782784
}else if( azName[i][0]=='#' ){
783
- tn = atoi(zData);
784
- @ <td valign="top"><a href="tktview?tn=%d(tn),%d(rn)">%h(zData)</a></td>
785
+ zTid = zData;
786
+ @ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
785787
}else if( zData[0]==0 ){
786788
@ <td valign="top">&nbsp;</td>
787789
}else{
788790
@ <td valign="top">
789791
@ %h(zData)
790792
@ </td>
791793
}
792794
}
793
- if( tn>0 && g.okWrite ){
794
- @ <td valign="top"><a href="tktedit?tn=%d(tn),%d(rn)">edit</a></td>
795
+ if( zTid && g.okWrite ){
796
+ @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
795797
}
796798
@ </tr>
797799
return 0;
798800
}
799801
800802
--- src/report.c
+++ src/report.c
@@ -676,11 +676,11 @@
676 char **azArg, /* Text of data in all columns */
677 char **azName /* Names of the columns */
678 ){
679 struct GenerateHTML *pState = (struct GenerateHTML*)pUser;
680 int i;
681 int tn; /* Ticket number. (value of column named '#') */
682 int rn; /* Report number */
683 char *zBg = 0; /* Use this background color */
684 char zPage[30]; /* Text version of the ticket number */
685
686 /* Get the report number
@@ -717,30 +717,29 @@
717 }
718
719 /* The first time this routine is called, output a table header
720 */
721 @ <tr>
722 tn = -1;
723 for(i=0; i<nArg; i++){
724 char *zName = azName[i];
725 if( i==pState->iBg ) continue;
726 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
727 if( g.okWrite && tn>=0 ){
728 @ <th>&nbsp;</th>
729 tn = -1;
730 }
731 if( zName[0]=='_' ) zName++;
732 @ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
733 }else{
734 if( zName[0]=='#' ){
735 tn = i;
736 }else{
737 @ <th>%h(zName)</th>
738 }
 
739 }
740 }
741 if( g.okWrite && tn>=0 ){
742 @ <th>&nbsp;</th>
743 }
744 @ </tr>
745 }
746 if( azArg==0 ){
@@ -761,39 +760,42 @@
761 /* Output the data for this entry from the database
762 */
763 zBg = pState->iBg>=0 ? azArg[pState->iBg] : 0;
764 if( zBg==0 ) zBg = "white";
765 @ <tr bgcolor="%h(zBg)">
766 tn = 0;
767 zPage[0] = 0;
768 for(i=0; i<nArg; i++){
769 char *zData;
770 if( i==pState->iBg ) continue;
771 zData = azArg[i];
772 if( zData==0 ) zData = "";
773 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
774 if( tn>0 && g.okWrite ){
775 @ <td valign="top"><a href="tktedit?tn=%d(tn),%d(rn)">edit</a></td>
776 tn = 0;
777 }
778 if( zData[0] ){
 
779 @ </tr><tr bgcolor="%h(zBg)"><td colspan=%d(pState->nCol)>
780 @ %h(zData)
 
 
781 }
782 }else if( azName[i][0]=='#' ){
783 tn = atoi(zData);
784 @ <td valign="top"><a href="tktview?tn=%d(tn),%d(rn)">%h(zData)</a></td>
785 }else if( zData[0]==0 ){
786 @ <td valign="top">&nbsp;</td>
787 }else{
788 @ <td valign="top">
789 @ %h(zData)
790 @ </td>
791 }
792 }
793 if( tn>0 && g.okWrite ){
794 @ <td valign="top"><a href="tktedit?tn=%d(tn),%d(rn)">edit</a></td>
795 }
796 @ </tr>
797 return 0;
798 }
799
800
--- src/report.c
+++ src/report.c
@@ -676,11 +676,11 @@
676 char **azArg, /* Text of data in all columns */
677 char **azName /* Names of the columns */
678 ){
679 struct GenerateHTML *pState = (struct GenerateHTML*)pUser;
680 int i;
681 const char *zTid; /* Ticket UUID. (value of column named '#') */
682 int rn; /* Report number */
683 char *zBg = 0; /* Use this background color */
684 char zPage[30]; /* Text version of the ticket number */
685
686 /* Get the report number
@@ -717,30 +717,29 @@
717 }
718
719 /* The first time this routine is called, output a table header
720 */
721 @ <tr>
722 zTid = 0;
723 for(i=0; i<nArg; i++){
724 char *zName = azName[i];
725 if( i==pState->iBg ) continue;
726 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
727 if( g.okWrite && zTid ){
728 @ <th>&nbsp;</th>
729 zTid = 0;
730 }
731 if( zName[0]=='_' ) zName++;
732 @ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
733 }else{
734 if( zName[0]=='#' ){
735 zTid = zName;
 
 
736 }
737 @ <th>%h(zName)</th>
738 }
739 }
740 if( g.okWrite && zTid ){
741 @ <th>&nbsp;</th>
742 }
743 @ </tr>
744 }
745 if( azArg==0 ){
@@ -761,39 +760,42 @@
760 /* Output the data for this entry from the database
761 */
762 zBg = pState->iBg>=0 ? azArg[pState->iBg] : 0;
763 if( zBg==0 ) zBg = "white";
764 @ <tr bgcolor="%h(zBg)">
765 zTid = 0;
766 zPage[0] = 0;
767 for(i=0; i<nArg; i++){
768 char *zData;
769 if( i==pState->iBg ) continue;
770 zData = azArg[i];
771 if( zData==0 ) zData = "";
772 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
773 if( zTid && g.okWrite ){
774 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
775 zTid = 0;
776 }
777 if( zData[0] ){
778 Blob content;
779 @ </tr><tr bgcolor="%h(zBg)"><td colspan=%d(pState->nCol)>
780 blob_init(&content, zData, -1);
781 wiki_convert(&content, 0, 0);
782 blob_reset(&content);
783 }
784 }else if( azName[i][0]=='#' ){
785 zTid = zData;
786 @ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
787 }else if( zData[0]==0 ){
788 @ <td valign="top">&nbsp;</td>
789 }else{
790 @ <td valign="top">
791 @ %h(zData)
792 @ </td>
793 }
794 }
795 if( zTid && g.okWrite ){
796 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
797 }
798 @ </tr>
799 return 0;
800 }
801
802
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -66,11 +66,11 @@
6666
"Control access settings.");
6767
setup_menu_entry("Configuration", "setup_config",
6868
"Configure the WWW components of the repository");
6969
setup_menu_entry("Timeline", "setup_timeline",
7070
"Timeline display preferences");
71
- setup_menu_entry("Tickets", "setup_ticket",
71
+ setup_menu_entry("Tickets", "tktsetup",
7272
"Configure the trouble-ticketing system for this repository");
7373
setup_menu_entry("CSS", "setup_editcss",
7474
"Edit the Cascading Style Sheet used by all pages of this repository");
7575
setup_menu_entry("Header", "setup_header",
7676
"Edit HTML text inserted at the top of every page");
7777
--- src/setup.c
+++ src/setup.c
@@ -66,11 +66,11 @@
66 "Control access settings.");
67 setup_menu_entry("Configuration", "setup_config",
68 "Configure the WWW components of the repository");
69 setup_menu_entry("Timeline", "setup_timeline",
70 "Timeline display preferences");
71 setup_menu_entry("Tickets", "setup_ticket",
72 "Configure the trouble-ticketing system for this repository");
73 setup_menu_entry("CSS", "setup_editcss",
74 "Edit the Cascading Style Sheet used by all pages of this repository");
75 setup_menu_entry("Header", "setup_header",
76 "Edit HTML text inserted at the top of every page");
77
--- src/setup.c
+++ src/setup.c
@@ -66,11 +66,11 @@
66 "Control access settings.");
67 setup_menu_entry("Configuration", "setup_config",
68 "Configure the WWW components of the repository");
69 setup_menu_entry("Timeline", "setup_timeline",
70 "Timeline display preferences");
71 setup_menu_entry("Tickets", "tktsetup",
72 "Configure the trouble-ticketing system for this repository");
73 setup_menu_entry("CSS", "setup_editcss",
74 "Edit the Cascading Style Sheet used by all pages of this repository");
75 setup_menu_entry("Header", "setup_header",
76 "Edit HTML text inserted at the top of every page");
77
+412 -2
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -28,17 +28,427 @@
2828
#include "tktsetup.h"
2929
#include <assert.h>
3030
3131
/*
3232
** Main sub-menu for configuring the ticketing system.
33
-** WEBPAGE: /tktsetup
33
+** WEBPAGE: tktsetup
3434
*/
3535
void tktsetup_page(void){
3636
login_check_credentials();
3737
if( !g.okSetup ){
3838
login_needed();
3939
}
4040
4141
style_header("Ticket Setup");
42
- @ <i>TBD...</i>
42
+ @ <table border="0" cellspacing="20">
43
+ setup_menu_entry("Table", "tktsetup_tab",
44
+ "Specify the schema of the \"ticket\" table in the database.");
45
+ setup_menu_entry("Common", "tktsetup_com",
46
+ "Common TH1 code run before all ticket processing.");
47
+ setup_menu_entry("New Ticket Page", "tktsetup_newpage",
48
+ "HTML with embedded TH1 code for the \"new ticket\" webpage.");
49
+ setup_menu_entry("View Ticket Page", "tktsetup_viewpage",
50
+ "HTML with embedded TH1 code for the \"view ticket\" webpage.");
51
+ setup_menu_entry("Edit Ticket Page", "tktsetup_editpage",
52
+ "HTML with embedded TH1 code for the \"edit ticket\" webpage.");
53
+ setup_menu_entry("Report Format", "tktsetup_drep",
54
+ "The default ticket report format.");
55
+ @ </table>
56
+ style_footer();
57
+}
58
+
59
+/* @-comment: ** */
60
+static char zDefaultTab[] =
61
+@ CREATE TABLE ticket(
62
+@ -- Do not change any column that begins with tkt_
63
+@ tkt_id INTEGER PRIMARY KEY,
64
+@ tkt_uuid TEXT,
65
+@ tkt_mtime DATE,
66
+@ -- Add as many field as required below this line
67
+@ type TEXT,
68
+@ status TEXT,
69
+@ subsystem TEXT,
70
+@ priority TEXT,
71
+@ severity TEXT,
72
+@ foundin TEXT,
73
+@ contact TEXT,
74
+@ resolution TEXT,
75
+@ title TEXT,
76
+@ comment TEXT,
77
+@ -- Do not alter this UNIQUE clause:
78
+@ UNIQUE(tkt_uuid, tkt_mtime)
79
+@ );
80
+;
81
+
82
+/*
83
+** Common implementation for the ticket setup editor pages.
84
+*/
85
+static void tktsetup_generic(
86
+ const char *zTitle, /* Page title */
87
+ const char *zDbField, /* Configuration field being edited */
88
+ char *zDfltValue, /* Default text value */
89
+ const char *zDesc, /* Description of this field */
90
+ int height /* Height of the edit box */
91
+){
92
+ const char *z;
93
+ int isSubmit;
94
+
95
+ login_check_credentials();
96
+ if( !g.okSetup ){
97
+ login_needed();
98
+ }
99
+ if( P("setup") ){
100
+ cgi_redirect("tktsetup");
101
+ }
102
+ isSubmit = P("submit")!=0;
103
+ db_begin_transaction();
104
+ z = P("x");
105
+ if( z==0 ){
106
+ z = db_get(zDbField, zDfltValue);
107
+ }
108
+ style_header("Edit %s", zTitle);
109
+ if( P("clear")!=0 ){
110
+ db_unset(zDbField, 0);
111
+ z = zDfltValue;
112
+ }else if( isSubmit ){
113
+ db_set(zDbField, z, 0);
114
+ }
115
+ @ <form action="%s(g.zBaseURL)/%s(g.zPath)" method="POST">
116
+ @ %s(zDesc)
117
+ @ <textarea name="tab" rows="%d(height)" cols="80">%h(z)</textarea>
118
+ @ <br />
119
+ @ <input type="submit" name="submit" value="Apply Changes">
120
+ @ <input type="submit" name="clear" value="Revert To Default">
121
+ @ <input type="submit" name="setup" value="Ticket Setup Menu">
122
+ @ </form>
123
+ @ <hr>
124
+ @ <h2>Default %s(zTitle)</h2>
125
+ @ <blockquote><pre>
126
+ @ %h(zDfltValue)
127
+ @ </pre></blockquote>
128
+ db_end_transaction(0);
43129
style_footer();
44130
}
131
+
132
+/*
133
+** WEBPAGE: tktsetup_tab
134
+*/
135
+void tktsetup_tab_page(void){
136
+ static const char zDesc[] =
137
+ @ <p>Enter a valid CREATE TABLE statement for the "ticket" table. The
138
+ @ table must contain columns named "tkt_id", "tkt_uuid", and "tkt_mtime"
139
+ @ with an unique index on "tkt_uuid" and "tkt_mtime".</p>
140
+ ;
141
+ tktsetup_generic(
142
+ "Ticket Table Schema",
143
+ "ticket-table",
144
+ zDefaultTab,
145
+ zDesc,
146
+ 20
147
+ );
148
+}
149
+
150
+static char zDefaultCom[] =
151
+@ set type_choices {
152
+@ Code_Defect
153
+@ Build_Problem
154
+@ Documentation
155
+@ Feature_Request
156
+@ Incident
157
+@ }
158
+@ set priority_choices {
159
+@ Immediate
160
+@ High
161
+@ Medium
162
+@ Low
163
+@ Zero
164
+@ }
165
+@ set severity_choices {
166
+@ Critical
167
+@ Severe
168
+@ Important
169
+@ Minor
170
+@ Cosmetic
171
+@ }
172
+@ set resolution_choices {
173
+@ Open
174
+@ Fixed
175
+@ Rejected
176
+@ Unable_To_Reproduce
177
+@ Works_As_Designed
178
+@ External_Bug
179
+@ Not_A_Bug
180
+@ Duplicate
181
+@ Overcome_By_Events
182
+@ Drive_By_Patch
183
+@ }
184
+@ set status_choices {
185
+@ Open
186
+@ Verified
187
+@ In_Process
188
+@ Deferred
189
+@ Fixed
190
+@ Tested
191
+@ Closed
192
+@ }
193
+@ set subsystem_choices {one two three}
194
+;
195
+
196
+/*
197
+** WEBPAGE: tktsetup_com
198
+*/
199
+void tktsetup_com_page(void){
200
+ static const char zDesc[] =
201
+ @ <p>Enter TH1 script that initializes variables prior to generating
202
+ @ any of the ticket view, edit, or creation pages.</p>
203
+ ;
204
+ tktsetup_generic(
205
+ "Ticket Common Script",
206
+ "ticket-common",
207
+ zDefaultCom,
208
+ zDesc,
209
+ 30
210
+ );
211
+}
212
+
213
+static char zDefaultNew[] =
214
+@ <th1>
215
+@ if {[info exists submit]} {
216
+@ set status Open
217
+@ submit_ticket
218
+@ }
219
+@ </th1>
220
+@ <table cellpadding="5">
221
+@ <tr>
222
+@ <td colspan="2">
223
+@ Enter a one-line summary of the problem:<br>
224
+@ <input type="text" name="title" size="60" value="$<title>">
225
+@ </td>
226
+@ </tr>
227
+@
228
+@ <tr>
229
+@ <td align="right">Type:
230
+@ <th1>combobox type $type_choices 1</th1>
231
+@ </td>
232
+@ <td>What type of ticket is this?</td>
233
+@ </tr>
234
+@
235
+@ <tr>
236
+@ <td align="right">Version:
237
+@ <input type="text" name="foundin" size="20" value="$<foundin>">
238
+@ </td>
239
+@ <td>In what version or build number do you observe the problem?</td>
240
+@ </tr>
241
+@
242
+@ <tr>
243
+@ <td align="right">Severity:
244
+@ <th1>combobox severity $severity_choices 1</th1>
245
+@ </td>
246
+@ <td>How debilitating is the problem? How badly does the problem
247
+@ effect the operation of the product?</td>
248
+@ </tr>
249
+@
250
+@ <tr>
251
+@ <td align="right">EMail:
252
+@ <input type="text" name="contact" value="$<contact>" size="30">
253
+@ </td>
254
+@ <td>Not publically visible. Used by developers to contact you with
255
+@ questions.</td>
256
+@ </tr>
257
+@
258
+@ <tr>
259
+@ <td colspan="2">
260
+@ Enter a detailed description of the problem.
261
+@ For code defects, be sure to provide details on exactly how
262
+@ the problem can be reproduced. Provide as much detail as
263
+@ possible.
264
+@ <br>
265
+@ <th1>set nline [linecount $comment 50 10]</th1>
266
+@ <textarea name="comment" cols="80" rows="$nline"
267
+@ wrap="virtual" class="wikiedit">$<comment></textarea><br>
268
+@ <input type="submit" name="preview" value="Preview">
269
+@ </tr>
270
+@
271
+@ <th1>enable_output [info exists preview]</th1>
272
+@ <tr><td colspan="2">
273
+@ Description Preview:<br><hr>
274
+@ <th1>wiki $comment</th1>
275
+@ <hr>
276
+@ </td></tr>
277
+@ <th1>enable_output 1</th1>
278
+@
279
+@ <tr>
280
+@ <td align="right">
281
+@ <input type="submit" name="submit" value="Submit">
282
+@ </td>
283
+@ <td>After filling in the information above, press this button to create
284
+@ the new ticket</td>
285
+@ </tr>
286
+@ </table>
287
+;
288
+
289
+/*
290
+** WEBPAGE: tktsetup_newpage
291
+*/
292
+void tktsetup_newpage_page(void){
293
+ static const char zDesc[] =
294
+ @ <p>Enter HTML with embedded TH1 script that will render the "new ticket"
295
+ @ page</p>
296
+ ;
297
+ tktsetup_generic(
298
+ "HTML For New Tickets",
299
+ "ticket-newpage",
300
+ zDefaultNew,
301
+ zDesc,
302
+ 40
303
+ );
304
+}
305
+
306
+static char zDefaultView[] =
307
+@ <table cellpadding="5">
308
+@ <tr><td align="right">Title:</td><td>
309
+@ $<title>
310
+@ </td></tr>
311
+@ <tr><td align="right">Status:</td><td>
312
+@ $<status>
313
+@ </td></tr>
314
+@ <tr><td align="right">Type:</td><td>
315
+@ $<type>
316
+@ </td></tr>
317
+@ <tr><td align="right">Severity:</td><td>
318
+@ $<severity>
319
+@ </td></tr>
320
+@ <tr><td align="right">Priority:</td><td>
321
+@ $<priority>
322
+@ </td></tr>
323
+@ <tr><td align="right">Resolution:</td><td>
324
+@ $<resolution>
325
+@ </td></tr>
326
+@ <tr><td align="right">Subsystem:</td><td>
327
+@ $<subsystem>
328
+@ </td></tr>
329
+@ <th1>enable_output [hascap e]</th1>
330
+@ <tr><td align="right">Contact:</td><td>
331
+@ $<contact>
332
+@ </td></tr>
333
+@ <th1>enable_output 1</th1>
334
+@ <tr><td align="right">Version&nbsp;Found&nbsp;In:</td><td>
335
+@ $<foundin>
336
+@ </td></tr>
337
+@ <tr><td colspan="2">
338
+@ Description And Comments:<br>
339
+@ <th1>wiki $comment</th1>
340
+@ </td></tr>
341
+@ </table>
342
+;
343
+
344
+
345
+/*
346
+** WEBPAGE: tktsetup_viewpage
347
+*/
348
+void tktsetup_viewpage_page(void){
349
+ static const char zDesc[] =
350
+ @ <p>Enter HTML with embedded TH1 script that will render the "view ticket"
351
+ @ page</p>
352
+ ;
353
+ tktsetup_generic(
354
+ "HTML For Viewing Tickets",
355
+ "ticket-viewpage",
356
+ zDefaultView,
357
+ zDesc,
358
+ 40
359
+ );
360
+}
361
+
362
+static char zDefaultEdit[] =
363
+@ <th1>
364
+@ if {![info exists username]} {set username $login}
365
+@ if {[info exists submit]} {
366
+@ if {[info exists cmappnd]} {
367
+@ if {[string length $cmappnd]>0} {
368
+@ set ctxt "\n\n<hr><i>[htmlize $login]"
369
+@ if {$username ne $login} {
370
+@ set ctxt "$ctxt claiming to be [htmlize $username]"
371
+@ }
372
+@ set ctxt "$ctxt added on [date]:</i><br>\n$cmappnd"
373
+@ append_field comment $ctxt
374
+@ }
375
+@ }
376
+@ submit_ticket
377
+@ }
378
+@ </th1>
379
+@ <table cellpadding="5">
380
+@ <tr><td align="right">Title:</td><td>
381
+@ <input type="text" name="title" value="$<title>" size="60">
382
+@ </td></tr>
383
+@ <tr><td align="right">Status:</td><td>
384
+@ <th1>combobox status $status_choices 1</th1>
385
+@ </td></tr>
386
+@ <tr><td align="right">Type:</td><td>
387
+@ <th1>combobox type $type_choices 1</th1>
388
+@ </td></tr>
389
+@ <tr><td align="right">Severity:</td><td>
390
+@ <th1>combobox severity $severity_choices 1</th1>
391
+@ </td></tr>
392
+@ <tr><td align="right">Priority:</td><td>
393
+@ <th1>combobox priority $priority_choices 1</th1>
394
+@ </td></tr>
395
+@ <tr><td align="right">Resolution:</td><td>
396
+@ <th1>combobox resolution $resolution_choices 1</th1>
397
+@ </td></tr>
398
+@ <tr><td align="right">Subsystem:</td><td>
399
+@ <th1>combobox subsystem $subsystem_choices 1</th1>
400
+@ </td></tr>
401
+@ <th1>enable_output [hascap e]</th1>
402
+@ <tr><td align="right">Contact:</td><td>
403
+@ <input type="text" name="contact" size="40" value="$<contact>">
404
+@ </td></tr>
405
+@ <th1>enable_output 1</th1>
406
+@ <tr><td align="right">Version&nbsp;Found&nbsp;In:</td><td>
407
+@ <input type="text" name="foundin" size="50" value="$<foundin>">
408
+@ </td></tr>
409
+@ <tr><td colspan="2">
410
+@ <th1>
411
+@ if {![info exists eall]} {set eall 0}
412
+@ if {[info exists aonlybtn]} {set eall 0}
413
+@ if {[info exists eallbtn]} {set eall 1}
414
+@ if {![hascap w]} {set eall 0}
415
+@ if {![info exists cmappnd]} {set cmappnd {}}
416
+@ set nline [linecount $comment 15 10]
417
+@ enable_output $eall
418
+@ </th1>
419
+@ Description And Comments:<br>
420
+@ <textarea name="comment" cols="80" rows="$nline"
421
+@ wrap="virtual" class="wikiedit">$<comment></textarea><br>
422
+@ <input type="hidden" name="eall" value="1">
423
+@ <input type="submit" name="aonlybtn" value="Append Remark">
424
+@ <th1>enable_output [expr {!$eall}]</th1>
425
+@ Append Remark from
426
+@ <input type="text" name="username" value="$<username>" size="30">:<br>
427
+@ <textarea name="cmappnd" cols="80" rows="15"
428
+@ wrap="virtual" class="wikiedit">$<cmappnd></textarea><br>
429
+@ <th1>enable_output [expr {[hascap w] && !$eall}]</th1>
430
+@ <input type="submit" name="eallbtn" value="Edit All">
431
+@ <th1>enable_output 1</th1>
432
+@ </td></tr>
433
+@ <tr><td align="right"></td><td>
434
+@ <input type="submit" name="submit" value="Submit Changes">
435
+@ </td></tr>
436
+@ </table>
437
+;
438
+
439
+/*
440
+** WEBPAGE: tktsetup_editpage
441
+*/
442
+void tktsetup_editpage_page(void){
443
+ static const char zDesc[] =
444
+ @ <p>Enter HTML with embedded TH1 script that will render the "edit ticket"
445
+ @ page</p>
446
+ ;
447
+ tktsetup_generic(
448
+ "HTML For Editing Tickets",
449
+ "ticket-editpage",
450
+ zDefaultEdit,
451
+ zDesc,
452
+ 40
453
+ );
454
+}
45455
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -28,17 +28,427 @@
28 #include "tktsetup.h"
29 #include <assert.h>
30
31 /*
32 ** Main sub-menu for configuring the ticketing system.
33 ** WEBPAGE: /tktsetup
34 */
35 void tktsetup_page(void){
36 login_check_credentials();
37 if( !g.okSetup ){
38 login_needed();
39 }
40
41 style_header("Ticket Setup");
42 @ <i>TBD...</i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43 style_footer();
44 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -28,17 +28,427 @@
28 #include "tktsetup.h"
29 #include <assert.h>
30
31 /*
32 ** Main sub-menu for configuring the ticketing system.
33 ** WEBPAGE: tktsetup
34 */
35 void tktsetup_page(void){
36 login_check_credentials();
37 if( !g.okSetup ){
38 login_needed();
39 }
40
41 style_header("Ticket Setup");
42 @ <table border="0" cellspacing="20">
43 setup_menu_entry("Table", "tktsetup_tab",
44 "Specify the schema of the \"ticket\" table in the database.");
45 setup_menu_entry("Common", "tktsetup_com",
46 "Common TH1 code run before all ticket processing.");
47 setup_menu_entry("New Ticket Page", "tktsetup_newpage",
48 "HTML with embedded TH1 code for the \"new ticket\" webpage.");
49 setup_menu_entry("View Ticket Page", "tktsetup_viewpage",
50 "HTML with embedded TH1 code for the \"view ticket\" webpage.");
51 setup_menu_entry("Edit Ticket Page", "tktsetup_editpage",
52 "HTML with embedded TH1 code for the \"edit ticket\" webpage.");
53 setup_menu_entry("Report Format", "tktsetup_drep",
54 "The default ticket report format.");
55 @ </table>
56 style_footer();
57 }
58
59 /* @-comment: ** */
60 static char zDefaultTab[] =
61 @ CREATE TABLE ticket(
62 @ -- Do not change any column that begins with tkt_
63 @ tkt_id INTEGER PRIMARY KEY,
64 @ tkt_uuid TEXT,
65 @ tkt_mtime DATE,
66 @ -- Add as many field as required below this line
67 @ type TEXT,
68 @ status TEXT,
69 @ subsystem TEXT,
70 @ priority TEXT,
71 @ severity TEXT,
72 @ foundin TEXT,
73 @ contact TEXT,
74 @ resolution TEXT,
75 @ title TEXT,
76 @ comment TEXT,
77 @ -- Do not alter this UNIQUE clause:
78 @ UNIQUE(tkt_uuid, tkt_mtime)
79 @ );
80 ;
81
82 /*
83 ** Common implementation for the ticket setup editor pages.
84 */
85 static void tktsetup_generic(
86 const char *zTitle, /* Page title */
87 const char *zDbField, /* Configuration field being edited */
88 char *zDfltValue, /* Default text value */
89 const char *zDesc, /* Description of this field */
90 int height /* Height of the edit box */
91 ){
92 const char *z;
93 int isSubmit;
94
95 login_check_credentials();
96 if( !g.okSetup ){
97 login_needed();
98 }
99 if( P("setup") ){
100 cgi_redirect("tktsetup");
101 }
102 isSubmit = P("submit")!=0;
103 db_begin_transaction();
104 z = P("x");
105 if( z==0 ){
106 z = db_get(zDbField, zDfltValue);
107 }
108 style_header("Edit %s", zTitle);
109 if( P("clear")!=0 ){
110 db_unset(zDbField, 0);
111 z = zDfltValue;
112 }else if( isSubmit ){
113 db_set(zDbField, z, 0);
114 }
115 @ <form action="%s(g.zBaseURL)/%s(g.zPath)" method="POST">
116 @ %s(zDesc)
117 @ <textarea name="tab" rows="%d(height)" cols="80">%h(z)</textarea>
118 @ <br />
119 @ <input type="submit" name="submit" value="Apply Changes">
120 @ <input type="submit" name="clear" value="Revert To Default">
121 @ <input type="submit" name="setup" value="Ticket Setup Menu">
122 @ </form>
123 @ <hr>
124 @ <h2>Default %s(zTitle)</h2>
125 @ <blockquote><pre>
126 @ %h(zDfltValue)
127 @ </pre></blockquote>
128 db_end_transaction(0);
129 style_footer();
130 }
131
132 /*
133 ** WEBPAGE: tktsetup_tab
134 */
135 void tktsetup_tab_page(void){
136 static const char zDesc[] =
137 @ <p>Enter a valid CREATE TABLE statement for the "ticket" table. The
138 @ table must contain columns named "tkt_id", "tkt_uuid", and "tkt_mtime"
139 @ with an unique index on "tkt_uuid" and "tkt_mtime".</p>
140 ;
141 tktsetup_generic(
142 "Ticket Table Schema",
143 "ticket-table",
144 zDefaultTab,
145 zDesc,
146 20
147 );
148 }
149
150 static char zDefaultCom[] =
151 @ set type_choices {
152 @ Code_Defect
153 @ Build_Problem
154 @ Documentation
155 @ Feature_Request
156 @ Incident
157 @ }
158 @ set priority_choices {
159 @ Immediate
160 @ High
161 @ Medium
162 @ Low
163 @ Zero
164 @ }
165 @ set severity_choices {
166 @ Critical
167 @ Severe
168 @ Important
169 @ Minor
170 @ Cosmetic
171 @ }
172 @ set resolution_choices {
173 @ Open
174 @ Fixed
175 @ Rejected
176 @ Unable_To_Reproduce
177 @ Works_As_Designed
178 @ External_Bug
179 @ Not_A_Bug
180 @ Duplicate
181 @ Overcome_By_Events
182 @ Drive_By_Patch
183 @ }
184 @ set status_choices {
185 @ Open
186 @ Verified
187 @ In_Process
188 @ Deferred
189 @ Fixed
190 @ Tested
191 @ Closed
192 @ }
193 @ set subsystem_choices {one two three}
194 ;
195
196 /*
197 ** WEBPAGE: tktsetup_com
198 */
199 void tktsetup_com_page(void){
200 static const char zDesc[] =
201 @ <p>Enter TH1 script that initializes variables prior to generating
202 @ any of the ticket view, edit, or creation pages.</p>
203 ;
204 tktsetup_generic(
205 "Ticket Common Script",
206 "ticket-common",
207 zDefaultCom,
208 zDesc,
209 30
210 );
211 }
212
213 static char zDefaultNew[] =
214 @ <th1>
215 @ if {[info exists submit]} {
216 @ set status Open
217 @ submit_ticket
218 @ }
219 @ </th1>
220 @ <table cellpadding="5">
221 @ <tr>
222 @ <td colspan="2">
223 @ Enter a one-line summary of the problem:<br>
224 @ <input type="text" name="title" size="60" value="$<title>">
225 @ </td>
226 @ </tr>
227 @
228 @ <tr>
229 @ <td align="right">Type:
230 @ <th1>combobox type $type_choices 1</th1>
231 @ </td>
232 @ <td>What type of ticket is this?</td>
233 @ </tr>
234 @
235 @ <tr>
236 @ <td align="right">Version:
237 @ <input type="text" name="foundin" size="20" value="$<foundin>">
238 @ </td>
239 @ <td>In what version or build number do you observe the problem?</td>
240 @ </tr>
241 @
242 @ <tr>
243 @ <td align="right">Severity:
244 @ <th1>combobox severity $severity_choices 1</th1>
245 @ </td>
246 @ <td>How debilitating is the problem? How badly does the problem
247 @ effect the operation of the product?</td>
248 @ </tr>
249 @
250 @ <tr>
251 @ <td align="right">EMail:
252 @ <input type="text" name="contact" value="$<contact>" size="30">
253 @ </td>
254 @ <td>Not publically visible. Used by developers to contact you with
255 @ questions.</td>
256 @ </tr>
257 @
258 @ <tr>
259 @ <td colspan="2">
260 @ Enter a detailed description of the problem.
261 @ For code defects, be sure to provide details on exactly how
262 @ the problem can be reproduced. Provide as much detail as
263 @ possible.
264 @ <br>
265 @ <th1>set nline [linecount $comment 50 10]</th1>
266 @ <textarea name="comment" cols="80" rows="$nline"
267 @ wrap="virtual" class="wikiedit">$<comment></textarea><br>
268 @ <input type="submit" name="preview" value="Preview">
269 @ </tr>
270 @
271 @ <th1>enable_output [info exists preview]</th1>
272 @ <tr><td colspan="2">
273 @ Description Preview:<br><hr>
274 @ <th1>wiki $comment</th1>
275 @ <hr>
276 @ </td></tr>
277 @ <th1>enable_output 1</th1>
278 @
279 @ <tr>
280 @ <td align="right">
281 @ <input type="submit" name="submit" value="Submit">
282 @ </td>
283 @ <td>After filling in the information above, press this button to create
284 @ the new ticket</td>
285 @ </tr>
286 @ </table>
287 ;
288
289 /*
290 ** WEBPAGE: tktsetup_newpage
291 */
292 void tktsetup_newpage_page(void){
293 static const char zDesc[] =
294 @ <p>Enter HTML with embedded TH1 script that will render the "new ticket"
295 @ page</p>
296 ;
297 tktsetup_generic(
298 "HTML For New Tickets",
299 "ticket-newpage",
300 zDefaultNew,
301 zDesc,
302 40
303 );
304 }
305
306 static char zDefaultView[] =
307 @ <table cellpadding="5">
308 @ <tr><td align="right">Title:</td><td>
309 @ $<title>
310 @ </td></tr>
311 @ <tr><td align="right">Status:</td><td>
312 @ $<status>
313 @ </td></tr>
314 @ <tr><td align="right">Type:</td><td>
315 @ $<type>
316 @ </td></tr>
317 @ <tr><td align="right">Severity:</td><td>
318 @ $<severity>
319 @ </td></tr>
320 @ <tr><td align="right">Priority:</td><td>
321 @ $<priority>
322 @ </td></tr>
323 @ <tr><td align="right">Resolution:</td><td>
324 @ $<resolution>
325 @ </td></tr>
326 @ <tr><td align="right">Subsystem:</td><td>
327 @ $<subsystem>
328 @ </td></tr>
329 @ <th1>enable_output [hascap e]</th1>
330 @ <tr><td align="right">Contact:</td><td>
331 @ $<contact>
332 @ </td></tr>
333 @ <th1>enable_output 1</th1>
334 @ <tr><td align="right">Version&nbsp;Found&nbsp;In:</td><td>
335 @ $<foundin>
336 @ </td></tr>
337 @ <tr><td colspan="2">
338 @ Description And Comments:<br>
339 @ <th1>wiki $comment</th1>
340 @ </td></tr>
341 @ </table>
342 ;
343
344
345 /*
346 ** WEBPAGE: tktsetup_viewpage
347 */
348 void tktsetup_viewpage_page(void){
349 static const char zDesc[] =
350 @ <p>Enter HTML with embedded TH1 script that will render the "view ticket"
351 @ page</p>
352 ;
353 tktsetup_generic(
354 "HTML For Viewing Tickets",
355 "ticket-viewpage",
356 zDefaultView,
357 zDesc,
358 40
359 );
360 }
361
362 static char zDefaultEdit[] =
363 @ <th1>
364 @ if {![info exists username]} {set username $login}
365 @ if {[info exists submit]} {
366 @ if {[info exists cmappnd]} {
367 @ if {[string length $cmappnd]>0} {
368 @ set ctxt "\n\n<hr><i>[htmlize $login]"
369 @ if {$username ne $login} {
370 @ set ctxt "$ctxt claiming to be [htmlize $username]"
371 @ }
372 @ set ctxt "$ctxt added on [date]:</i><br>\n$cmappnd"
373 @ append_field comment $ctxt
374 @ }
375 @ }
376 @ submit_ticket
377 @ }
378 @ </th1>
379 @ <table cellpadding="5">
380 @ <tr><td align="right">Title:</td><td>
381 @ <input type="text" name="title" value="$<title>" size="60">
382 @ </td></tr>
383 @ <tr><td align="right">Status:</td><td>
384 @ <th1>combobox status $status_choices 1</th1>
385 @ </td></tr>
386 @ <tr><td align="right">Type:</td><td>
387 @ <th1>combobox type $type_choices 1</th1>
388 @ </td></tr>
389 @ <tr><td align="right">Severity:</td><td>
390 @ <th1>combobox severity $severity_choices 1</th1>
391 @ </td></tr>
392 @ <tr><td align="right">Priority:</td><td>
393 @ <th1>combobox priority $priority_choices 1</th1>
394 @ </td></tr>
395 @ <tr><td align="right">Resolution:</td><td>
396 @ <th1>combobox resolution $resolution_choices 1</th1>
397 @ </td></tr>
398 @ <tr><td align="right">Subsystem:</td><td>
399 @ <th1>combobox subsystem $subsystem_choices 1</th1>
400 @ </td></tr>
401 @ <th1>enable_output [hascap e]</th1>
402 @ <tr><td align="right">Contact:</td><td>
403 @ <input type="text" name="contact" size="40" value="$<contact>">
404 @ </td></tr>
405 @ <th1>enable_output 1</th1>
406 @ <tr><td align="right">Version&nbsp;Found&nbsp;In:</td><td>
407 @ <input type="text" name="foundin" size="50" value="$<foundin>">
408 @ </td></tr>
409 @ <tr><td colspan="2">
410 @ <th1>
411 @ if {![info exists eall]} {set eall 0}
412 @ if {[info exists aonlybtn]} {set eall 0}
413 @ if {[info exists eallbtn]} {set eall 1}
414 @ if {![hascap w]} {set eall 0}
415 @ if {![info exists cmappnd]} {set cmappnd {}}
416 @ set nline [linecount $comment 15 10]
417 @ enable_output $eall
418 @ </th1>
419 @ Description And Comments:<br>
420 @ <textarea name="comment" cols="80" rows="$nline"
421 @ wrap="virtual" class="wikiedit">$<comment></textarea><br>
422 @ <input type="hidden" name="eall" value="1">
423 @ <input type="submit" name="aonlybtn" value="Append Remark">
424 @ <th1>enable_output [expr {!$eall}]</th1>
425 @ Append Remark from
426 @ <input type="text" name="username" value="$<username>" size="30">:<br>
427 @ <textarea name="cmappnd" cols="80" rows="15"
428 @ wrap="virtual" class="wikiedit">$<cmappnd></textarea><br>
429 @ <th1>enable_output [expr {[hascap w] && !$eall}]</th1>
430 @ <input type="submit" name="eallbtn" value="Edit All">
431 @ <th1>enable_output 1</th1>
432 @ </td></tr>
433 @ <tr><td align="right"></td><td>
434 @ <input type="submit" name="submit" value="Submit Changes">
435 @ </td></tr>
436 @ </table>
437 ;
438
439 /*
440 ** WEBPAGE: tktsetup_editpage
441 */
442 void tktsetup_editpage_page(void){
443 static const char zDesc[] =
444 @ <p>Enter HTML with embedded TH1 script that will render the "edit ticket"
445 @ page</p>
446 ;
447 tktsetup_generic(
448 "HTML For Editing Tickets",
449 "ticket-editpage",
450 zDefaultEdit,
451 zDesc,
452 40
453 );
454 }
455

Keyboard Shortcuts

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