Module: check_mk
Branch: master
Commit: b916d9951ec55363a6118add0750b5fde37e3e96
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b916d9951ec553…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Sep 14 10:06:40 2017 +0200
Pagetypes: Parameters now know the edit mode (create/edit/clone)
Change-Id: I428a6929c50aec9ddd7c3834c9f3da3376f0cddc
---
web/htdocs/pagetypes.py | 16 ++++++++--------
web/plugins/sidebar/shipped.py | 4 ++--
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py
index 2a5836a..0ff64d8 100644
--- a/web/htdocs/pagetypes.py
+++ b/web/htdocs/pagetypes.py
@@ -96,7 +96,7 @@ class Base(object):
# Each element is a triple of order, key and valuespec
# TODO: Add topic here
@classmethod
- def parameters(cls):
+ def parameters(cls, mode):
return [ ( _("General Properties"), [
( 1.1, 'name', ID(
title = _('Unique ID'),
@@ -129,9 +129,9 @@ class Base(object):
# Do *not* override this. It collects all editable parameters of our
# page type by calling parameters() for each class
@classmethod
- def collect_parameters(cls):
+ def _collect_parameters(cls, mode):
topics = {}
- for topic, elements in cls.parameters():
+ for topic, elements in cls.parameters(mode):
el = topics.setdefault(topic, [])
el += elements
@@ -317,8 +317,8 @@ class PageRenderer(Base):
# Parameters special for page renderers. These can be added to the sidebar,
# so we need a topic and a checkbox for the visibility
@classmethod
- def parameters(cls):
- parameters = super(PageRenderer, cls).parameters()
+ def parameters(cls, mode):
+ parameters = super(PageRenderer, cls).parameters(mode)
parameters += [(_("General Properties"), [
( 1.4, 'topic', TextUnicode(
@@ -412,8 +412,8 @@ class Overridable(Base):
@classmethod
- def parameters(cls):
- parameters = super(Overridable, cls).parameters()
+ def parameters(cls, mode):
+ parameters = super(Overridable, cls).parameters(mode)
if cls.has_overriding_permission("publish"):
parameters += [( _("General Properties"), [
@@ -1025,7 +1025,7 @@ class Overridable(Base):
title = _("General Properties"),
render = 'form',
optional_keys = None,
- elements = cls.collect_parameters(),
+ elements = cls._collect_parameters(mode),
)
def validate(page_dict):
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index 4f8075b..7b80057 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -1442,7 +1442,7 @@ class BookmarkList(pagetypes.Overridable):
@classmethod
- def parameters(cls):
+ def parameters(cls, mode):
vs_topic = TextUnicode(
title = _("Topic") + "<sup>*</sup>",
size = 50,
@@ -1463,7 +1463,7 @@ class BookmarkList(pagetypes.Overridable):
"topic" : v[3],
}
- parameters = super(BookmarkList, cls).parameters()
+ parameters = super(BookmarkList, cls).parameters(mode)
parameters += [(_("Bookmarks"), [
# sort-index, key, valuespec