-
Navigation
+
+
+
+
+
+
+
+
+
diff --git a/browser/configurator.py b/browser/configurator.py
index 8c0096a..5401438 100644
--- a/browser/configurator.py
+++ b/browser/configurator.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
+# Copyright (c) 2008 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
@@ -22,12 +22,11 @@ A view configurator provides configuration data for a view controller.
$Id$
"""
-from zope.app import zapi
+from zope import component
from zope.annotation.interfaces import IAttributeAnnotatable, IAnnotations
from zope.annotation.attribute import AttributeAnnotations
from zope.cachedescriptors.property import Lazy
from zope.interface import Interface, Attribute, implements
-from zope.component import adapts
# interfaces
@@ -64,15 +63,28 @@ class IMacroViewProperty(IViewProperty):
#default implementations
-ANNOTATION_KEY = 'cybertools.browser.configurator.ViewConfigurator'
-
class ViewConfigurator(object):
- """ Simple/basic default adapter using attribute annotations as storage
- for view properties.
+ """ An base class for adapters that allow the registration of view properties.
"""
implements(IViewConfigurator)
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+ self.viewProperties = []
+
+ def getActiveViewProperties(self):
+ return self.viewProperties
+
+
+ANNOTATION_KEY = 'cybertools.browser.configurator.ViewConfigurator'
+
+class AnnotationViewConfigurator(ViewConfigurator):
+ """ Simple adapter using attribute annotations as storage
+ for view properties.
+ """
+
def __init__(self, context, request):
self.context = context
self.request = request
@@ -83,19 +95,12 @@ class ViewConfigurator(object):
propDefs = ann.get(ANNOTATION_KEY, {})
return [self.setupViewProperty(prop, propDef)
for prop, propDef in propDefs.items() if propDef]
- # idea: include properties from GlobalViewConfigurator;
- # there also may be other view configurators e.g. based on
- # the class (or some sort of type) of the context object.
- # Also the view properties may be filtered by permission
- # or other conditions.
- # Note: collecting configurators may be solved by getting
- # multiple configurators (+ utilities) in the controller!
def getActiveViewProperties(self):
return self.viewProperties
def setupViewProperty(self, prop, propDef):
- vp = zapi.queryMultiAdapter((self.context, self.request),
+ vp = component.queryMultiAdapter((self.context, self.request),
IViewProperty, name=prop)
if vp is None:
vp = ViewProperty(self.context, self.request)
@@ -104,19 +109,6 @@ class ViewConfigurator(object):
return vp
-class GlobalViewConfigurator(object):
- """ A global utility that allows the registration of view properties.
- """
-
- implements(IViewConfigurator)
-
- def __init__(self):
- self.viewProperties = []
-
- def getActiveViewProperties(self):
- return self.viewProperties
-
-
class ViewProperty(object):
implements(IViewProperty)
@@ -136,7 +128,7 @@ class ViewProperty(object):
self.params = params
-class MacroViewProperty(object):
+class MacroViewProperty(ViewProperty):
implements(IMacroViewProperty)
diff --git a/browser/configure.zcml b/browser/configure.zcml
index df80f1e..04e3994 100644
--- a/browser/configure.zcml
+++ b/browser/configure.zcml
@@ -6,6 +6,8 @@
i18n_domain="zope"
>
+
+
-
-->
+
+
diff --git a/browser/controller.py b/browser/controller.py
index f710248..6b54462 100644
--- a/browser/controller.py
+++ b/browser/controller.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
+# Copyright (c) 2008 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
@@ -27,6 +27,8 @@ from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from cybertools.browser.configurator import IViewConfigurator, IMacroViewProperty
+from cybertools.browser.member import IMemberInfoProvider
+from cybertools.util.jeep import Jeep
# layout controller: collects information about head elements, skins, portlets, etc
@@ -54,15 +56,11 @@ class Controller(object):
return self.request.URL[0] + skinSetter + '/@@/'
def configure(self):
- #configurator = component.queryMultiAdapter((self.context, self.request),
- # IViewConfigurator)
- # idea: collect multiple configurators:
+ # collect multiple configurators:
configurators = component.getAdapters((self.context, self.request),
IViewConfigurator)
for conf in configurators:
configurator = conf[1]
- #if configurator is not None:
- #for item in configurator.viewProperties:
for item in configurator.getActiveViewProperties():
if IMacroViewProperty.providedBy(item):
self.macros.register(item.slot, item.idenitifier,
@@ -71,6 +69,12 @@ class Controller(object):
else:
setattr(self, item.slot, item)
+ @Lazy
+ def memberInfo(self):
+ provider = component.queryMultiAdapter((self.context, self.request),
+ IMemberInfoProvider)
+ return provider is not None and provider.data or None
+
class Macros(dict):
@@ -81,7 +85,7 @@ class Macros(dict):
self.identifiers = set()
def register(self, slot, identifier=None, template=None, name=None,
- position=None, **kw):
+ priority=50, **kw):
if identifier:
# make sure a certain resource is only registered once
if identifier in self.identifiers:
@@ -91,22 +95,20 @@ class Macros(dict):
template = self.standardTemplate
if name is None:
name = slot
- macro = Macro(template, name, **kw)
+ macro = Macro(template, name, priority, **kw)
entry = self.setdefault(slot, [])
- if position is None:
- entry.append(macro)
- else:
- entry.insert(position, macro)
+ entry.append(macro)
def __getitem__(self, key):
- return self.get(key, [])
+ return list(sorted(self.get(key, []), key=lambda x: x.priority))
class Macro(object):
- def __init__(self, template, name, **kw):
+ def __init__(self, template, name, priority, **kw):
self.template = template
self.name = name
+ self.priority = priority
for k in kw:
setattr(self, k, kw[k])
diff --git a/browser/icons/user.png b/browser/icons/user.png
new file mode 100644
index 0000000..79f35cc
Binary files /dev/null and b/browser/icons/user.png differ
diff --git a/browser/liquid/base.css b/browser/liquid/base.css
index 22e8199..0d89884 100644
--- a/browser/liquid/base.css
+++ b/browser/liquid/base.css
@@ -28,75 +28,4 @@ body {
#menu {width:20%}
#content {width:62%}
#sub-section {width:17%}
-#footer {clear:left}
-
-/* more general stuff */
-
-.top image {
- margin-top: -1px;
-}
-
-div.box {
- margin: 12px 12px 8px 10px;
- border: 1px solid #ccc;
- border-bottom: none;
-}
-
-div.box h4 {
- font: 110% Verdana, Tahoma, Arial, Helvetica, sans-serif;
- color: #000040;
- border: none;
- border-bottom: 1px solid #ccc;
- padding: 4px;
- padding-top: 1px;
- padding-bottom: 3px;
- background-color: #ddd;
- height: auto;
-}
-
-table.listing {
- margin: 1px;
- margin-top: 6px;
-}
-
-table.listing th {
- font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
- color: #000040;
-}
-
-.footer {
- text-align: center;
- border-top: 1px solid #ccc;
- border-bottom: none;
- margin-top: 12px;
- padding-top: 6px;
-}
-
-.itemViews {
- border-bottom-width: 2px;
-}
-
-.button {
- margin: 1em 0 1em 0;
-}
-
-.button a, .button a:visited {
- padding: 2px 4px 2px 4px;
- background-color: #e8e8e8;
- text-decoration: None;
- color: Black;
- border-width: 2px;
- border-style: solid;
- border-color: #f4f4f4 #989898 #989898 #f4f4f4;
-}
-
-.button a:active {
- border-color: #989898 #f4f4f4 #f4f4f4 #989898;
-}
-
-pre {
- background-color: #f4f4f4;
-}
-
-#footer { border-bottom: none; }
-
+#footer {clear:left; float:left}
diff --git a/browser/liquid/configure.zcml b/browser/liquid/configure.zcml
index f3c7656..0c9c604 100644
--- a/browser/liquid/configure.zcml
+++ b/browser/liquid/configure.zcml
@@ -43,6 +43,8 @@
layer="cybertools.browser.liquid.Liquid" />
+
diff --git a/browser/liquid/controller.py b/browser/liquid/controller.py
index e98cf6b..a2d7dc0 100644
--- a/browser/liquid/controller.py
+++ b/browser/liquid/controller.py
@@ -28,19 +28,26 @@ from cybertools.browser.controller import Controller as BaseController
class Controller(BaseController):
def __init__(self, context, request):
+ self.view = view = context # the controller is adapted to a view
+ self.context = context.context
+ self.request = request
self.setupCss()
self.setupJs()
super(Controller, self).__init__(context, request)
def setupCss(self):
macros = self.macros
- params = [('zope3_tablelayout.css', 'all'),
- ('base.css', 'screen'),
- ('print.css', 'print'),
- ('custom.css', 'all')]
+ presentationMode = self.request.get('liquid.viewmode') == 'presentation'
+ params = [('zope3_tablelayout.css', 'all', 20),
+ ('base.css', 'screen', 25),
+ ('print.css', 'print', 30),
+ ('custom.css', 'all', 100)]
+ if presentationMode:
+ params.append(('presentation.css', 'all', 30))
for param in params:
macros.register('css', identifier=param[0],
- resourceName=param[0], media=param[1])
+ resourceName=param[0], media=param[1],
+ priority=param[2])
def setupJs(self):
return
diff --git a/browser/liquid/presentation.css b/browser/liquid/presentation.css
new file mode 100644
index 0000000..7846861
--- /dev/null
+++ b/browser/liquid/presentation.css
@@ -0,0 +1,21 @@
+/*
+ $Id$
+
+*/
+
+.body {
+ margin: 4em;
+}
+
+.top, #header, #menu, #sub-section, #footer, #xedit_icon {
+ display: none;
+}
+
+#content {
+ width: 100%;
+ color: #000077;
+}
+
+h1, h2, h3, h4, h5 {
+ color: #005599;
+}
diff --git a/browser/liquid/zope3_tablelayout.css b/browser/liquid/zope3_tablelayout.css
index 70aceb6..4a0ef28 100644
--- a/browser/liquid/zope3_tablelayout.css
+++ b/browser/liquid/zope3_tablelayout.css
@@ -1,10 +1,8 @@
/*
** Zope3 style sheet for CSS2-capable browsers.
-** For future skin see zope.app.boston.
-*/
-
-/*
-* { border: 1px dotted red }
+**
+** $Id$
+**
*/
@@ -31,7 +29,7 @@ table {
font-size: 100%;
}
-a {
+a[href] {
text-decoration: none;
color: #369;
background-color: transparent;
@@ -46,11 +44,6 @@ img {
vertical-align: middle;
}
-p {
- margin: 0.5em 0em 1em 0em;
- line-height: 1.5em;
-}
-
p a:visited {
color: Purple;
background-color: transparent;
@@ -80,7 +73,7 @@ h1, h2, h3, h4, h5, h6 {
clear: left;
font: 100% bold Verdana, Helvetica, Arial, sans-serif;
margin: 0;
- padding-top: 0.5em;
+ padding-top: 0;
border-bottom: 1px solid #369;
}
@@ -109,7 +102,7 @@ h6 {
}
ul {
- line-height: 1.5em;
+ line-height: 1.2em;
/* list-style-image: url("bullet.gif"); */
margin-left: 2em;
padding:0;
@@ -411,9 +404,6 @@ div.box h4 {
}
-#content {
-}
-
#context_information {
padding-top: 1em;
width: 15%;
@@ -425,18 +415,6 @@ div.box h4 {
width: 100%;
}
-#helpers {
-}
-
-#inspectors {
-}
-
-#footer {
- border-bottom: 1px solid black;
- float: left;
- clear: both;
-}
-
input.textType {
width: 88%; /* Same as textarea */
}
diff --git a/browser/main.pt b/browser/main.pt
index 43929c2..87d58a1 100644
--- a/browser/main.pt
+++ b/browser/main.pt
@@ -32,7 +32,8 @@
-
+