| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | ! Copyright (C) 2008 Slava Pestov. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							|  |  |  | USING: kernel accessors http.server.dispatchers | 
					
						
							|  |  |  | http.server.static furnace.actions furnace.redirection urls | 
					
						
							| 
									
										
										
										
											2008-12-15 02:13:35 -05:00
										 |  |  | validators locals io.files io.directories html.forms | 
					
						
							|  |  |  | html.components help.html ;
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | IN: webapps.help | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: help-webapp < dispatcher ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-23 04:55:43 -05:00
										 |  |  | M: result link-title title>> ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: result link-href href>> ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | :: <search-action> ( help-dir -- action )
 | 
					
						
							|  |  |  |     <page-action> | 
					
						
							|  |  |  |         { help-webapp "search" } >>template | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         [ | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2008-09-29 23:33:06 -04:00
										 |  |  |                 { "search" [ 1 v-min-length 50 v-max-length v-one-line ] } | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  |             } validate-params | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:30:47 -05:00
										 |  |  |             help-dir [ | 
					
						
							|  |  |  |                 "search" value article-apropos "articles" set-value | 
					
						
							|  |  |  |                 "search" value word-apropos "words" set-value | 
					
						
							|  |  |  |                 "search" value vocab-apropos "vocabs" set-value | 
					
						
							|  |  |  |             ] with-directory | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |             { help-webapp "search" } <chloe-content> | 
					
						
							|  |  |  |         ] >>submit ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : <main-action> ( -- action )
 | 
					
						
							|  |  |  |     <page-action> | 
					
						
							|  |  |  |         { help-webapp "help" } >>template ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : <help-webapp> ( help-dir -- webapp )
 | 
					
						
							|  |  |  |     help-webapp new-dispatcher | 
					
						
							|  |  |  |         <main-action> "" add-responder | 
					
						
							|  |  |  |         over <search-action> "search" add-responder | 
					
						
							|  |  |  |         swap <static> "content" add-responder ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |