From 10d4a15ca4339fc13ba128be4d4eaac256055f64 Mon Sep 17 00:00:00 2001 From: helmutm Date: Fri, 17 Oct 2008 09:38:41 +0000 Subject: [PATCH] allow hiding of controller macros, e.g. portlets git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2921 fd906abe-77d9-0310-91a1-e0d9ade77398 --- browser/action_macros.pt | 6 ++++-- browser/controller.py | 15 +++++++++++---- browser/icons/ledgrey.png | Bin 0 -> 493 bytes organize/party.py | 7 ++++--- stateful/publishing.py | 4 ++-- 5 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 browser/icons/ledgrey.png diff --git a/browser/action_macros.pt b/browser/action_macros.pt index ab185c0..38492dc 100644 --- a/browser/action_macros.pt +++ b/browser/action_macros.pt @@ -8,7 +8,8 @@
+ title action/description;" + i18n:attributes="title"> icon + alt action/description" + i18n:attributes="alt" /> Action Title diff --git a/browser/controller.py b/browser/controller.py index c44c408..3fcd482 100644 --- a/browser/controller.py +++ b/browser/controller.py @@ -83,7 +83,7 @@ class Macros(dict): def __init__(self, controller): self.controller = controller - self.identifiers = set() + self.identifiers = {} def register(self, slot, identifier=None, template=None, name=None, priority=50, **kw): @@ -91,21 +91,28 @@ class Macros(dict): # make sure a certain resource is only registered once if identifier in self.identifiers: return - self.identifiers.add(identifier) + #self.identifiers.add(identifier) + self.identifiers[identifier] = True if template is None: template = self.standardTemplate if name is None: name = slot - macro = Macro(template, name, priority, **kw) + macro = Macro(template, name, priority, identifier=identifier, **kw) entry = self.setdefault(slot, []) entry.append(macro) + def hide(self, identifier): + self.identifiers[identifier] = False + def __getitem__(self, key): - return list(sorted(self.get(key, []), key=lambda x: x.priority)) + return [m for m in sorted(self.get(key, []), key=lambda x: x.priority) + if self.identifiers.get(m.identifier, True)] class Macro(object): + identifier = '' + def __init__(self, template, name, priority, **kw): self.template = template self.name = name diff --git a/browser/icons/ledgrey.png b/browser/icons/ledgrey.png new file mode 100644 index 0000000000000000000000000000000000000000..53369b02e60cfe3cad57b44403dec1fb367b6cf6 GIT binary patch literal 493 zcmVfwr_gDtF)Cr4oE^d%u^rJjIm?p<1#PggD>Kdi<{&(c-&Tr(fiU z?8;|(oN)##MV>zP@2tt4ZWPs64pCUd!9xfWNT%v&@ zN7$BWZ~Q))oN)2*@o<2ARD)KM*L0`9R}~B{9t8q|(Uu`)uS)7byOunCFzMps6W}6P zGIBmPj#s(V@Mln8sn$~rpiqFJ%ZJ9n6Z+r)$a(TN|p{WUys+`|61h)KwbMR ja31Ozu!s3~(tqJ!rVF8wY5L-&00000NkvXXu0mjf5c