Module: check_mk
Branch: master
Commit: 941d90c9bb5a6b72cfc78a57a59414537ea24a25
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=941d90c9bb5a6b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 8 10:36:02 2015 +0200
reworked styling of icon and snmp trap upload dialogs
---
mkeventd/web/plugins/wato/mkeventd.py | 6 ++++++
web/htdocs/wato.py | 20 +++++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/mkeventd/web/plugins/wato/mkeventd.py
b/mkeventd/web/plugins/wato/mkeventd.py
index 2c752a7..d013c21 100644
--- a/mkeventd/web/plugins/wato/mkeventd.py
+++ b/mkeventd/web/plugins/wato/mkeventd.py
@@ -1853,8 +1853,14 @@ def mode_mkeventd_mibs(phase):
html.write("<h3>" + _("Upload MIB file") +
"</h3>")
html.write(_("Allowed are single MIB files - usually with the extension
<tt>.mib</tt> or <tt>.txt</tt>.<br><br>"))
+
html.begin_form("upload_form", method = "POST")
+ forms.header(_("Upload MIB file"))
+
+ forms.section(_("Select file"))
html.upload_file("_upload_mib")
+ forms.end()
+
html.button("upload_button", _("Upload MIB(s)"),
"submit")
html.hidden_fields()
html.end_form()
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e77c26a..d666cfc 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -17597,8 +17597,8 @@ def upload_icon(icon_info):
# Add the icon category to the PNG comment
from PIL import Image, PngImagePlugin
from StringIO import StringIO
- im = Image.open(StringIO(icon_info[0][2]))
- im.info['Comment'] = icon_info[1]
+ im = Image.open(StringIO(icon_info['icon'][2]))
+ im.info['Comment'] = icon_info['category']
meta = PngImagePlugin.PngInfo()
for k,v in im.info.iteritems():
if k not in ('interlace', 'gamma', 'dpi',
'transparency', 'aspect'):
@@ -17607,7 +17607,7 @@ def upload_icon(icon_info):
# and finally save the image
dest_dir = "%s/local/share/check_mk/web/htdocs/images/icons" %
defaults.omd_root
make_nagios_directories(dest_dir)
- im.save(dest_dir+'/'+icon_info[0][0], 'PNG', pnginfo=meta)
+ im.save(dest_dir+'/'+icon_info['icon'][0], 'PNG',
pnginfo=meta)
def load_custom_icons():
@@ -17627,19 +17627,21 @@ def mode_icons(phase):
home_button()
return
- vs_upload = Tuple(
+ vs_upload = Dictionary(
title = _('Icon'),
+ optional_keys = False,
+ render = "form",
elements = [
- FileUpload(
+ ('icon', FileUpload(
title = _('Icon'),
allow_empty = False,
validate = validate_icon,
- ),
- DropdownChoice(
+ )),
+ ('category', DropdownChoice(
title = _('Category'),
choices = IconSelector._categories,
no_preselect = True,
- )
+ ))
]
)
@@ -17668,7 +17670,7 @@ def mode_icons(phase):
html.message(_("Sorry, you can mange your icons only within OMD
environments."))
return
- html.write(_("Allowed are single PNG image files with a maximum size of 80x80
px."))
+ html.write("<p>"+_("Allowed are single PNG image files with a
maximum size of 80x80 px.")+"</p>")
html.begin_form('upload_form', method='POST')
vs_upload.render_input('_upload_icon', None)