Fossil

Check-in [68c24b1857]
Login

Check-in [68c24b1857]

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

Overview
Comment:Progress toward getting ticket handling to work.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 68c24b185731fad5e835f816428aaa739552cdd5
User & Date: drh 2008-05-16 18:11:39.000
Context
2008-05-16
18:57
Get rudimentary ticket editing working. ... (check-in: 46e6a03232 user: drh tags: trunk)
18:11
Progress toward getting ticket handling to work. ... (check-in: 68c24b1857 user: drh tags: trunk)
17:05
The rebuild command corrects any errors seen in the blob.size field. ... (check-in: 5b74febbcc user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/diff.c.
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
  int mid = atoi(PD("mid","0"));
  int fnid = atoi(PD("fnid","0"));
  int i;
  Annotator ann;

  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  if( mid==0 || fnid==0 ){ cgi_redirect("index"); }
  if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
    cgi_redirect("index");
  }
  style_header("File Annotation");
  annotate_file(&ann, fnid, mid, 1);
  @ <pre>
  for(i=0; i<ann.nOrig; i++){
    ((char*)ann.aOrig[i].z)[ann.aOrig[i].n] = 0;
    @ %s(ann.aOrig[i].zSrc): %h(ann.aOrig[i].z)







|

|







736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
  int mid = atoi(PD("mid","0"));
  int fnid = atoi(PD("fnid","0"));
  int i;
  Annotator ann;

  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
  if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
    fossil_redirect_home();
  }
  style_header("File Annotation");
  annotate_file(&ann, fnid, mid, 1);
  @ <pre>
  for(i=0; i<ann.nOrig; i++){
    ((char*)ann.aOrig[i].z)[ann.aOrig[i].n] = 0;
    @ %s(ann.aOrig[i].zSrc): %h(ann.aOrig[i].z)
Changes to src/info.c.
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
    vid = db_lget_int("checkout", 0);
    if( vid==0 ){
      printf("checkout:     nil\n");
    }else{
      show_common_info(vid, "checkout:", 1);
    }
  }else{

    int rid = name_to_rid(g.argv[2]);
    if( rid==0 ){
      fossil_panic("no such object: %s\n", g.argv[2]);
    }
    show_common_info(rid, "uuid:", 1);
  }
}








>
|







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
    vid = db_lget_int("checkout", 0);
    if( vid==0 ){
      printf("checkout:     nil\n");
    }else{
      show_common_info(vid, "checkout:", 1);
    }
  }else{
    int rid;
    rid = name_to_rid(g.argv[2]);
    if( rid==0 ){
      fossil_panic("no such object: %s\n", g.argv[2]);
    }
    show_common_info(rid, "uuid:", 1);
  }
}

