Fossil

Check-in [4c9e24fd]
Login

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

Overview
Comment:Add the "raw" query parameter to the /tkthistory page.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4c9e24fdcc334b97e76c764657bb6748e751691808dd8a90e57e08c85837f099
User & Date: drh 2020-03-22 15:02:12.900
Context
2020-03-22
15:33
The "formatted" mode for the ticket history viewer assumed that all text was Fossil-Wiki formatted. It did not account for Markdown (since that feature was added long before Markdown formatting was added). And, indeed, there is no general way for it to know what the mimetype of the text is. Hence, disable formatted mode, and show all text as plaintext. ... (check-in: f1e8cd69 user: drh tags: trunk)
15:02
Add the "raw" query parameter to the /tkthistory page. ... (check-in: 4c9e24fd user: drh tags: trunk)
14:29
Update the built-in SQLite to the latest 3.32.0 alpha that includes fixes for the DBCONFIG_MAINDBNAME problem. ... (check-in: 8d114c2a user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/tkt.c.
930
931
932
933
934
935
936
937







938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956



957
958



959
960



961
962
963
964
965
966
967
968
969



970
971
972
973
974
975
976
  style_footer();
}

/*
** WEBPAGE: tkthistory
** URL: /tkthistory?name=TICKETUUID
**
** Show the complete change history for a single ticket







*/
void tkthistory_page(void){
  Stmt q;
  char *zTitle;
  const char *zUuid;
  int tagid;
  int nChng = 0;

  login_check_credentials();
  if( !g.perm.Hyperlink || !g.perm.RdTkt ){
    login_needed(g.anon.Hyperlink && g.anon.RdTkt);
    return;
  }
  zUuid = PD("name","");
  zTitle = mprintf("History Of Ticket %h", zUuid);
  style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
  style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
    g.zTop, zUuid);
  style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);



  if( P("plaintext")!=0 ){
    style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);



  }else{
    style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);



  }
  style_header("%z", zTitle);

  tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
  if( tagid==0 ){
    @ No such ticket: %h(zUuid)
    style_footer();
    return;
  }



  db_prepare(&q,
    "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
    "  FROM event, blob"
    " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
    "   AND blob.rid=event.objid"
    " UNION "
    "SELECT datetime(mtime,toLocal()), attachid, uuid, src, filename, user"







|
>
>
>
>
>
>
>



















>
>
>
|

>
>
>


>
>
>









>
>
>







930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
  style_footer();
}

/*
** WEBPAGE: tkthistory
** URL: /tkthistory?name=TICKETUUID
**
** Show the complete change history for a single ticket.  Or (to put it
** another way) show a list of artifacts associated with a single ticket.
**
** By default, the artifacts are decoded and formatted.  If the
** "plaintext" query parameter is present, then icomment text fields
** are shown as plain text rather than being formatted according
** to mimetype.  Or if the "raw" query parameter is present, then the
** undecoded and unformatted text of each artifact is displayed.
*/
void tkthistory_page(void){
  Stmt q;
  char *zTitle;
  const char *zUuid;
  int tagid;
  int nChng = 0;

  login_check_credentials();
  if( !g.perm.Hyperlink || !g.perm.RdTkt ){
    login_needed(g.anon.Hyperlink && g.anon.RdTkt);
    return;
  }
  zUuid = PD("name","");
  zTitle = mprintf("History Of Ticket %h", zUuid);
  style_submenu_element("Status", "%s/info/%s", g.zTop, zUuid);
  style_submenu_element("Check-ins", "%s/tkttimeline?name=%s&y=ci",
    g.zTop, zUuid);
  style_submenu_element("Timeline", "%s/tkttimeline?name=%s", g.zTop, zUuid);
  if( P("raw")!=0 ){
    style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
    style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
  }else if( P("plaintext")!=0 ){
    style_submenu_element("Formatted", "%R/tkthistory/%s", zUuid);
    if( g.perm.Admin ){
      style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
    }
  }else{
    style_submenu_element("Plaintext", "%R/tkthistory/%s?plaintext", zUuid);
    if( g.perm.Admin ){
      style_submenu_element("Raw", "%R/tkthistory/%s?raw", zUuid);
    }
  }
  style_header("%z", zTitle);

  tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid);
  if( tagid==0 ){
    @ No such ticket: %h(zUuid)
    style_footer();
    return;
  }
  if( P("raw")!=0 ){
    @ <h2>Raw Artifacts Associated With Ticket %h(zUuid)</h2>
  }
  db_prepare(&q,
    "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL"
    "  FROM event, blob"
    " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
    "   AND blob.rid=event.objid"
    " UNION "
    "SELECT datetime(mtime,toLocal()), attachid, uuid, src, filename, user"
1011
1012
1013
1014
1015
1016
1017








1018

1019
1020
1021
1022
1023
1024
1025
        @
        @ <li><p>Ticket change
        @ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>]
        @ (rid %d(rid)) by
        hyperlink_to_user(pTicket->zUser,zDate," on");
        hyperlink_to_date(zDate, ":");
        @ </p>








        ticket_output_change_artifact(pTicket, "a");

      }
      manifest_destroy(pTicket);
    }
  }
  db_finalize(&q);
  if( nChng ){
    @ </ol>







>
>
>
>
>
>
>
>
|
>







1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
        @
        @ <li><p>Ticket change
        @ [%z(href("%R/artifact/%!S",zChngUuid))%S(zChngUuid)</a>]
        @ (rid %d(rid)) by
        hyperlink_to_user(pTicket->zUser,zDate," on");
        hyperlink_to_date(zDate, ":");
        @ </p>
        if( P("raw")!=0 ){
          Blob c;
          content_get(rid, &c);
          @ <blockquote><pre>
          @ %h(blob_str(&c))
          @ </pre></blockquote>
          blob_reset(&c);
        }else{
          ticket_output_change_artifact(pTicket, "a");
        }
      }
      manifest_destroy(pTicket);
    }
  }
  db_finalize(&q);
  if( nChng ){
    @ </ol>