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
|
|
|
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
97
98
99
100
101
102
103
104
105
106
|
}
/*
** 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>
}
if( g.okRdWiki ){
@ | <a href="%s(g.zBaseURL)/wiki">Wiki</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>
|
>
>
>
>
<
<
<
|
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
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
|
/*
** WEBPAGE: index
** WEBPAGE: home
** WEBPAGE: not_found
*/
void page_index(void){
char *zHome = (char*)db_get("homepage", 0);
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);
|
|
|
|
|
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
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);
|
|
|
|
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
239
240
241
242
243
244
245
246
|
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;
|
|
|
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
293
294
295
296
297
298
299
300
301
|
@ #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 {
|
|
|
|
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 {
|
| ︙ | | | ︙ | |