[KSS-checkins] r53908 - in kukit/kss.demo/branch/1.4/kss/demo: . browser
gotcha at codespeak.net
gotcha at codespeak.net
Sun Apr 20 17:23:39 CEST 2008
Author: gotcha
Date: Sun Apr 20 17:23:39 2008
New Revision: 53908
Modified:
kukit/kss.demo/branch/1.4/kss/demo/browser/body_macros.pt
kukit/kss.demo/branch/1.4/kss/demo/browser/configure.zcml
kukit/kss.demo/branch/1.4/kss/demo/browser/header_macros.pt
kukit/kss.demo/branch/1.4/kss/demo/browser/kss_demo_index.pt
kukit/kss.demo/branch/1.4/kss/demo/browser/registry.py
kukit/kss.demo/branch/1.4/kss/demo/resource.py
kukit/kss.demo/branch/1.4/kss/demo/simplecontent.py
Log:
merge 50490-HEAD of improve-demos branch
Modified: kukit/kss.demo/branch/1.4/kss/demo/browser/body_macros.pt
==============================================================================
--- kukit/kss.demo/branch/1.4/kss/demo/browser/body_macros.pt (original)
+++ kukit/kss.demo/branch/1.4/kss/demo/browser/body_macros.pt Sun Apr 20 17:23:39 2008
@@ -2,15 +2,23 @@
<metal:header define-macro="header">
- <div id="global-links">
+ <div id="global-links"
+ tal:define="demoregistry context/@@demoregistry;
+ demo python: demoregistry.getDemo(viewname);">
<ul>
<li><a href=".">All demos</a></li>
<li><a tal:attributes="href mainkss">View KSS resource</a></li>
+ <li tal:condition="python: demo and demo.helpfile">
+ <a href="#" id="displayHelp" tal:attributes="class string:kssattr-viewname-${viewname}">Description</a>
+ <a href="#" id="hideHelp" tal:attributes="class string:hidden kssattr-viewname-${viewname}">Hide Description</a>
+ </li>
</ul>
</div>
<p metal:use-macro="context/@@body_macros/kss_mode">Kss mode</p>
+ <div id="help"></div>
+
</metal:header>
Modified: kukit/kss.demo/branch/1.4/kss/demo/browser/configure.zcml
==============================================================================
--- kukit/kss.demo/branch/1.4/kss/demo/browser/configure.zcml (original)
+++ kukit/kss.demo/branch/1.4/kss/demo/browser/configure.zcml Sun Apr 20 17:23:39 2008
@@ -58,7 +58,7 @@
for="kss.demo.interfaces.ISimpleContent"
name="kss_demo_registry"
class=".registry.KSSDemoRegistryView"
- allowed_attributes="getSortedDemos getDemoGroups getSeleniumTests"
+ allowed_attributes="getSortedDemos getDemoGroups getSeleniumTests getZuite"
permission="zope.View"
/>
<page
Modified: kukit/kss.demo/branch/1.4/kss/demo/browser/header_macros.pt
==============================================================================
--- kukit/kss.demo/branch/1.4/kss/demo/browser/header_macros.pt (original)
+++ kukit/kss.demo/branch/1.4/kss/demo/browser/header_macros.pt Sun Apr 20 17:23:39 2008
@@ -15,9 +15,12 @@
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <link rel="kinetic-stylesheet" type="text/css"
+ <link rel="kinetic-stylesheet" type="text/kss"
tal:attributes="href mainkss"/>
+ <link rel="kinetic-stylesheet" type="text/kss"
+ tal:attributes="href string:${context/@@absolute_url}/++resource++help.kss"/>
+
<link rel="stylesheet" type="text/css"
tal:attributes="href string:${context/@@absolute_url}/@@kss_devel_mode/ui_css"/>
Modified: kukit/kss.demo/branch/1.4/kss/demo/browser/kss_demo_index.pt
==============================================================================
--- kukit/kss.demo/branch/1.4/kss/demo/browser/kss_demo_index.pt (original)
+++ kukit/kss.demo/branch/1.4/kss/demo/browser/kss_demo_index.pt Sun Apr 20 17:23:39 2008
@@ -7,19 +7,12 @@
<h1>KSS demos</h1>
<p metal:use-macro="context/@@body_macros/kss_mode">Kss mode</p>
<h2>Tests</h2>
- <ul style="background-color:#E0E0C0;">
- <li><a href="@@kukittestsuite">Run all ECMA unittests</a></li>
- <li>Link to Zelenium object:
- <form tal:attributes="action string:${context/absolute_url}/zuite.html">
- <input type="text" name="path" value="zuite" />
- <input type="submit" name="submit" value="Run all Selenium tests" />
- </form>
- </li>
+ <ul>
+ <li><a href="@@kukittestsuite">ECMA unittests</a></li>
+ <li tal:condition="context/@@kss_demo_registry/getZuite">
+ <a tal:attributes="href string:${context/absolute_url}/zuite.html">
+ Selenium tests runner</a></li>
</ul>
- <p class="help">
- Zelenium object link must be an absolute path from the domain root,
- or a relative path from the demo SimpleContent's parent.
- </p>
<tal:groups repeat="demo_group context/@@kss_demo_registry/getDemoGroups">
<tal:plugin condition="python:demo_group['is_first_plugin_namespace'] and demo_group['plugin_namespace']==''">
<h2>Core plugin</h2>
@@ -34,7 +27,11 @@
<tal:demos repeat="demo demo_group/demos">
<li><a href="demo_page.html"
tal:attributes="href demo/page_url"
- tal:content="demo/title">A simple demo</a></li>
+ tal:content="demo/title">A simple demo</a>
+ <tal:condition condition="demo/description">
+ <small tal:content="demo/description" />
+ </tal:condition>
+ </li>
</tal:demos>
</ul>
</tal:groups>
Modified: kukit/kss.demo/branch/1.4/kss/demo/browser/registry.py
==============================================================================
--- kukit/kss.demo/branch/1.4/kss/demo/browser/registry.py (original)
+++ kukit/kss.demo/branch/1.4/kss/demo/browser/registry.py Sun Apr 20 17:23:39 2008
@@ -107,12 +107,22 @@
self.request.response.setHeader('Content-type', 'text/html;charset=utf-8')
return file(filename).read()
- def getZuiteHomePage(self, path):
+ def getZuiteHomePage(self):
"""Redirects to the Zuite home page, Zuite object is found from path."""
- zuite = self.context.aq_inner.aq_parent.restrictedTraverse(path)
+ zuite = self.getZuite()
html = "%s/core/TestRunner.html?test=%s/suite.html" % (zuite.absolute_url(), self.context.absolute_url())
return self.request.response.redirect(html)
+ def getZuite(self):
+ """Finds a zuite in the same directory or under"""
+ if not hasattr(self, 'zuites'):
+ container = self.context.aq_inner.aq_parent
+ self.zuites = self.context.ZopeFind(container, obj_metatypes=['Zuite'], search_sub=1)
+ if self.zuites:
+ return self.zuites[0][1]
+ else:
+ return None
+
class KSSDemoRegistryAdminView(BrowserView):
"""Things that only admin should do"""
implements(IBrowserPublisher)
Modified: kukit/kss.demo/branch/1.4/kss/demo/resource.py
==============================================================================
--- kukit/kss.demo/branch/1.4/kss/demo/resource.py (original)
+++ kukit/kss.demo/branch/1.4/kss/demo/resource.py Sun Apr 20 17:23:39 2008
@@ -13,11 +13,16 @@
"""Represents a demo.
"""
implements(IKSSDemo)
- def __init__(self, plugin_namespace, category, page_url, title):
+ def __init__(self, plugin_namespace, category, page_url, title, description=None, helpfile=None, packageName=None):
self.plugin_namespace = plugin_namespace
self.category = category
self.page_url = page_url
self.title = title
+ self.description = description
+ if not packageName:
+ helpfile = None
+ self.helpfile = helpfile
+ self.packageName = packageName
# convenience access for page templates
__allow_access_to_unprotected_subobjects__ = 1
Modified: kukit/kss.demo/branch/1.4/kss/demo/simplecontent.py
==============================================================================
--- kukit/kss.demo/branch/1.4/kss/demo/simplecontent.py (original)
+++ kukit/kss.demo/branch/1.4/kss/demo/simplecontent.py Sun Apr 20 17:23:39 2008
@@ -29,6 +29,7 @@
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zope.interface import implements
from interfaces import ISimpleContent
+from persistent.mapping import PersistentMapping
class SimpleContent(SimpleItem):
implements(ISimpleContent)
@@ -43,6 +44,17 @@
def __init__(self, id, title):
self.id = id
self.title = title
+ self.mapping = PersistentMapping()
+
+ def getValue(self, name, default=None):
+ result = self.mapping.get(name, default)
+ if not result or result == default:
+ result = default
+ self.setValue(name, result)
+ return result
+
+ def setValue(self, name, value):
+ self.mapping[name] = value
security.declarePublic('direct')
def direct(self):
More information about the Kukit-checkins
mailing list