annotate MoinMoin/macro/AdvancedSearch.py @ 3040:8608b258f8e6

bug fix of MoinMoinBugs/MoveAttachmentNotWorkingWithModPython (thanks to Boleslaw Kulbabinski) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 05 Feb 2008 21:22:56 +0100
parents 388204baf00f
children 3489709aa99f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
2 """
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
3 MoinMoin - AdvancedSearch Macro
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
4
2725
388204baf00f change [[macro]] to <<macro>> in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2595
diff changeset
5 <<AdvancedSearch>>
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
6 displays advanced search dialog.
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1792
diff changeset
7
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1792
diff changeset
8 @license: GNU GPL, see COPYING for details.
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
9 """
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
10
3040
8608b258f8e6 bug fix of MoinMoinBugs/MoveAttachmentNotWorkingWithModPython (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2725
diff changeset
11 from MoinMoin import wikiutil
1367
4c29aeea8bf7 languages dropdown menu
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1364
diff changeset
12 from MoinMoin.i18n import languages
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
13 from MoinMoin.widget import html
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
14 from MoinMoin.util.web import makeSelection
2595
5e7b45489430 moved python2.3/2.4 compatibility code to MoinMoin.support.python_compatibility (thanks to Heinrich Wendel)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2286
diff changeset
15 from MoinMoin.support.python_compatibility import sorted
1374
aa33bb2b40d6 mimetype-search is live, i18n fixes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1373
diff changeset
16 import mimetypes
aa33bb2b40d6 mimetype-search is live, i18n fixes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1373
diff changeset
17
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
18 Dependencies = ['pages']
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
19
1370
25ad5f5c6e3d py2.4 fix, sorted
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1369
diff changeset
20
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
21 def form_get(request, name, default=''):
1506
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
22 """ Fetches a form field
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2224
diff changeset
23
1506
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
24 @param request: current request
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
25 @param name: name of the field
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
26 @keyword default: value if not present (default: '')
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
27 """
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
28 return request.form.get(name, [default])[0]
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
29
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
30
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
31 def advanced_ui(macro):
1506
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
32 """ Returns the code for the advanced search user interface
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
33
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
34 @param macro: current macro instance
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
35 """
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
36 _ = macro._
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
37 f = macro.formatter
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
38 request = macro.request
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
39
1491
92c7972c8d54 grey out fields not currently supported by moinSearch if xapian disabled
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1488
diff changeset
40 disabledIfMoinSearch = not request.cfg.xapian_search and \
92c7972c8d54 grey out fields not currently supported by moinSearch if xapian disabled
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1488
diff changeset
41 ' disabled="disabled"' or ''
92c7972c8d54 grey out fields not currently supported by moinSearch if xapian disabled
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1488
diff changeset
42
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
43 search_boxes = ''.join([
1369
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
44 f.table_row(1),
1373
90cb8fe71cdf get fullsearch action working with the advanced search dialogue
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1372
diff changeset
45 f.table_cell(1, attrs={'rowspan': '6', 'class': 'searchfor'}),
1460
44a52e7ff380 s/pages/items/g and s/include/exclude/g underlay
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1449
diff changeset
46 f.text(_('Search for items')),
1369
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
47 f.table_cell(0),
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
48 ''.join([''.join([
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
49 f.table_row(1),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
50 f.table_cell(1),
1444
1a3c73509f15 info for last modification date in advanced ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1441
diff changeset
51 f.text(txt),
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
52 f.table_cell(0),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
53 f.table_cell(1),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
54 f.rawHTML(input_field),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
55 f.table_cell(0),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
56 f.table_row(0),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
57 ]) for txt, input_field in (
1374
aa33bb2b40d6 mimetype-search is live, i18n fixes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1373
diff changeset
58 (_('containing all the following terms'),
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
59 '<input type="text" name="and_terms" size="30" value="%s">'
1506
21e85d9d355e small cleanups, advanced ui can preserve search terms from other ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1501
diff changeset
60 % (form_get(request, 'and_terms') or form_get(request, 'value'))),
1374
aa33bb2b40d6 mimetype-search is live, i18n fixes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1373
diff changeset
61 (_('containing one or more of the following terms'),
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
62 '<input type="text" name="or_terms" size="30" value="%s">'
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
63 % form_get(request, 'or_terms')),
1374
aa33bb2b40d6 mimetype-search is live, i18n fixes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1373
diff changeset
64 (_('not containing the following terms'),
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
65 '<input type="text" name="not_terms" size="30" value="%s">'
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
66 % form_get(request, 'not_terms')),
1373
90cb8fe71cdf get fullsearch action working with the advanced search dialogue
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1372
diff changeset
67 #('containing only one of the following terms',
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
68 # '<input type="text" name="xor_terms" size="30" value="%s">'
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
69 # % form_get(request, 'xor_terms')),
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
70 # TODO: dropdown-box?
1374
aa33bb2b40d6 mimetype-search is live, i18n fixes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1373
diff changeset
71 (_('belonging to one of the following categories'),
1492
e0c816e54863 CategorySearch is implemented through a regexp'ed TextSearch
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1491
diff changeset
72 '<input type="text" name="categories" size="30" value="%s">'
e0c816e54863 CategorySearch is implemented through a regexp'ed TextSearch
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1491
diff changeset
73 % form_get(request, 'categories')),
1444
1a3c73509f15 info for last modification date in advanced ui
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1441
diff changeset
74 (_('last modified since (e.g. last 2 weeks)'),
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
75 '<input type="text" name="mtime" size="30" value="%s">'
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
76 % form_get(request, 'mtime')),
1369
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
77 )])
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
78 ])
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
79
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
80 # language selection
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
81 searchedlang = form_get(request, 'language')
1367
4c29aeea8bf7 languages dropdown menu
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1364
diff changeset
82 langs = dict([(lang, lmeta['x-language-in-english'])
1435
17e40b5bf1df reworked language list sorting
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1433
diff changeset
83 for lang, lmeta in languages.items()])
1449
e219092e1a0d a few small fixes to get misc things working with xapian
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1448
diff changeset
84 userlang = macro.request.lang
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
85 lang_select = makeSelection('language',
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
86 [('', _('any language')), (userlang, langs[userlang])] +
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
87 sorted(langs.items(), key=lambda i: i[1]),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
88 searchedlang)
1367
4c29aeea8bf7 languages dropdown menu
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1364
diff changeset
89
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
90 # mimetype selection
1488
2178a0153213 advanced search dialogue preserves state
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1460
diff changeset
91 mimetype = form_get(request, 'mimetype')
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
92 mt_select = makeSelection('mimetype',
2224
4ca25b36adb0 AdvancedSearch: added i18n for 'any mimetype'
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
93 [('', _('any mimetype'))] + [(m[1], '*%s - %s' % m) for m in sorted(mimetypes.types_map.items())],
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
94 mimetype)
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
95
1369
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
96
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
97 # misc search options (checkboxes)
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
98 search_options = ''.join([
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
99 ''.join([
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
100 f.table_row(1),
1372
6dacf2061124 cosmetic change for language and file type selection
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1371
diff changeset
101 f.table_cell(1, attrs={'class': 'searchfor'}),
6dacf2061124 cosmetic change for language and file type selection
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1371
diff changeset
102 txt[0],
6dacf2061124 cosmetic change for language and file type selection
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1371
diff changeset
103 f.table_cell(0),
6dacf2061124 cosmetic change for language and file type selection
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1371
diff changeset
104 f.table_cell(1, colspan=2),
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
105 unicode(txt[1]),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
106 txt[2],
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
107 f.table_cell(0),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
108 f.table_row(0),
1369
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
109 ]) for txt in (
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
110 (_('Language'), unicode(lang_select), ''),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
111 (_('File Type'), unicode(mt_select), ''),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
112 ('', html.INPUT(type='checkbox', name='titlesearch',
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
113 value='1', checked=form_get(request, 'titlesearch'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
114 id='titlesearch'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
115 '<label for="titlesearch">%s</label>' % _('Search only in titles')),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
116 ('', html.INPUT(type='checkbox', name='case', value='1',
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
117 checked=form_get(request, 'case'), id='case'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
118 '<label for="case">%s</label>' % _('Case-sensitive search')),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
119 ('', html.INPUT(type='checkbox', name='excludeunderlay',
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
120 value='1', checked=form_get(request, 'excludeunderlay'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
121 id='excludeunderlay'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
122 '<label for="excludeunderlay">%s</label>' % _('Exclude underlay')),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
123 ('', html.INPUT(type='checkbox', name='nosystemitems',
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
124 value='1', checked=form_get(request, 'nosystemitems'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
125 id='nosystempages'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
126 '<label for="nosystempages">%s</label>' % _('No system items')),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
127 ('', html.INPUT(type='checkbox', name='historysearch',
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
128 value='1', checked=form_get(request, 'historysearch'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
129 disabled=(not request.cfg.xapian_search or
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
130 not request.cfg.xapian_index_history),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
131 id='historysearch'),
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
132 '<label for="historysearch">%s</label>' % _('Search in all page revisions'))
1376
649b60a4064a domain-secific search (for system pages)
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1374
diff changeset
133 )
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
134 ])
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
135
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
136 # the dialogue
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
137 return f.rawHTML('\n'.join([
3040
8608b258f8e6 bug fix of MoinMoinBugs/MoveAttachmentNotWorkingWithModPython (thanks to Boleslaw Kulbabinski) (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2725
diff changeset
138 u'<form method="get" action="%s/%s">' % (macro.request.getScriptname(), wikiutil.quoteWikinameURL(macro.request.formatter.page.page_name)),
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
139 u'<div>',
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
140 u'<input type="hidden" name="action" value="fullsearch">',
1369
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
141 u'<input type="hidden" name="advancedsearch" value="1">',
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
142 f.table(1, attrs={'tableclass': 'advancedsearch'}),
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
143 search_boxes,
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
144 search_options,
1369
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
145 f.table_row(1),
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
146 f.table_cell(1, attrs={'class': 'submit', 'colspan': '3'}),
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
147 u'<input type="submit" value="%s">' % _('Go get it!'),
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
148 f.table_cell(0),
0a291dcb0555 more work on the advanced ui.. css, mimetype and language stuff
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1367
diff changeset
149 f.table_row(0),
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
150 f.table(0),
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
151 u'</div>',
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
152 u'</form>',
1509
6cd9bcede8cf make use of MoinMoin.widget.html and MoinMoin.util.web, clickable labels for advaced ui checkboxes
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1506
diff changeset
153 ]))
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
154
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
155
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
156 def execute(macro, needle):
1499
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
157 # for now, just show the advanced ui
ffa0d1f81059 final polishing round adding docstrings, comments and fixing small issues
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1494
diff changeset
158 return advanced_ui(macro)
1364
12ddd8661ad6 basic structure for new AdvancedSearch macro, py2.4 fix for html formatter
Franz Pletz <fpletz AT franz-pletz DOT org>
parents:
diff changeset
159