Overview
SHA1 Hash: | 46e6a032324baa69275a552deaae8410af8fe663 |
---|---|
Date: | 2008-05-16 18:57:59 |
User: | drh |
Comment: | Get rudimentary ticket editing working. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/th_main.c from [6295c8f141] to [59821e5286].
@@ -139,10 +139,51 @@ } return TH_OK; } /* +** TH command: htmlize STRING +** +** Escape all characters of STRING which have special meaning in HTML. +** Return a new string result. +*/ +static int htmlizeCmd( + Th_Interp *interp, + void *p, + int argc, + const unsigned char **argv, + int *argl +){ + char *zOut; + if( argc!=2 ){ + return Th_WrongNumArgs(interp, "htmlize STRING"); + } + zOut = htmlize((char*)argv[1], argl[1]); + Th_SetResult(interp, (unsigned char*)zOut, -1); + free(zOut); + return TH_OK; +} + +/* +** TH command: date +** +** Return a string which is the current time and date. +*/ +static int dateCmd( + Th_Interp *interp, + void *p, + int argc, + const unsigned char **argv, + int *argl +){ + char *zOut = db_text("??", "SELECT datetime('now')"); + Th_SetResult(interp, (unsigned char*)zOut, -1); + free(zOut); + return TH_OK; +} + +/* ** TH command: hascap STRING ** ** Return true if the user has all of the capabilities listed in STRING. */ static int hascapCmd( @@ -259,10 +300,12 @@ } aCommand[] = { {"combobox", comboboxCmd, 0}, {"enable_output", enableOutputCmd, 0}, {"linecount", linecntCmd, 0}, {"hascap", hascapCmd, 0}, + {"htmlize", htmlizeCmd, 0}, + {"date", dateCmd, 0}, {"html", putsCmd, 0}, {"puts", putsCmd, (void*)1}, {"wiki", wikiCmd, 0}, }; if( g.interp==0 ){
Modified src/tktconfig.c from [9beffaf065] to [fc468af27b].
@@ -202,19 +202,19 @@ @ # CGI parameters. @ set tktedit_template { @ <th1> @ if {![info exists username]} {set username $login} @ if {[info exists submit]} { -@ if {[info exists $cmappnd] && [string length $cmappnd]>0} { -@ set ctxt "\n\n<hr><i>" -@ if {$username==$login} { -@ set usr "$ctxt[htmlize $login]" -@ } else { -@ set usr "[htmlize $login claimingn to be [htmlize $username]" -@ } -@ append_field comment \ -@ "\n\n<hr><i>$usr added on [date]:</i><br>\n$comment" +@ if {[info exists cmappnd]} { +@ if {[string length $cmappnd]>0} { +@ set ctxt "\n\n<hr><i>[htmlize $login]" +@ if {$username ne $login} { +@ set ctxt "$ctxt claiming to be [htmlize $username]" +@ } +@ set ctxt "$ctxt added on [date]:</i><br>\n$cmappnd" +@ append_field comment $ctxt +@ } @ } @ submit_ticket @ } @ </th1> @ <table cellpadding="5">