580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  style_header("Baseline Changes");
  login_anonymous_available();

  rid = name_to_rid(PD("name",""));
  if( rid==0 ){
    cgi_redirect("index");
  }
  db_prepare(&q,
     "SELECT pid, fid, name"
     "  FROM mlink, filename"
     " WHERE mlink.mid=%d"
     "   AND filename.fnid=mlink.fnid"
     " ORDER BY name",







|







581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  style_header("Baseline Changes");
  login_anonymous_available();

  rid = name_to_rid(PD("name",""));
  if( rid==0 ){
    fossil_redirect_home();
  }
  db_prepare(&q,
     "SELECT pid, fid, name"
     "  FROM mlink, filename"
     " WHERE mlink.mid=%d"
     "   AND filename.fnid=mlink.fnid"
     " ORDER BY name",
803
804
805
806
807
808
809
810
811
812
813




814
815
816
817
818
819
820
** Figure out what the UUID is and jump to it.
*/
void info_page(void){
  const char *zName;
  int rid, nName;
  
  zName = P("name");
  if( zName==0 ) cgi_redirect("index");
  nName = strlen(zName);
  if( nName<4 || nName>UUID_SIZE || !validate16(zName, nName) ){
    cgi_redirect("index");




  }
  rid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%s*'", zName);
  if( rid==0 ){
    style_header("Broken Link");
    @ <p>No such object: %h(zName)</p>
    style_footer();
    return;







|


|
>
>
>
>







804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
** Figure out what the UUID is and jump to it.
*/
void info_page(void){
  const char *zName;
  int rid, nName;
  
  zName = P("name");
  if( zName==0 ) fossil_redirect_home();
  nName = strlen(zName);
  if( nName<4 || nName>UUID_SIZE || !validate16(zName, nName) ){
    fossil_redirect_home();
  }
  if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%s*'", zName) ){
    tktview_page();
    return;
  }
  rid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%s*'", zName);
  if( rid==0 ){
    style_header("Broken Link");
    @ <p>No such object: %h(zName)</p>
    style_footer();
    return;
Changes to src/main.c.
449
450
451
452
453
454
455







456
457
458
459
460
461
462
    g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
    g.zTop = &g.zBaseURL[8+strlen(zHost)];
  }else{
    g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);
    g.zTop = &g.zBaseURL[7+strlen(zHost)];
  }
}








/*
** Preconditions:
**
**    * Environment variables are set up according to the CGI standard.
**    * The respository database has been located and opened.
** 







>
>
>
>
>
>
>







449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
    g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
    g.zTop = &g.zBaseURL[8+strlen(zHost)];
  }else{
    g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);
    g.zTop = &g.zBaseURL[7+strlen(zHost)];
  }
}

/*
** Send an HTTP redirect back to the designated Index Page.
*/
void fossil_redirect_home(void){
  cgi_redirectf("%s%s", g.zBaseURL, db_get("index-page", "/index"));
}

/*
** Preconditions:
**
**    * Environment variables are set up according to the CGI standard.
**    * The respository database has been located and opened.
** 
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
  /* Find the page that the user has requested, construct and deliver that
  ** page.
  */
  set_base_url();
  zPathInfo = P("PATH_INFO");
  if( zPathInfo==0 || zPathInfo[0]==0 
      || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
    cgi_redirectf("%s%s", g.zBaseURL, db_get("index-page", "/index"));
  }else{
    zPath = mprintf("%s", zPathInfo);
  }

  /* Remove the leading "/" at the beginning of the path.
  */
  g.zPath = &zPath[1];







|







479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
  /* Find the page that the user has requested, construct and deliver that
  ** page.
  */
  set_base_url();
  zPathInfo = P("PATH_INFO");
  if( zPathInfo==0 || zPathInfo[0]==0 
      || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
    fossil_redirect_home();
  }else{
    zPath = mprintf("%s", zPathInfo);
  }

  /* Remove the leading "/" at the beginning of the path.
  */
  g.zPath = &zPath[1];
Changes to src/style.c.
86
87
88
89
90
91
92

93
94
95
96
97
98
99
  Th_Store("index_page", db_get("index-page","/home"));
  Th_Store("manifest_version", MANIFEST_VERSION);
  Th_Store("manifest_date", MANIFEST_DATE);
  if( g.zLogin ){
    Th_Store("login", g.zLogin);
  }
  Th_Render(zHeader);

  cgi_destination(CGI_BODY);
  g.cgiPanic = 1;
}

/*
** Draw the footer at the bottom of the page.
*/







>







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  Th_Store("index_page", db_get("index-page","/home"));
  Th_Store("manifest_version", MANIFEST_VERSION);
  Th_Store("manifest_date", MANIFEST_DATE);
  if( g.zLogin ){
    Th_Store("login", g.zLogin);
  }
  Th_Render(zHeader);
  Th_Unstore("title");   /* Avoid collisions with ticket field names */
  cgi_destination(CGI_BODY);
  g.cgiPanic = 1;
}

/*
** Draw the footer at the bottom of the page.
*/
Changes to src/th_main.c.
279
280
281
282
283
284
285









286
287
288
289
290
291
292
/*
** Store a string value in a variable in the interpreter.
*/
void Th_Store(const char *zName, const char *zValue){
  Th_FossilInit();
  Th_SetVar(g.interp, (uchar*)zName, -1, (uchar*)zValue, strlen(zValue));
}










/*
** Retrieve a string value from the interpreter.  If no such
** variable exists, return NULL.
*/
char *Th_Fetch(const char *zName, int *pSize){
  int rc;







>
>
>
>
>
>
>
>
>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
/*
** Store a string value in a variable in the interpreter.
*/
void Th_Store(const char *zName, const char *zValue){
  Th_FossilInit();
  Th_SetVar(g.interp, (uchar*)zName, -1, (uchar*)zValue, strlen(zValue));
}

/*
** Unset a variable.
*/
void Th_Unstore(const char *zName){
  if( g.interp ){
    Th_UnsetVar(g.interp, (uchar*)zName, -1);
  }
}

/*
** Retrieve a string value from the interpreter.  If no such
** variable exists, return NULL.
*/
char *Th_Fetch(const char *zName, int *pSize){
  int rc;
Changes to src/tkt.c.
296
297
298
299
300
301
302

303
304
305
306
307
308
309
  }
  db_finalize(&q);
  db_end_transaction(0);
}

/*
** WEBPAGE: tktview

**
** View a ticket.
*/
void tktview_page(void){
  char *zScript;
  int nScript;
  login_check_credentials();







>







296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
  }
  db_finalize(&q);
  db_end_transaction(0);
}

/*
** WEBPAGE: tktview
** URL:  tktview?name=UUID
**
** View a ticket.
*/
void tktview_page(void){
  char *zScript;
  int nScript;
  login_check_credentials();