Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merged in [timeline-rss-ticket] changes. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
dbaf5209105ee8346acc6742ae48893e |
| User & Date: | stephan 2013-02-20 18:46:49.299 |
Context
|
2013-02-20
| ||
| 18:54 | Added timeline.rss changes to changelog. check-in: d84ec60ddd user: stephan tags: trunk | |
| 18:46 | Merged in [timeline-rss-ticket] changes. check-in: dbaf520910 user: stephan tags: trunk | |
| 15:08 | In main.c: Shorten all source code lines to no more than 80 characters. Add google-chrome to the list of browser to try to launch with the "ui" command. check-in: 12ff5ff85e user: drh tags: trunk | |
|
2013-02-18
| ||
| 21:45 | /info/TICKET_UUID now only shows the ticket title if the ticket db has a title field. Closed-Leaf check-in: 1c46835e4c user: stephan tags: timeline-rss-ticket | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 |
}
int db_lget_int(const char *zName, int dflt){
return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
}
void db_lset_int(const char *zName, int value){
db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
}
/*
** Record the name of a local repository in the global_config() database.
** The repository filename %s is recorded as an entry with a "name" field
** of the following form:
**
** repo:%s
| > > > > > > > > > > > > > > > > > > > > > | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 |
}
int db_lget_int(const char *zName, int dflt){
return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
}
void db_lset_int(const char *zName, int value){
db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
}
/*
** Returns non-0 if the database (which must be open) table identified
** by zTableName has a column named zColName (case-sensitive), else
** returns 0.
*/
int db_table_has_column( char const *zTableName, char const *zColName ){
Stmt q = empty_Stmt;
int rc = 0;
db_prepare( &q, "PRAGMA table_info(%Q)", zTableName );
while(SQLITE_ROW == db_step(&q)){
/* Columns: (cid, name, type, notnull, dflt_value, pk) */
char const * zCol = db_column_text(&q, 1);
if(0==fossil_strcmp(zColName, zCol)){
rc = 1;
break;
}
}
db_finalize(&q);
return rc;
}
/*
** Record the name of a local repository in the global_config() database.
** The repository filename %s is recorded as an entry with a "name" field
** of the following form:
**
** repo:%s
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
1663 1664 1665 1666 1667 1668 1669 | int rid; char *zDate; const char *zUuid; char zTktName[UUID_SIZE+1]; Manifest *pTktChng; int modPending; const char *zModAction; | | | 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 |
int rid;
char *zDate;
const char *zUuid;
char zTktName[UUID_SIZE+1];
Manifest *pTktChng;
int modPending;
const char *zModAction;
char *zTktTitle;
login_check_credentials();
if( !g.perm.RdTkt ){ login_needed(); return; }
rid = name_to_rid_www("name");
if( rid==0 ){ fossil_redirect_home(); }
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
if( g.perm.Admin ){
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
|
| ︙ | ︙ | |||
1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 |
cgi_redirectf("%R/tktview/%s", zTktName);
/*NOTREACHED*/
}
if( strcmp(zModAction,"approve")==0 ){
moderation_approve(rid);
}
}
style_header("Ticket Change Details");
style_submenu_element("Raw", "Raw", "%R/artifact/%S", zUuid);
style_submenu_element("History", "History", "%R/tkthistory/%s", zTktName);
style_submenu_element("Page", "Page", "%R/tktview/%t", zTktName);
style_submenu_element("Timeline", "Timeline", "%R/tkttimeline/%t", zTktName);
if( P("plaintext") ){
style_submenu_element("Formatted", "Formatted", "%R/info/%S", zUuid);
| > > > | 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 |
cgi_redirectf("%R/tktview/%s", zTktName);
/*NOTREACHED*/
}
if( strcmp(zModAction,"approve")==0 ){
moderation_approve(rid);
}
}
zTktTitle = db_table_has_column( "ticket", "title" )
? db_text("(No title)", "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
: 0;
style_header("Ticket Change Details");
style_submenu_element("Raw", "Raw", "%R/artifact/%S", zUuid);
style_submenu_element("History", "History", "%R/tkthistory/%s", zTktName);
style_submenu_element("Page", "Page", "%R/tktview/%t", zTktName);
style_submenu_element("Timeline", "Timeline", "%R/tkttimeline/%t", zTktName);
if( P("plaintext") ){
style_submenu_element("Formatted", "Formatted", "%R/info/%S", zUuid);
|
| ︙ | ︙ | |||
1716 1717 1718 1719 1720 1721 1722 |
@ (%d(rid))
}
modPending = moderation_pending(rid);
if( modPending ){
@ <span class="modpending">*** Awaiting Moderator Approval ***</span>
}
@ <tr><th>Ticket:</th>
| | > > > > > | 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 |
@ (%d(rid))
}
modPending = moderation_pending(rid);
if( modPending ){
@ <span class="modpending">*** Awaiting Moderator Approval ***</span>
}
@ <tr><th>Ticket:</th>
@ <td>%z(href("%R/tktview/%s",zTktName))%s(zTktName)</a>
if(zTktTitle){
@<br>%h(zTktTitle)
}
@</td></tr>
@ <tr><th>Date:</th><td>
hyperlink_to_date(zDate, "</td></tr>");
@ <tr><th>User:</th><td>
hyperlink_to_user(pTktChng->zUser, zDate, "</td></tr>");
@ </table>
free(zDate);
free(zTktTitle);
if( g.perm.ModTkt && modPending ){
@ <div class="section">Moderation</div>
@ <blockquote>
@ <form method="POST" action="%R/tinfo/%s(zUuid)">
@ <label><input type="radio" name="modaction" value="delete">
@ Delete this change</label><br />
|
| ︙ | ︙ |
Changes to src/rss.c.
| ︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
#include "config.h"
#include <time.h>
#include "rss.h"
#include <assert.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 */
int nLimit = atoi(PD("n","20"));
const char zSQL1[] =
@ SELECT
@ blob.rid,
@ uuid,
@ event.mtime,
@ coalesce(ecomment,comment),
@ coalesce(euser,user),
| > > > > > > > > > > > > > > > > > > > | 20 21 22 23 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 |
#include "config.h"
#include <time.h>
#include "rss.h"
#include <assert.h>
/*
** WEBPAGE: timeline.rss
** URL: /timeline.rss/y=TYPE&n=LIMIT&tkt=UUID&tag=TAG&wiki=NAME&name=FILENAME
**
** Produce an RSS feed of the timeline.
**
** TYPE may be: all, ci (show checkins only), t (show tickets only),
** w (show wiki only). LIMIT is the number of items to show.
**
** tkt=UUID filters for only those events for the specified ticket. tag=TAG
** filters for a tag, and wiki=NAME for a wiki page. Only one may be used.
**
** In addition, name=FILENAME filters for a specific file. This may be
** combined with one of the other filters (useful for looking at a specific
** branch).
*/
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 *zTicketUuid = PD("tkt",NULL);
const char *zTag = PD("tag",NULL);
const char *zFilename = PD("name",NULL);
const char *zWiki = PD("wiki",NULL);
int nLimit = atoi(PD("n","20"));
int nTagId;
const char zSQL1[] =
@ SELECT
@ blob.rid,
@ uuid,
@ event.mtime,
@ coalesce(ecomment,comment),
@ coalesce(euser,user),
|
| ︙ | ︙ | |||
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 |
blob_appendf(&bSQL, " AND event.type=%Q", zType);
}else{
if( !g.perm.Read ){
if( g.perm.RdTkt && g.perm.RdWiki ){
blob_append(&bSQL, " AND event.type!='ci'", -1);
}else if( g.perm.RdTkt ){
blob_append(&bSQL, " AND event.type=='t'", -1);
}else{
blob_append(&bSQL, " AND event.type=='w'", -1);
}
}else if( !g.perm.RdWiki ){
if( g.perm.RdTkt ){
blob_append(&bSQL, " AND event.type!='w'", -1);
}else{
blob_append(&bSQL, " AND event.type=='ci'", -1);
}
}else if( !g.perm.RdTkt ){
assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki );
blob_append(&bSQL, " AND event.type!='t'", -1);
}
}
blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
cgi_set_content_type("application/rss+xml");
zProjectName = db_get("project-name", 0);
if( zProjectName==0 ){
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
blob_appendf(&bSQL, " AND event.type=%Q", zType);
}else{
if( !g.perm.Read ){
if( g.perm.RdTkt && g.perm.RdWiki ){
blob_append(&bSQL, " AND event.type!='ci'", -1);
}else if( g.perm.RdTkt ){
blob_append(&bSQL, " AND event.type=='t'", -1);
}else{
blob_append(&bSQL, " AND event.type=='w'", -1);
}
}else if( !g.perm.RdWiki ){
if( g.perm.RdTkt ){
blob_append(&bSQL, " AND event.type!='w'", -1);
}else{
blob_append(&bSQL, " AND event.type=='ci'", -1);
}
}else if( !g.perm.RdTkt ){
assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki );
blob_append(&bSQL, " AND event.type!='t'", -1);
}
}
if( zTicketUuid ){
nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
zTicketUuid);
if ( nTagId==0 ){
nTagId = -1;
}
}else if( zTag ){
nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'sym-%q*'",
zTag);
if ( nTagId==0 ){
nTagId = -1;
}
}else if( zWiki ){
nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'wiki-%q*'",
zWiki);
if ( nTagId==0 ){
nTagId = -1;
}
}else{
nTagId = 0;
}
if( nTagId==-1 ){
blob_appendf(&bSQL, " AND 0");
}else if( nTagId!=0 ){
blob_appendf(&bSQL, " AND (EXISTS(SELECT 1 FROM tagxref"
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid))", nTagId);
}
if( zFilename ){
blob_appendf(&bSQL,
" AND (SELECT mlink.fnid FROM mlink WHERE event.objid=mlink.mid) IN (SELECT fnid FROM filename WHERE name=%Q %s)",
zFilename, filename_collation()
);
}
blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
cgi_set_content_type("application/rss+xml");
zProjectName = db_get("project-name", 0);
if( zProjectName==0 ){
|
| ︙ | ︙ |