1 """
2 Limited Search Macro
3
4 by Christian Bird <chris.bird@lineo.com>
5
6 This macro needs the limitedsearch.py action
7 to work correctly. To use this limited
8 search you simply specify a "root" page,
9 a link depth, and a word. The search looks
10 for that word in all pages that are connected
11 to the root page through n links where
12 n is the link depth. It's very handy for
13 searches that should stay within a specific
14 area of the wiki.
15
16 """
17
18
19
20 import re
21
22
23 def execute(macro, args):
24
25
26 defaultpage = ""
27 if args:
28 defaultpage = args
29 if macro.form.has_key("value"):
30 defaultpage = macro.form["value"].value
31
32
33 result = """<form method="get">
34 <input type="hidden" name = "action" value="limitedsearch">
35 Page Name:<br>
36 <input name="page" size="30" value="%s">
37 Link Depth: <SELECT NAME="depth">
38 <OPTION> 1
39 <OPTION> 2
40 <OPTION> 3
41 <OPTION> 4
42 <OPTION> 5
43 </SELECT><br>
44 Search Term(s):<br>
45 <input name="value" size="30" value="">
46 <input type="submit" value="Go">
47 </form>""" % defaultpage
48
49
50 return result
MoinMoin: macro/LimitedSearch.py (last edited 2007-10-29 19:15:06 by localhost)