From lewicki at provider.pl Fri Feb 2 16:09:40 2007 From: lewicki at provider.pl (Pawel Lewicki) Date: Fri, 02 Feb 2007 16:09:40 +0100 Subject: [Kss-devel] Key events - change proposal Message-ID: <45C35434.1000005@provider.pl> Hi, I have a proposal of changing key events, especially keyup event. Now they require code of pressed key in keyCodes parameter to trigger an event. In my usecase I don't care which key is pressed as I pass input value as a parameter not key code itself. I guess it is quite a common use-case as 'change' event is triggered when focus is lost. So my proposal is to trigger that event even when no keyCodes provided. I use another branch but on trunk it would be : http://codespeak.net/svn/kukit/kukit.js/trunk/kukit/plugin.js =================================================================== --- plugin.js (revision 37810) +++ plugin.js (working copy) @@ -144,7 +144,7 @@ } var func = function(e) { target = kukit.pl.getTargetForBrowserEvent(e); - if (allowbubbling || target == node) { + if (allowbubbling || target == node || oper.parms.keyCodes=="") { var keyCode = e.keyCode.toString(); if (! oper.parms.keycodes || keycodes[keyCode]) { // Execute the action, provide browserevent on oper Maybe additional parameter for 'keyCodes-required' would be added. Pawel Lewicki From philipp at weitershausen.de Mon Feb 5 23:05:17 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 05 Feb 2007 23:05:17 +0100 Subject: [Kss-devel] Cleanup of kss.core Message-ID: <45C7AA1D.3040905@weitershausen.de> Over the past two days I've been cleaning up some of kss.core. As a consumer of kss.core you should only be affected by changes in the event system. The semantics haven't changed, just the way you subscribe to events. From the commit message: If a portlet or other provider of HTML content wants to be notified of changes, it should register an event subscriber for the object, the view and the event that describe the change. For example, if you'd like to know about object modified events of documents that occurred during any KSS view, register your subscriber like so: @adapter(IDocument, IKSSView, IObjectMOdifiedEvent) def reactToDocumentChangesInKSSViews(doc, view, event): # order of parameters described by @adapter line ... append to view's KSS commands here Those changes have been made in the 'philikon-cleanup' branch of kss.core. plone.app.kss and archetypes.kss as the only two consumers of kss.core events known to me have been fixed up as well in their 'philikon-kss-cleanup' branches. All the tests pass (kss.core unit tests now even pass on Zope 3!) and I think the branches are ready for merging. However, this being my first Plone check-in in the last 4 years (last time I worked on Plone it was the infamous 1.1 release :)), I'd prefer if others would first give this code a spin. If you think it's ready and works for you, please feel free to merge the branches. Otherwise I'll be happy to do it after positive feedback. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From hedley at upfrontsystems.co.za Thu Feb 22 15:10:03 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Thu, 22 Feb 2007 16:10:03 +0200 Subject: [Kss-devel] Marshalling of form data Message-ID: <45DDA43B.1010405@upfrontsystems.co.za> This applies to azax 1.1.alpha1 I am working on a project using PloneAzax and I make use of marshalling (:list, :record, :records) in my page templates. Azax cannot handle this, which means that in my Python scripts I do not have access to the structures. There are other ugly solutions like assembling special tag attributes and decoding them, but I wanted a clean solution. I heavily modified forms.js and kukit.js and made a single char change to resourcedata.js. See attached patches and examples to understand the discussion below. In my KSS file I had to make use of a naming convention. For exmaple consider the line kss_MarshallTest-value_record|record: currentFormVar('arecord:record') I have to name the form var with its marshalling, hence arecord:record. The actual form elements will be called something like arecord.foo:record of course. And I had to use a pipe in value_record|record since a colon breaks the KSS parsing. The |record denotes the marshal type. The page templates and scripts are for use in a Plone site. I didn't have time to strip Plone away and use only Zope for the test page. My additions do not seem to break anything. Oh, the regexp's in the Javascript are not very elegant. Sorry. And I can't handle :int marshalling yet. Todo. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: forms.js.patch Url: http://codespeak.net/pipermail/kss-devel/attachments/20070222/d5040474/attachment-0005.diff -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: kss_MarshallTest.py Url: http://codespeak.net/pipermail/kss-devel/attachments/20070222/d5040474/attachment-0006.diff -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: kukit.js.patch Url: http://codespeak.net/pipermail/kss-devel/attachments/20070222/d5040474/attachment-0007.diff -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: marshalltest.kss.dtml Url: http://codespeak.net/pipermail/kss-devel/attachments/20070222/d5040474/attachment-0008.diff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kss-devel/attachments/20070222/d5040474/attachment-0001.htm -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: resourcedata.js.patch Url: http://codespeak.net/pipermail/kss-devel/attachments/20070222/d5040474/attachment-0009.diff From gotcha at bubblenet.be Thu Feb 22 16:08:46 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Thu, 22 Feb 2007 16:08:46 +0100 Subject: [Kss-devel] Marshalling of form data In-Reply-To: <45DDA43B.1010405@upfrontsystems.co.za> References: <45DDA43B.1010405@upfrontsystems.co.za> Message-ID: <45DDB1FE.8060202@bubblenet.be> Hedley Roos wrote: > This applies to azax 1.1.alpha1 > > I am working on a project using PloneAzax and I make use of marshalling > (:list, :record, :records) in my page templates. Azax cannot handle > this, which means that in my Python scripts I do not have access to the > structures. There are other ugly solutions like assembling special tag > attributes and decoding them, but I wanted a clean solution. > > I heavily modified forms.js and kukit.js and made a single char change > to resourcedata.js. See attached patches and examples to understand the > discussion below. Against which revision of which branch are those patches ? > > In my KSS file I had to make use of a naming convention. For exmaple > consider the line > > kss_MarshallTest-value_record|record: currentFormVar('arecord:record') > > I have to name the form var with its marshalling, hence arecord:record. > The actual form elements will be called something like > arecord.foo:record of course. > > And I had to use a pipe in value_record|record since a colon breaks the > KSS parsing. The |record denotes the marshal type. I am sure I hate the | (don't feel personnally offensed). I think that covering the Zope marshalling is really useful though. OTOH, this marshalling being really specific, I'd like to avoid to integrate in kss core if we need to pollute the whole code base. IOW, thanks for the code... Balazs and I will try to find the right way to integrate this. When ready, we might ask you to help us with trunk merging though. > > The page templates and scripts are for use in a Plone site. I didn't > have time to strip Plone away and use only Zope for the test page. > > My additions do not seem to break anything. > > Oh, the regexp's in the Javascript are not very elegant. Sorry. And I > can't handle :int marshalling yet. Todo. > > -- Godefroid Chapelle (aka __gotcha)- BubbleNet http://bubblenet.be From ree at ree.hu Fri Feb 23 09:31:53 2007 From: ree at ree.hu (Balazs Ree) Date: Fri, 23 Feb 2007 09:31:53 +0100 Subject: [Kss-devel] Marshalling of form data In-Reply-To: <45DDA43B.1010405@upfrontsystems.co.za> References: <45DDA43B.1010405@upfrontsystems.co.za> Message-ID: <1172219513.10887.15.camel@brumi.ree> 2007. 02. 22, 16.10 Hedley Roos wrote: > I am working on a project using PloneAzax and I make use of marshalling > (:list, :record, :records) in my page templates. Azax cannot handle > this, which means that in my Python scripts I do not have access to the > structures. There are other ugly solutions like assembling special tag > attributes and decoding them, but I wanted a clean solution. > > I heavily modified forms.js and kukit.js and made a single char change > to resourcedata.js. See attached patches and examples to understand the > discussion below. > > In my KSS file I had to make use of a naming convention. For exmaple > consider the line > > kss_MarshallTest-value_record|record: currentFormVar('arecord:record') I think we don't need the | convention in the variable name for that. Because that is already known from the type of the data to be sent over (= the output of currentFormVar). The marshaller can put the record tags automatically. This is actually already used with :list and maybe with :record too. So what we actually need to do is - to make the marshaller marshall the :records types too - to make the formvar logic smarter so that it can select the composite variables that belong to one varname only, from the form. I am not saying the final word on this, but changing the syntax in the suggested way is something we would like to avoid. So if we can do without it... -- Balazs Ree -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Ez az =?ISO-8859-1?Q?=FCzenetr=E9sz?= =?ISO-8859-1?Q?_digit=E1lis?= =?ISO-8859-1?Q?_al=E1=EDr=E1ssal?= van =?ISO-8859-1?Q?ell=E1tva?= Url : http://codespeak.net/pipermail/kss-devel/attachments/20070223/46bd322a/attachment.pgp From hedley at upfrontsystems.co.za Fri Feb 23 11:23:21 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Fri, 23 Feb 2007 12:23:21 +0200 Subject: [Kss-devel] Marshalling of form data In-Reply-To: <1172219513.10887.15.camel@brumi.ree> References: <45DDA43B.1010405@upfrontsystems.co.za> <1172219513.10887.15.camel@brumi.ree> Message-ID: <45DEC099.4000407@upfrontsystems.co.za> > I think we don't need the | convention in the variable name for that. > Because that is already known from the type of the data to be sent over > (= the output of currentFormVar). The marshaller can put the record tags > automatically. I think you are correct. I'll try to get rid of the redundant and ugly pipe marshall. > > This is actually already used with :list and maybe with :record too. So > what we actually need to do is > > - to make the marshaller marshall the :records types too My patch does provide this. > > - to make the formvar logic smarter so that it can select the composite > variables that belong to one varname only, from the form. Example as I understand your statement. And in the KSS input.someclass:click { evt-click-preventdefault: True; action-server: kss_MarshallTest; kss_MarshallTest-value: currentFormVar(); } Will result in the value {'bar':'a', 'zap':'b'} being available in the Python script if the user clicks on either of the two inputs. Is this correct? If so I can see it being difficult but definitely possible. I handle such a situation by setting 'intelligent' id attributes on the input tags, and I add "kss_onMetaTypeChange-input_id: nodeAttr("id")". Then I can manipulate the input_id in the Python script. > > I am not saying the final word on this, but changing the syntax in the > suggested way is something we would like to avoid. So if we can do > without it... If I can prevent any syntax changes ot the KSS and provide a limited set of marshalling would it suffice? Basically I can try provide for all the cases in marshalltest_form.pt without changing KSS syntax. From gotcha at bubblenet.be Fri Feb 23 13:41:47 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Fri, 23 Feb 2007 13:41:47 +0100 Subject: [Kss-devel] Marshalling of form data In-Reply-To: <1172219513.10887.15.camel@brumi.ree> References: <45DDA43B.1010405@upfrontsystems.co.za> <1172219513.10887.15.camel@brumi.ree> Message-ID: <45DEE10B.9030006@bubblenet.be> Balazs Ree wrote: > 2007. 02. 22, 16.10 Hedley Roos wrote: >> I am working on a project using PloneAzax and I make use of marshalling >> (:list, :record, :records) in my page templates. Azax cannot handle >> this, which means that in my Python scripts I do not have access to the >> structures. There are other ugly solutions like assembling special tag >> attributes and decoding them, but I wanted a clean solution. >> >> I heavily modified forms.js and kukit.js and made a single char change >> to resourcedata.js. See attached patches and examples to understand the >> discussion below. >> >> In my KSS file I had to make use of a naming convention. For exmaple >> consider the line >> >> kss_MarshallTest-value_record|record: currentFormVar('arecord:record') > > I think we don't need the | convention in the variable name for that. > Because that is already known from the type of the data to be sent over > (= the output of currentFormVar). The marshaller can put the record tags > automatically. > > This is actually already used with :list and maybe with :record too. So > what we actually need to do is > > - to make the marshaller marshall the :records types too > > - to make the formvar logic smarter so that it can select the composite > variables that belong to one varname only, from the form. > > I am not saying the final word on this, but changing the syntax in the > suggested way is something we would like to avoid. So if we can do > without it... > At the end of the sprint, Balazs and I discussed syntax for a few features that we did not know how to implement. We suddenly recalled that CSS has stuff like the following : border: solid 1px black; and that those space-separated values were a solution to the features we wanted to implement. I think it is the case this time as well. I propose that we explore the thing shown below. kss_MarshallTest-value_record: currentFormVar('arecord:record') record This would be a non invasive zopism : frameworks that do not pass type like Zope does would not state type and they would even not know... Your opinion ? PS: I do not have a lot of time this week to discuss more. Please hassle me in the coming days -- Godefroid Chapelle (aka __gotcha)- BubbleNet http://bubblenet.be From jeroen.vloothuis at pareto.nl Fri Feb 23 15:46:06 2007 From: jeroen.vloothuis at pareto.nl (jeroen.vloothuis at pareto.nl) Date: Fri, 23 Feb 2007 15:46:06 +0100 Subject: [Kss-devel] Global state Message-ID: <20070223144606.GA2163@slakje.lan> Hi, For a script I am developing I need some global state. The first thing I need is to know wheter the shift key is currently pressed. Right now I am doing this using a normal Javascript global variable and document.onkey(up/down). This works but it would be nice do this using more of the KSS framework. One problem I had with this is that it does not seem possible to bind events to document using KSS. The next thing I need is a globalish variable to store a reference to a selected checkbox. I am now using normal Javascript code for this. To see the code of which I speak go to this url: http://dev.plone.org/plone/changeset/12975/plone.app.kss/branches/folder-contents/plone/app/kss/plugins/plone/plugin.js Maybe a KSS wizard can enlighten me on the right way to store such state using the framework? Cheers, Jeroen From gotcha at bubblenet.be Fri Feb 23 15:52:46 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Fri, 23 Feb 2007 15:52:46 +0100 Subject: [Kss-devel] Global state In-Reply-To: <20070223144606.GA2163@slakje.lan> References: <20070223144606.GA2163@slakje.lan> Message-ID: <45DEFFBE.2010008@bubblenet.be> jeroen.vloothuis at pareto.nl wrote: > Hi, > > For a script I am developing I need some global state. The first thing I > need is to know wheter the shift key is currently pressed. > > Right now I am doing this using a normal Javascript global variable and > document.onkey(up/down). This works but it would be nice do this using > more of the KSS framework. One problem I had with this is that it does > not seem possible to bind events to document using KSS. AFAIK, there is document:load I suppose you have tried document:keydown. Do you get an error ? > > The next thing I need is a globalish variable to store a reference to a > selected checkbox. I am now using normal Javascript code for this. > > To see the code of which I speak go to this url: > > http://dev.plone.org/plone/changeset/12975/plone.app.kss/branches/folder-contents/plone/app/kss/plugins/plone/plugin.js > > Maybe a KSS wizard can enlighten me on the right way to store such state > using the framework? At the end of http://kukit.org/documentation/cheat-sheet : ''' Miscellaneous * stateVar(varname): Procudes the value of a state variable, that is, the same that can be set via the setStateVar command. ''' HTH > > Cheers, > Jeroen > _______________________________________________ > Kss-devel mailing list > Kss-devel at codespeak.net > http://codespeak.net/mailman/listinfo/kss-devel -- Godefroid Chapelle (aka __gotcha)- BubbleNet http://bubblenet.be From hedley at upfrontsystems.co.za Mon Feb 26 16:48:51 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Mon, 26 Feb 2007 17:48:51 +0200 Subject: [Kss-devel] Marshalling of form data In-Reply-To: <45DEE10B.9030006@bubblenet.be> References: <45DDA43B.1010405@upfrontsystems.co.za> <1172219513.10887.15.camel@brumi.ree> <45DEE10B.9030006@bubblenet.be> Message-ID: <45E30163.1070602@upfrontsystems.co.za> kss_MarshallTest-value_record: currentFormVar('arecord:record') record I like that idea. As for the currentFormVar method and marshalling, I implemented a few missing features. Let's say we have Case A ------ then this KSS for a click event on any input with class personclass kss_MarshallTest-person|record: currentFormVar() will fill the person variable with {'name':'John', 'surname':'Smith'} Case B (more impressive :) -------------------------- First person Second person then this KSS for a click event on any input with class personsclass kss_MarshallTest-person|record: currentFormVar() will fill the person variable with {'name':'John', 'surname':'Smith'} if the user clicked on the first "element" and {'name':'Jane', 'surname':'Doe'} if the user clicked on the second "element". These odd bits of functionality have drastically simplified my templates and Python scripts. Let me know when you have more time then we can chat some more. From florian.kamm at gmx.de Wed Feb 28 16:49:59 2007 From: florian.kamm at gmx.de (Florian Kamm) Date: Wed, 28 Feb 2007 16:49:59 +0100 Subject: [Kss-devel] KSS & tests Message-ID: Hi, at the moment I am working on doctests and functionality tests for my KSS-based batching product (btw it has been checked in into the collective repository in the meantime). To get used on testing KSS-based products I looked into the plone.app.kss , kss.core and kss.demo code base of plone 3.0 trunk, but I am a little bit confused now. What is the preferred way of testing KSS-products? And is the selenium rc approach the one and only way of functionality testing (saw it in the demo package)? It would be nice to get some help from you regarding these topics... Regards Florian From jeroen.vloothuis at xs4all.nl Wed Feb 28 21:00:37 2007 From: jeroen.vloothuis at xs4all.nl (Jeroen Vloothuis) Date: Wed, 28 Feb 2007 21:00:37 +0100 Subject: [Kss-devel] KSS & tests In-Reply-To: References: Message-ID: <45E5DF65.6070309@xs4all.nl> Florian Kamm wrote: > at the moment I am working on doctests and functionality tests for > my KSS-based batching product (btw it has been checked in into the > collective repository in the meantime). To get used on testing > KSS-based products I looked into the plone.app.kss , kss.core and > kss.demo code base of plone 3.0 trunk, but I am a little bit confused > now. What is the preferred way of testing KSS-products? > The prefered way of testing I think you will want to test at multiple levels. One of the easiest ways to avoid breaking KSS functionality is checking for classes and id's in your template output. You can do this by writing functional test browser tests (zope.testbrowser). These of course don't test the actual javascript. If you only use KSS as an end user then this should be enough (depending on your trust in the framework). When you write you're own plugins or want to do full testing of your app then selenium is the way to go. > And is the > selenium rc approach the one and only way of functionality testing (saw > it in the demo package)? It would be nice to get some help from you > regarding these topics... > To the KSS framework itself selenium is used. Because testing different platforms is tedious automation using selenium rc is key. There is already quite some work done to make automated tests for KSS a reality. One of the components in this is the kss.demo package. This exercises core framework functionality (so that it is testable by selenium). Cheers, Jeroen