Fossil

Check-in [484c8f9f]
Login

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

Overview
Comment:Clean up the RSS code slightly.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 484c8f9f860a0e1f9bf5feedbdb682dfb7a37d2c
User & Date: drh 2009-12-08 18:43:51
References
2009-12-08
19:02 Open ticket [974618fe]: fossil all rebuild does redundant rebuilds on windows plus 2 other changes artifact: 28d3590e user: rwilson
Context
2009-12-09
14:39
  • Added enumeration list support via the # character (identical to *).
  • Updated the wiki rules web page to reflect new enumeration list rules and terminated begining
  • tags with
  • .
check-in: 2bb1d646 user: jeremy_c tags: trunk
2009-12-08
18:43
Clean up the RSS code slightly. check-in: 484c8f9f user: drh tags: trunk
10:10
rolled back my last commit for stripping P tags around UL/OL, which had broken logic. check-in: 083cad82 user: stephan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/rss.c.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
94
95
96
97
98
99
100
101
102
103
104

105
106

107

108
109
110
111
112
113
114
115
...
119
120
121
122
123
124
125

126
127
128
129
130
131
132
133
134
135
136
** This file contains code used to create a RSS feed for the CGI interface.
*/
#include "config.h"
#include "rss.h"
#include <assert.h>
#include <time.h>

time_t rss_datetime_to_time_t(const char *dt){
  struct tm the_tm;

  the_tm.tm_year = atoi(dt)-1900;
  the_tm.tm_mon  = atoi(&dt[5])-1;
  the_tm.tm_mday = atoi(&dt[8]);
  the_tm.tm_hour = atoi(&dt[11]);
  the_tm.tm_min  = atoi(&dt[14]);
  the_tm.tm_sec  = atoi(&dt[17]);

  return mktime(&the_tm);
}

/*
** WEBPAGE: timeline.rss
*/

void page_timeline_rss(void){
  Stmt q;
  int nLine=0;
  char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0;
  Blob bSQL;
  const char *zType = PD("y","all"); /* Type of events.  All if NULL */
  const char zSQL1[] =
    @ SELECT
    @   blob.rid,
    @   uuid,
    @   datetime(event.mtime),
    @   coalesce(ecomment,comment),
    @   coalesce(euser,user),
    @   (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
    @   (SELECT count(*) FROM plink WHERE cid=blob.rid)
    @ FROM event, blob
    @ WHERE blob.rid=event.objid
  ;
................................................................................
  @     <description>%s(zProjectDescr)</description>
  @     <pubDate>%s(zPubDate)</pubDate>
  @     <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator>
  db_prepare(&q, blob_buffer(&bSQL));
  blob_reset( &bSQL );
  while( db_step(&q)==SQLITE_ROW && nLine<=20 ){
    const char *zId = db_column_text(&q, 1);
    const char *zDate = db_column_text(&q, 2);
    const char *zCom = db_column_text(&q, 3);
    const char *zAuthor = db_column_text(&q, 4);
    char *zPrefix = "";

    int nChild = db_column_int(&q, 5);
    int nParent = db_column_int(&q, 6);



    zDate = cgi_rfc822_datestamp(rss_datetime_to_time_t(zDate));

    if( nParent>1 && nChild>1 ){
      zPrefix = "*MERGE/FORK* ";
    }else if( nParent>1 ){
      zPrefix = "*MERGE* ";
    }else if( nChild>1 ){
      zPrefix = "*FORK* ";
................................................................................
    @       <title>%s(zPrefix)%s(zCom)</title>
    @       <link>%s(g.zBaseURL)/ci/%s(zId)</link>
    @       <description>%s(zPrefix)%s(zCom)</description>
    @       <pubDate>%s(zDate)</pubDate>
    @       <author>%s(zAuthor)</author>
    @       <guid>%s(g.zBaseURL)/ci/%s(zId)</guid>
    @     </item>

    nLine++;
  }

  db_finalize(&q);
  @   </channel>
  @ </rss>

  if( zFreeProjectName != 0 ){
    free( zFreeProjectName );
  }
}







<
<
<
<
<
<
<
<
<
<
<
<
<



<










|







 







<



>


>

>
|







 







>











24
25
26
27
28
29
30













31
32
33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
..
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
** This file contains code used to create a RSS feed for the CGI interface.
*/
#include "config.h"
#include "rss.h"
#include <assert.h>
#include <time.h>














/*
** WEBPAGE: timeline.rss
*/

void page_timeline_rss(void){
  Stmt q;
  int nLine=0;
  char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0;
  Blob bSQL;
  const char *zType = PD("y","all"); /* Type of events.  All if NULL */
  const char zSQL1[] =
    @ SELECT
    @   blob.rid,
    @   uuid,
    @   event.mtime,
    @   coalesce(ecomment,comment),
    @   coalesce(euser,user),
    @   (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
    @   (SELECT count(*) FROM plink WHERE cid=blob.rid)
    @ FROM event, blob
    @ WHERE blob.rid=event.objid
  ;
................................................................................
  @     <description>%s(zProjectDescr)</description>
  @     <pubDate>%s(zPubDate)</pubDate>
  @     <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator>
  db_prepare(&q, blob_buffer(&bSQL));
  blob_reset( &bSQL );
  while( db_step(&q)==SQLITE_ROW && nLine<=20 ){
    const char *zId = db_column_text(&q, 1);

    const char *zCom = db_column_text(&q, 3);
    const char *zAuthor = db_column_text(&q, 4);
    char *zPrefix = "";
    char *zDate;
    int nChild = db_column_int(&q, 5);
    int nParent = db_column_int(&q, 6);
    time_t ts;

    ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
    zDate = cgi_rfc822_datestamp(ts);

    if( nParent>1 && nChild>1 ){
      zPrefix = "*MERGE/FORK* ";
    }else if( nParent>1 ){
      zPrefix = "*MERGE* ";
    }else if( nChild>1 ){
      zPrefix = "*FORK* ";
................................................................................
    @       <title>%s(zPrefix)%s(zCom)</title>
    @       <link>%s(g.zBaseURL)/ci/%s(zId)</link>
    @       <description>%s(zPrefix)%s(zCom)</description>
    @       <pubDate>%s(zDate)</pubDate>
    @       <author>%s(zAuthor)</author>
    @       <guid>%s(g.zBaseURL)/ci/%s(zId)</guid>
    @     </item>
    free(zDate);
    nLine++;
  }

  db_finalize(&q);
  @   </channel>
  @ </rss>

  if( zFreeProjectName != 0 ){
    free( zFreeProjectName );
  }
}