Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Removed unnecessary items from WWW Configuration, also made RSS Title and Description into generic Project Name and Project Description settings, which will be used elsewhere in the web site. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
f3807dbd88a8d65b85ca39489611268b |
| User & Date: | jnc 2007-10-10 02:49:29.000 |
Context
|
2007-10-10
| ||
| 03:39 | Added diff-command and gdiff-command to the valid settings ... (check-in: 29bc8da1d9 user: jnc tags: trunk) | |
| 02:49 | Removed unnecessary items from WWW Configuration, also made RSS Title and Description into generic Project Name and Project Description settings, which will be used elsewhere in the web site. ... (check-in: f3807dbd88 user: jnc tags: trunk) | |
|
2007-10-09
| ||
| 02:35 | Refinements to the timeline for giving better information about wiki pages. ... (check-in: dfea940da8 user: drh tags: trunk) | |
Changes
Changes to src/rss.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
/*
** Copyright (c) 2007 D. Richard Hipp
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public
** License version 2 as published by the Free Software Foundation.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public
** License along with this library; if not, write to the
** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
** Boston, MA 02111-1307, USA.
**
** Author contact information:
** drh@hwaci.com
** http://www.hwaci.com/drh/
**
*******************************************************************************
**
** 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;
const char zSQL[] =
@ 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
@ ORDER BY event.mtime DESC
;
cgi_set_content_type("application/rss+xml");
zProjectName = db_get("project-name", 0);
if( zProjectName==0 ){
zFreeProjectName = zProjectName = mprintf("Fossil source repository for: %s",
g.zBaseURL);
}
zProjectDescr = db_get("project-description", 0);
if( zProjectDescr==0 ){
zProjectDescr = zProjectName;
}
zPubDate = cgi_rfc822_datestamp(time(NULL));
@ <?xml version="1.0"?>
@ <rss version="2.0">
@ <channel>
@ <title>%s(zProjectName)</title>
@ <link>%s(g.zBaseURL)</link>
@ <description>%s(zProjectDescr)</description>
@ <pubDate>%s(zPubDate)</pubDate>
@ <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator>
db_prepare(&q, zSQL);
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* ";
}
|
| ︙ | ︙ | |||
115 116 117 118 119 120 121 |
@ </item>
nLine++;
}
db_finalize(&q);
@ </channel>
@ </rss>
| | > > > > | 115 116 117 118 119 120 121 122 123 124 125 126 |
@ </item>
nLine++;
}
db_finalize(&q);
@ </channel>
@ </rss>
if( zFreeProjectName != 0 ){
free( zFreeProjectName );
}
}
|
Changes to src/setup.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License as published by the Free Software Foundation; either ** version 2 of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License as published by the Free Software Foundation; either ** version 2 of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com |
| ︙ | ︙ | |||
78 79 80 81 82 83 84 |
** WEBPAGE: setup_ulist
**
** Show a list of users. Clicking on any user jumps to the edit
** screen for that user.
*/
void setup_ulist(void){
Stmt s;
| | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
** WEBPAGE: setup_ulist
**
** Show a list of users. Clicking on any user jumps to the edit
** screen for that user.
*/
void setup_ulist(void){
Stmt s;
login_check_credentials();
if( !g.okSetup ){
login_needed();
return;
}
style_submenu_element("Add", "Add User", "setup_uedit");
|
| ︙ | ︙ | |||
235 236 237 238 239 240 241 |
zCap[i] = 0;
zPw = P("pw");
if( zPw==0 || zPw[0]==0 ){
zPw = db_text(0, "SELECT pw FROM user WHERE uid=%d", uid);
}
zLogin = P("login");
| | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
zCap[i] = 0;
zPw = P("pw");
if( zPw==0 || zPw[0]==0 ){
zPw = db_text(0, "SELECT pw FROM user WHERE uid=%d", uid);
}
zLogin = P("login");
if( uid>0 &&
db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid)
){
style_header("User Creation Error");
@ <font color="red">Login "%h(zLogin)" is already used by a different
@ user.</font>
@
@ <p><a href="setup_uedit?id=%d(uid))>[Bummer]</a></p>
|
| ︙ | ︙ | |||
365 366 367 368 369 370 371 | @ The <b>Delete</b> privilege give the user the ability to erase @ wiki, tickets, and atttachments that have been added by anonymous @ users. This capability is intended for deletion of spam. @ </p></li> @ @ <li><p> @ The <b>Query</b> privilege allows the user to create or edit | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | @ The <b>Delete</b> privilege give the user the ability to erase @ wiki, tickets, and atttachments that have been added by anonymous @ users. This capability is intended for deletion of spam. @ </p></li> @ @ <li><p> @ The <b>Query</b> privilege allows the user to create or edit @ report formats by specifying appropriate SQL. Users can run @ existing reports without the Query privilege. @ </p></li> @ @ <li><p> @ An <b>Admin</b> user can add other users, create new ticket report @ formats, and change system defaults. But only the <b>Setup</b> user @ is able to change the repository to |
| ︙ | ︙ | |||
510 511 512 513 514 515 516 |
@ 127.0.0.1.</p></li>
@ <hr>
entry_attribute("Login expiration time", 6, "cookie-expire", "cex", "8766");
@ <p>The number of hours for which a login is valid. This must be a
@ positive number. The default is 8760 hours which is approximately equal
@ to a year.</p>
| | | | < < < < < | < < < < | < < < < | | < < < < > | | > | < | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
@ 127.0.0.1.</p></li>
@ <hr>
entry_attribute("Login expiration time", 6, "cookie-expire", "cex", "8766");
@ <p>The number of hours for which a login is valid. This must be a
@ positive number. The default is 8760 hours which is approximately equal
@ to a year.</p>
@ <hr>
onoff_attribute("Allow anonymous signup", "anon-signup", "asu", 0);
@ <p>Allow users to create their own accounts</p>
@ <hr>
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
@ </form>
db_end_transaction(0);
style_footer();
}
/*
** WEBPAGE: setup_config
*/
void setup_config(void){
login_check_credentials();
if( !g.okSetup ){
login_needed();
}
style_header("WWW Configuration");
db_begin_transaction();
@ <form action="%s(g.zBaseURL)/setup_config" method="POST">
@ <hr />
entry_attribute("Project Name", 60, "project-name", "pn", "");
@ <p>Give your project a name so visitors know what this site is about.
@ The project name will also be used as the RSS feed title.</p>
@ <hr />
textarea_attribute("Project Description", 5, 60, "project-description", "pd", "");
@ <p>Describe your project. This will be used in page headers for search
@ engines as well as a short RSS description.</p>
@ <hr />
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
@ </form>
db_end_transaction(0);
style_footer();
}
|
Changes to src/style.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** Copyright (c) 2006,2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** Copyright (c) 2006,2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com |
| ︙ | ︙ | |||
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 93 94 95 96 |
}
/*
** Draw the header.
*/
void style_header(const char *zTitle){
const char *zLogInOut = "Logout";
login_check_credentials();
@ <html>
@ <head>
@ <title>%s(zTitle)</title>
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss">
@ <link rel="stylesheet" href="%s(g.zBaseURL)/style.css" type="text/css" media="screen">
@ </head>
@ <body>
@ <div id="page-title">%s(zTitle)</div>
@ <div id="login-status">
if( g.zLogin==0 ){
@ not logged in
zLogInOut = "Login";
}else{
@ logged in as %h(g.zLogin)
}
@ </div>
@ <div id="main-menu">
@ <a href="%s(g.zBaseURL)/index">Home</a>
if( g.okRead ){
@ | <a href="%s(g.zBaseURL)/leaves">Leaves</a>
@ | <a href="%s(g.zBaseURL)/timeline">Timeline</a>
}
| > > > > < < < | 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
}
/*
** Draw the header.
*/
void style_header(const char *zTitle){
const char *zLogInOut = "Logout";
char *zProjectDescr = db_get("project-description", 0);
login_check_credentials();
@ <html>
@ <head>
@ <title>%s(zTitle)</title>
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss">
@ <link rel="stylesheet" href="%s(g.zBaseURL)/style.css" type="text/css" media="screen">
if( zProjectDescr != 0 ){
@ <meta name="description" content="%s(zProjectDescr)">
}
@ </head>
@ <body>
@ <div id="page-title">%s(zTitle)</div>
@ <div id="login-status">
if( g.zLogin==0 ){
@ not logged in
zLogInOut = "Login";
}else{
@ logged in as %h(g.zLogin)
}
@ </div>
@ <div id="main-menu">
@ <a href="%s(g.zBaseURL)/index">Home</a>
if( g.okRead ){
@ | <a href="%s(g.zBaseURL)/leaves">Leaves</a>
@ | <a href="%s(g.zBaseURL)/timeline">Timeline</a>
}
#if 0
@ | <font color="#888888">Search</font>
@ | <font color="#888888">Ticket</font>
@ | <font color="#888888">Reports</font>
#endif
if( g.okSetup ){
@ | <a href="%s(g.zBaseURL)/setup">Setup</a>
|
| ︙ | ︙ | |||
143 144 145 146 147 148 149 |
/*
** WEBPAGE: index
** WEBPAGE: home
** WEBPAGE: not_found
*/
void page_index(void){
| | | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
/*
** WEBPAGE: index
** WEBPAGE: home
** WEBPAGE: not_found
*/
void page_index(void){
char *zHome = "Home";
if( zHome ){
g.zExtra = zHome;
g.okRdWiki = 1;
wiki_page();
}else{
style_header("Main Title Page");
@ No homepage configured for this server
style_footer();
}
}
/*
** TODO: COPIED FROM WIKI.C... BAD
*/
/*
** Create a fake replicate of the "vfile" table as a TEMP table
** using the manifest identified by manid.
*/
static void style_create_fake_vfile(int manid){
static const char zVfileDef[] =
@ CREATE TEMP TABLE vfile(
@ id INTEGER PRIMARY KEY, -- ID of the checked out file
@ vid INTEGER REFERENCES blob, -- The version this file is part of.
@ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add
@ deleted BOOLEAN DEFAULT 0, -- True if deleted
@ rid INTEGER, -- Originally from this repository record
@ mrid INTEGER, -- Based on this record due to a merge
@ pathname TEXT, -- Full pathname
@ UNIQUE(pathname,vid)
@ );
;
db_multi_exec(zVfileDef);
|
| ︙ | ︙ | |||
190 191 192 193 194 195 196 |
void page_style_css(void){
Stmt q;
int id = 0;
int rid = 0;
int chnged = 0;
char *zPathname = 0;
char *z;
| | | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
void page_style_css(void){
Stmt q;
int id = 0;
int rid = 0;
int chnged = 0;
char *zPathname = 0;
char *z;
cgi_set_content_type("text/css");
login_check_credentials();
if( !g.localOpen ){
int headid = db_int(0,
"SELECT cid FROM plink ORDER BY mtime DESC LIMIT 1"
);
style_create_fake_vfile(headid);
}
db_prepare(&q,
"SELECT id, rid, chnged, pathname FROM vfile"
" WHERE (pathname='style.css' OR pathname LIKE '%%/style.css')"
" AND NOT deleted"
);
if( db_step(&q)==SQLITE_ROW ){
id = db_column_int(&q, 0);
|
| ︙ | ︙ | |||
232 233 234 235 236 237 238 |
z = blob_str(&src);
@ %s(z)
}else{
/* No CSS file found, use our own */
/*
** Selector order: tags, ids, classes, other
| | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
z = blob_str(&src);
@ %s(z)
}else{
/* No CSS file found, use our own */
/*
** Selector order: tags, ids, classes, other
** Content order: margin, borders, padding, fonts, colors, other
** Note: Once things are finialize a bit we can collapse this and
** make it much smaller, if necessary. Right now, it's verbose
** but easy to edit.
*/
@ body {
@ margin: 0px;
@ padding: 0px;
|
| ︙ | ︙ | |||
286 287 288 289 290 291 292 |
@ #main-menu a:hover, #sub-menu a:hover {
@ color: #414f84;
@ background-color: white;
@ }
@ #page {
@ padding: 10px 20px 10px 20px;
@ }
| | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
@ #main-menu a:hover, #sub-menu a:hover {
@ color: #414f84;
@ background-color: white;
@ }
@ #page {
@ padding: 10px 20px 10px 20px;
@ }
@ #style-footer {
@ font-size: 0.8em;
@ margin-top: 12px;
@ padding: 5px 10px 5px 10px;
@ text-align: right;
@ background-color: #414f84;
@ color: white;
@ }
@ table.label-value th {
|
| ︙ | ︙ |
Changes to src/user.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** Copyright (c) 2006 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** Copyright (c) 2006 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com |
| ︙ | ︙ | |||
50 51 52 53 54 55 56 |
#ifdef __MINGW32__
/*
** getpass for Windows
*/
static char *getpass(const char *prompt){
static char pwd[64];
size_t i;
| | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
#ifdef __MINGW32__
/*
** getpass for Windows
*/
static char *getpass(const char *prompt){
static char pwd[64];
size_t i;
fputs(prompt,stderr);
fflush(stderr);
for(i=0; i<sizeof(pwd)-1; ++i){
pwd[i] = _getch();
if(pwd[i]=='\r' || pwd[i]=='\n'){
break;
}
|
| ︙ | ︙ |