Attachment 'search-ie9compatmode-workaround.diff'

Download

   1 diff -r 748a41f12915 MoinMoin/action/fullsearch.py
   2 --- a/MoinMoin/action/fullsearch.py	Sat Jan 04 18:24:56 2014 +0100
   3 +++ b/MoinMoin/action/fullsearch.py	Sat Jan 04 23:27:45 2014 +0100
   4 @@ -22,6 +22,11 @@
   5      '0' or '1'. In standard search, we have either 'titlesearch' or
   6      'fullsearch' with localized string. If both missing, default to
   7      True (might happen with Safari) if this isn't an advanced search.
   8 +
   9 +    We also evaluate a "default" html form field that can be either
  10 +    "fullsearch" or "titlesearch". This was added to work around weird MS IE9
  11 +    compatibility mode behaviour: if you press Enter it does NOT behave the
  12 +    same as when clicking the default button.
  13  """
  14      form = request.values
  15      if 'titlesearch' in form and 'fullsearch' in form:
  16 @@ -32,7 +37,12 @@
  17          except ValueError:
  18              ret = 1
  19          except KeyError:
  20 -            ret = ('fullsearch' not in form and not isAdvancedSearch(request)) and 1 or 0
  21 +            ret = ('fullsearch' not in form
  22 +                   and
  23 +                   form.get('default', u'titlesearch') != u'fullsearch'
  24 +                   and
  25 +                   not isAdvancedSearch(request)
  26 +                  ) and 1 or 0
  27      return ret
  28  
  29  def isAdvancedSearch(request):
  30 diff -r 748a41f12915 MoinMoin/theme/__init__.py
  31 --- a/MoinMoin/theme/__init__.py	Sat Jan 04 18:24:56 2014 +0100
  32 +++ b/MoinMoin/theme/__init__.py	Sat Jan 04 23:27:45 2014 +0100
  33 @@ -813,6 +813,7 @@
  34  <div>
  35  <input type="hidden" name="action" value="fullsearch">
  36  <input type="hidden" name="context" value="180">
  37 +<input type="hidden" name="default" value="titlesearch">
  38  <label for="searchinput">%(search_label)s</label>
  39  <input id="searchinput" type="text" name="value" value="%(search_value)s" size="20"
  40      onfocus="searchFocus(this)" onblur="searchBlur(this)"

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2014-01-04 22:31:00, 1.8 KB) [[attachment:search-ie9compatmode-workaround.diff]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.