Overview
SHA1 Hash: | c7c81df13855c9fa22ad9a9bc96d46d981961f61 |
---|---|
Date: | 2008-05-16 13:31:51 |
User: | drh |
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: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/main.c from [b6f2004a21] to [1f3362585e].
@@ -465,22 +465,20 @@ */ static void process_one_web_page(void){ const char *zPathInfo; char *zPath = NULL; int idx; - int i, j; + 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 ){ - const char *zUri; - zUri = PD("REQUEST_URI","/"); - for(i=0; zUri[i] && zUri[i]!='?' && zUri[i]!='#'; i++){} - for(j=i; j>0 && zUri[j-1]!='/'; j--){} - cgi_redirectf("%.*s/index", i, zUri); + 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. @@ -491,11 +489,10 @@ zPath[i] = 0; g.zExtra = &zPath[i+1]; }else{ g.zExtra = 0; } - set_base_url(); if( g.zExtra ){ /* CGI parameters get this treatment elsewhere, but places like getfile ** will use g.zExtra directly. */ dehttpize(g.zExtra);
Modified src/setup.c from [ccb6e89143] to [b4cd5e8549].
@@ -104,12 +104,12 @@ @ <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><th width="15"></td> - @ <th>Capabilities</th><th width="15"></td> + @ <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> @@ -119,12 +119,13 @@ } @ <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><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"> @@ -452,13 +453,13 @@ db_set(zVar, iQ ? "1" : "0", 0); iVal = iQ; } } if( iVal ){ - @ <input type="checkbox" name="%s(zQParm)" checked>%s(zLabel)</input> + @ <input type="checkbox" name="%s(zQParm)" checked><b>%s(zLabel)</b></input> }else{ - @ <input type="checkbox" name="%s(zQParm)">%s(zLabel)</input> + @ <input type="checkbox" name="%s(zQParm)"><b>%s(zLabel)</b></input> } } /* ** Generate an entry box for an attribute. @@ -475,11 +476,11 @@ 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)"> - @ %s(zLabel) + @ <b>%s(zLabel)</b> } /* ** Generate a text box for an attribute. */ @@ -497,11 +498,11 @@ 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> - @ %s(zLabel) + @ <b>%s(zLabel)</b> } } /* @@ -600,10 +601,26 @@ @ <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();
Modified src/style.c from [6490811740] to [93f13836b2].
@@ -81,10 +81,11 @@ /* 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); } @@ -155,11 +156,11 @@ @ puts "Not logged in" @ } @ </th1></nobr></div> @ </div> @ <div class="mainmenu"><th1> -@ html "<a href='$baseurl/home'>Home</a>" +@ 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>"