| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | ! Copyright (C) 2008 Slava Pestov. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2014-09-25 15:37:46 -04:00
										 |  |  | USING: accessors assocs furnace.actions furnace.redirection | 
					
						
							|  |  |  | help.html help.topics html.components html.forms http.server | 
					
						
							| 
									
										
										
										
											2011-10-14 01:09:30 -04:00
										 |  |  | http.server.dispatchers http.server.static io.directories | 
					
						
							| 
									
										
										
										
											2014-09-25 15:37:46 -04:00
										 |  |  | io.files.temp kernel locals namespaces sequences | 
					
						
							| 
									
										
										
										
											2016-03-31 02:29:48 -04:00
										 |  |  | unicode urls ;
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | IN: webapps.help | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: help-webapp < dispatcher ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-25 15:37:46 -04:00
										 |  |  | : links ( seq -- seq' )
 | 
					
						
							|  |  |  |     [ swap <simple-link> ] { } assoc>map ;
 | 
					
						
							| 
									
										
										
										
											2008-11-23 04:55:43 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | :: <search-action> ( help-dir -- action )
 | 
					
						
							|  |  |  |     <page-action> | 
					
						
							|  |  |  |         { help-webapp "search" } >>template | 
					
						
							|  |  |  |         [ | 
					
						
							| 
									
										
										
										
											2011-10-14 01:09:30 -04:00
										 |  |  |             "search" param [ blank? ] trim [ | 
					
						
							|  |  |  |                 help-dir [ | 
					
						
							| 
									
										
										
										
											2014-09-25 15:37:46 -04:00
										 |  |  |                     [ article-apropos links "articles" set-value ] | 
					
						
							|  |  |  |                     [ word-apropos links "words" set-value ] | 
					
						
							|  |  |  |                     [ vocab-apropos links "vocabs" set-value ] tri
 | 
					
						
							| 
									
										
										
										
											2011-10-14 01:09:30 -04:00
										 |  |  |                 ] with-directory | 
					
						
							|  |  |  |             ] unless-empty
 | 
					
						
							| 
									
										
										
										
											2011-11-06 15:16:46 -05:00
										 |  |  |             help-navbar "navbar" set-value | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |             { help-webapp "search" } <chloe-content> | 
					
						
							| 
									
										
										
										
											2011-11-05 03:07:16 -04:00
										 |  |  |         ] >>display ;
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-14 01:09:30 -04:00
										 |  |  | : help-url ( topic -- url )
 | 
					
						
							|  |  |  |     topic>filename "$help-webapp/content/" prepend >url ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | : <main-action> ( -- action )
 | 
					
						
							| 
									
										
										
										
											2011-10-14 01:09:30 -04:00
										 |  |  |     <action> | 
					
						
							|  |  |  |         [ "handbook" >link help-url <redirect> ] >>display ;
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-14 01:09:30 -04:00
										 |  |  | :: <help-webapp> ( help-dir -- webapp )
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  |     help-webapp new-dispatcher | 
					
						
							|  |  |  |         <main-action> "" add-responder | 
					
						
							| 
									
										
										
										
											2011-10-14 01:09:30 -04:00
										 |  |  |         help-dir <search-action> "search" add-responder | 
					
						
							| 
									
										
										
										
											2011-10-03 14:09:12 -04:00
										 |  |  |         help-dir <static> "content" add-responder | 
					
						
							| 
									
										
										
										
											2009-09-23 21:56:47 -04:00
										 |  |  |         "resource:basis/definitions/icons/" <static> "icons" add-responder ;
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 13:20:15 -04:00
										 |  |  | : run-help-webapp ( -- )
 | 
					
						
							| 
									
										
										
										
											2012-06-18 15:32:44 -04:00
										 |  |  |     "docs" cache-file <help-webapp> | 
					
						
							| 
									
										
										
										
											2011-09-27 13:20:15 -04:00
										 |  |  |         main-responder set-global
 | 
					
						
							|  |  |  |     8080 httpd drop ;
 | 
					
						
							| 
									
										
										
										
											2008-09-29 05:10:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-27 13:20:15 -04:00
										 |  |  | MAIN: run-help-webapp |