Fossil SCM
Get rudimentary ticket editing working.
Commit
46e6a032324baa69275a552deaae8410af8fe663
Parent
68c24b185731fad…
2 files changed
+43
+8
-8
+43
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -137,10 +137,51 @@ | ||
| 137 | 137 | wiki_convert(&src, 0, WIKI_INLINE); |
| 138 | 138 | blob_reset(&src); |
| 139 | 139 | } |
| 140 | 140 | return TH_OK; |
| 141 | 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 | +} | |
| 142 | 183 | |
| 143 | 184 | /* |
| 144 | 185 | ** TH command: hascap STRING |
| 145 | 186 | ** |
| 146 | 187 | ** Return true if the user has all of the capabilities listed in STRING. |
| @@ -259,10 +300,12 @@ | ||
| 259 | 300 | } aCommand[] = { |
| 260 | 301 | {"combobox", comboboxCmd, 0}, |
| 261 | 302 | {"enable_output", enableOutputCmd, 0}, |
| 262 | 303 | {"linecount", linecntCmd, 0}, |
| 263 | 304 | {"hascap", hascapCmd, 0}, |
| 305 | + {"htmlize", htmlizeCmd, 0}, | |
| 306 | + {"date", dateCmd, 0}, | |
| 264 | 307 | {"html", putsCmd, 0}, |
| 265 | 308 | {"puts", putsCmd, (void*)1}, |
| 266 | 309 | {"wiki", wikiCmd, 0}, |
| 267 | 310 | }; |
| 268 | 311 | if( g.interp==0 ){ |
| 269 | 312 |
| --- 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 @@ | ||
| 202 | 202 | @ # CGI parameters. |
| 203 | 203 | @ set tktedit_template { |
| 204 | 204 | @ <th1> |
| 205 | 205 | @ if {![info exists username]} {set username $login} |
| 206 | 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]" | |
| 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 | |
| 213 | 215 | @ } |
| 214 | -@ append_field comment \ | |
| 215 | -@ "\n\n<hr><i>$usr added on [date]:</i><br>\n$comment" | |
| 216 | 216 | @ } |
| 217 | 217 | @ submit_ticket |
| 218 | 218 | @ } |
| 219 | 219 | @ </th1> |
| 220 | 220 | @ <table cellpadding="5"> |
| 221 | 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] && [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 |