Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add default report checkbox and compare report titles instead |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | ticket-search-empty-report-number |
| Files: | files | file ages | folders |
| SHA3-256: |
eaa7f6bb5cf0342d48e057be3a1aaddf |
| User & Date: | kevgrig 2021-07-11 21:55:49.215 |
Context
|
2021-07-11
| ||
| 23:43 | Add the ticket-default-report setting, which if set to the title of a ticket report causes that ticket report to be displayed below the search box in the /ticket page. ... (check-in: c51ace6bc8 user: drh tags: trunk) | |
| 21:55 | Add default report checkbox and compare report titles instead ... (Closed-Leaf check-in: eaa7f6bb5c user: kevgrig tags: ticket-search-empty-report-number) | |
|
2021-07-10
| ||
| 05:47 | Add ticket-search-empty-report-number setting to optionally show a report if the ticket search page query is blank ... (check-in: 714ce73d38 user: kevgrig tags: ticket-search-empty-report-number) | |
Changes
Changes to src/report.c.
| ︙ | ︙ | |||
27 28 29 30 31 32 33 | #ifndef SQLITE_RECURSIVE # define SQLITE_RECURSIVE 33 #endif /* Settings that can be used to control ticket reports */ /* | | < | | | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
#ifndef SQLITE_RECURSIVE
# define SQLITE_RECURSIVE 33
#endif
/* Settings that can be used to control ticket reports */
/*
** SETTING: ticket-default-report width=80
** If this setting has a string value, then when the ticket
** search page query is blank, the report with this title is shown.
** If the setting is blank (default), then no report is shown.
*/
/*
** WEBPAGE: reportlist
**
** Main menu for Tickets.
*/
void view_list(void){
const char *zScript;
Blob ril; /* Report Item List */
Stmt q;
int rn = 0;
int cnt = 0;
char *defaultReport = db_get("ticket-default-report", 0);
login_check_credentials();
if( !g.perm.RdTkt && !g.perm.NewTkt ){
login_needed(g.anon.RdTkt || g.anon.NewTkt);
return;
}
style_header("Ticket Main Menu");
|
| ︙ | ︙ | |||
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
){
blob_appendf(&ril, "[%zedit</a>]",
href("%R/rptedit?rn=%d", rn));
}
if( g.perm.TktFmt ){
blob_appendf(&ril, "[%zsql</a>]",
href("%R/rptsql?rn=%d", rn));
}
blob_appendf(&ril, "</li>\n");
}
db_finalize(&q);
Th_Store("report_items", blob_str(&ril));
| > > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
){
blob_appendf(&ril, "[%zedit</a>]",
href("%R/rptedit?rn=%d", rn));
}
if( g.perm.TktFmt ){
blob_appendf(&ril, "[%zsql</a>]",
href("%R/rptsql?rn=%d", rn));
}
if( fossil_strcmp(zTitle, defaultReport)==0 ){
blob_appendf(&ril, " ← default");
}
blob_appendf(&ril, "</li>\n");
}
db_finalize(&q);
Th_Store("report_items", blob_str(&ril));
|
| ︙ | ︙ | |||
391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
int rn;
const char *zTitle;
const char *z;
const char *zOwner;
const char *zClrKey;
char *zSQL;
char *zErr = 0;
login_check_credentials();
if( !g.perm.TktFmt ){
login_needed(g.anon.TktFmt);
return;
}
style_set_current_feature("report");
| > | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
int rn;
const char *zTitle;
const char *z;
const char *zOwner;
const char *zClrKey;
char *zSQL;
char *zErr = 0;
int dflt = P("dflt") ? 1 : 0;
login_check_credentials();
if( !g.perm.TktFmt ){
login_needed(g.anon.TktFmt);
return;
}
style_set_current_feature("report");
|
| ︙ | ︙ | |||
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
" owner=%Q, cols=%Q, mtime=now() WHERE rn=%d",
zTitle, zSQL, zOwner, zClrKey, rn);
}else{
db_multi_exec("INSERT INTO reportfmt(title,sqlcode,owner,cols,mtime) "
"VALUES(%Q,%Q,%Q,%Q,now())",
zTitle, zSQL, zOwner, zClrKey);
rn = db_last_insert_rowid();
}
cgi_redirect(mprintf("rptview?rn=%d", rn));
return;
}
}else if( rn==0 ){
zTitle = "";
zSQL = ticket_report_template();
zClrKey = ticket_key_template();
}else{
Stmt q;
db_prepare(&q, "SELECT title, sqlcode, owner, cols "
"FROM reportfmt WHERE rn=%d",rn);
if( db_step(&q)==SQLITE_ROW ){
zTitle = db_column_malloc(&q, 0);
zSQL = db_column_malloc(&q, 1);
zOwner = db_column_malloc(&q, 2);
zClrKey = db_column_malloc(&q, 3);
}
db_finalize(&q);
if( P("copy") ){
rn = 0;
zTitle = mprintf("Copy Of %s", zTitle);
zOwner = g.zLogin;
}
| > > > > > > > > > > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
" owner=%Q, cols=%Q, mtime=now() WHERE rn=%d",
zTitle, zSQL, zOwner, zClrKey, rn);
}else{
db_multi_exec("INSERT INTO reportfmt(title,sqlcode,owner,cols,mtime) "
"VALUES(%Q,%Q,%Q,%Q,now())",
zTitle, zSQL, zOwner, zClrKey);
rn = db_last_insert_rowid();
}
if( dflt ){
db_set("ticket-default-report", zTitle, 0);
}else{
char *defaultReport = db_get("ticket-default-report", 0);
if( fossil_strcmp(zTitle, defaultReport)==0 ){
db_set("ticket-default-report", "", 0);
}
}
cgi_redirect(mprintf("rptview?rn=%d", rn));
return;
}
}else if( rn==0 ){
zTitle = "";
zSQL = ticket_report_template();
zClrKey = ticket_key_template();
}else{
Stmt q;
db_prepare(&q, "SELECT title, sqlcode, owner, cols "
"FROM reportfmt WHERE rn=%d",rn);
if( db_step(&q)==SQLITE_ROW ){
char *defaultReport = db_get("ticket-default-report", 0);
zTitle = db_column_malloc(&q, 0);
zSQL = db_column_malloc(&q, 1);
zOwner = db_column_malloc(&q, 2);
zClrKey = db_column_malloc(&q, 3);
dflt = fossil_strcmp(zTitle, defaultReport)==0;
}
db_finalize(&q);
if( P("copy") ){
rn = 0;
zTitle = mprintf("Copy Of %s", zTitle);
zOwner = g.zLogin;
}
|
| ︙ | ︙ | |||
514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
}
@ <p>Enter an optional color key in the following box. (If blank, no
@ color key is displayed.) Each line contains the text for a single
@ entry in the key. The first token of each line is the background
@ color for that line.<br />
@ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
@ </p>
if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
@ <p>This report format is owned by %h(zOwner). You are not allowed
@ to change it.</p>
@ </form>
report_format_hints();
style_finish_page();
return;
| > > | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
}
@ <p>Enter an optional color key in the following box. (If blank, no
@ color key is displayed.) Each line contains the text for a single
@ entry in the key. The first token of each line is the background
@ color for that line.<br />
@ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
@ </p>
@ <p><label><input type="checkbox" name="dflt" %s(dflt?"checked":"")> \
@ Make this the default report</label></p>
if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
@ <p>This report format is owned by %h(zOwner). You are not allowed
@ to change it.</p>
@ </form>
report_format_hints();
style_finish_page();
return;
|
| ︙ | ︙ | |||
996 997 998 999 1000 1001 1002 | rptview_page_content(0, 1, 1); } /* ** Render a report. */ void rptview_page_content( | | > | < < < | > > > | | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
rptview_page_content(0, 1, 1);
}
/*
** Render a report.
*/
void rptview_page_content(
const char *defaultTitleSearch, /* If rn and title query parameters are
blank, search reports by this title. */
int pageWrap, /* If true, render full page; otherwise, just the report */
int redirectMissing /* If true and report not found, go to reportlist */
){
int count = 0;
int rn, rc;
char *zSql;
char *zTitle;
char *zOwner;
char *zClrKey;
int tabs;
Stmt q;
char *zErr1 = 0;
char *zErr2 = 0;
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; }
tabs = P("tablist")!=0;
db_prepare(&q,
"SELECT title, sqlcode, owner, cols, rn FROM reportfmt WHERE rn=%d",
atoi(PD("rn","0")));
rc = db_step(&q);
if( rc!=SQLITE_ROW ){
const char *titleSearch =
defaultTitleSearch==0 || trim_string(defaultTitleSearch)[0]==0 ?
P("title") : defaultTitleSearch;
db_finalize(&q);
db_prepare(&q,
"SELECT title, sqlcode, owner, cols, rn FROM reportfmt WHERE title GLOB %Q",
titleSearch);
rc = db_step(&q);
}
if( rc!=SQLITE_ROW ){
db_finalize(&q);
if( redirectMissing ) {
cgi_redirect("reportlist");
}
return;
}
zTitle = db_column_malloc(&q, 0);
zSql = db_column_malloc(&q, 1);
zOwner = db_column_malloc(&q, 2);
|
| ︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 |
count = 0;
if( !tabs ){
struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const char *zQS = PD("QUERY_STRING","");
db_multi_exec("PRAGMA empty_result_callbacks=ON");
style_set_current_feature("report");
| | | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 |
count = 0;
if( !tabs ){
struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const char *zQS = PD("QUERY_STRING","");
db_multi_exec("PRAGMA empty_result_callbacks=ON");
style_set_current_feature("report");
if( pageWrap ) {
/* style_finish_page() should provide escaping via %h formatting */
if( zQS[0] ){
style_submenu_element("Raw","%R/%s?tablist=1&%s",g.zPath,zQS);
style_submenu_element("Reports","%R/reportlist?%s",zQS);
} else {
style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
style_submenu_element("Reports","%R/reportlist");
|
| ︙ | ︙ | |||
1101 1102 1103 1104 1105 1106 1107 |
@ </tbody></table>
if( zErr1 ){
@ <p class="reportError">Error: %h(zErr1)</p>
}else if( zErr2 ){
@ <p class="reportError">Error: %h(zErr2)</p>
}
style_table_sorter();
| | | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 |
@ </tbody></table>
if( zErr1 ){
@ <p class="reportError">Error: %h(zErr1)</p>
}else if( zErr2 ){
@ <p class="reportError">Error: %h(zErr2)</p>
}
style_table_sorter();
if( pageWrap ) {
style_finish_page();
}
}else{
report_restrict_sql(&zErr1);
db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2);
report_unrestrict_sql();
cgi_set_content_type("text/plain");
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
1634 1635 1636 1637 1638 1639 1640 |
/*
** WEBPAGE: tktsrch
** Usage: /tktsrch?s=PATTERN
**
** Full-text search of all current tickets
*/
void tkt_srchpage(void){
| | | | | | | 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 |
/*
** WEBPAGE: tktsrch
** Usage: /tktsrch?s=PATTERN
**
** Full-text search of all current tickets
*/
void tkt_srchpage(void){
char *defaultReport;
login_check_credentials();
style_set_current_feature("tkt");
style_header("Ticket Search");
ticket_standard_submenu(T_ALL_BUT(T_SRCH));
if( !search_screen(SRCH_TKT, 0) ){
defaultReport = db_get("ticket-default-report", 0);
if( defaultReport ){
rptview_page_content(defaultReport, 0, 0);
}
}
style_finish_page();
}
|
Changes to test/tester.tcl.
| ︙ | ︙ | |||
349 350 351 352 353 354 355 |
sitemap-extra \
ssh-command \
ssl-ca-location \
ssl-identity \
tclsh \
th1-setup \
th1-uri-regexp \
| | | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
sitemap-extra \
ssh-command \
ssl-ca-location \
ssl-identity \
tclsh \
th1-setup \
th1-uri-regexp \
ticket-default-report \
user-color-map \
uv-sync \
web-browser]
fossil test-th-eval "hasfeature legacyMvRm"
if {[normalize_result] eq "1"} {
|
| ︙ | ︙ |