CVSTrac Legacy Code

Check-in [c72535f17c]
Login

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

Overview
Comment:(#791) allow individual pages to have their own RSS feeds

This means we need to allow generic RSS substitutions in the header. To that end, we add %R for the URL and %F for the title (a distinct feed needs a distinct title).

Figuring out whether a page has its own RSS feed is done by looking for an "RSS" entry in the action bar. The title is built from the project name and the current page title.

Then, to override the default (timeline) RSS feed on any given page, it's just a matter of doing something like:

common_add_action_item(mprintf("tkthistory.rss?tn=%d",tn), "RSS");

and the header output logic will just pick it up.

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c72535f17cdd217c16d3a545b6471299db24dec7
User & Date: cpb 2009-03-08 00:14:55
Context
2009-03-10
01:19
the dashed-forms of the git commands are now not reliably avaiable. check-in: ec1de0af03 user: cpb tags: trunk
2009-03-08
00:14
(#791) allow individual pages to have their own RSS feeds

This means we need to allow generic RSS substitutions in the header. To that end, we add %R for the URL and %F for the title (a distinct feed needs a distinct title).

Figuring out whether a page has its own RSS feed is done by looking for an "RSS" entry in the action bar. The title is built from the project name and the current page title.

Then, to override the default (timeline) RSS feed on any given page, it's just a matter of doing something like:

common_add_action_item(mprintf("tkthistory.rss?tn=%d",tn), "RSS");

and the header output logic will just pick it up. check-in: c72535f17c user: cpb tags: trunk

2009-03-07
00:42
(#231) ditch the opaque class names like "border2" and "bkgnd1" and replace with more meaningful class names, and related cleanups. check-in: 64a9390abe user: cpb tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to common.c.

30
31
32
33
34
35
36



37
38
39
40
41
42
43
..
55
56
57
58
59
60
61












62
63
64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
...
300
301
302
303
304
305
306








307
308
309
310
311
312
313
/*
** Output a string with the following substitutions:
**
**     %T      The title of the current page.
**     %N      Project name
**     %V      CVSTrac version number
**     %B      Base URL



**     %%      The character '%'
*/
static void output_with_subst(const char *zText, const char *zTitle){
  int i;
  while( zText[0] ){
    for(i=0; zText[i] && zText[i]!='%'; i++){}
    if( i>0 ) cgi_append_content(zText, i);
................................................................................
        zText += i+2;
        cgi_printf("%h", "@VERSION@");
        break;
      case 'B':
        zText += i+2;
        cgi_printf("%h", g.zBaseURL);
        break;












      case 'D':
        {
          char *zQS = getenv("QUERY_STRING");
          zText += i+2;
          cgi_printf("%h%h%h", g.zPath,
            (zQS && *zQS) ? "?" : "",
            (zQS && *zQS) ? zQS : zQS
          );
        }
        break;

      case '%':
        zText += i+2;
        cgi_printf("%%");
        break;
      default:
        zText += i+1;
        cgi_printf("%%");
................................................................................
  const char *zUrl,      /* The URL to be appended */
  const char *zName      /* The menu entry name */
){
  azAction[nAction++] = zUrl;
  azAction[nAction++] = zName;
  azAction[nAction] = 0;
}









/*
** Add a "help" link to a specific Wiki page. Currently, we place the help
** link in the "link" section rather than "action" section, although arguably
** it's context dependent. However, there should be a help link on pretty much
** any page, so...
*/







>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
|
<
|
|
|
|
|
|
<

>







 







>
>
>
>
>
>
>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
...
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/*
** Output a string with the following substitutions:
**
**     %T      The title of the current page.
**     %N      Project name
**     %V      CVSTrac version number
**     %B      Base URL
**     %R      Page (or site) RSS feed URL
**     %F      Page (or site) RSS feed title
**     %D      Current document URL (without base URL)
**     %%      The character '%'
*/
static void output_with_subst(const char *zText, const char *zTitle){
  int i;
  while( zText[0] ){
    for(i=0; zText[i] && zText[i]!='%'; i++){}
    if( i>0 ) cgi_append_content(zText, i);
................................................................................
        zText += i+2;
        cgi_printf("%h", "@VERSION@");
        break;
      case 'B':
        zText += i+2;
        cgi_printf("%h", g.zBaseURL);
        break;
      case 'R': {
        const char *z = common_find_action_url("RSS");
        zText += i+2;
        cgi_printf("%h/%h", g.zBaseURL, z ? z : "timeline.rss");
        break;
      }
      case 'F': {
        const char *z = common_find_action_url("RSS");
        zText += i+2;
        cgi_printf("%h %h Feed", g.zName, z ? zTitle : "Timeline" );
        break;
      }
      case 'D': {

        char *zQS = getenv("QUERY_STRING");
        zText += i+2;
        cgi_printf("%h%h%h", g.zPath,
          (zQS && *zQS) ? "?" : "",
          (zQS && *zQS) ? zQS : zQS
        );

        break;
      }
      case '%':
        zText += i+2;
        cgi_printf("%%");
        break;
      default:
        zText += i+1;
        cgi_printf("%%");
................................................................................
  const char *zUrl,      /* The URL to be appended */
  const char *zName      /* The menu entry name */
){
  azAction[nAction++] = zUrl;
  azAction[nAction++] = zName;
  azAction[nAction] = 0;
}

const char *common_find_action_url(const char *zName){
  int i;
  for(i=0; i+1<nAction; i+=2) {
    if( !strcmp(azAction[i+1], zName) ) return azAction[i];
  }
  return NULL;
}

/*
** Add a "help" link to a specific Wiki page. Currently, we place the help
** link in the "link" section rather than "action" section, although arguably
** it's context dependent. However, there should be a help link on pretty much
** any page, so...
*/

Changes to config.h.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
               "<head>\n" \
               "<link rel=\"stylesheet\" title=\"CVSTrac Stylesheet\"\n" \
               "      type=\"text/css\" href=\"%B/cvstrac.css\">\n" \
               "<link rel=\"alternate stylesheet\"\n" \
               "      title=\"Default Stylesheet\"\n" \
               "      type=\"text/css\" href=\"%B/cvstrac_default.css\">\n" \
               "<link rel=\"alternate\" type=\"application/rss+xml\"\n" \
               "   title=\"%N Timeline Feed\" href=\"%B/timeline.rss\">\n" \
               "<link rel=\"index\" title=\"Index\" href=\"%B/index\">\n" \
               "<link rel=\"search\" title=\"Search\" href=\"%B/search\">\n" \
               "<link rel=\"help\" title=\"Help\"\n" \
               "   href=\"%B/wiki?p=CvstracDocumentation\">\n" \
               "<title>%N: %T</title>\n</head>\n" \
               "<body>"








|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
               "<head>\n" \
               "<link rel=\"stylesheet\" title=\"CVSTrac Stylesheet\"\n" \
               "      type=\"text/css\" href=\"%B/cvstrac.css\">\n" \
               "<link rel=\"alternate stylesheet\"\n" \
               "      title=\"Default Stylesheet\"\n" \
               "      type=\"text/css\" href=\"%B/cvstrac_default.css\">\n" \
               "<link rel=\"alternate\" type=\"application/rss+xml\"\n" \
               "   title=\"%F\" href=\"%R\">\n" \
               "<link rel=\"index\" title=\"Index\" href=\"%B/index\">\n" \
               "<link rel=\"search\" title=\"Search\" href=\"%B/search\">\n" \
               "<link rel=\"help\" title=\"Help\"\n" \
               "   href=\"%B/wiki?p=CvstracDocumentation\">\n" \
               "<title>%N: %T</title>\n</head>\n" \
               "<body>"

Changes to setup.c.

1505
1506
1507
1508
1509
1510
1511


1512
1513
1514
1515
1516
1517
1518
  @
  @ <blockquote>
  @ <table>
  @ <tr><td width="40"><b>%%N</b></td><td>The name of the project</td></tr>
  @ <tr><td><b>%%T</b></td><td>The title of the current page</td></tr>
  @ <tr><td><b>%%V</b></td><td>The version number of CVSTrac</td></tr>
  @ <tr><td><b>%%B</b></td><td>CVSTrac base URL</td></tr>


  @ <tr><td><b>%%D</b></td><td>Current document URL (without base URL)</td></tr>
  @ <tr><td><b>%%%%</b></td><td>The literal character "<b>%%</b>"</td></tr>
  @ </table>
  @ </blockquote>
  @
  @ <form action="%s(g.zPath)" method="POST">
  login_output_csrf_token();







>
>







1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
  @
  @ <blockquote>
  @ <table>
  @ <tr><td width="40"><b>%%N</b></td><td>The name of the project</td></tr>
  @ <tr><td><b>%%T</b></td><td>The title of the current page</td></tr>
  @ <tr><td><b>%%V</b></td><td>The version number of CVSTrac</td></tr>
  @ <tr><td><b>%%B</b></td><td>CVSTrac base URL</td></tr>
  @ <tr><td><b>%%R</b></td><td>Page (or site) RSS feed URL</td></tr>
  @ <tr><td><b>%%F</b></td><td>RSS feed title</td></tr>
  @ <tr><td><b>%%D</b></td><td>Current document URL (without base URL)</td></tr>
  @ <tr><td><b>%%%%</b></td><td>The literal character "<b>%%</b>"</td></tr>
  @ </table>
  @ </blockquote>
  @
  @ <form action="%s(g.zPath)" method="POST">
  login_output_csrf_token();