Fossil SCM

Add a separate /docsrch webpage to handle just document search.

drh 2015-02-02 04:13 trunk
Commit 15f0dbd953cf65e2d1817c0e65694de6e50706da
+37
--- src/doc.c
+++ src/doc.c
@@ -775,5 +775,42 @@
775775
}
776776
cgi_set_content_type(zMime);
777777
cgi_set_content(&bgimg);
778778
g.isConst = 1;
779779
}
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
+}
780817
--- src/doc.c
+++ src/doc.c
@@ -775,5 +775,42 @@
775 }
776 cgi_set_content_type(zMime);
777 cgi_set_content(&bgimg);
778 g.isConst = 1;
779 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
--- src/doc.c
+++ src/doc.c
@@ -775,5 +775,42 @@
775 }
776 cgi_set_content_type(zMime);
777 cgi_set_content(&bgimg);
778 g.isConst = 1;
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 }
817
+1 -2
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -83,13 +83,12 @@
8383
fconfigure $out -encoding utf-8 -translation lf
8484
puts $out \
8585
"<div class='fossil-doc' data-title='Index Of Fossil Documentation'>"
8686
puts $out {
8787
<center>
88
-<form action='../../../search' method='GET'>
88
+<form action='../../../docsrch' method='GET'>
8989
<input type="text" name="s" size="40">
90
-<input type="hidden" name="only" value="d">
9190
<input type="submit" value="Search Docs">
9291
</form>
9392
</center>
9493
<h2>Primary Documents:</h2>
9594
<ul>
9695
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -83,13 +83,12 @@
83 fconfigure $out -encoding utf-8 -translation lf
84 puts $out \
85 "<div class='fossil-doc' data-title='Index Of Fossil Documentation'>"
86 puts $out {
87 <center>
88 <form action='../../../search' method='GET'>
89 <input type="text" name="s" size="40">
90 <input type="hidden" name="only" value="d">
91 <input type="submit" value="Search Docs">
92 </form>
93 </center>
94 <h2>Primary Documents:</h2>
95 <ul>
96
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -83,13 +83,12 @@
83 fconfigure $out -encoding utf-8 -translation lf
84 puts $out \
85 "<div class='fossil-doc' data-title='Index Of Fossil Documentation'>"
86 puts $out {
87 <center>
88 <form action='../../../docsrch' method='GET'>
89 <input type="text" name="s" size="40">
 
90 <input type="submit" value="Search Docs">
91 </form>
92 </center>
93 <h2>Primary Documents:</h2>
94 <ul>
95
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -1,11 +1,10 @@
11
<div class='fossil-doc' data-title='Index Of Fossil Documentation'>
22
33
<center>
4
-<form action='../../../search' method='GET'>
4
+<form action='../../../docsrch' method='GET'>
55
<input type="text" name="s" size="40">
6
-<input type="hidden" name="only" value="d">
76
<input type="submit" value="Search Docs">
87
</form>
98
</center>
109
<h2>Primary Documents:</h2>
1110
<ul>
1211
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -1,11 +1,10 @@
1 <div class='fossil-doc' data-title='Index Of Fossil Documentation'>
2
3 <center>
4 <form action='../../../search' method='GET'>
5 <input type="text" name="s" size="40">
6 <input type="hidden" name="only" value="d">
7 <input type="submit" value="Search Docs">
8 </form>
9 </center>
10 <h2>Primary Documents:</h2>
11 <ul>
12
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -1,11 +1,10 @@
1 <div class='fossil-doc' data-title='Index Of Fossil Documentation'>
2
3 <center>
4 <form action='../../../docsrch' method='GET'>
5 <input type="text" name="s" size="40">
 
6 <input type="submit" value="Search Docs">
7 </form>
8 </center>
9 <h2>Primary Documents:</h2>
10 <ul>
11

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button