Fossil

Check-in [f3f7f138]
Login

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

Overview
Comment:ticket show working(without UUID-filter)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wolfgangTicketCmd
Files: files | file ages | folders
SHA1:f3f7f138154aef259d2aff0a4d866c3b2eafd64a
User & Date: wolfgang 2010-10-04 20:18:06
Context
2010-10-05
09:56
merge from trunk and extending Makefile.dmc with event check-in: a6dd0bf3 user: wolfgang tags: wolfgangTicketCmd
2010-10-04
20:18
ticket show working(without UUID-filter) check-in: f3f7f138 user: wolfgang tags: wolfgangTicketCmd
2010-10-03
23:31
Make the R card of manifests truely optional. It is always generated on manifests created by Fossil itself, but 3rd party import tools might choose to omit the R card as a simplification. Ticket [a32ff1eddb6ac1f499]. check-in: aab38ef0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/report.c.

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

/*
** This is the SQLite authorizer callback used to make sure that the
** SQL statements entered by users do not try to do anything untoward.
** If anything suspicious is tried, set *(char**)pError to an error
** message obtained from malloc.
*/
static int report_query_authorizer(
  void *pError,
  int code,
  const char *zArg1,
  const char *zArg2,
  const char *zArg3,
  const char *zArg4
){







|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

/*
** This is the SQLite authorizer callback used to make sure that the
** SQL statements entered by users do not try to do anything untoward.
** If anything suspicious is tried, set *(char**)pError to an error
** message obtained from malloc.
*/
int report_query_authorizer(
  void *pError,
  int code,
  const char *zArg1,
  const char *zArg2,
  const char *zArg3,
  const char *zArg4
){

Changes to src/tkt.c.

344
345
346
347
348
349
350

351
352
353
354
355
356
357
358
359
360
361

362
363
364
365
366
367
368
...
826
827
828
829
830
831
832









































































































































      const char *zFile = db_column_text(&q, 1);
      const char *zUser = db_column_text(&q, 2);
      if( cnt==0 ){
        @ <hr /><h2>Attachments:</h2>
        @ <ul>
      }
      cnt++;

      if( g.okRead && g.okHistory ){
        @ <li><a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
        @ %h(zFile)</a>
      }else{
        @ %h(zFile)
      }
      @ added by %h(zUser) on
      hyperlink_to_date(zDate, ".");
      if( g.okWrTkt && g.okAttach ){
        @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
      }

    }
    if( cnt ){
      @ </ul>
    }
    db_finalize(&q);
  }
 
................................................................................
    }else{
      @ <li>Change %h(z) to "%h(blob_str(&val))"</li>
    }
    blob_reset(&val);
  }
  @ </ol>
}
















































































































































>

|









>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
...
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
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
      const char *zFile = db_column_text(&q, 1);
      const char *zUser = db_column_text(&q, 2);
      if( cnt==0 ){
        @ <hr /><h2>Attachments:</h2>
        @ <ul>
      }
      cnt++;
      @ <li>
      if( g.okRead && g.okHistory ){
        @ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
        @ %h(zFile)</a>
      }else{
        @ %h(zFile)
      }
      @ added by %h(zUser) on
      hyperlink_to_date(zDate, ".");
      if( g.okWrTkt && g.okAttach ){
        @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
      }
      @ </li>
    }
    if( cnt ){
      @ </ul>
    }
    db_finalize(&q);
  }
 
................................................................................
    }else{
      @ <li>Change %h(z) to "%h(blob_str(&val))"</li>
    }
    blob_reset(&val);
  }
  @ </ol>
}

/*
** user defined separator used by ticket show command
*/
static const char *zSep = 0;

/*
** Output the text given in the argument.  Convert tabs and newlines into
** spaces.
*/
static void output_no_tabs(const char *z){
  while( z && z[0] ){
    int i, j;
    for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){}
    if( i>0 ){
      printf("%.*s", i, z);
    }
    for(j=i; isspace(z[j]); j++){}
    if( j>i ){
      printf("%*s", j-i, "");
    }
    z += j;
  }
}

/*
** Output a row as a tab-separated line of text.
*/
int output_separated(
  void *pUser,     /* Pointer to row-count integer */
  int nArg,        /* Number of columns in this result row */
  char **azArg,    /* Text of data in all columns */
  char **azName    /* Names of the columns */
){
  int *pCount = (int*)pUser;
  int i;

  if( *pCount==0 ){
    for(i=0; i<nArg; i++){
      output_no_tabs(azName[i]);
      printf("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n");
    }
  }
  ++*pCount;
  for(i=0; i<nArg; i++){
    output_no_tabs(azArg[i]);
    printf("%s", i<nArg-1 ? (zSep?zSep:"\t") : "\n");
  }
  return 0;
}

/*
** COMMAND: ticket
** Usage: %fossil ticket SUBCOMMAND ...
**
** Run various subcommands to control tickets
**
**     %fossil ticket show REPORTNR ?TICKETUUID? ?-l|--limit LIMITCHAR?
**
**         Run the the ticket report, identified by the report number
**         used in the gui. The data is written as flat file on stdout,
**         using "," as separator. The seperator "," can be changed using
**         the -l or --limit option.
**         If TICKETUUID is given on the commandline, only this ticket
**         is shown, if the report delivers the uuid, otherwise the
**         argument is ignored.
**
**     %fossil ticket set FIELD VALUE ?FIELD VALUE ... ? TICKETUUID
**
**         change ticket identified by TICKETUUID and set the value of
**         field FIELD to VALUE. Valid field descriptions are:
**            status, type, severity, priority, resolution,
**            foundin, private_contact, resolution, title or comment
**         Field names given above are the ones, defined in a standard
**         fossil environment. If you have added, deleted columns, you
**         change the all your configured columns.
**         You can use more than one field/value pair on the commandline.
**
**     %fossil ticket add FIELD VALUE ?FIELD VALUE ... ?
**
**         like set, but create a new ticket with the given values.
**
*/
void ticket_cmd(void){
  int n;

  db_find_and_open_repository(1);

  if( g.argc<3 ){
    usage("add|set|show");
  }else{
    n = strlen(g.argv[2]);
    if( strncmp(g.argv[2],"show",n)==0 ){
      if( g.argc==3 ){
        usage("ticket show REPORTNR");
      }else{
        int rn;
        Stmt q;
        char *zSql;
        char *zTitle;
        char *zOwner;
        char *zClrKey;
        char *zErr1 = 0;
        char *zErr2 = 0;
        int count = 0;

        zSep = find_option("limit","l",1);
if( g.argc>4 ){
  fossil_fatal("show filter not implemented yet");
}

        rn = atoi(g.argv[3]);
        /* view_add_functions(tabs); */
        db_prepare(&q,
          "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn);
        if( db_step(&q)!=SQLITE_ROW ){
          db_finalize(&q);
          fossil_fatal("unkown report format(%d)!",rn);
        }
        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);
        count = 0;
        sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1);
        sqlite3_exec(g.db, zSql, output_separated, &count, &zErr2);
        sqlite3_set_authorizer(g.db, 0, 0);
        cgi_set_content_type("text/plain");
      }
    }else if( strncmp(g.argv[2],"set",n)==0 ){
      fossil_fatal("set unimplemented");
    }else if( strncmp(g.argv[2],"add",n)==0 ){
      fossil_fatal("add unimplemented");
    }
  }
}