Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Unify the search screen generator code. Provide class marks to support CSS customization. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
bb4a13012143affd0d88412d5654f19f |
| User & Date: | drh 2015-02-03 13:17:16.796 |
Context
|
2015-02-03
| ||
| 13:26 | Adapt "makefile.wiki" to new requirement: availability of FTS4 ... (check-in: 0b3464cf72 user: jan.nijtmans tags: trunk) | |
| 13:17 | Unify the search screen generator code. Provide class marks to support CSS customization. ... (check-in: bb4a130121 user: drh tags: trunk) | |
| 06:05 | Fix to hyperlinks on search results. ... (check-in: 1c25812337 user: drh tags: trunk) | |
Changes
Changes to src/doc.c.
| ︙ | ︙ | |||
781 782 783 784 785 786 787 |
/*
** WEBPAGE: /docsrch
**
** Search for documents that match a user-supplied pattern.
*/
void doc_search_page(void){
| < < < < < < < < < < < < | < < < < < < < < < < < < | 781 782 783 784 785 786 787 788 789 790 791 792 |
/*
** WEBPAGE: /docsrch
**
** Search for documents that match a user-supplied pattern.
*/
void doc_search_page(void){
login_check_credentials();
style_header("Document Search");
search_screen(SRCH_DOC, "docsrch");
style_footer();
}
|
Changes to src/search.c.
| ︙ | ︙ | |||
568 569 570 571 572 573 574 |
** Remove bits from srchFlags which are disallowed by either the
** current server configuration or by user permissions.
*/
unsigned int search_restrict(unsigned int srchFlags){
if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
| < | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
** Remove bits from srchFlags which are disallowed by either the
** current server configuration or by user permissions.
*/
unsigned int search_restrict(unsigned int srchFlags){
if( g.perm.Read==0 ) srchFlags &= ~(SRCH_CKIN|SRCH_DOC);
if( g.perm.RdTkt==0 ) srchFlags &= ~(SRCH_TKT);
if( g.perm.RdWiki==0 ) srchFlags &= ~(SRCH_WIKI);
if( (srchFlags & SRCH_CKIN)!=0 && db_get_boolean("search-ci",0)==0 ){
srchFlags &= ~SRCH_CKIN;
}
if( (srchFlags & SRCH_DOC)!=0 && db_get_boolean("search-doc",0)==0 ){
srchFlags &= ~SRCH_DOC;
}
if( (srchFlags & SRCH_TKT)!=0 && db_get_boolean("search-tkt",0)==0 ){
|
| ︙ | ︙ | |||
822 823 824 825 826 827 828 |
if( nRow ){
@ </ol>
}
return nRow;
}
/*
| > > | < > > > > | > | | | | < < | < | | | | > < | > > > > > | | > > > > > > > > > > | > > > > > > > > > | > > > > > > > > | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 |
if( nRow ){
@ </ol>
}
return nRow;
}
/*
** Generate some HTML for doing search. At a minimum include the
** Search-Text entry form. If the "s" query parameter is present, also
** show search results.
**
** The srchFlags parameter is used to customize some of the text of the
** form and the results. srchFlags should be either a single search
** category or all categories. Any srchFlags with two or more bits set
** is treated like SRCH_ALL for display purposes.
**
** The entry box is shown disabled if srchFlags is 0.
*/
void search_screen(unsigned srchFlags, const char *zAction){
const char *zType = 0;
const char *zClass = 0;
const char *zDisable;
const char *zPattern;
switch( srchFlags ){
case SRCH_CKIN: zType = " Check-ins"; zClass = "Ckin"; break;
case SRCH_DOC: zType = " Docs"; zClass = "Doc"; break;
case SRCH_TKT: zType = " Tickets"; zClass = "Tkt"; break;
case SRCH_WIKI: zType = " Wiki"; zClass = "Wiki"; break;
}
srchFlags = search_restrict(srchFlags);
if( srchFlags==0 ){
zDisable = " disabled";
zPattern = "";
}else{
zDisable = "";
zPattern = PD("s","");
}
@ <form method='GET' action='%s(zAction)'>
if( zClass ){
@ <div class='searchForm searchForm%s(zClass)'>
}else{
@ <div class='searchForm'>
}
@ <input type="text" name="s" size="40" value="%h(zPattern)"%s(zDisable)>
@ <input type="submit" value="Search%s(zType)"%s(zDisable)>
if( srchFlags==0 ){
@ <p class="generalError">Search is disabled</p>
}
@ </div></form>
while( fossil_isspace(zPattern[0]) ) zPattern++;
if( zPattern[0] ){
if( zClass ){
@ <div class='searchResult searchResult%s(zClass)'>
}else{
@ <div class='searchResult'>
}
if( search_run_and_output(zPattern, srchFlags)==0 ){
@ <p class='searchEmpty'>No matches for: <span>%h(zPattern)</span></p>
}
@ </div>
}
}
/*
** WEBPAGE: /search
**
** Search for check-in comments, documents, tickets, or wiki that
** match a user-supplied pattern.
*/
void search_page(void){
unsigned srchFlags = SRCH_ALL;
const char *zOnly = P("only");
login_check_credentials();
if( zOnly ){
if( strchr(zOnly,'c') ) srchFlags &= SRCH_CKIN;
if( strchr(zOnly,'d') ) srchFlags &= SRCH_DOC;
if( strchr(zOnly,'t') ) srchFlags &= SRCH_TKT;
if( strchr(zOnly,'w') ) srchFlags &= SRCH_WIKI;
}
style_header("Search");
search_screen(srchFlags, "search");
style_footer();
}
/*
** This is a helper function for search_stext(). Writing into pOut
** the search text obtained from pIn according to zMimetype.
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 |
@ content: '\2191';
},
{ "span.snippet>mark",
"Search markup",
@ background-color: inherit;
@ font-weight: bold;
},
{ 0,
0,
0
}
};
/*
| > > > > > > > > | 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 |
@ content: '\2191';
},
{ "span.snippet>mark",
"Search markup",
@ background-color: inherit;
@ font-weight: bold;
},
{ "div.searchForm",
"Container for the search terms entry box",
@ text-align: center;
},
{ "p.searchEmpty",
"Message explaining that there are no search results",
@ font-style: italic;
},
{ 0,
0,
0
}
};
/*
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
1429 1430 1431 1432 1433 1434 1435 |
/*
** WEBPAGE: tktsrch
** Usage: /tktsrch?s=PATTERN
**
** Full-text search of all current tickets
*/
void tkt_srchpage(void){
| < < < < < < < < < < < < | < < < < < < < < < < < < | 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 |
/*
** WEBPAGE: tktsrch
** Usage: /tktsrch?s=PATTERN
**
** Full-text search of all current tickets
*/
void tkt_srchpage(void){
login_check_credentials();
style_header("Ticket Search");
ticket_standard_submenu(T_ALL_BUT(T_SRCH));
search_screen(SRCH_TKT, "tktsrch");
style_footer();
}
|
Changes to src/wiki.c.
| ︙ | ︙ | |||
286 287 288 289 290 291 292 |
/*
** WEBPAGE: wikisrch
** Usage: /wikisrch?s=PATTERN
**
** Full-text search of all current wiki text
*/
void wiki_srchpage(void){
| < < < < < < < < < < < < | < < < < < < < < < < < < | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
/*
** WEBPAGE: wikisrch
** Usage: /wikisrch?s=PATTERN
**
** Full-text search of all current wiki text
*/
void wiki_srchpage(void){
login_check_credentials();
style_header("Wiki Search");
wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX);
search_screen(SRCH_WIKI, "wikisrch");
style_footer();
}
/*
** WEBPAGE: wiki
** URL: /wiki?name=PAGENAME
*/
|
| ︙ | ︙ |