Fossil

Changes On Branch 714ce73d38ef9d1b
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch ticket-search-empty-report-number Through [714ce73d38] Excluding Merge-Ins

This is equivalent to a diff from dc97155ec7 to 714ce73d38

2021-07-11
21:55
Add default report checkbox and compare report titles instead Closed-Leaf check-in: eaa7f6bb5c user: kevgrig tags: ticket-search-empty-report-number
19:30
Enhance the Cache-control: header for tarballs and archives so that if the object is uniquely identified by a hash the download has a 10-year timeout and an "immutable" tag. check-in: 44339d5378 user: drh tags: trunk
19:16
Checked into the wrong branch... Closed-Leaf check-in: 005bba0650 user: drh tags: wrong-branch
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
2021-07-09
16:15
Auto-sync prior to running "fossil open". Add the --nosync flags to "fossil open" and "fossil up" to disable the auto-sync. check-in: dc97155ec7 user: drh tags: trunk
10:51
Update to the latest Pikchr trunk version. check-in: f0b08d071a user: drh tags: trunk

Changes to src/report.c.
25
26
27
28
29
30
31









32
33
34
35
36
37
38
/* Forward references to static routines */
static void report_format_hints(void);

#ifndef SQLITE_RECURSIVE
#  define SQLITE_RECURSIVE            33
#endif










/*
** WEBPAGE: reportlist
**
** Main menu for Tickets.
*/
void view_list(void){
  const char *zScript;







>
>
>
>
>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Forward references to static routines */
static void report_format_hints(void);

#ifndef SQLITE_RECURSIVE
#  define SQLITE_RECURSIVE            33
#endif

/* Settings that can be used to control ticket reports */
/*
** SETTING: ticket-search-empty-report-number    width=10 default=0
**
** If this setting has an integer value of N, then when the ticket
** search page query is blank, the report with rn=N is shown.
** If N is zero, then no report is shown.
*/

/*
** WEBPAGE: reportlist
**
** Main menu for Tickets.
*/
void view_list(void){
  const char *zScript;
980
981
982
983
984
985
986











987
988
989
990
991
992
993
994
995
996
997
998
999
1000



1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013

1014

1015
1016
1017
1018
1019
1020
1021
**
** Generate a report.  The rn query parameter is the report number
** corresponding to REPORTFMT.RN.  If the tablist query parameter exists,
** then the output consists of lines of tab-separated fields instead of
** an HTML table.
*/
void rptview_page(void){











  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 ){
    db_finalize(&q);
    db_prepare(&q,
      "SELECT title, sqlcode, owner, cols, rn FROM reportfmt WHERE title GLOB %Q",
      P("title"));
    rc = db_step(&q);
  }
  if( rc!=SQLITE_ROW ){
    db_finalize(&q);

    cgi_redirect("reportlist");

    return;
  }
  zTitle = db_column_malloc(&q, 0);
  zSql = db_column_malloc(&q, 1);
  zOwner = db_column_malloc(&q, 2);
  zClrKey = db_column_malloc(&q, 3);
  rn = db_column_int(&q,4);







>
>
>
>
>
>
>
>
>
>
>

|












>
>
>


|










>
|
>







989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
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
**
** Generate a report.  The rn query parameter is the report number
** corresponding to REPORTFMT.RN.  If the tablist query parameter exists,
** then the output consists of lines of tab-separated fields instead of
** an HTML table.
*/
void rptview_page(void){
  rptview_page_content(0, 1, 1);
}

/*
** Render a report.
*/
void rptview_page_content(
  int rn, /* Report number. If 0, retrieve from rn query parameter. */
  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 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;
  if ( rn==0 ) {
    rn = atoi(PD("rn","0"));
  }
  db_prepare(&q,
    "SELECT title, sqlcode, owner, cols, rn FROM reportfmt WHERE rn=%d",
     rn);
  rc = db_step(&q);
  if( rc!=SQLITE_ROW ){
    db_finalize(&q);
    db_prepare(&q,
      "SELECT title, sqlcode, owner, cols, rn FROM reportfmt WHERE title GLOB %Q",
      P("title"));
    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);
  zClrKey = db_column_malloc(&q, 3);
  rn = db_column_int(&q,4);
1039
1040
1041
1042
1043
1044
1045

1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064

1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080

1081

1082
1083
1084
1085
1086
1087
1088
  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");

    /* 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");
    }
    if( g.perm.Admin
       || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
      style_submenu_element("Edit", "rptedit?rn=%d", rn);
    }
    if( g.perm.TktFmt ){
      style_submenu_element("SQL", "rptsql?rn=%d",rn);
    }
    if( g.perm.NewTkt ){
      style_submenu_element("New Ticket", "%R/tktnew");
    }
    style_header("%s", zTitle);

    output_color_key(zClrKey, 1,
        "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\"");
    @ <table border="1" cellpadding="2" cellspacing="0" class="report sortable"
    @  data-column-types='' data-init-sort='0'>
    sState.rn = rn;
    sState.nCount = 0;
    report_restrict_sql(&zErr1);
    db_exec_readonly(g.db, zSql, generate_html, &sState, &zErr2);
    report_unrestrict_sql();
    @ </tbody></table>
    if( zErr1 ){
      @ <p class="reportError">Error: %h(zErr1)</p>
    }else if( zErr2 ){
      @ <p class="reportError">Error: %h(zErr2)</p>
    }
    style_table_sorter();

    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");
  }
}







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
















>
|
>







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
  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");
      }
      if( g.perm.Admin
        || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
        style_submenu_element("Edit", "rptedit?rn=%d", rn);
      }
      if( g.perm.TktFmt ){
        style_submenu_element("SQL", "rptsql?rn=%d",rn);
      }
      if( g.perm.NewTkt ){
        style_submenu_element("New Ticket", "%R/tktnew");
      }
      style_header("%s", zTitle);
    }
    output_color_key(zClrKey, 1,
        "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\"");
    @ <table border="1" cellpadding="2" cellspacing="0" class="report sortable"
    @  data-column-types='' data-init-sort='0'>
    sState.rn = rn;
    sState.nCount = 0;
    report_restrict_sql(&zErr1);
    db_exec_readonly(g.db, zSql, generate_html, &sState, &zErr2);
    report_unrestrict_sql();
    @ </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

1641
1642
1643
1644
1645





1646
1647
/*
** WEBPAGE: tktsrch
** Usage:  /tktsrch?s=PATTERN
**
** Full-text search of all current tickets
*/
void tkt_srchpage(void){

  login_check_credentials();
  style_set_current_feature("tkt");
  style_header("Ticket Search");
  ticket_standard_submenu(T_ALL_BUT(T_SRCH));
  search_screen(SRCH_TKT, 0);





  style_finish_page();
}







>




|
>
>
>
>
>


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){
  int rn;
  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) ) {
    rn = db_get_int("ticket-search-empty-report-number",0);
    if ( rn ) {
      rptview_page_content(rn, 0, 0);
    }
  }
  style_finish_page();
}
Changes to test/tester.tcl.
349
350
351
352
353
354
355

356
357
358
359
360
361
362
      sitemap-extra \
      ssh-command \
      ssl-ca-location \
      ssl-identity \
      tclsh \
      th1-setup \
      th1-uri-regexp \

      user-color-map \
      uv-sync \
      web-browser]

  fossil test-th-eval "hasfeature legacyMvRm"

  if {[normalize_result] eq "1"} {







>







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-search-empty-report-number \
      user-color-map \
      uv-sync \
      web-browser]

  fossil test-th-eval "hasfeature legacyMvRm"

  if {[normalize_result] eq "1"} {