CVSTrac Legacy Code

Check-in [4149691655]
Login

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

Overview
Comment:(#786) ensure local attachments links from the {quote:{image:}} tags aren't broken in the RSS feed. This requires adding an appropriate page id to the formatting calls.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 41496916558f43d4106f9dcc0f21eca293c90f79
User & Date: cpb 2009-02-25 02:04:47
Context
2009-03-02
00:07
(#787) append/add remarks should be hidden for users without ticket write permissions check-in: 10e5c9bba7 user: cpb tags: trunk
2009-02-25
02:04
(#786) ensure local attachments links from the {quote:{image:}} tags aren't broken in the RSS feed. This requires adding an appropriate page id to the formatting calls. check-in: 4149691655 user: cpb tags: trunk
2009-02-19
03:38
(#783) when dealing with remarks in the timeline, break them out separately and (try to) link directly to a new remark in the ticket. This won't work perfectly when dealing with direct edits to the remark field, but for normal use it should be fine. check-in: 743d4611de user: cpb tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to rss.c.

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
337
338
339
340
341
342
343

344
345
346
347
348
349
350
...
407
408
409
410
411
412
413


414
415
416
417
418
419
420
...
448
449
450
451
452
453
454

455
456
457
458
459
460
461
...
468
469
470
471
472
473
474

475
476
477
478
479
480
481
...
495
496
497
498
499
500
501

502
503
504
505
506
507
508
...
546
547
548
549
550
551
552

553
554
555
556
557
558
559
...
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
  common_rss_header("Unauthorized", "No content available", 0);
  common_rss_footer();
}

/*
** Format wiki output and return it in a buffer.
*/
char *format_formatted(const char *zText){
  /* we'll need to restore this later */
  int n=0, n2=0;
  char *zFormatted;
  char *zContent = cgi_extract_content(&n);

  output_formatted(zText,0);
  zFormatted = cgi_extract_content(&n2);

  /* restore the original buffer */
  cgi_append_content(zContent,n);
  if( zContent ) free(zContent);

  return zFormatted;
................................................................................

  lastDay = 0;
  common_rss_header("Timeline", "Changes", nLastBuildDate);
  for(i=0; az[i]; i+=7){
    char *zMsg = 0;      /* HTML text for description */
    char *zWiki = 0;     /* Wiki text for description */
    char *zTailMsg = 0; /* trailing HTML text for description */

    char zLink[400];
    char zPrefix[1000];
    char zSuffix[200];
    int nEdits, nLastEdit;
    
    thisDate = atoi(az[i]);
    pTm = localtime(&thisDate);
................................................................................
        break;
      }
      case 2: {  /* A new ticket was created */
        bprintf(zPrefix, sizeof(zPrefix), "Create ticket #%.20s: ", az[i+5]);
        bprintf(zSuffix, sizeof(zSuffix), " (By %.30s)", az[i+2]);
        bprintf(zLink,sizeof(zLink), "tktview?tn=%.20s",az[i+5]);



        /*
        ** Ticket title is not wiki markup, but the description _is_.
        ** Include both of them.
        */
        zMsg = mprintf("Created #%.20s <i>%h</i>:", az[i+5], az[i+6]);
        if( rssDetail>=9 ) zWiki = az[i+4];
        break;
................................................................................
          appendf(zPrefix,0,sizeof(zPrefix), " Plus other changes.");
          while( az[i+7] && atoi(az[i+8])==6 && strcmp(az[i],az[i+7])==0
                 && strcmp(az[i+5],az[i+12])==0 ){
            i += 7;
          }
        }
        bprintf(zLink,sizeof(zLink),"tktview?tn=%.20s",az[i+5]);

        break;
      }
      case 4: {  /* The assigned-to field of a ticket changed */
        if( rssDetail>=5 ){
          zMsg = mprintf("%h",get_ticket_title( atoi(az[i+5]) ));
        }
        if( az[i+4][0]==0 ){
................................................................................
        }else{
          bprintf(zPrefix, sizeof(zPrefix),
                  "Reassign ticket #%.20s from %.50s to %.50s",
                  az[i+5], az[i+3], az[i+4]); 
        }
        bprintf(zSuffix, sizeof(zSuffix), " (By %.30s)", az[i+2]);
        bprintf(zLink,sizeof(zLink),"tktview?tn=%.20s",az[i+5]);

        break;
      }
      case 5: {   /* Changes to a Wiki page */
        bprintf(zPrefix, sizeof(zPrefix), "Wiki page %.300s ", az[i+5]);
        /* Skip over subsequent lines of the same text and display 
        ** number of edits if greater then 1
        */
................................................................................
        }
        if( rssDetail>=5 ){
          zMsg = mprintf("%h",az[i+6]);
        }
        if( g.okRdWiki ){
          bprintf(zLink,sizeof(zLink),"wiki?p=%.300s",az[i+5]);
        }

        break;
      }
      case 6: {  /* Changes to a ticket other than status or assignment */
        bprintf(zSuffix, sizeof(zSuffix), " (By %.30s)", az[i+2]);
        /* Skip over subsequent lines of the same text and display 
        ** number of edits if greater then 1
        */
................................................................................
        if( nEdits>1 ){
          bprintf(zPrefix, sizeof(zPrefix), "%d changes to ticket #%.20s",
                  nEdits, az[i+5]);
        }else{
          bprintf(zPrefix, sizeof(zPrefix), "Changes to ticket #%.20s",
              az[i+5]);
        }

        break;
      }
      case 7: { /* Attachments */
        if( isdigit(az[i+3][0]) ){
          bprintf(zPrefix, sizeof(zPrefix), "Attachment to ticket #%.20s: ",
                  az[i+3]);
          zMsg = mprintf(
................................................................................
      }
      cgi_printf("%h","<br>");
      /* don't free this */
    }

    if( zWiki ){
      if( rssDetail<9 && output_trim_message(zWiki, MN_CKIN_MSG, MX_CKIN_MSG) ){
        zWiki = format_formatted(zWiki);
        @ %h(zWiki) [...]%h("<br>")
      }else{
        zWiki = format_formatted(zWiki);
        @ %h(zWiki)%h("<br>")
      }
      free(zWiki);  /* format_formatted(), no longer points to az[?] */
    }
    
    if(zTailMsg){
      if( rssDetail<9







|





|







 







>







 







>
>







 







>







 







>







 







>







 







>







 







|


|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
...
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
...
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
...
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
...
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
...
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
  common_rss_header("Unauthorized", "No content available", 0);
  common_rss_footer();
}

/*
** Format wiki output and return it in a buffer.
*/
char *format_formatted(const char *zText, const char *zPageId){
  /* we'll need to restore this later */
  int n=0, n2=0;
  char *zFormatted;
  char *zContent = cgi_extract_content(&n);

  output_formatted(zText,zPageId);
  zFormatted = cgi_extract_content(&n2);

  /* restore the original buffer */
  cgi_append_content(zContent,n);
  if( zContent ) free(zContent);

  return zFormatted;
................................................................................

  lastDay = 0;
  common_rss_header("Timeline", "Changes", nLastBuildDate);
  for(i=0; az[i]; i+=7){
    char *zMsg = 0;      /* HTML text for description */
    char *zWiki = 0;     /* Wiki text for description */
    char *zTailMsg = 0; /* trailing HTML text for description */
    char *zPageId = 0;
    char zLink[400];
    char zPrefix[1000];
    char zSuffix[200];
    int nEdits, nLastEdit;
    
    thisDate = atoi(az[i]);
    pTm = localtime(&thisDate);
................................................................................
        break;
      }
      case 2: {  /* A new ticket was created */
        bprintf(zPrefix, sizeof(zPrefix), "Create ticket #%.20s: ", az[i+5]);
        bprintf(zSuffix, sizeof(zSuffix), " (By %.30s)", az[i+2]);
        bprintf(zLink,sizeof(zLink), "tktview?tn=%.20s",az[i+5]);

        zPageId = az[i+5];

        /*
        ** Ticket title is not wiki markup, but the description _is_.
        ** Include both of them.
        */
        zMsg = mprintf("Created #%.20s <i>%h</i>:", az[i+5], az[i+6]);
        if( rssDetail>=9 ) zWiki = az[i+4];
        break;
................................................................................
          appendf(zPrefix,0,sizeof(zPrefix), " Plus other changes.");
          while( az[i+7] && atoi(az[i+8])==6 && strcmp(az[i],az[i+7])==0
                 && strcmp(az[i+5],az[i+12])==0 ){
            i += 7;
          }
        }
        bprintf(zLink,sizeof(zLink),"tktview?tn=%.20s",az[i+5]);
        zPageId = az[i+5];
        break;
      }
      case 4: {  /* The assigned-to field of a ticket changed */
        if( rssDetail>=5 ){
          zMsg = mprintf("%h",get_ticket_title( atoi(az[i+5]) ));
        }
        if( az[i+4][0]==0 ){
................................................................................
        }else{
          bprintf(zPrefix, sizeof(zPrefix),
                  "Reassign ticket #%.20s from %.50s to %.50s",
                  az[i+5], az[i+3], az[i+4]); 
        }
        bprintf(zSuffix, sizeof(zSuffix), " (By %.30s)", az[i+2]);
        bprintf(zLink,sizeof(zLink),"tktview?tn=%.20s",az[i+5]);
        zPageId = az[i+5];
        break;
      }
      case 5: {   /* Changes to a Wiki page */
        bprintf(zPrefix, sizeof(zPrefix), "Wiki page %.300s ", az[i+5]);
        /* Skip over subsequent lines of the same text and display 
        ** number of edits if greater then 1
        */
................................................................................
        }
        if( rssDetail>=5 ){
          zMsg = mprintf("%h",az[i+6]);
        }
        if( g.okRdWiki ){
          bprintf(zLink,sizeof(zLink),"wiki?p=%.300s",az[i+5]);
        }
        zPageId = az[i+5];
        break;
      }
      case 6: {  /* Changes to a ticket other than status or assignment */
        bprintf(zSuffix, sizeof(zSuffix), " (By %.30s)", az[i+2]);
        /* Skip over subsequent lines of the same text and display 
        ** number of edits if greater then 1
        */
................................................................................
        if( nEdits>1 ){
          bprintf(zPrefix, sizeof(zPrefix), "%d changes to ticket #%.20s",
                  nEdits, az[i+5]);
        }else{
          bprintf(zPrefix, sizeof(zPrefix), "Changes to ticket #%.20s",
              az[i+5]);
        }
        zPageId = az[i+5];
        break;
      }
      case 7: { /* Attachments */
        if( isdigit(az[i+3][0]) ){
          bprintf(zPrefix, sizeof(zPrefix), "Attachment to ticket #%.20s: ",
                  az[i+3]);
          zMsg = mprintf(
................................................................................
      }
      cgi_printf("%h","<br>");
      /* don't free this */
    }

    if( zWiki ){
      if( rssDetail<9 && output_trim_message(zWiki, MN_CKIN_MSG, MX_CKIN_MSG) ){
        zWiki = format_formatted(zWiki, zPageId);
        @ %h(zWiki) [...]%h("<br>")
      }else{
        zWiki = format_formatted(zWiki, zPageId);
        @ %h(zWiki)%h("<br>")
      }
      free(zWiki);  /* format_formatted(), no longer points to az[?] */
    }
    
    if(zTailMsg){
      if( rssDetail<9

Changes to ticket.c.

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  }
  if( cnt['c']>0 && (azSubst['c']==0 || azSubst['c'][0]==0) ){
    azSubst['c'] = 
      db_short_query("SELECT user.email FROM ticket, user "
                     "WHERE ticket.tn=%d and ticket.owner=user.id", tn);
  }
  if( cnt['D'] ){
    azSubst['D'] = format_formatted( azSubst['d'] );
    cnt['d']--;
  }
  if( cnt['R'] ){
    azSubst['R'] = format_formatted( azSubst['r'] );
    cnt['r']--;
  }

  /* Sanitize the strings to be substituted by removing any single-quotes
  ** and backslashes.
  **
  ** That way, the notify command can contains strings like '%d' or '%r'







|



|







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  }
  if( cnt['c']>0 && (azSubst['c']==0 || azSubst['c'][0]==0) ){
    azSubst['c'] = 
      db_short_query("SELECT user.email FROM ticket, user "
                     "WHERE ticket.tn=%d and ticket.owner=user.id", tn);
  }
  if( cnt['D'] ){
    azSubst['D'] = format_formatted( azSubst['d'], mprintf("%d", tn) );
    cnt['d']--;
  }
  if( cnt['R'] ){
    azSubst['R'] = format_formatted( azSubst['r'], mprintf("%d", tn) );
    cnt['r']--;
  }

  /* Sanitize the strings to be substituted by removing any single-quotes
  ** and backslashes.
  **
  ** That way, the notify command can contains strings like '%d' or '%r'