Fossil SCM

Get rudimentary ticket editing working.

drh 2008-05-16 18:57 trunk
Commit 46e6a032324baa69275a552deaae8410af8fe663
2 files changed +43 +8 -8
--- src/th_main.c
+++ src/th_main.c
@@ -137,10 +137,51 @@
137137
wiki_convert(&src, 0, WIKI_INLINE);
138138
blob_reset(&src);
139139
}
140140
return TH_OK;
141141
}
142
+
143
+/*
144
+** TH command: htmlize STRING
145
+**
146
+** Escape all characters of STRING which have special meaning in HTML.
147
+** Return a new string result.
148
+*/
149
+static int htmlizeCmd(
150
+ Th_Interp *interp,
151
+ void *p,
152
+ int argc,
153
+ const unsigned char **argv,
154
+ int *argl
155
+){
156
+ char *zOut;
157
+ if( argc!=2 ){
158
+ return Th_WrongNumArgs(interp, "htmlize STRING");
159
+ }
160
+ zOut = htmlize((char*)argv[1], argl[1]);
161
+ Th_SetResult(interp, (unsigned char*)zOut, -1);
162
+ free(zOut);
163
+ return TH_OK;
164
+}
165
+
166
+/*
167
+** TH command: date
168
+**
169
+** Return a string which is the current time and date.
170
+*/
171
+static int dateCmd(
172
+ Th_Interp *interp,
173
+ void *p,
174
+ int argc,
175
+ const unsigned char **argv,
176
+ int *argl
177
+){
178
+ char *zOut = db_text("??", "SELECT datetime('now')");
179
+ Th_SetResult(interp, (unsigned char*)zOut, -1);
180
+ free(zOut);
181
+ return TH_OK;
182
+}
142183
143184
/*
144185
** TH command: hascap STRING
145186
**
146187
** Return true if the user has all of the capabilities listed in STRING.
@@ -259,10 +300,12 @@
259300
} aCommand[] = {
260301
{"combobox", comboboxCmd, 0},
261302
{"enable_output", enableOutputCmd, 0},
262303
{"linecount", linecntCmd, 0},
263304
{"hascap", hascapCmd, 0},
305
+ {"htmlize", htmlizeCmd, 0},
306
+ {"date", dateCmd, 0},
264307
{"html", putsCmd, 0},
265308
{"puts", putsCmd, (void*)1},
266309
{"wiki", wikiCmd, 0},
267310
};
268311
if( g.interp==0 ){
269312
--- src/th_main.c
+++ src/th_main.c
@@ -137,10 +137,51 @@
137 wiki_convert(&src, 0, WIKI_INLINE);
138 blob_reset(&src);
139 }
140 return TH_OK;
141 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
143 /*
144 ** TH command: hascap STRING
145 **
146 ** Return true if the user has all of the capabilities listed in STRING.
@@ -259,10 +300,12 @@
259 } aCommand[] = {
260 {"combobox", comboboxCmd, 0},
261 {"enable_output", enableOutputCmd, 0},
262 {"linecount", linecntCmd, 0},
263 {"hascap", hascapCmd, 0},
 
 
264 {"html", putsCmd, 0},
265 {"puts", putsCmd, (void*)1},
266 {"wiki", wikiCmd, 0},
267 };
268 if( g.interp==0 ){
269
--- src/th_main.c
+++ src/th_main.c
@@ -137,10 +137,51 @@
137 wiki_convert(&src, 0, WIKI_INLINE);
138 blob_reset(&src);
139 }
140 return TH_OK;
141 }
142
143 /*
144 ** TH command: htmlize STRING
145 **
146 ** Escape all characters of STRING which have special meaning in HTML.
147 ** Return a new string result.
148 */
149 static int htmlizeCmd(
150 Th_Interp *interp,
151 void *p,
152 int argc,
153 const unsigned char **argv,
154 int *argl
155 ){
156 char *zOut;
157 if( argc!=2 ){
158 return Th_WrongNumArgs(interp, "htmlize STRING");
159 }
160 zOut = htmlize((char*)argv[1], argl[1]);
161 Th_SetResult(interp, (unsigned char*)zOut, -1);
162 free(zOut);
163 return TH_OK;
164 }
165
166 /*
167 ** TH command: date
168 **
169 ** Return a string which is the current time and date.
170 */
171 static int dateCmd(
172 Th_Interp *interp,
173 void *p,
174 int argc,
175 const unsigned char **argv,
176 int *argl
177 ){
178 char *zOut = db_text("??", "SELECT datetime('now')");
179 Th_SetResult(interp, (unsigned char*)zOut, -1);
180 free(zOut);
181 return TH_OK;
182 }
183
184 /*
185 ** TH command: hascap STRING
186 **
187 ** Return true if the user has all of the capabilities listed in STRING.
@@ -259,10 +300,12 @@
300 } aCommand[] = {
301 {"combobox", comboboxCmd, 0},
302 {"enable_output", enableOutputCmd, 0},
303 {"linecount", linecntCmd, 0},
304 {"hascap", hascapCmd, 0},
305 {"htmlize", htmlizeCmd, 0},
306 {"date", dateCmd, 0},
307 {"html", putsCmd, 0},
308 {"puts", putsCmd, (void*)1},
309 {"wiki", wikiCmd, 0},
310 };
311 if( g.interp==0 ){
312
+8 -8
--- src/tktconfig.c
+++ src/tktconfig.c
@@ -202,19 +202,19 @@
202202
@ # CGI parameters.
203203
@ set tktedit_template {
204204
@ <th1>
205205
@ if {![info exists username]} {set username $login}
206206
@ if {[info exists submit]} {
207
-@ if {[info exists $cmappnd] && [string length $cmappnd]>0} {
208
-@ set ctxt "\n\n<hr><i>"
209
-@ if {$username==$login} {
210
-@ set usr "$ctxt[htmlize $login]"
211
-@ } else {
212
-@ set usr "[htmlize $login claimingn to be [htmlize $username]"
207
+@ if {[info exists cmappnd]} {
208
+@ if {[string length $cmappnd]>0} {
209
+@ set ctxt "\n\n<hr><i>[htmlize $login]"
210
+@ if {$username ne $login} {
211
+@ set ctxt "$ctxt claiming to be [htmlize $username]"
212
+@ }
213
+@ set ctxt "$ctxt added on [date]:</i><br>\n$cmappnd"
214
+@ append_field comment $ctxt
213215
@ }
214
-@ append_field comment \
215
-@ "\n\n<hr><i>$usr added on [date]:</i><br>\n$comment"
216216
@ }
217217
@ submit_ticket
218218
@ }
219219
@ </th1>
220220
@ <table cellpadding="5">
221221
--- src/tktconfig.c
+++ src/tktconfig.c
@@ -202,19 +202,19 @@
202 @ # CGI parameters.
203 @ set tktedit_template {
204 @ <th1>
205 @ if {![info exists username]} {set username $login}
206 @ if {[info exists submit]} {
207 @ if {[info exists $cmappnd] && [string length $cmappnd]>0} {
208 @ set ctxt "\n\n<hr><i>"
209 @ if {$username==$login} {
210 @ set usr "$ctxt[htmlize $login]"
211 @ } else {
212 @ set usr "[htmlize $login claimingn to be [htmlize $username]"
 
 
213 @ }
214 @ append_field comment \
215 @ "\n\n<hr><i>$usr added on [date]:</i><br>\n$comment"
216 @ }
217 @ submit_ticket
218 @ }
219 @ </th1>
220 @ <table cellpadding="5">
221
--- src/tktconfig.c
+++ src/tktconfig.c
@@ -202,19 +202,19 @@
202 @ # CGI parameters.
203 @ set tktedit_template {
204 @ <th1>
205 @ if {![info exists username]} {set username $login}
206 @ if {[info exists submit]} {
207 @ if {[info exists cmappnd]} {
208 @ if {[string length $cmappnd]>0} {
209 @ set ctxt "\n\n<hr><i>[htmlize $login]"
210 @ if {$username ne $login} {
211 @ set ctxt "$ctxt claiming to be [htmlize $username]"
212 @ }
213 @ set ctxt "$ctxt added on [date]:</i><br>\n$cmappnd"
214 @ append_field comment $ctxt
215 @ }
 
 
216 @ }
217 @ submit_ticket
218 @ }
219 @ </th1>
220 @ <table cellpadding="5">
221

Keyboard Shortcuts

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