Author: jvloothuis
Date: Sun Sep 30 16:34:48 2007
New Revision: 47042
Modified:
kukit/docs/creating-plugins-plone-conf-2007/buildout.cfg
kukit/docs/creating-plugins-plone-conf-2007/kss-presentation.odp
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/configure.zcml
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/plugin.js
kukit/docs/creating-plugins-plone-conf-2007/src/plonedemo/plonedemo/configure.zcml
Log:
Added an example action which renders rects on a canvas
Modified: kukit/docs/creating-plugins-plone-conf-2007/buildout.cfg
==============================================================================
--- kukit/docs/creating-plugins-plone-conf-2007/buildout.cfg (original)
+++ kukit/docs/creating-plugins-plone-conf-2007/buildout.cfg Sun Sep 30
16:34:48 2007
@@ -40,4 +40,3 @@
zcml=
plonedemo
kssdemoplugin
-
Modified: kukit/docs/creating-plugins-plone-conf-2007/kss-presentation.odp
==============================================================================
Binary files. No diff available.
Modified:
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/configure.zcml
==============================================================================
---
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/configure.zcml
(original)
+++
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/configure.zcml
Sun Sep 30 16:34:48 2007
@@ -28,13 +28,13 @@
<!-- Client actions & commands -->
-<!-- <kss:action -->
-<!-- name="myCustomAction" -->
-<!-- jsfile="browser/my_plugins.js" -->
-<!-- command_factory="selector/global" -->
-<!-- params_mandatory="param1 param2 ... paramN" -->
-<!-- params_optional="" -->
-<!-- /> -->
+ <kss:action
+ name="demoplugin-canvasRect"
+ jsfile="javascript/plugin.js"
+ command_factory="selector"
+ params_mandatory="fromX fromY toX toY"
+ params_optional="fillStyle"
+ />
<kss:paramprovider
name="demo-plugin-prompt"
@@ -42,7 +42,6 @@
/>
-
<!-- Command sets -->
<kss:commandset
name="demo-plugin"
Modified:
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/plugin.js
==============================================================================
---
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/plugin.js
(original)
+++
kukit/docs/creating-plugins-plone-conf-2007/src/KSSDemoPlugin/kssdemoplugin/javascript/plugin.js
Sun Sep 30 16:34:48 2007
@@ -19,41 +19,24 @@
//-----------------------------------------------------------
// Action example
//-----------------------------------------------------------
-kukit.actionsGlobalRegistry.register('demo-plugin-exampleAction', function
(oper) {
- // The following is used for logging
-;;; oper.componentName = '[demo-plugin-exampleAction] action';
+kukit.actionsGlobalRegistry.register('demoplugin-canvasRect', function (oper) {
+;;; oper.componentName = '[demoplugin-canvasRect] 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
+ oper.evaluateParameters(['fromX', 'fromY', 'toX', 'toY'],
+ {'fillStyle': 'rgb(0, 255, 0)'});
+ oper.evalInt('fromX');
+ oper.evalInt('fromY');
+ oper.evalInt('toX');
+ oper.evalInt('toY');
+
+ var ctx = oper.node.getContext("2d");
+
+ ctx.fillStyle = oper.parms.fillStyle;
+ ctx.fillRect(oper.parms.fromX, oper.parms.fromY,
+ oper.parms.toX, oper.parms.toY);
});
-// 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.
-
+ 'demoplugin-canvasRect', kukit.cr.makeSelectorCommand);
//-----------------------------------------------------------
@@ -77,9 +60,9 @@
}
};
kukit.pprovidersGlobalRegistry.register(
- 'demo-plugin-prompt', ExampleProvider);
+ 'demoplugin-prompt', ExampleProvider);
// The line above registers the value provider under the name
-// `demo-plugin-exampleProvider`
+// `demoplugin-exampleProvider`
@@ -94,7 +77,7 @@
};
ExampleEventBinder.prototype.__bind__ = function(name, func_to_bind, oper) {
// The following is used for logging
-;;; oper.componentName = '[demo-plugin-example] event binding';
+;;; oper.componentName = '[demoplugin-example] event binding';
// Validate the parameters to this action, you can add multiple
// required or optional parameters. Optional parameters will be
@@ -109,12 +92,12 @@
// Add your specific event code here
};
-kukit.eventsGlobalRegistry.register('demo-plugin', 'exampleEvent',
+kukit.eventsGlobalRegistry.register('demoplugin', 'exampleEvent',
ExampleEventBinder, '__bind__', null);
-// The above line registers the demo-plugin-exampleEvent
+// The above line registers the demoplugin-exampleEvent
// with the binder method __bind__.
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}();
-// END CLOSURE plugin demo-plugin
+// END CLOSURE plugin demoplugin
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 30 16:34:48 2007
@@ -1,5 +1,6 @@
<configure
xmlns="http://namespaces.zope.org/zope"
+ xmlns:cmf="http://namespaces.zope.org/cmf"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:five="http://namespaces.zope.org/five"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup">
@@ -13,9 +14,17 @@
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
/>
- <browser:resource
- file="plone-demo-plugin.kss"
- name="plone-demo-plugin.kss"
- />
-
+ <browser:resource
+ file="plone-demo-plugin.kss"
+ name="plone-demo-plugin.kss"
+ />
+
+
+ <cmf:registerDirectory
+ name="skins"
+ directory="skins"
+ recursive="True"
+ />
+
+
</configure>
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins