Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | New default header and footer and CSS. Add the ability to edit the footer. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
34af72801d08a58a3c97d1ef75557b21 |
| User & Date: | drh 2007-11-23 22:09:47.000 |
Context
|
2007-11-23
| ||
| 23:06 | Fix a bug in the default header. ... (check-in: 13732d495d user: drh tags: trunk) | |
| 22:09 | New default header and footer and CSS. Add the ability to edit the footer. ... (check-in: 34af72801d user: drh tags: trunk) | |
| 12:55 | Fix a redundancy in the text output of the usage comment on the tag command. ... (check-in: b346a7cf7d user: drh tags: trunk) | |
Changes
Changes to src/info.c.
| ︙ | ︙ | |||
131 132 133 134 135 136 137 |
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 4);
cnt++;
if( cnt==1 ){
if( zTitle ){
| | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 4);
cnt++;
if( cnt==1 ){
if( zTitle ){
@ <div class="section">%s(zTitle)</div>
}
@ <ul>
}
@ <li>
hyperlink_to_uuid(zUuid);
@ %w(zCom) (by %s(zUser) on %s(zDate))
if( depth ){
|
| ︙ | ︙ | |||
182 183 184 185 186 187 188 |
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 4);
cnt++;
if( cnt==1 ){
if( zTitle ){
| | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
const char *zCom = db_column_text(&q, 4);
cnt++;
if( cnt==1 ){
if( zTitle ){
@ <div class="section">%s(zTitle)</div>
}
@ <ul>
}
@ <li>
hyperlink_to_uuid(zUuid);
@ %w(zCom) (by %s(zUser) on %s(zDate))
if( depth ){
|
| ︙ | ︙ | |||
222 223 224 225 226 227 228 |
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
const char *zDate = db_column_text(&q, 1);
const char *zUser = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
cnt++;
if( cnt==1 ){
| | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
const char *zDate = db_column_text(&q, 1);
const char *zUser = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
cnt++;
if( cnt==1 ){
@ <div class="section">Leaves</div>
@ <ul>
}
@ <li>
hyperlink_to_uuid(zUuid);
@ %w(zCom) (by %s(zUser) on %s(zDate))
}
db_finalize(&q);
|
| ︙ | ︙ | |||
258 259 260 261 262 263 264 |
int srcid = db_column_int(&q, 2);
const char *zUuid = db_column_text(&q, 3);
const char *zValue = db_column_text(&q, 4);
const char *zDate = db_column_text(&q, 5);
int tagtype = db_column_int(&q, 6);
cnt++;
if( cnt==1 ){
| | | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
int srcid = db_column_int(&q, 2);
const char *zUuid = db_column_text(&q, 3);
const char *zValue = db_column_text(&q, 4);
const char *zDate = db_column_text(&q, 5);
int tagtype = db_column_int(&q, 6);
cnt++;
if( cnt==1 ){
@ <div class="section">Tags And Properties</div>
@ <ul>
}
@ <li>
@ <b>%h(zTagname)</b>
if( zValue ){
@ = %h(zValue)<i>
}else if( tagtype==0 ){
|
| ︙ | ︙ | |||
319 320 321 322 323 324 325 |
);
if( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
char *zTitle = mprintf("Version: [%.10s]", zUuid);
style_header(zTitle);
free(zTitle);
/*@ <h2>Version %s(zUuid)</h2>*/
| | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
);
if( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
char *zTitle = mprintf("Version: [%.10s]", zUuid);
style_header(zTitle);
free(zTitle);
/*@ <h2>Version %s(zUuid)</h2>*/
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
@ <tr><th>Date:</th><td>%s(db_column_text(&q, 1))</td></tr>
if( g.okSetup ){
@ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
}
@ <tr><th>Original User:</th><td>%h(db_column_text(&q, 2))</td></tr>
|
| ︙ | ︙ | |||
342 343 344 345 346 347 348 |
@ </tr>
@ </table></p>
}else{
style_header("Version Information");
}
db_finalize(&q);
showTags(rid);
| | | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
@ </tr>
@ </table></p>
}else{
style_header("Version Information");
}
db_finalize(&q);
showTags(rid);
@ <div class="section">Changes</div>
@ <ul>
db_prepare(&q,
"SELECT name, pid, fid"
" FROM mlink, filename"
" WHERE mid=%d"
" AND filename.fnid=mlink.fnid",
rid
|
| ︙ | ︙ | |||
409 410 411 412 413 414 415 |
);
if( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
const char *zUuid = db_column_text(&q, 1);
char *zTitle = mprintf("Wiki Page %s", zName);
style_header(zTitle);
free(zTitle);
| | | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
);
if( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
const char *zUuid = db_column_text(&q, 1);
char *zTitle = mprintf("Wiki Page %s", zName);
style_header(zTitle);
free(zTitle);
@ <div class="section">Overview</div>
@ <p><table class="label-value">
@ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
@ <tr><th>Date:</th><td>%s(db_column_text(&q, 2))</td></tr>
if( g.okSetup ){
@ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
}
@ <tr><th>Original User:</th><td>%s(db_column_text(&q, 3))</td></tr>
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
"Configure the WWW components of the repository");
setup_menu_entry("Tickets", "tktsetup",
"Configure the trouble-ticketing system for this repository");
setup_menu_entry("CSS", "setup_editcss",
"Edit the Cascading Style Sheet used by all pages of this repository");
setup_menu_entry("Header", "setup_header",
"Edit HTML text inserted at the top of every page");
@ </dl>
style_footer();
}
/*
** WEBPAGE: setup_ulist
| > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
"Configure the WWW components of the repository");
setup_menu_entry("Tickets", "tktsetup",
"Configure the trouble-ticketing system for this repository");
setup_menu_entry("CSS", "setup_editcss",
"Edit the Cascading Style Sheet used by all pages of this repository");
setup_menu_entry("Header", "setup_header",
"Edit HTML text inserted at the top of every page");
setup_menu_entry("Footer", "setup_footer",
"Edit HTML text inserted at the bottom of every page");
@ </dl>
style_footer();
}
/*
** WEBPAGE: setup_ulist
|
| ︙ | ︙ | |||
615 616 617 618 619 620 621 622 623 624 | @ <input type="submit" name="submit" value="Apply Changes"> @ <input type="submit" name="clear" value="Revert To Default"> @ </form> @ <hr> @ Here is the default page header: @ <blockquote><pre> @ %h(zDefaultHeader) @ </pre></blockquote> db_end_transaction(0); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
@ <input type="submit" name="submit" value="Apply Changes">
@ <input type="submit" name="clear" value="Revert To Default">
@ </form>
@ <hr>
@ Here is the default page header:
@ <blockquote><pre>
@ %h(zDefaultHeader)
@ </pre></blockquote>
db_end_transaction(0);
}
/*
** WEBPAGE: setup_footer
*/
void setup_footer(void){
login_check_credentials();
if( !g.okSetup ){
login_needed();
}
db_begin_transaction();
if( P("clear")!=0 ){
db_multi_exec("DELETE FROM config WHERE name='footer'");
cgi_replace_parameter("footer", zDefaultFooter);
}else{
textarea_attribute(0, 0, 0, "footer", "footer", zDefaultFooter);
}
style_header("Edit Page Footer");
@ <form action="%s(g.zBaseURL)/setup_footer" method="POST">
@ <p>Edit HTML text with embedded subscript that will be used to
@ generate the end of every page.</p>
textarea_attribute("", 20, 80, "footer", "footer", zDefaultFooter);
@ <br />
@ <input type="submit" name="submit" value="Apply Changes">
@ <input type="submit" name="clear" value="Revert To Default">
@ </form>
@ <hr>
@ Here is the default page footer:
@ <blockquote><pre>
@ %h(zDefaultFooter)
@ </pre></blockquote>
db_end_transaction(0);
}
|
Changes to src/style.c.
| ︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 |
*/
static int submenuCompare(const void *a, const void *b){
const struct Submenu *A = (const struct Submenu*)a;
const struct Submenu *B = (const struct Submenu*)b;
return strcmp(A->zLabel, B->zLabel);
}
/*
** Draw the header.
*/
void style_header(const char *zTitle){
const char *zLogInOut = "Login";
const char *zHeader = db_get("header", (char*)zDefaultHeader);
| > > > > > < | > > | | > > | | < | | 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 |
*/
static int submenuCompare(const void *a, const void *b){
const struct Submenu *A = (const struct Submenu*)a;
const struct Submenu *B = (const struct Submenu*)b;
return strcmp(A->zLabel, B->zLabel);
}
/*
** The Subscript interpreter used to render header and footer.
*/
static struct Subscript *pInterp;
/*
** Draw the header.
*/
void style_header(const char *zTitle){
const char *zLogInOut = "Login";
const char *zHeader = db_get("header", (char*)zDefaultHeader);
login_check_credentials();
/* Generate the header up through the main menu */
pInterp = SbS_Create();
SbS_Store(pInterp, "project_name",
db_get("project-name","Unnamed Fossil Project"), 0);
SbS_Store(pInterp, "title", zTitle, 0);
SbS_Store(pInterp, "baseurl", g.zBaseURL, 0);
SbS_Store(pInterp, "manifest_version", MANIFEST_VERSION, 0);
SbS_Store(pInterp, "manifest_date", MANIFEST_DATE, 0);
if( g.zLogin ){
SbS_Store(pInterp, "login", g.zLogin, 0);
zLogInOut = "Logout";
}
SbS_Render(pInterp, zHeader);
/* Generate the main menu and the submenu (if any) */
@ <div class="mainmenu">
@ <a href="%s(g.zBaseURL)/home">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>
|
| ︙ | ︙ | |||
106 107 108 109 110 111 112 |
}
if( !g.noPswd ){
@ <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
}
@ </div>
if( nSubmenu>0 ){
int i;
| | | | | | < > | > > > > > | | | < | < | > > > > > > > > > > > < < < < < < > | > > > > > > > > > > > > | | | | | > > > > | < | | | | > | > > > > | > > > | | > > | | | > | | > > > > > | > > > > > > > > > > > > > > > > > | > > > > > | | < < < < < < < < < < < < | < | < < < | 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 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 184 185 186 187 188 189 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 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
}
if( !g.noPswd ){
@ <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
}
@ </div>
if( nSubmenu>0 ){
int i;
@ <div class="submenu">
qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
for(i=0; i<nSubmenu; i++){
struct Submenu *p = &aSubmenu[i];
if( p->zLink==0 ){
@ <span class="label">%h(p->zLabel)</span>
}else{
@ <a class="label" href="%s(p->zLink)">%h(p->zLabel)</a>
}
}
@ </div>
}
@ <div class="content">
g.cgiPanic = 1;
}
/*
** Draw the footer at the bottom of the page.
*/
void style_footer(void){
const char *zFooter = db_get("footer", (char*)zDefaultFooter);
@ </div>
SbS_Render(pInterp, zFooter);
SbS_Destroy(pInterp);
}
/* @-comment: // */
/*
** The default page header.
*/
const char zDefaultHeader[] =
@ <html>
@ <head>
@ <title>[project_name html]: [title html]</title>
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@ href="[baseurl puts]/timeline.rss">
@ <link rel="stylesheet" href="[baseurl puts]/style.css" type="text/css"
@ media="screen">
@ </head>
@ <body>
@ <div class="header">
@ <div class="logo">
@ <!-- <img src="logo.gif" alt="logo"><br></br> -->
@ <nobr>[project_name html]</nobr>
@ </div>
@ <div class="title">[title html]</div>
@ <div class="status"><nobr>
@ [login exists enable_output] Logged in as [0 /login get html]
@ [login exists not enable_output] Not logged in
@ [1 enable_output]
@ </nobr></div>
@ </div>
;
/*
** The default page footer
*/
const char zDefaultFooter[] =
@ <div class="footer">
@ Fossil version [manifest_version puts] [manifest_date puts]
@ </div>
@ </body></html>
;
/*
** The default Cascading Style Sheet.
*/
const char zDefaultCSS[] =
@ /* General settings for the entire page */
@ body {
@ margin: 0ex 1ex;
@ padding: 0px;
@ background-color: white;
@ font-family: "sans serif";
@ }
@
@ /* The project logo in the upper left-hand corner of each page */
@ div.logo {
@ display: table-cell;
@ text-align: center;
@ vertical-align: bottom;
@ font-weight: bold;
@ color: #558195;
@ }
@
@ /* The page title centered at the top of each page */
@ div.title {
@ display: table-cell;
@ font-size: 2em;
@ font-weight: bold;
@ text-align: center;
@ color: #558195;
@ vertical-align: bottom;
@ width: 100%;
@ }
@
@ /* The login status message in the top right-hand corner */
@ div.status {
@ display: table-cell;
@ text-align: right;
@ vertical-align: bottom;
@ color: #558195;
@ font-size: 0.8em;
@ font-weight: bold;
@ }
@
@ /* The header across the top of the page */
@ div.header {
@ display: table;
@ width: 100%;
@ }
@
@ /* The main menu bar that appears at the top of the page beneath
@ ** the header */
@ div.mainmenu {
@ padding: 5px 10px 5px 10px;
@ font-size: 0.9em;
@ font-weight: bold;
@ text-align: center;
@ letter-spacing: 1px;
@ background-color: #558195;
@ color: white;
@ }
@
@ /* The submenu bar that *sometimes* appears below the main menu */
@ div.submenu {
@ padding: 3px 10px 3px 0px;
@ font-size: 0.9em;
@ text-align: center;
@ background-color: #456878;
@ color: white;
@ }
@ div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited {
@ padding: 3px 10px 3px 10px;
@ color: white;
@ text-decoration: none;
@ }
@ div.mainmenu a:hover, div.submenu a:hover {
@ color: #558195;
@ background-color: white;
@ }
@
@ /* All page content from the bottom of the menu or submenu down to
@ ** the footer */
@ div.content {
@ padding: 0ex 1ex 0ex 2ex;
@ }
@
@ /* Some pages have section dividers */
@ div.section {
@ margin-bottom: 0px;
@ margin-top: 1em;
@ padding: 1px 1px 1px 1px;
@ font-size: 1.2em;
@ font-weight: bold;
@ background-color: #558195;
@ color: white;
@ }
@
@ /* The "Date" that occurs on the left hand side of timelines */
@ div.divider {
@ background: #a1c4d4;
@ border: 2px #558195 solid;
@ font-size: 1em; font-weight: normal;
@ padding: .25em;
@ margin: .2em 0 .2em 0;
@ float: left;
@ clear: left;
@ }
@
@ /* The footer at the very bottom of the page */
@ div.footer {
@ font-size: 0.8em;
@ margin-top: 12px;
@ padding: 5px 10px 5px 10px;
@ text-align: right;
@ background-color: #558195;
@ color: white;
@ }
;
/*
** WEBPAGE: style.css
*/
void page_style_css(void){
char *zCSS = 0;
cgi_set_content_type("text/css");
zCSS = db_get("css",(char*)zDefaultCSS);
cgi_append_content(zCSS, -1);
}
/*
** WEBPAGE: test_env
*/
void page_test_env(void){
style_header("Environment Test");
@ g.zBaseURL = %h(g.zBaseURL)<br>
@ g.zTop = %h(g.zTop)<br>
cgi_print_all();
style_footer();
}
|
Changes to src/subscript.c.
| ︙ | ︙ | |||
110 111 112 113 114 115 116 |
** An entry in the hash table is an instance of this structure.
*/
typedef struct SbsHashEntry SbsHashEntry;
struct SbsHashEntry {
SbsHashEntry *pNext; /* Next entry with the same hash on zKey */
SbSValue val; /* The payload */
int nKey; /* Length of the key */
| | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
** An entry in the hash table is an instance of this structure.
*/
typedef struct SbsHashEntry SbsHashEntry;
struct SbsHashEntry {
SbsHashEntry *pNext; /* Next entry with the same hash on zKey */
SbSValue val; /* The payload */
int nKey; /* Length of the key */
char zKey[1]; /* The key */
};
/*
** A hash table is an instance of the following structure.
*/
typedef struct SbsHashTab SbsHashTab;
struct SbsHashTab {
|
| ︙ | ︙ | |||
381 382 383 384 385 386 387 | /* ** Store a value in an interpreter variable. */ int SbS_Store( struct Subscript *p, /* Store into this interpreter */ const char *zName, /* Name of the variable */ const char *zValue, /* Value of the variable */ | | | < > > > | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
/*
** Store a value in an interpreter variable.
*/
int SbS_Store(
struct Subscript *p, /* Store into this interpreter */
const char *zName, /* Name of the variable */
const char *zValue, /* Value of the variable */
int persistence /* 0: static. 1: ephemeral. 2: dynamic */
){
SbSValue v;
v.flags = SBSVAL_STR;
v.u.str.size = strlen(zValue);
if( persistence==1 ){
v.u.str.z = mprintf("%s", zValue);
}else{
v.u.str.z = (char*)zValue;
}
if( persistence>0 ){
v.flags |= SBSVAL_DYN;
}
return sbs_store(&p->symTab, zName, -1, &v);
}
/*
** Push a string value onto the stack.
**
** If the 4th parameter is 0, then the string is static.
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
127 128 129 130 131 132 133 |
db_multi_exec("INSERT OR IGNORE INTO seen VALUES(%d)", rid);
if( xCallback ){
xCallback(rid, pArg);
}
if( memcmp(zDate, zPrevDate, 10) ){
sprintf(zPrevDate, "%.10s", zDate);
@ <tr><td colspan=3>
| < < < | < < | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
db_multi_exec("INSERT OR IGNORE INTO seen VALUES(%d)", rid);
if( xCallback ){
xCallback(rid, pArg);
}
if( memcmp(zDate, zPrevDate, 10) ){
sprintf(zPrevDate, "%.10s", zDate);
@ <tr><td colspan=3>
@ <div class="divider">%s(zPrevDate)</div>
@ </td></tr>
}
@ <tr>
@ <td valign="top">%s(&zDate[11])</td>
@ <td width="20" align="center" valign="top">
@ <font id="m%d(rid)" size="+1" color="white">*</font></td>
if( zBgClr && zBgClr[0] ){
|
| ︙ | ︙ |