[KSS-checkins] r46839 - in kukit/docs/creating-plugins-plone-conf-2007/src: KSSDemoPlugin KSSDemoPlugin/kssdemoplugin KSSDemoPlugin/kssdemoplugin/javascript KSSDemoPlugin/kssdemoplugin/tests plonedemo plonedemo/plonedemo
jvloothuis at codespeak.net
jvloothuis at codespeak.net
Sun Sep 23 13:32:50 CEST 2007
Author: jvloothuis
Date: Sun Sep 23 13:32:49 2007
New Revision: 46839
Added:
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/README.txt
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/README.txt
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/__init__.py
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/commands.py
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/config.py
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/configure.zcml
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/helpers.py
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/interfaces.py
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/plugin.js
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/tests/
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/tests/__init__.py
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/setup.py
Modified:
kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/__init__.py
kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/configure.zcml
kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/setup.py
Log:
First start of the demo (there is one working value provider)
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/README.txt
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/README.txt Sun Sep 23 13:32:49 2007
@@ -0,0 +1,16 @@
+
+KSS plugin package "demo-plugin"
+
+Installation and Setup
+======================
+
+Install ``KSSDemoPlugin`` using easy_install::
+
+ easy_install KSSDemoPlugin
+
+Documentation
+=============
+
+Where to find documentation on this project? You will usually refer
+people to the README.txt and other doctests located in package
+(kssdemoplugin).
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/README.txt
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/README.txt Sun Sep 23 13:32:49 2007
@@ -0,0 +1,29 @@
+================================================
+ KSSDemoPlugin
+================================================
+
+Explain a bit a about your project here.
+
+Command sets
+============
+
+Describe the commandsets you provide with examples of how to use
+it. The examples will be run as part of the tests.
+
+ >>> from kss.base import KSSCommands, load_plugins
+
+ >>> load_plugins('kss-core')
+
+ >>> from kss.base.selectors import CSS
+
+ >>> from {package}.commands import KssdemopluginCommands
+
+ >>> commands = KSSCommands()
+ >>> kssdemoplugin = KssdemopluginCommands(commands)
+
+Add explanations and tests for your actions here.
+
+ >>> kssdemoplugin.replaceInnerHTML(CSS('#someid'), 'example data')
+ >>> print commands.render()
+ yourAction(css('#someid'), parameter='example data')
+
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/__init__.py
==============================================================================
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/commands.py
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/commands.py Sun Sep 23 13:32:49 2007
@@ -0,0 +1,10 @@
+from kss.core.kssview import CommandSet
+
+class KssdemopluginCommands(CommandSet):
+
+ # Add your own actions here, you can use the following code as
+ # a starting point
+ def yourAction(self, selector, data):
+ command = self.commands.addCommand('yourAction', selector)
+ # Repeat for each parameter you need
+ command.addParam('parameter', data)
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/config.py
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/config.py Sun Sep 23 13:32:49 2007
@@ -0,0 +1,24 @@
+import os
+
+from kssdemoplugin.commands import KssdemopluginCommands
+
+package_dir = os.path.dirname(os.path.abspath(__file__))
+javascript_dir = os.path.join(package_dir, 'javascript')
+
+class Kssdemoplugin(Plugin):
+
+ javascripts = [os.path.join(javascript_dir, 'plugin.js')]
+
+ extra_javascripts = []
+
+ # if you need extra 3rd party Javascript files put them in the 3rd
+ # party directory and use the line below
+ #
+ # extra_javascripts = [] javascripts_from(os.path.join(package_dir, '3rd_party'))
+
+ commandsets = {
+ 'KSSDemoPlugin': KssdemopluginCommands,
+ }
+
+ selectors = []
+
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/configure.zcml
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/configure.zcml Sun Sep 23 13:32:49 2007
@@ -0,0 +1,54 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:kss="http://namespaces.zope.org/kss"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ >
+
+ <!-- Third party library dependencies -->
+ <!--
+ <browser:resource
+ file="3rd_party/prototype.js"
+ name="prototype.js"
+ />
+
+ <browser:resource
+ file="3rd_party/effects.js"
+ name="effects.js"
+ />
+ -->
+
+
+ <!-- Event types -->
+ <!--
+ <kss:eventtype
+ name="myCustomEventType"
+ jsfile="browser/my_plugins.js"
+ />
+ -->
+
+ <!-- Client actions & commands -->
+
+<!-- <kss:action -->
+<!-- name="myCustomAction" -->
+<!-- jsfile="browser/my_plugins.js" -->
+<!-- command_factory="selector/global" -->
+<!-- params_mandatory="param1 param2 ... paramN" -->
+<!-- params_optional="" -->
+<!-- /> -->
+
+ <kss:paramprovider
+ name="demo-plugin-prompt"
+ jsfile="javascript/plugin.js"
+ />
+
+
+
+ <!-- Command sets -->
+ <kss:commandset
+ name="demo-plugin"
+ for="kss.core.interfaces.IKSSView"
+ class=".commands.KssdemopluginCommands"
+ provides=".interfaces.IKssdemopluginCommands"
+ />
+
+</configure>
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/helpers.py
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/helpers.py Sun Sep 23 13:32:49 2007
@@ -0,0 +1,8 @@
+"""
+Helper functions
+
+All names available in this module will be available under the Pylons h object.
+"""
+from webhelpers import *
+from pylons.helpers import log
+from pylons.i18n import get_lang, set_lang
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/interfaces.py
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/interfaces.py Sun Sep 23 13:32:49 2007
@@ -0,0 +1,7 @@
+from zope.interface import Interface
+
+class IKssdemopluginCommands(Interface):
+ '''Documentation for your command set'''
+
+ def yourAction(selector, data):
+ '''Documentation on yourAction'''
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/plugin.js
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/plugin.js Sun Sep 23 13:32:49 2007
@@ -0,0 +1,120 @@
+/*
+
+In this file you can put your own custom Javascript. In the following
+sections you can find examples on how to create the most common
+plugins.
+
+Lines beginning with `;;;` are automatically stripped when served in
+production mode. Put these in front of lines with code like assertions
+statements or logging calls. (But never put ;;; embedded inside multiline
+(), [] or {} constructs like an "if" condition or a "switch" statement.)
+
+*/
+
+// CLOSURE for plugin demo-plugin
+// The closure makes all the embedded code private.
+new function () {
+// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+//-----------------------------------------------------------
+// Action example
+//-----------------------------------------------------------
+kukit.actionsGlobalRegistry.register('demo-plugin-exampleAction', function (oper) {
+ // The following is used for logging
+;;; oper.componentName = '[demo-plugin-exampleAction] action';
+
+ // Validate the parameters to this action, you can add multiple
+ // required or optional parameters. Optional parameters will be
+ // initialized with a default when not passed.
+ oper.evaluateParameters(['requiredParameter'],
+ {'optionalParameter': 'default'});
+
+ // optionally, you can check if a parameter is of a given data type,
+ // and convert to it.
+ oper.evalBool('requiredParameter');
+
+ // You can get at the node for which this action is executed like
+ // this. An action is always invoked on a single node. Even when
+ // it applies to multiple nodes (then it will be invoked multiple
+ // times on each node).
+ var node = oper.node;
+
+ // Read a parameter from the parameters
+ var required = oper.parms.requiredParameter;
+
+ // Add your specific action code here
+});
+// The line above registers the action under the name
+// `demo-plugin-exampleAction`.
+
+kukit.commandsGlobalRegistry.registerFromAction(
+ 'demo-plugin-exampleAction', kukit.cr.makeSelectorCommand);
+// The line above also defines the action as a command
+// with selectors. To make a global command that executes
+// without a selector, exactly once, use makeGlobalCommand.
+// It is a good idea to always make an action into a command as well.
+
+
+
+//-----------------------------------------------------------
+// Value provider
+//-----------------------------------------------------------
+var ExampleProvider = function() {};
+ExampleProvider.prototype = {
+ // The check function is executed during the parsing of KSS. Use
+ // this to make sure the arguments are correct.
+ // Use ;;; in the beginning of each line in check.
+;;; check: function(args) {
+;;; // An example of what you could check is the argument length
+;;; if (args.length != 1) {
+;;; // Raise an error in case something is wrong
+;;; throw new Error('exampleProvider provider needs 1 argument [message]');
+;;; }
+;;; },
+ eval: function(args, node) {
+ // Return the value which for this provider
+ return window.prompt(args[0]);
+ }
+};
+kukit.pprovidersGlobalRegistry.register(
+ 'demo-plugin-prompt', ExampleProvider);
+// The line above registers the value provider under the name
+// `demo-plugin-exampleProvider`
+
+
+
+
+//-----------------------------------------------------------
+// Simple event binder for stateful events
+//-----------------------------------------------------------
+
+var ExampleEventBinder = function() {
+ // Add your initialization stuff here
+ this.exampleVar = {};
+};
+ExampleEventBinder.prototype.__bind__ = function(name, func_to_bind, oper) {
+ // The following is used for logging
+;;; oper.componentName = '[demo-plugin-example] event binding';
+
+ // Validate the parameters to this action, you can add multiple
+ // required or optional parameters. Optional parameters will be
+ // initialized with a default when not passed.
+ oper.evaluateParameters(['delay'], {'repeat': 'true'});
+
+ // optionally, you can check if a parameter is of a given data type,
+ // and convert to it.
+ oper.evalInt('delay');
+ oper.evalBool('repeat');
+
+ // Add your specific event code here
+};
+
+kukit.eventsGlobalRegistry.register('demo-plugin', 'exampleEvent',
+ ExampleEventBinder, '__bind__', null);
+// The above line registers the demo-plugin-exampleEvent
+// with the binder method __bind__.
+
+
+// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+}();
+// END CLOSURE plugin demo-plugin
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/tests/__init__.py
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/tests/__init__.py Sun Sep 23 13:32:49 2007
@@ -0,0 +1,12 @@
+import unittest
+import doctest
+
+def test_suite():
+ suite = unittest.TestSuite((
+ doctest.DocFileSuite(
+ 'README.txt',
+ package='kssdemoplugin',
+ optionflags=doctest.ELLIPSIS|doctest.REPORT_ONLY_FIRST_FAILURE,
+ ),
+ ))
+ return suite
Added: kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/setup.py
==============================================================================
--- (empty file)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/setup.py Sun Sep 23 13:32:49 2007
@@ -0,0 +1,19 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='KSSDemoPlugin',
+ version="",
+ #description="",
+ #author="",
+ #author_email="",
+ #url="",
+ install_requires=["kss.core"],
+ packages=find_packages(),
+ include_package_data=True,
+ test_suite = 'kssdemoplugin.tests.test_suite',
+ entry_points={
+ 'kss.plugin': [
+ 'demo-plugin=kssdemoplugin.config:Kssdemoplugin'
+ ],
+ },
+)
Modified: kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/__init__.py
==============================================================================
--- kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/__init__.py (original)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/__init__.py Sun Sep 23 13:32:49 2007
@@ -1,30 +0,0 @@
-from Products.CMFCore import utils
-from Products.Archetypes.public import process_types, listTypes
-from config import GLOBALS, PKG_NAME
-from config import AddFilesystemGateway
-
-from Products.GenericSetup import EXTENSION
-from Products.GenericSetup import profile_registry
-import Products.CMFPlone.interfaces
-
-def initialize(context):
- import content
- profile_registry.registerProfile( name='default',
- title='xmlcontent',
- description='',
- path='profiles/default',
- product='xmlcontent',
- profile_type=EXTENSION,
- for_=Products.CMFPlone.interfaces.IPloneSiteRoot)
-
- content_types, constructors, ftis = process_types(
- listTypes(PKG_NAME),
- PKG_NAME)
-
- utils.ContentInit(
- PKG_NAME + ' Content',
- content_types = content_types,
- permission = AddFilesystemGateway,
- extra_constructors = constructors,
- fti = ftis,
- ).initialize(context)
Modified: kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/configure.zcml
==============================================================================
--- kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/configure.zcml (original)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/configure.zcml Sun Sep 23 13:32:49 2007
@@ -1,38 +1,21 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
- xmlns:five="http://namespaces.zope.org/five">
+ xmlns:five="http://namespaces.zope.org/five"
+ xmlns:genericsetup="http://namespaces.zope.org/genericsetup">
- <five:registerPackage package="." initialize=".initialize" />
-
- <adapter
- for=".interfaces.IATContentGateway"
- factory=".content.gateway.ContentGateway"
- provides=".interfaces.IContentGateway"
- />
-
- <adapter
- for=".interfaces.IATContentGateway
- zope.publisher.interfaces.browser.IBrowserRequest"
- factory=".gatewaytraversal.GatewayTraversal"
- provides="zope.publisher.interfaces.IPublishTraverse"
- />
-
- <adapter
- for=".interfaces.IContentGateway"
- factory=".filesystemproxy.FilesystemProxy"
- provides=".interfaces.IFilesystemProxy"
- />
-
- <adapter
- for="Products.ZCatalog.interfaces.IZCatalog
- .interfaces.IContentGateway"
- factory=".catalogsupport.CatalogIndexer"
- provides=".interfaces.ICatalogIndexer"
+ <genericsetup:registerProfile
+ name="kssplugindemo"
+ title="KSS Plugin Demo (Plone)"
+ directory="profiles/default"
+ description="Profile for demonstrating the functionality of the demo plugin."
+ provides="Products.GenericSetup.interfaces.EXTENSION"
+ for="Products.CMFPlone.interfaces.IPloneSiteRoot"
/>
- <include package=".browser" />
-
- <include package=".examples" />
+ <browser:resource
+ file="plone-demo-plugin.kss"
+ name="plone-demo-plugin.kss"
+ />
</configure>
Modified: kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/setup.py
==============================================================================
--- kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/setup.py (original)
+++ kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/setup.py Sun Sep 23 13:32:49 2007
@@ -2,27 +2,21 @@
version = '0.1'
-setup(name='xmlcontent',
+setup(name='plonedemo',
version=version,
- description="Transparent XML publishing for Zope/Plone",
- long_description="""\
-xmlcontent contains a mechanism to publish XML content from the file
-system with the full feature set of Zope 3.
-
-It does this by creating a proxy object for each XML file. Based on a
-declaration in the XML file a marker interface is set as well. This
-makes it possible to create views and adapters for this proxy object,
-thereby being able to display and even index it.
+ description="Demonstration package for the KSS demo plugin",
+ long_description="""
+This shows the usage of the KSS demo plugin within Plone.
""",
classifiers=[
"Framework :: Plone",
- "License :: OSI Approved :: LGPL",
+ "License :: OSI Approved :: GPL",
"Programming Language :: Python",
],
- keywords='plone xml',
+ keywords='plone kss',
author='Jeroen Vloothuis',
author_email='jeroen.vloothuis at xs4all.nl',
- url='http://svn.plone.org/svn/collective/xmlcontent',
+# url='',
license='GPL',
packages=find_packages(exclude=['ez_setup']),
include_package_data=True,
More information about the Kukit-checkins
mailing list