Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the "Index Page" setup option to allow each site to configure a page to appear when no URL is specified or when the "Home" menu option is selected. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
c7c81df13855c9fa22ad9a9bc96d46d9 |
| User & Date: | drh 2008-05-16 13:31:51.000 |
Context
|
2008-05-16
| ||
| 13:55 | Preserve the case of unknown HTML markup on wiki pages. check-in: a4d7e9162d user: drh tags: trunk | |
| 13:31 | Add the "Index Page" setup option to allow each site to configure a page to appear when no URL is specified or when the "Home" menu option is selected. check-in: c7c81df138 user: drh tags: trunk | |
| 03:18 | added optional FILE arg to wiki export check-in: 7adbf773c2 user: stephan tags: trunk | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
463 464 465 466 467 468 469 |
** Process the webpage specified by the PATH_INFO or REQUEST_URI
** environment variable.
*/
static void process_one_web_page(void){
const char *zPathInfo;
char *zPath = NULL;
int idx;
| | > | < < < | | < | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
** Process the webpage specified by the PATH_INFO or REQUEST_URI
** environment variable.
*/
static void process_one_web_page(void){
const char *zPathInfo;
char *zPath = NULL;
int idx;
int i;
/* Find the page that the user has requested, construct and deliver that
** page.
*/
set_base_url();
zPathInfo = P("PATH_INFO");
if( zPathInfo==0 || zPathInfo[0]==0
|| (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
cgi_redirectf("%s%s", g.zBaseURL, db_get("index-page", "/index"));
}else{
zPath = mprintf("%s", zPathInfo);
}
/* Remove the leading "/" at the beginning of the path.
*/
g.zPath = &zPath[1];
for(i=1; zPath[i] && zPath[i]!='/'; i++){}
if( zPath[i]=='/' ){
zPath[i] = 0;
g.zExtra = &zPath[i+1];
}else{
g.zExtra = 0;
}
if( g.zExtra ){
/* CGI parameters get this treatment elsewhere, but places like getfile
** will use g.zExtra directly.
*/
dehttpize(g.zExtra);
cgi_set_parameter_nocopy("name", g.zExtra);
}
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
102 103 104 105 106 107 108 |
style_header("User List");
@ <table border="0" cellpadding="0" cellspacing="25">
@ <tr><td valign="top">
@ <b>Users:</b>
@ <table border="1" cellpadding="10"><tr><td>
@ <table cellspacing=0 cellpadding=0 border=0>
@ <tr>
| | | | | > | 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 |
style_header("User List");
@ <table border="0" cellpadding="0" cellspacing="25">
@ <tr><td valign="top">
@ <b>Users:</b>
@ <table border="1" cellpadding="10"><tr><td>
@ <table cellspacing=0 cellpadding=0 border=0>
@ <tr>
@ <th align="right">User ID</th><td width="20"> </td>
@ <th>Capabilities</th><td width="15"> </td>
@ <th>Contact Info</th>
@ </tr>
db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
while( db_step(&s)==SQLITE_ROW ){
@ <tr>
@ <td align="right">
if( g.okAdmin ){
@ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
}
@ <nobr>%h(db_column_text(&s,1))</nobr>
if( g.okAdmin ){
@ </a>
}
@ </td><td> </td>
@ <td align="center">%s(db_column_text(&s,2))</td>
@ <td> </td>
@ <td align="left">%s(db_column_text(&s,3))</td>
@ </tr>
}
@ </table></td></tr></table>
@ <td valign="top">
@ <b>Notes:</b>
@ <ol>
|
| ︙ | ︙ | |||
450 451 452 453 454 455 456 |
int iQ = strcmp(zQ,"on")==0 || atoi(zQ);
if( iQ!=iVal ){
db_set(zVar, iQ ? "1" : "0", 0);
iVal = iQ;
}
}
if( iVal ){
| | | | | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
int iQ = strcmp(zQ,"on")==0 || atoi(zQ);
if( iQ!=iVal ){
db_set(zVar, iQ ? "1" : "0", 0);
iVal = iQ;
}
}
if( iVal ){
@ <input type="checkbox" name="%s(zQParm)" checked><b>%s(zLabel)</b></input>
}else{
@ <input type="checkbox" name="%s(zQParm)"><b>%s(zLabel)</b></input>
}
}
/*
** Generate an entry box for an attribute.
*/
static void entry_attribute(
const char *zLabel, /* The text label on the entry box */
int width, /* Width of the entry box */
const char *zVar, /* The corresponding row in the VAR table */
const char *zQParm, /* The query parameter */
char *zDflt /* Default value if VAR table entry does not exist */
){
const char *zVal = db_get(zVar, zDflt);
const char *zQ = P(zQParm);
if( zQ && strcmp(zQ,zVal)!=0 ){
db_set(zVar, zQ, 0);
zVal = zQ;
}
@ <input type="text" name="%s(zQParm)" value="%h(zVal)" size="%d(width)">
@ <b>%s(zLabel)</b>
}
/*
** Generate a text box for an attribute.
*/
static void textarea_attribute(
const char *zLabel, /* The text label on the textarea */
|
| ︙ | ︙ | |||
495 496 497 498 499 500 501 |
const char *zQ = P(zQP);
if( zQ && strcmp(zQ,z)!=0 ){
db_set(zVar, zQ, 0);
z = zQ;
}
if( rows>0 && cols>0 ){
@ <textarea name="%s(zQP)" rows="%d(rows)" cols="%d(cols)">%h(z)</textarea>
| | | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
const char *zQ = P(zQP);
if( zQ && strcmp(zQ,z)!=0 ){
db_set(zVar, zQ, 0);
z = zQ;
}
if( rows>0 && cols>0 ){
@ <textarea name="%s(zQP)" rows="%d(rows)" cols="%d(cols)">%h(z)</textarea>
@ <b>%s(zLabel)</b>
}
}
/*
** WEBPAGE: setup_access
*/
|
| ︙ | ︙ | |||
599 600 601 602 603 604 605 606 607 608 609 610 611 612 |
@ 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();
}
/*
| > > > > > > > > > > > > > > > > | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 |
@ 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 />
entry_attribute("Index Page", 60, "index-page", "idxpg", "/home");
@ <p>Enter the pathname of the page to display when the "Home" menu
@ option is selected and when no pathname is
@ specified in the URL. For example, if you visit the url:</p>
@
@ <blockquote>%h(g.zBaseURL)</blockquote>
@
@ <p>And you have specified an index page of "/home" the above will
@ automatically redirect to:</p>
@
@ <blockquote>%h(g.zBaseURL)/home</blockquote>
@
@ <p>The default "/home" page displays a Wiki page with the same name
@ as the Project Name specified above. Some sites prefer to redirect
@ to a documentation page (ex: "/doc/tip/index.wiki") or to "/timeline".</p>
@ <hr />
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
@ </form>
db_end_transaction(0);
style_footer();
}
/*
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
cgi_destination(CGI_HEADER);
/* Generate the header up through the main menu */
Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
Th_Store("title", zTitle);
Th_Store("baseurl", g.zBaseURL);
Th_Store("manifest_version", MANIFEST_VERSION);
Th_Store("manifest_date", MANIFEST_DATE);
if( g.zLogin ){
Th_Store("login", g.zLogin);
}
Th_Render(zHeader);
cgi_destination(CGI_BODY);
| > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
cgi_destination(CGI_HEADER);
/* Generate the header up through the main menu */
Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
Th_Store("title", zTitle);
Th_Store("baseurl", g.zBaseURL);
Th_Store("index_page", db_get("index-page","/home"));
Th_Store("manifest_version", MANIFEST_VERSION);
Th_Store("manifest_date", MANIFEST_DATE);
if( g.zLogin ){
Th_Store("login", g.zLogin);
}
Th_Render(zHeader);
cgi_destination(CGI_BODY);
|
| ︙ | ︙ | |||
153 154 155 156 157 158 159 |
@ html "Logged in as <a href='$baseurl/my'>$login</a>"
@ } else {
@ puts "Not logged in"
@ }
@ </th1></nobr></div>
@ </div>
@ <div class="mainmenu"><th1>
| | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
@ html "Logged in as <a href='$baseurl/my'>$login</a>"
@ } else {
@ puts "Not logged in"
@ }
@ </th1></nobr></div>
@ </div>
@ <div class="mainmenu"><th1>
@ html "<a href='$baseurl$index_page'>Home</a>"
@ if {[hascap h]} {
@ html "<a href='$baseurl/dir'>Files</a>"
@ }
@ if {[hascap o]} {
@ html "<a href='$baseurl/leaves'>Leaves</a>"
@ html "<a href='$baseurl/timeline'>Timeline</a>"
@ html "<a href='$baseurl/tagview'>Tags</a>"
|
| ︙ | ︙ |