From 14a324412ad538678a9e95695972fb16d60c26a0 Mon Sep 17 00:00:00 2001 From: helmutm Date: Tue, 18 Oct 2005 06:01:13 +0000 Subject: [PATCH] first steps towards using/integrating the viewlet and menu stuff git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@629 fd906abe-77d9-0310-91a1-e0d9ade77398 --- browser/configure.zcml | 13 +++++++++ browser/menu.py | 53 ++++++++++++++++++++++++++++++++++++ browser/skin/configure.zcml | 20 ++++++++++++++ browser/skin/left_slot.pt | 10 +++++++ browser/skin/menu_viewlet.pt | 2 ++ browser/skin/view_macros.pt | 2 +- browser/viewlets.py | 29 ++++++++++++++++++++ 7 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 browser/menu.py create mode 100644 browser/skin/left_slot.pt create mode 100644 browser/skin/menu_viewlet.pt create mode 100644 browser/viewlets.py diff --git a/browser/configure.zcml b/browser/configure.zcml index 4b92714..19e1eeb 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -38,6 +38,19 @@ fields="title" /> + + + + diff --git a/browser/menu.py b/browser/menu.py new file mode 100644 index 0000000..61c82bd --- /dev/null +++ b/browser/menu.py @@ -0,0 +1,53 @@ +# +# Copyright (c) 2005 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +cybertools menu. + +$Id$ +""" + +from zope.app import zapi +from zope.app.pagetemplate.simpleviewclass import simple +from zope.viewlet.viewlet import ViewletBase, SimpleViewletClass +from zope.app.publisher.interfaces.browser import IBrowserMenu + + +class MenuViewlet(ViewletBase): + """ Menu viewlet. + """ + + def getMenu(self): + menu = zapi.getUtility(IBrowserMenu, name='mmain') + return menu + + +def GenericMenuViewlet(template, offering=None, bases=(), name=u'', weight=0): + #return SimpleViewletClass(template, offering, + # bases + (MenuViewletBase,), name, weight) + if offering is None: + offering = sys._getframe(1).f_globals + bases += (MenuViewletBase, simple) + class_ = type("GenericMenuViewlet from %s" % template, bases, + {'index' : ViewletPageTemplateFile(template, offering), + '_weight' : weight, + '__name__' : name}) + return class_ + + + \ No newline at end of file diff --git a/browser/skin/configure.zcml b/browser/skin/configure.zcml index 5ebe6b9..e48d04d 100644 --- a/browser/skin/configure.zcml +++ b/browser/skin/configure.zcml @@ -32,4 +32,24 @@ + + + + + + diff --git a/browser/skin/left_slot.pt b/browser/skin/left_slot.pt new file mode 100644 index 0000000..f03026c --- /dev/null +++ b/browser/skin/left_slot.pt @@ -0,0 +1,10 @@ +
+ Headline +
+
+
+ +
+
diff --git a/browser/skin/menu_viewlet.pt b/browser/skin/menu_viewlet.pt new file mode 100644 index 0000000..35598ba --- /dev/null +++ b/browser/skin/menu_viewlet.pt @@ -0,0 +1,2 @@ +
diff --git a/browser/skin/view_macros.pt b/browser/skin/view_macros.pt index b0cc3d5..becb812 100644 --- a/browser/skin/view_macros.pt +++ b/browser/skin/view_macros.pt @@ -27,13 +27,13 @@
- +