changeset 1369:0a291dcb0555

more work on the advanced ui.. css, mimetype and language stuff
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Fri, 18 Aug 2006 14:25:08 +0200
parents 949341c1c5ed
children 25ad5f5c6e3d
files MoinMoin/action/fullsearch.py MoinMoin/macro/AdvancedSearch.py wiki/htdocs/modern/css/common.css
diffstat 3 files changed, 76 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/fullsearch.py	Fri Aug 18 13:12:57 2006 +0200
+++ b/MoinMoin/action/fullsearch.py	Fri Aug 18 14:25:08 2006 +0200
@@ -23,14 +23,20 @@
     try:
         return int(request.form['titlesearch'][0])
     except ValueError:
-        return True
+        return not isAdvancedSearch(request)
     except KeyError:
         return 'fullsearch' not in request.form
 
+def isAdvancedSearch(request):
+    try:
+        return int(request.form['advancedsearch'][0])
+    except ValueError:
+        return False
 
 def execute(pagename, request, fieldname='value', titlesearch=0):
     _ = request.getText
     titlesearch = isTitleSearch(request)
+    advancedsearch = isAdvancedSearch(request)
 
     # context is relevant only for full search
     if titlesearch:
--- a/MoinMoin/macro/AdvancedSearch.py	Fri Aug 18 13:12:57 2006 +0200
+++ b/MoinMoin/macro/AdvancedSearch.py	Fri Aug 18 14:25:08 2006 +0200
@@ -20,7 +20,11 @@
     f = macro.formatter
 
     search_boxes = ''.join([
-        ''.join([
+        f.table_row(1),
+        f.table_cell(1, attrs={'rowspan': '7', 'class': 'searchfor'}),
+        f.text(_('Search for pages')),
+        f.table_cell(0),
+        ''.join([''.join([
             f.table_row(1),
             f.table_cell(1),
             f.text('%s:' % _(txt)),
@@ -30,49 +34,71 @@
             f.table_cell(0),
             f.table_row(0),
         ]) for txt, input_field in (
-            ('Search for pages containing all the following terms',
+            ('containing all the following terms',
                 '<input type="text" name="all_terms" size="30">'),
-            ('Search for pages containing one or more of the following '
+            ('containing one or more of the following '
                 'terms', '<input type="text" name="or_terms" size="30">'),
-            ('Search for pages not containing the following terms',
+            ('not containing the following terms',
                 '<input type="text" name="not_terms" size="30">'),
-            ('Search for pages containing only one of the following terms',
+            ('containing only one of the following terms',
                 '<input type="text" name="xor_terms" size="30">'),
             # TODO: dropdown-box?
-            ('Search for pages belonging to one of the following categories',
+            ('belonging to one of the following categories',
                 '<input type="text" name="categories" size="30">'),
-        )
+            ('edited since/until the following date',
+                '<input type="text" name="date" size="30" value="now">'),
+        )])
     ])
 
     langs = dict([(lang, lmeta['x-language-in-english'])
-        for lang, lmeta in languages.iteritems()])
+        for lang, lmeta in sorted(languages.items())])
     lang_dropdown = ''.join([
         u'<select name="language" size="1">',
-        ''.join(['<option value="%s">%s</option>' % i for i in
+        u'<option value="" selected>%s</option>' % _('any language'),
+        ''.join(['<option value="%s">%s</option>' % lt for lt in
             langs.items()]),
         u'</select>',
     ])
 
+    import mimetypes
+    ft_dropdown = ''.join([
+        u'<select name="language" size="1">',
+        u'<option value="" selected>%s</option>' % _('any type'),
+        ''.join(['<option value="%s">%s</option>' % (m[1], '*%s - %s' % m)
+            for m in sorted(mimetypes.types_map.items())]),
+        u'</select>',
+    ])
+
     search_options = ''.join([
         ''.join([
             f.table_row(1),
-            f.table_cell(1, colspan=2),
+            f.table_cell(1, colspan=3),
             txt,
             f.table_cell(0),
             f.table_row(0),
-            ]) for txt in ('Language:' + lang_dropdown, 'xxxx')
+            ]) for txt in (
+                'Language: ' + lang_dropdown,
+                'File Type: ' + ft_dropdown,
+                '<input type="checkbox" name="titlesearch" value="1">%s</input>' %
+                _('Search only in titles'),
+                '<input type="checkbox" name="case" value="1">%s</input>' %
+                _('Case-sensitive search'))
     ])
     
     html = [
         u'<form method="get" action="">',
         u'<div>',
         u'<input type="hidden" name="action" value="fullsearch">',
-        u'<input type="hidden" name="titlesearch" value="0">',
-        f.table(1),
+        u'<input type="hidden" name="advancedsearch" value="1">',
+        f.table(1, attrs={'tableclass': 'advancedsearch'}),
         search_boxes,
         search_options,
+        f.table_row(1),
+        f.table_cell(1, attrs={'class': 'submit', 'colspan': '3'}),
+        u'<input type="submit" value="%s">' % _('Go get it!'),
+        f.table_cell(0),
+        f.table_row(0),
         f.table(0),
-        u'<input type="submit" value="%s">' % _('Go get it!'),
         u'</div>',
         u'</form>',
     ]
--- a/wiki/htdocs/modern/css/common.css	Fri Aug 18 13:12:57 2006 +0200
+++ b/wiki/htdocs/modern/css/common.css	Fri Aug 18 14:25:08 2006 +0200
@@ -331,6 +331,35 @@
 div.codearea pre span.DiffSeparator {color: #228B22; font-weight: bold}
 
 /* Search results */
+.advancedsearch {
+    border: 1pt solid #ADB9CC;
+}
+
+.advancedsearch td {
+    vertical-align: top;
+    background-color: #E7E7E7;    
+    border: 0px;
+}
+
+.advancedsearch td.searchfor {
+    font-weight: bold;
+}
+.advancedsearch input {
+    border: 1px solid #ADB9CC;
+    background-color: #fff;
+}
+
+.advancedsearch td.submit {
+    border-top: 1px solid #ADB9CC;
+    background-color: #fff;
+    text-align: right;
+}
+
+.advancedsearch optioni, select {
+    border: 1px solid #ADB9CC;
+    background-color: #fff;
+}
+
 
 .searchresults dt {
     margin-top: 1em;