| | @@ -775,5 +775,42 @@ |
| 775 | 775 | } |
| 776 | 776 | cgi_set_content_type(zMime); |
| 777 | 777 | cgi_set_content(&bgimg); |
| 778 | 778 | g.isConst = 1; |
| 779 | 779 | } |
| 780 | + |
| 781 | + |
| 782 | +/* |
| 783 | +** WEBPAGE: /docsrch |
| 784 | +** |
| 785 | +** Search for documents that match a user-supplied pattern. |
| 786 | +*/ |
| 787 | +void doc_search_page(void){ |
| 788 | + const char *zPattern = PD("s",""); |
| 789 | + unsigned srchFlags = 0; |
| 790 | + const char *zDisable; |
| 791 | + |
| 792 | + login_check_credentials(); |
| 793 | + srchFlags = search_restrict(SRCH_DOC); |
| 794 | + if( srchFlags==0 ){ |
| 795 | + zDisable = " disabled"; |
| 796 | + zPattern = ""; |
| 797 | + }else{ |
| 798 | + zDisable = ""; |
| 799 | + zPattern = PD("s",""); |
| 800 | + } |
| 801 | + style_header("Document Search"); |
| 802 | + @ <form method="GET" action="docsrch"><center> |
| 803 | + @ <input type="text" name="s" size="40" value="%h(zPattern)"%s(zDisable)> |
| 804 | + @ <input type="submit" value="Search Docs"%s(zDisable)> |
| 805 | + if( srchFlags==0 ){ |
| 806 | + @ <p class="generalError">Document search is disabled</p> |
| 807 | + } |
| 808 | + @ </center></form> |
| 809 | + while( fossil_isspace(zPattern[0]) ) zPattern++; |
| 810 | + if( zPattern[0] ){ |
| 811 | + if( search_run_and_output(zPattern, srchFlags)==0 ){ |
| 812 | + @ <p><i>No matches for: "%h(zPattern)"</i></p> |
| 813 | + } |
| 814 | + } |
| 815 | + style_footer(); |
| 816 | +} |
| 780 | 817 | |