Module: check_mk
Branch: master
Commit: 3dd5245d3096018f0b4d139fc6277a66a59d71c4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3dd5245d309601…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 28 07:17:59 2014 +0100
#1477 New screenshot mode for Multisite
If you add <tt>screenshotmode = True</tt> to your
<tt>multisite.mk</tt> or add a <tt>?screenshotmode=1</tt>
to your URL, then Multisite will replace the fancy blue background by a plain white. This
makes it easier
to screenshot parts of the GUI like configuration boxes, sidebar snapins, etc.
---
.werks/1477 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 8 +++++++-
web/htdocs/index.py | 4 ++++
web/htdocs/login.css | 5 ++++-
web/htdocs/pages.css | 8 ++++++++
web/plugins/config/builtin.py | 1 +
7 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/.werks/1477 b/.werks/1477
new file mode 100644
index 0000000..cb6a212
--- /dev/null
+++ b/.werks/1477
@@ -0,0 +1,11 @@
+Title: New screenshot mode for Multisite
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.5i6
+Date: 1414477007
+Class: feature
+
+If you add <tt>screenshotmode = True</tt> to your
<tt>multisite.mk</tt> or add a <tt>?screenshotmode=1</tt>
+to your URL, then Multisite will replace the fancy blue background by a plain white. This
makes it easier
+to screenshot parts of the GUI like configuration boxes, sidebar snapins, etc.
diff --git a/ChangeLog b/ChangeLog
index af93fea..36fc182 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -135,6 +135,7 @@
* 1411 New builting views for the history of scheduled downtimes
* 1185 mobile ui: Added a new view to see events from the Event Console
* 1412 Speed up of displaying and sorting after WATO folder path
+ * 1477 New screenshot mode for Multisite...
* 1067 FIX: Fixed login problem in LDAP connector when no user filter specified...
* 1094 FIX: sidebar snaping 'Tree of folders': fixed exception
* 1154 FIX: Availability: Fixed unwanted redirect to edit annotation page after
editing availability options...
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index e24a5f4..53820a2 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -71,6 +71,7 @@ class html:
self.keybindings_enabled = True
self.io_error = False
self.enable_debug = False
+ self.screenshotmode = True
self.help_visible = False
self.treestates = {}
self.treestates_for_id = None
@@ -750,7 +751,12 @@ class html:
if self.output_format == "html":
if not self.header_sent:
self.html_head(title, **args)
- self.write('<body class="main %s">' %
self.var("_body_class", ""))
+ body_classes = [ "main" ]
+ if self.var("_body_class"):
+ body_classes.append(self.var("_body_class"))
+ if self.screenshotmode:
+ body_classes.append("screenshotmode")
+ self.write('<body class="%s">' % "
".join(body_classes))
self.header_sent = True
if self.render_headfoot:
self.top_heading(title)
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index b43ddb6..22e982a 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -106,6 +106,10 @@ def handler(req, fields = None, profiling = True):
config.load_config() # load multisite.mk
if html.var("debug"): # Debug flag may be set via URL
config.debug = True
+
+ if html.var("screenshotmode") or config.screenshotmode: # Omit fancy
background, make it white
+ html.screenshotmode = True
+
html.enable_debug = config.debug
html.set_buffering(config.buffered_http_stream)
diff --git a/web/htdocs/login.css b/web/htdocs/login.css
index 78c77f3..6b499ed 100644
--- a/web/htdocs/login.css
+++ b/web/htdocs/login.css
@@ -43,7 +43,6 @@ body.main {
vertical-align: middle;
}
-
div#login {
background-image: url("images/login_spotlight.png");
background-repeat: no-repeat;
@@ -56,6 +55,10 @@ div#login {
/* border: 1px solid yellow; */
}
+body.main.screenshotmode div#login {
+ background-image: url("");
+}
+
img#login_window {
width: 370px;
height: 230px;
diff --git a/web/htdocs/pages.css b/web/htdocs/pages.css
index d395b96..5590450 100644
--- a/web/htdocs/pages.css
+++ b/web/htdocs/pages.css
@@ -70,6 +70,14 @@ body.main {
background-color: #426D8A;
}
+/* Special mode for creating screenshots of single elements. Omit background.
+ This can be selected in multisite.mk with screenshotmode = True or screenshotmode=1
+ on the URL */
+body.main.screenshotmode {
+ background-image: url("");
+ background-color: white;
+}
+
body.main div.main {
padding-left: 10px;
border-left: 1px solid red;
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index 8c82e27..6e98986 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -34,6 +34,7 @@ roles = {} # User supplied roles
# define default values for all settings
debug = False
+screenshotmode = False
profile = False
users = []
admin_users = []