Module: check_mk
Branch: master
Commit: 2a328ebdce3d153974fa7641df929989f7e48eb8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2a328ebdce3d15…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 10 14:12:46 2016 +0200
Improved general regex help texts a bit; removed special help text from rule editor
---
web/htdocs/valuespec.py | 23 +++++++++++++++++++----
web/htdocs/wato.py | 7 -------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index d6e3f0d..c451805 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -542,17 +542,28 @@ class RegExp(TextAscii):
help_text.append(_("The text entered here is handled as a regular expression
pattern."))
if self._mode == RegExp.infix:
- help_text.append(_("The pattern is applied as infix search."))
+ help_text.append(_("The pattern is applied as infix search. Add a
leading <tt>^</tt> "
+ "to make it match from the beginning and/or a tailing
<tt>$</tt> "
+ "to match till the end of the text."))
elif self._mode == RegExp.prefix:
- help_text.append(_("The pattern is matched from the beginning."))
+ help_text.append(_("The pattern is matched from the beginning. Add a
tailing "
+ "<tt>$</tt> to change it to a whole text
match."))
elif self._mode == RegExp.complete:
- help_text.append(_("The pattern is matching the whole text."))
+ help_text.append(_("The pattern is matching the whole text. You can add
<tt>.*</tt> "
+ "in front or at the end of your pattern to make it
either a prefix "
+ "or infix search."))
if self._case_sensitive == True:
help_text.append(_("The match is performed case sensitive."))
elif self._case_sensitive == False:
help_text.append(_("The match is performed case insensitive."))
+ help_text.append(
+ _("Please note that any backslashes need to be escaped using a
backslash, "
+ "for example you need to insert <tt>C:\\\\windows\\\\</tt>
if you want to match "
+ "<tt>c:\windows\</tt>.")
+ )
+
return " ".join(help_text)
@@ -1050,8 +1061,10 @@ class ListOfStrings(ValueSpec):
help_text = ValueSpec.help(self)
field_help = self._valuespec.help()
- if field_help:
+ if help_text and field_help:
return help_text + " " + field_help
+ elif field_help:
+ return field_help
else:
return help_text
@@ -1074,6 +1087,8 @@ class ListOfStrings(ValueSpec):
self._valuespec.render_input(vp + "_%d" % nr, s)
html.write('</div>')
html.write('</div>')
+ html.write("<div style=\"clear:left\"></div>")
+ html.help(self.help())
html.javascript("list_of_strings_init('%s');" % vp);
def canonical_value(self):
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a85bf7b..0334d7e 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -13314,17 +13314,10 @@ def mode_edit_rule(phase, new = False):
itemspec.render_input("item", value)
else:
vs_rule_service_conditions().render_input("itemlist",
cleaned_item_list)
- html.write("<br><br>")
html.checkbox("negate_entries", negate_entries, label =
_("<b>Negate:</b> make rule apply for
<b>all but</b> the above entries"))
- if not itemenum:
- html.help(_("The entries here are regular expressions to match the
beginning. "
- "Add a <tt>$</tt> for an exact match. An
arbitrary substring is matched "
- "with <tt>.*</tt><br>Please note that
on windows systems any backslashes need to be escaped."
- "For example C:\\\\tmp\\\\message.log"))
-
html.write("</div>")
forms.end()