add new Mojo skin - management interface based on Dojo

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@4036 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-10-12 09:07:46 +00:00
parent 74afbba15a
commit 73cc58e295
9 changed files with 252 additions and 0 deletions

View file

@ -40,4 +40,7 @@
<!-- a skin based on blueprint css -->
<include package=".blue" />
<!-- a skin for management tasks based on Dojo -->
<include package=".mojo" />
</configure>

10
browser/mojo/__init__.py Normal file
View file

@ -0,0 +1,10 @@
"""
$Id$
"""
from zope.app.rotterdam import Rotterdam
class Mojo(Rotterdam):
""" The Mojo (Management Interface with Dojo) skin """

22
browser/mojo/base.css Normal file
View file

@ -0,0 +1,22 @@
/*
$Id$
*/
body, html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow:hidden;
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
font-size: 13px;
background-color: white;
color: #000040;
}
#borderContainer {
width: 100%;
height: 100%;
}

65
browser/mojo/body.pt Normal file
View file

@ -0,0 +1,65 @@
<tal:block i18n:domain="loops">
<metal:block define-macro="body"
tal:define="controller nocall:view/controller;
resourceBase controller/resourceBase;">
<div id="borderContainer"
dojoType="dijit.layout.BorderContainer"
gutters="true">
<div id="global" metal:define-macro="global"
dojoType="dijit.layout.ContentPane"
region="top" splitter="false">
<div class="top" metal:define-slot="top">
<a href="#" name="top" metal:define-slot="logo"
tal:attributes="href string:${request/URL/1}"><img class="logo"
src="logo.gif" border="0" alt="Home"
tal:attributes="src string:${resourceBase}logo.gif" /></a>
</div>
</div>
<div id="mainSplit"
dojoType="dijit.layout.BorderContainer"
region="center" gutters="true" design="sidebar"
splitter="false" liveSplitters="true">
<div metal:define-macro="menu"
dojoType="dijit.layout.ContentPane"
region="leading" splitter="true"
style="width: 15%">
<tal:portlet repeat="macro controller/macros/portlet_left">
<metal:portlet use-macro="macro" />
</tal:portlet>
</div>
<div metal:define-macro="content"
dojoType="dijit.layout.ContentPane"
region="center" splitter="true">
<div metal:define-slot="actions"></div>
<div metal:define-slot="message"></div>
<metal:content define-slot="content">
<tal:content define="item nocall:view/item;
level level|python: 1;
macro item/macro;"
condition="macro">
<metal:block use-macro="macro" />
</tal:content>
</metal:content>
</div>
</div>
<div class="footer" metal:define-macro="footer"
dojoType="dijit.layout.ContentPane"
region="bottom" splitter="false"
style="margin-top: 0">
<metal:footer define-slot="footer">
Powered by <b><a href="http://www.python.org">Python</a></b> &middot;
<b><a href="http://loops.cy55.de">loops</a></b> &middot;
<b><a href="http://wiki.zope.org/zope3">Zope 3</a></b> &middot;
<b><a href="http://www.python.org">Python</a></b> &middot;
<b><a href="http://www.dojotoolkit.org">Dojo</a></b>.
</metal:footer>
</div>
</div>
</metal:block>
</tal:block>

31
browser/mojo/browser.py Normal file
View file

@ -0,0 +1,31 @@
#
# Copyright (c) 2006 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
#
"""
Dummy view class for providing the body template.
$Id$
"""
from cybertools.browser.view import UnboundTemplateFile
class View(object):
bodyTemplate = UnboundTemplateFile('body.pt')

View file

@ -0,0 +1,32 @@
<!-- $Id$ -->
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns="http://namespaces.zope.org/browser"
i18n_domain="zope">
<zope:interface
interface="cybertools.browser.mojo.Mojo"
type="zope.publisher.interfaces.browser.IBrowserSkinType"
name="Mojo" />
<page for="*"
name="body.html"
class="cybertools.browser.mojo.browser.View"
permission="zope.View"
layer="cybertools.browser.mojo.Mojo" />
<page name="controller"
for="zope.publisher.interfaces.browser.IBrowserView"
class="cybertools.browser.mojo.controller.Controller"
permission="zope.Public"
layer="cybertools.browser.mojo.Mojo" />
<resource name="base.css" file="base.css"
layer="cybertools.browser.mojo.Mojo" />
<resource name="print.css" file="print.css"
layer="cybertools.browser.mojo.Mojo" />
<resource name="custom.css" file="custom.css"
layer="cybertools.browser.mojo.Mojo" />
</configure>

View file

@ -0,0 +1,65 @@
#
# Copyright (c) 2010 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
#
"""
View controller for the Mojo skin.
$Id$
"""
from cybertools.ajax.dojo import dojoMacroTemplate
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 = [('base.css', 'screen', 25),
('print.css', 'print', 30),
('custom.css', 'all', 100)]
for param in params:
macros.register('css', identifier=param[0],
resourceName=param[0], media=param[1],
priority=param[2])
def setupJs(self):
cm = self.macros
cm.register('js', 'dojo.js', template=dojoMacroTemplate, name='main',
position=0,
djConfig='parseOnLoad: true, usePlainJson: true, '
#'isDebug: true, '
'locale: "en"')
jsCall = ('dojo.require("dojo.parser"); '
'dojo.registerModulePath("jocy", "/@@/cybertools.jocy"); ')
cm.register('js-execute', 'dojo_registration', jsCall=jsCall)
jsCall = ('dojo.require("dijit.layout.ContentPane"); '
'dojo.require("dijit.layout.BorderContainer"); ')
cm.register('js-execute', 'dojo_contentpane', jsCall=jsCall)
cm.register('css', identifier='tundra.css', position=0,
resourceName='ajax.dojo/dijit/themes/tundra/tundra.css',
media='all')

7
browser/mojo/custom.css Normal file
View file

@ -0,0 +1,7 @@
/*
$Id$
Copy this to your custom skin directory and add custom settings.
*/

17
browser/mojo/print.css Normal file
View file

@ -0,0 +1,17 @@
/*
$Id$
*/
body {
font-size: 11px;
}
.top, #header, #menu, #sub-section, #footer, .object-actions, .button {
display: none;
}
#content {
width: 100%;
color: Black;
}