From jvloothuis at codespeak.net Thu Jul 5 18:31:57 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Thu, 5 Jul 2007 18:31:57 +0200 (CEST) Subject: [KSS-checkins] r44746 - in kukit/euro-python-2007: . img staticdemo Message-ID: <20070705163157.2DD4280F3@code0.codespeak.net> Author: jvloothuis Date: Thu Jul 5 18:31:55 2007 New Revision: 44746 Added: kukit/euro-python-2007/conclusion.html kukit/euro-python-2007/goals-of-kss.html kukit/euro-python-2007/img/ kukit/euro-python-2007/img/3d-kss-big.png (contents, props changed) kukit/euro-python-2007/img/3d-kss.png (contents, props changed) kukit/euro-python-2007/img/kss-back-big.png (contents, props changed) kukit/euro-python-2007/img/kss-back.png (contents, props changed) kukit/euro-python-2007/img/right-halfcirkle.png (contents, props changed) kukit/euro-python-2007/img/top-back.png (contents, props changed) kukit/euro-python-2007/img/welcome.png (contents, props changed) kukit/euro-python-2007/kss-presentation.css kukit/euro-python-2007/python-integration.html kukit/euro-python-2007/server-demo.html kukit/euro-python-2007/server_response.xml Removed: kukit/euro-python-2007/server-communication.html kukit/euro-python-2007/server-sending-data.html kukit/euro-python-2007/staticdemo/ kukit/euro-python-2007/syntax-explained.html Modified: kukit/euro-python-2007/example-plugin.html kukit/euro-python-2007/index.html kukit/euro-python-2007/kss-protocol.html kukit/euro-python-2007/presentation.css kukit/euro-python-2007/presentation.kss kukit/euro-python-2007/static-demo.html Log: Added images Added slides Removed slides which are not needed Added: kukit/euro-python-2007/conclusion.html ============================================================================== --- (empty file) +++ kukit/euro-python-2007/conclusion.html Thu Jul 5 18:31:55 2007 @@ -0,0 +1,62 @@ + + + + KSS, doing Ajax with style + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Conclusion

+ + More info on: kssproject.org +
+
+ + Modified: kukit/euro-python-2007/example-plugin.html ============================================================================== --- kukit/euro-python-2007/example-plugin.html (original) +++ kukit/euro-python-2007/example-plugin.html Thu Jul 5 18:31:55 2007 @@ -33,46 +33,57 @@ + + + -
-

Command example

-
- KSS Files -
-
-
- KSS Commands - +
- - -
-

An example KSS command in show which alters the style - property of a node. Notice how the plugin is registered using - the command registry API.

- -

You can also see that a command is defined using - Javascript. In this example you can see it is pretty straight - forware to get the arguments and the node on which to - operate.

+ Server communication example + + +
+

An example KSS command in show which alters the style + property of a node. Notice how the plugin is registered using + the command registry API.

+ +

You can also see that a command is defined using + Javascript. In this example you can see it is pretty straight + forware to get the arguments and the node on which to + operate.

+
Added: kukit/euro-python-2007/goals-of-kss.html ============================================================================== --- (empty file) +++ kukit/euro-python-2007/goals-of-kss.html Thu Jul 5 18:31:55 2007 @@ -0,0 +1,58 @@ + + + + KSS, doing Ajax with style + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Goals of the Kinectic Style Sheets system

+ + Start the demo! + Show some code +
+
+ + Added: kukit/euro-python-2007/img/3d-kss-big.png ============================================================================== Binary file. No diff available. Added: kukit/euro-python-2007/img/3d-kss.png ============================================================================== Binary file. No diff available. Added: kukit/euro-python-2007/img/kss-back-big.png ============================================================================== Binary file. No diff available. Added: kukit/euro-python-2007/img/kss-back.png ============================================================================== Binary file. No diff available. Added: kukit/euro-python-2007/img/right-halfcirkle.png ============================================================================== Binary file. No diff available. Added: kukit/euro-python-2007/img/top-back.png ============================================================================== Binary file. No diff available. Added: kukit/euro-python-2007/img/welcome.png ============================================================================== Binary file. No diff available. Modified: kukit/euro-python-2007/index.html ============================================================================== --- kukit/euro-python-2007/index.html (original) +++ kukit/euro-python-2007/index.html Thu Jul 5 18:31:55 2007 @@ -3,6 +3,11 @@ lang="en"> KSS, doing Ajax with style + + + @@ -25,14 +30,23 @@ + + + + + -
-

KSS, doing Ajax with style

-

Presented by: Jeroen Vloothuis

+
+
+

KSS, doing Ajax with style

+

Presented by: Jeroen Vloothuis

- Start the show! + Start the presentation +
Added: kukit/euro-python-2007/kss-presentation.css ============================================================================== --- (empty file) +++ kukit/euro-python-2007/kss-presentation.css Thu Jul 5 18:31:55 2007 @@ -0,0 +1,205 @@ +/* 1024 *768 + */ + +.wrapper { +background:transparent url(img/kss-back-big.png) no-repeat scroll; +position:relative; +top:30px; +width:800px; +height:650px; +} + +.content { +background:transparent url(img/3d-kss-big.png) no-repeat scroll 700px 480px; +width: 700px; +} + +pre, img { +margin:10px 40px; +} + +/* 600 * 800 + +.wrapper { +background:transparent url(img/kss-back.png) no-repeat scroll; +width: 710px; +height:530px; +position:relative; +top:9px; +} + +.content { +background:transparent url(img/3d-kss.png) no-repeat scroll 600px 380px; +width: 600px; +} + +*/ + +/* color */ + +body { +background:#201; +color:#fff; +} + +h1 { +color:#200; +} + +p, h2, .button, a { +color:#fff; +} + +pre { +background:#402; +color:#fff; +padding:5px 20px; +border:2px solid #fff; +} + +.nd { +opacity:0.4; +font-weight:bold; +} + +.nf { +opacity:0.7; +font-weight:bold; +} + +a, a:visited , .button { +opacity:0.8; +} + +a:hover , .button:hover { +opacity:0.5; +} + +#photo img { +border: 2px solid #fff; +} + +/* layout */ + +body { +margin:0; +padding:0; +} + +.wrapper { +margin: auto; +} + +.content { +height:100%; +float:left; +margin:0; +padding:0; +padding-left:80px; +} + +h1 { +display:block; +font-family:verdana; +font-size:200%; +line-height:28px; +padding:0px 20px 23px; +width:100%; +} + +h2 { +padding:0px 20px; +font-size:100%; +} + +p, h2, .button, a { +font-family:verdana; +padding:5px 20px; +font-size:1em; +cursor:pointer; +text-decoration:none; +display:block; +} + +pre { +font-family:Courier; +font-size:1em; +letter-spacing:.1em; +width:560px; +} + +.hidden { +display: none; +} + + +/* +font-family:"Everson Mono Latin 6" +font-family:"Prestige Elite Std"; +font-family:"Oloron Tryout"; +font-family:"MS LineDraw"; +font-family:""; +font-family:""; + */ + +} + +/* +.button { +color: grey; +} + +.button:hover { +color: black; +} + +.nf { +color:#06287E; +} + +.nd { +color:#555555; +font-weight:bold; +} + +jeroens kss shit + + body { + background-color: darkblue; + padding: 0; + margin: 0} + background-color: white; +*/ + + +/* +h1 { +font-family:"Street Corner Bold"; +font-family:Bubbleboy; +font-family:"Arial Rounded MT Bold"; +font-family:Glamourgirl; +font-weight:bold; +font-family:"Alba"; +font-family:"Agency FB"; +font-family:"Alba Super"; +font-family:"Brassiere Seethru"; +font-family:"Debussy"; +font-family:"Gilgongo Mutombo"; +font-family:"Gilgongo Ombre"; +font-family:"Howie's_Funhouse"; +font-family:MamaRound; +font-family:"National First Font"; +font-family:"OCR A Extended"; +font-family:"Phosphorus Iodide"; +font-family:"RNS BARUTA BLACK"; +font-family:"Turn Table BV"; +} + */ + + +/* +p, h2 { +font-family:"Poor Richard" + +} + */ Modified: kukit/euro-python-2007/kss-protocol.html ============================================================================== --- kukit/euro-python-2007/kss-protocol.html (original) +++ kukit/euro-python-2007/kss-protocol.html Thu Jul 5 18:31:55 2007 @@ -33,52 +33,63 @@ + + + -
-

KSS protocol

- - - - - - - - + +
- Browser - - ——› HTTP POST (form data) ——› - - Server -
- ‹—— XML response (commands) ‹—— -
-
-		
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+    
+
+

KSS protocol

+ + + + + + + + + + + - -
+ Browser + + ——› HTTP POST (form data) ——› + + Server +
+ ‹—— XML response (commands) ‹—— +
+ OPRUIMEN + + -
+
+
+
+
+ Python integration +
Modified: kukit/euro-python-2007/presentation.css ============================================================================== --- kukit/euro-python-2007/presentation.css (original) +++ kukit/euro-python-2007/presentation.css Thu Jul 5 18:31:55 2007 @@ -6,23 +6,9 @@ You can use this file as is or as a starting point for you own styling */ -pre code[class]:after { - content: 'highlight: ' attr(class); - display: block; text-align: right; - font-size: smaller; - color: #CCC; background: white; - border-top: solid 1px; - padding-top: 0.5em; -} pre code { display: block; - background: #F0F0F0; -} - -pre code, -.ruby .subst { - color: black; } .string, @@ -37,7 +23,7 @@ .django .template_tag, .django .variable, .smalltalk .class { - color: #800; + color: yellow; } .comment, @@ -60,7 +46,8 @@ .django .filter .argument, .smalltalk .localvars, .smalltalk .array { - color: #88F; + color: cyan; + font-weight: bold; } .keyword, Modified: kukit/euro-python-2007/presentation.kss ============================================================================== --- kukit/euro-python-2007/presentation.kss (original) +++ kukit/euro-python-2007/presentation.kss Thu Jul 5 18:31:55 2007 @@ -18,4 +18,32 @@ action-client: setStyle; setStyle-name: color; setStyle-value: red; -} \ No newline at end of file +} + +/* kss protocol */ +#server-commands:click { + evt-click-preventdefault: True; + action-client: toggleClass; + toggleClass-kssSelector: htmlid(protocol-detail); + toggleClass-classname: hidden; +} + +/* server demo */ +#invoke-server:click { + evt-click-preventdefault: True; + action-server: ./server_response.xml; +} + + +/* python integration */ +#show-plain-python:click{ + action-client: toggleClass; + toggleClass-kssSelector: htmlid(plain-python-source); + toggleClass-classname: hidden; +} + +#show-zope:click{ + action-client: toggleClass; + toggleClass-kssSelector: htmlid(zope-source); + toggleClass-classname: hidden; +} Added: kukit/euro-python-2007/python-integration.html ============================================================================== --- (empty file) +++ kukit/euro-python-2007/python-integration.html Thu Jul 5 18:31:55 2007 @@ -0,0 +1,80 @@ + + + + KSS, doing Ajax with style + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Python integration

+
Plain Python
+
+

+from kss.commands import KSSCommands
+from kss.commands.selectors import CSS
+
+commands = KSSCommands()
+core = commands.get('core')
+core.replace_inner_html(CSS('div.content'), 'html data')
+commands.render()
+	  
+
+ + +
Zope 3
+
+

+from kss.core import KSSView
+
+class FolderContentsKSSView(KSSView):
+
+    @kssaction
+    def update_content(self):
+        core = self.getCommandSet('core')
+        selector = ksscore.getCssSelector('div.content')
+        core.replaceInnerHTML(selector, 'html data')
+	    
+
+ + Plone demo + Conclusion +
+
+ + Deleted: /kukit/euro-python-2007/server-communication.html ============================================================================== --- /kukit/euro-python-2007/server-communication.html Thu Jul 5 18:31:55 2007 +++ (empty file) @@ -1,50 +0,0 @@ - - - - KSS, doing Ajax with style - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Server communication

-
-div a.button:click {
-
-
-    bold -\
-action-server: update_page;
-}
-      
-
- - Added: kukit/euro-python-2007/server-demo.html ============================================================================== --- (empty file) +++ kukit/euro-python-2007/server-demo.html Thu Jul 5 18:31:55 2007 @@ -0,0 +1,59 @@ + + + + KSS, doing Ajax with style + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Server example

+
Call server
+
+

+#invoke-server:click {
+  evt-click-preventdefault: True;
+  action-server: ./server_response.xml;
+}
+	    
+
+ KSS protocol +
+
+ + Deleted: /kukit/euro-python-2007/server-sending-data.html ============================================================================== --- /kukit/euro-python-2007/server-sending-data.html Thu Jul 5 18:31:55 2007 +++ (empty file) @@ -1,48 +0,0 @@ - - - - KSS, doing Ajax with style - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Server communication

-
-div a.button:click {
-  action-server: update_page;
-  update_page-title: formVar(title); # Fix to proper example
-}
-      
-
- - Added: kukit/euro-python-2007/server_response.xml ============================================================================== --- (empty file) +++ kukit/euro-python-2007/server_response.xml Thu Jul 5 18:31:55 2007 @@ -0,0 +1,14 @@ + + + + + + Hello from KSS! + + + + \ No newline at end of file Modified: kukit/euro-python-2007/static-demo.html ============================================================================== --- kukit/euro-python-2007/static-demo.html (original) +++ kukit/euro-python-2007/static-demo.html Thu Jul 5 18:31:55 2007 @@ -2,7 +2,12 @@ - KSS Demo + KSS, doing Ajax with style + + + @@ -25,15 +30,16 @@ + + - + -

KSS Demo

@@ -44,18 +50,21 @@
Look at the KSS
Plugin example Deleted: /kukit/euro-python-2007/syntax-explained.html ============================================================================== --- /kukit/euro-python-2007/syntax-explained.html Thu Jul 5 18:31:55 2007 +++ (empty file) @@ -1,54 +0,0 @@ - - - - KSS, doing Ajax with style - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Closer look at the syntax

-
-closer look at the syntax
-
-|    CSS    | event
-div a.button:click {
-
-| action type | command
-action-client: toggleClass;
-
-| command  | parameter | value
-toggleClass-className:   hidden;
-      
-
- - From jvloothuis at codespeak.net Thu Jul 5 18:55:27 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Thu, 5 Jul 2007 18:55:27 +0200 (CEST) Subject: [KSS-checkins] r44749 - kukit/euro-python-2007 Message-ID: <20070705165527.8180680F4@code0.codespeak.net> Author: jvloothuis Date: Thu Jul 5 18:55:27 2007 New Revision: 44749 Modified: kukit/euro-python-2007/index.html kukit/euro-python-2007/kss-presentation.css Log: Made the title slide prettier (like Thijs intended) Changed background color to the color seemingly proposed by Godefroid Modified: kukit/euro-python-2007/index.html ============================================================================== --- kukit/euro-python-2007/index.html (original) +++ kukit/euro-python-2007/index.html Thu Jul 5 18:55:27 2007 @@ -34,18 +34,36 @@ - +
-

KSS, doing Ajax with style

-

Presented by: Jeroen Vloothuis

- - Start the presentation +
Modified: kukit/euro-python-2007/kss-presentation.css ============================================================================== --- kukit/euro-python-2007/kss-presentation.css (original) +++ kukit/euro-python-2007/kss-presentation.css Thu Jul 5 18:55:27 2007 @@ -38,7 +38,8 @@ /* color */ body { -background:#201; +/*background:#201;*/ +background-color: #ff4916; color:#fff; } From gotcha at codespeak.net Thu Jul 5 21:46:42 2007 From: gotcha at codespeak.net (gotcha at codespeak.net) Date: Thu, 5 Jul 2007 21:46:42 +0200 (CEST) Subject: [KSS-checkins] r44753 - kukit/euro-python-2007 Message-ID: <20070705194642.0FB1380FA@code0.codespeak.net> Author: gotcha Date: Thu Jul 5 21:46:41 2007 New Revision: 44753 Modified: kukit/euro-python-2007/goals-of-kss.html Log: fix typo Modified: kukit/euro-python-2007/goals-of-kss.html ============================================================================== --- kukit/euro-python-2007/goals-of-kss.html (original) +++ kukit/euro-python-2007/goals-of-kss.html Thu Jul 5 21:46:41 2007 @@ -42,7 +42,7 @@
-

Goals of the Kinectic Style Sheets system

+

Goals of the Kinetic Style Sheets system

  • Ajax without writing Javascript
  • Unobtrusive
  • From jvloothuis at codespeak.net Thu Jul 5 23:08:43 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Thu, 5 Jul 2007 23:08:43 +0200 (CEST) Subject: [KSS-checkins] r44760 - kukit/euro-python-2007 Message-ID: <20070705210843.3B54A8106@code0.codespeak.net> Author: jvloothuis Date: Thu Jul 5 23:08:42 2007 New Revision: 44760 Modified: kukit/euro-python-2007/kss-presentation.css Log: Changed font to sans serif Modified: kukit/euro-python-2007/kss-presentation.css ============================================================================== --- kukit/euro-python-2007/kss-presentation.css (original) +++ kukit/euro-python-2007/kss-presentation.css Thu Jul 5 23:08:42 2007 @@ -101,7 +101,7 @@ h1 { display:block; -font-family:verdana; +font-family:sans serif; font-size:200%; line-height:28px; padding:0px 20px 23px; @@ -114,7 +114,7 @@ } p, h2, .button, a { -font-family:verdana; +font-family:sans serif; padding:5px 20px; font-size:1em; cursor:pointer; From jvloothuis at codespeak.net Thu Jul 5 23:16:04 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Thu, 5 Jul 2007 23:16:04 +0200 (CEST) Subject: [KSS-checkins] r44761 - kukit/docs/introducing_kss/trunk Message-ID: <20070705211604.0524C8106@code0.codespeak.net> Author: jvloothuis Date: Thu Jul 5 23:16:04 2007 New Revision: 44761 Added: kukit/docs/introducing_kss/trunk/rstxml2texinfo.py Log: Added an initial version of a convertor for restructured text xml output to the texinfo format. This can be used to generate online documentation for Emacs. Added: kukit/docs/introducing_kss/trunk/rstxml2texinfo.py ============================================================================== --- (empty file) +++ kukit/docs/introducing_kss/trunk/rstxml2texinfo.py Thu Jul 5 23:16:04 2007 @@ -0,0 +1,161 @@ +from elementtree import ElementTree +from optparse import OptionParser +import sys +import os + +def main(): + parser = OptionParser() + (options, args) = parser.parse_args() + + tree = ElementTree.parse(args[0]) + root = tree.getroot() + + output_filename = os.path.splitext(os.path.basename( + root.attrib['source']))[0] + '.info' + output = sys.stdout + + # Header + output.write('\n'.join(['\input texinfo @c -*-texinfo-*-', + '@c %**start of header', + '@setfilename %s' % output_filename, + '@settitle %s' % root.find('title').text, + '@c %**end of header', ''])) + + output.write(create_frontpage(root)) + output.write(create_sections(root, 0)) + + output.close() + +def create_menu(node): + sections = node.findall('section') + if len(sections) == 0: + return '' + + output = [] + output.append('@menu') + for section in sections: + output.append('* %s::' % section_title(section)) + output.append('@end menu\n') + return '\n'.join(output) + + +def create_frontpage(node): + output = [] + first_section = node.find('section') + title = section_title(node) + output.append('@node Top, %s, (dir), (dir)\n' % section_title(first_section)) + output.append('@top %s\n' % title) + output.append(create_menu(node)) +# output.append('@node %s, %s, Top, Top\n' % (title, +# section_title(sections[0]))) +# output.append('@unnumbered %s\n' % title) +# for paragraph in node.findall('paragraph'): +# output.append(paragraph.text + '\n\n') + return ''.join(output) + + +section_levels = ['chapter', 'section', 'subsection', 'subsubsection'] +def create_sections(node, level, parent='Top'): + sections = node.findall('section') + output = [] + for i, section in enumerate(sections): + title = section_title(section) + + # Node and section creation + if i + 1 == len(sections): + next_title = '' + else: + next_title = section_title(sections[i + 1]) + + if i == 0: + previous_title = parent + else: + previous_title = section_title(sections[i - 1]) + + output.append('@node %s, %s, %s, %s\n' % (title, + next_title, + previous_title, + parent)) + output.append('@%s %s\n' % (section_levels[level], title)) + + + output.append(create_menu(section)) + + # Page contents + for node in section.getchildren(): + tag = node.tag + if tag in ['section', 'title']: + continue + output.append(dispatch(node)) + + output.append(create_sections(section, level + 1, parent=title)) + return ''.join(output) + +def dispatch(node): + func = globals().get('create_' + node.tag, None) + if func is not None: + return func(node) + else: + raise node.tag + return '' + +def create_image(node): + return '@image{%s}\n\n' % os.path.splitext(node.get('uri'))[0] + +def create_paragraph(node): + text = node.text + if text is None: + text = '' + output = [escape(text)] + for child in node.getchildren(): + output.append(dispatch(child)) + output.append(child.tail) + return ''.join(output) + '\n\n' + +def create_strong(node): + return '@strong{%s}' % escape(node.text) + +def create_literal(node): + return '@samp{%s}' % escape(node.text) + +def create_bullet_list(node): + output = [] + output.append('@itemize @bullet') + for bullet_node in node.getchildren(): + if bullet_node.tag == 'list_item': + output.append('@item') + for child in bullet_node.getchildren(): + output.append(dispatch(child)) + else: + output.append(dispatch(node)) + output.append('@end itemize\n') + return '\n'.join(output) + +def create_literal_block(node): + output = ['@example'] + output.append(escape(node.text)) + output.append('@end example\n\n') + return '\n'.join(output) + +def create_block_quote(node): + output = ['@quotation'] + for child in node.getchildren(): + output.append(dispatch(child)) + output.append('@end quotation\n\n') + return '\n'.join(output) + + +def section_title(section): + return section.find('title').text + +def escape(text, comma=False): + replacements = ['@', '{', '}'] + if comma: + replacements.append(',') + + for replacement in replacements: + text = text.replace(replacement, '@' + replacement) + return text + +if __name__ == '__main__': + main() From jvloothuis at codespeak.net Thu Jul 5 23:37:09 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Thu, 5 Jul 2007 23:37:09 +0200 (CEST) Subject: [KSS-checkins] r44762 - kukit/docs/introducing_kss/trunk Message-ID: <20070705213709.0C3A98106@code0.codespeak.net> Author: jvloothuis Date: Thu Jul 5 23:37:09 2007 New Revision: 44762 Modified: kukit/docs/introducing_kss/trunk/1-kss-in-general.txt kukit/docs/introducing_kss/trunk/2-kss-on-the-zope-server.txt kukit/docs/introducing_kss/trunk/3-shipped-kss-plugins.txt kukit/docs/introducing_kss/trunk/4-kss-in-plone.txt kukit/docs/introducing_kss/trunk/5-extension-with-custom-plugins.txt Log: Removed numbering from all headers. This can (and should) be done by the docutils writers, not in the document itself. Modified: kukit/docs/introducing_kss/trunk/1-kss-in-general.txt ============================================================================== --- kukit/docs/introducing_kss/trunk/1-kss-in-general.txt (original) +++ kukit/docs/introducing_kss/trunk/1-kss-in-general.txt Thu Jul 5 23:37:09 2007 @@ -1,9 +1,8 @@ +KSS in general +============== -1. KSS in general -================= - -1.1 Introduction ----------------- +Introduction +------------ KSS is an acronym for Kinetic Style Sheets. KSS is a client side framework for implementing rich user interfaces with AJAX @@ -131,8 +130,8 @@ and non-Pythonic web application frameworks as well. -1.2 Architectural overview --------------------------- +Architectural overview +---------------------- In this section, we provide a high level overview of KSS' system architecture. @@ -264,8 +263,8 @@ the accompanying command plugin. -1.3 Syntax and semantics of the KSS resource file -------------------------------------------------- +Syntax and semantics of the KSS resource file +--------------------------------------------- In this section we detail what a KSS resource file contains and how to use it. @@ -884,8 +883,8 @@ second action with the same name. -1.4 Getting information from the DOM (parameter providers) ----------------------------------------------------------- +Getting information from the DOM (parameter providers) +------------------------------------------------------ Actions must be executed with parameters. Although static parameters can be sufficient for some application, most of the @@ -995,8 +994,8 @@ The second parameter in ``kssAttr(widgetid, True)`` tells KSS to look further in the parents of the node, until it finds the attribute. -1.5 Introduction to commands ----------------------------- +Introduction to commands +------------------------ "KSS commands" serve a very important role in a KSS application. They enable the application to use server-side code to instruct @@ -1088,5 +1087,3 @@ - - Modified: kukit/docs/introducing_kss/trunk/2-kss-on-the-zope-server.txt ============================================================================== --- kukit/docs/introducing_kss/trunk/2-kss-on-the-zope-server.txt (original) +++ kukit/docs/introducing_kss/trunk/2-kss-on-the-zope-server.txt Thu Jul 5 23:37:09 2007 @@ -1,6 +1,5 @@ - -2. KSS on the Zope server -========================= +KSS on the Zope server +====================== In this chapter we summarize how to write the application part that runs on the Zope server side: the server actions. @@ -13,8 +12,8 @@ funtionality of kss. The demos are also used for automatize functional testing with Selenium. -2.1. Installation ------------------ +Installation +------------ For installing KSS on the Zope server side, please refer to the release notes of the KSS version you are using. @@ -22,8 +21,8 @@ installing Python modules and ZCML "slugs" into your instance. -2.2 Providing javascript code for the client --------------------------------------------- +Providing javascript code for the client +---------------------------------------- First of all we need to serve the javascript code that is necessary for our application. This is done by the @@ -119,8 +118,8 @@ comments that helps you learn about different caching options, in case it becomes necessarry to change them. -2.2 Specifying stylesheets --------------------------- +Specifying stylesheets +---------------------- Now that we have the javascript of KSS enabled in the pages, we can start specifying one or more KSS stylesheets. The stylesheets, @@ -140,8 +139,8 @@ these link definitions, fetch the stylesheets from the server, and starts processing them. -2.3 Debugging possibilities ---------------------------- +Debugging possibilities +----------------------- Debuggability, as mentioned before, is a core feature of KSS. Besides the appearance of the server side errors in the @@ -200,8 +199,8 @@ server and not filtered (by applying necessary settings to the error_log tool). -2.4 The KSS command response ----------------------------- +The KSS command response +------------------------ In this part we will work with browser views for implementing out server actions. According to the current @@ -271,8 +270,8 @@ are mentioned in the method's signature (widgetid and href, in our example) will -2.5 How to work TTW -------------------- +How to work TTW +--------------- Besides the above described method that involves the usage of Zope views to define server actions, KSS also provides a @@ -315,8 +314,8 @@ return renderKSSCommands() -2.6 Server side event handling ------------------------------- +Server side event handling +-------------------------- When we talk about server side event handling, it is important to note that we talk about "events" in the real Modified: kukit/docs/introducing_kss/trunk/3-shipped-kss-plugins.txt ============================================================================== --- kukit/docs/introducing_kss/trunk/3-shipped-kss-plugins.txt (original) +++ kukit/docs/introducing_kss/trunk/3-shipped-kss-plugins.txt Thu Jul 5 23:37:09 2007 @@ -1,7 +1,5 @@ - - -3. Shipped KSS plugins -====================== +Shipped KSS plugins +=================== KSS plugins, the ones that come with the system @@ -15,8 +13,8 @@ have an additional selector parameter, which is not present at "global" commands. -3.1. The "core" plugins ------------------------ +The "core" plugins +------------------ Namespace: "core" @@ -651,8 +649,8 @@ Return a all nodes in the parent chain which match the given css selector. -3.2 The "zope" plugins ----------------------- +The "zope" plugins +------------------ Namespace: "zope" @@ -670,8 +668,8 @@ selected node. -3.3 The "plone" plugins ------------------------ +The "plone" plugins +------------------- Namespace: "plone" Modified: kukit/docs/introducing_kss/trunk/4-kss-in-plone.txt ============================================================================== --- kukit/docs/introducing_kss/trunk/4-kss-in-plone.txt (original) +++ kukit/docs/introducing_kss/trunk/4-kss-in-plone.txt Thu Jul 5 23:37:09 2007 @@ -1,12 +1,9 @@ +KSS in Plone +============ - -4. KSS in Plone -=============== - - -4.1 Setup of KSS in Plone -------------------------- +Setup of KSS in Plone +--------------------- Earlier we learned what headers are needed to be put into the page headers for KSS. With Plone the setup is even easier, thanks @@ -42,13 +39,13 @@ there is nothing more to do then to sit back and enjoy KSS's functionality everywhere in the portal. -4.2 How to kssize existing widgets ----------------------------------- +How to kssize existing widgets +------------------------------ XXX -4.3 What features are implemented with KSS in Plone ---------------------------------------------------- +What features are implemented with KSS in Plone +----------------------------------------------- We try to give a non-exhaustive report about what features are implemented with kss: Modified: kukit/docs/introducing_kss/trunk/5-extension-with-custom-plugins.txt ============================================================================== --- kukit/docs/introducing_kss/trunk/5-extension-with-custom-plugins.txt (original) +++ kukit/docs/introducing_kss/trunk/5-extension-with-custom-plugins.txt Thu Jul 5 23:37:09 2007 @@ -1,6 +1,5 @@ - -5. Extension with custom plugins -================================ +Extension with custom plugins +============================= KSS has a plugin architecture. Apart from the core that is parsing the .kss files and binding them to nodes, communicating @@ -15,8 +14,8 @@ To be able to do it, you must be familiar with javascript and KSS. -5.1 wrapping javascript on the client side ------------------------------------------- +Wrapping javascript on the client side +-------------------------------------- If we write a new plugin, first we need to create a javascript file that will contain the code for our plugin. @@ -26,8 +25,8 @@ kukit.myplugin = {}; -5.1.1. Creating an action -""""""""""""""""""""""""" +Creating an action +""""""""""""""""""" An action is a javascript method that is called when the action is executed. It receives the parameters in a given form and it @@ -35,16 +34,12 @@ - - - - -5.2 registering your plugin on the server and shipping with your product ------------------------------------------------------------------------- +Registering your plugin on the server and shipping with your product +-------------------------------------------------------------------- XXX -5.3. Testing ------------- +Testing +------- XXX From reebalazs at codespeak.net Fri Jul 6 02:48:41 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Fri, 6 Jul 2007 02:48:41 +0200 (CEST) Subject: [KSS-checkins] r44765 - kukit/kukit.js/trunk/kukit Message-ID: <20070706004841.29B3A811D@code0.codespeak.net> Author: reebalazs Date: Fri Jul 6 02:48:40 2007 New Revision: 44765 Modified: kukit/kukit.js/trunk/kukit/eventreg.js kukit/kukit.js/trunk/kukit/oper.js Log: Fix continuation event (currently used this way for livesearch only) - fix continue_event_allnodes to use defaultparms as necessary - make the default method copy automatically defaultparms to parms sp pass(xxx) for all parameters is not needed in cases where the operation is going all programmatically and no kss is involved in the continuation. Modified: kukit/kukit.js/trunk/kukit/eventreg.js ============================================================================== --- kukit/kukit.js/trunk/kukit/eventreg.js (original) +++ kukit/kukit.js/trunk/kukit/eventreg.js Fri Jul 6 02:48:40 2007 @@ -320,7 +320,7 @@ ;;; kukit.logDebug('Continuation event "' + name + '" executed on same node.'); }; -kukit.er.EventBinder__continue_event_allnodes__ = function(name, parms) { +kukit.er.EventBinder__continue_event_allnodes__ = function(name, defaultparms) { // Trigger an event bound to a given state instance, on all nodes. // (or on document, if node = null) // if no other nodes execute. @@ -333,10 +333,10 @@ for (var i=0; i Author: reebalazs Date: Fri Jul 6 02:49:12 2007 New Revision: 44766 Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/commands.py kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/interfaces.py Log: Correct the interface for the continueEvent command Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/commands.py ============================================================================== --- kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/commands.py (original) +++ kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/commands.py Fri Jul 6 02:49:12 2007 @@ -128,10 +128,12 @@ command.addParam('varname', varname) command.addParam('value', value) - def continueEvent(self, name, **kw): + def continueEvent(self, name, allnodes=False, **kw): """ see interfaces.py """ command = self.commands.addCommand('continueEvent') command.addParam('name', name) + if allnodes: + command.addParam('allnodes', allnodes) for key, value in kw.iteritems(): command.addParam(key, value) Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/interfaces.py ============================================================================== --- kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/interfaces.py (original) +++ kukit/azax/branch/1.1-ree-plugin-dad/plugins/core/interfaces.py Fri Jul 6 02:49:12 2007 @@ -76,9 +76,20 @@ def setStateVar(varname, value): """Set a client side kukit variable""" - def triggerEvent(name, **kw): - """Trigger an event on the client """ - # TODO: explain a bit better what this does + def continueEvent(name, allnodes=False, **kw): + """Trigger a continuation event on the client + + The event that is specified in "name" is called on the same + event binder instance (state) as the event that was triggered originally. + + All keywords will be passed to this event. + + If allnodes=False (default), the event will be called on the + node where the original event was triggered. + + If allnodes=True, the event will be called on all nodes + that the event is bound on. + """ def toggleClass(selector, value): """Add/remove a class to/from a node. From jvloothuis at codespeak.net Fri Jul 6 11:39:04 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Fri, 6 Jul 2007 11:39:04 +0200 (CEST) Subject: [KSS-checkins] r44768 - kukit/kss.buildout/trunk Message-ID: <20070706093904.85FA9818A@code0.codespeak.net> Author: jvloothuis Date: Fri Jul 6 11:39:03 2007 New Revision: 44768 Modified: kukit/kss.buildout/trunk/buildout.cfg Log: Updated the buildout config to use plone's instance recipe instead of the obsoleted z2c recipe Modified: kukit/kss.buildout/trunk/buildout.cfg ============================================================================== --- kukit/kss.buildout/trunk/buildout.cfg (original) +++ kukit/kss.buildout/trunk/buildout.cfg Fri Jul 6 11:39:03 2007 @@ -21,11 +21,11 @@ url = http://release.openqa.org/selenium-remote-control/0.9.0/selenium-remote-control-0.9.0.zip [zope2] -recipe = z2c.recipe.zope2install -url = http://www.zope.org/Products/Zope/2.10.2/Zope-2.10.2.tgz +recipe = plone.recipe.zope2install +url = http://www.zope.org/Products/Zope/2.10.4/Zope-2.10.4-final.tgz [instance] -recipe = z2c.recipe.zope2instance +recipe = plone.recipe.zope2instance zope2-location = ${zope2:location} user = admin:admin debug-mode = on From jvloothuis at codespeak.net Fri Jul 6 12:56:22 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Fri, 6 Jul 2007 12:56:22 +0200 (CEST) Subject: [KSS-checkins] r44769 - kukit/kss.demo/trunk/kss/demo/browser/selectors Message-ID: <20070706105622.D232C81A4@code0.codespeak.net> Author: jvloothuis Date: Fri Jul 6 12:56:21 2007 New Revision: 44769 Modified: kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.kss kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.pt Log: Added an extra test for the new % option to the parentnode selector. Modified: kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.kss ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.kss (original) +++ kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.kss Fri Jul 6 12:56:21 2007 @@ -21,3 +21,9 @@ executeCommand-selectorType: parentnode; executeCommand-html: '
    selected
    '; } + +#parentnodesurrounding:click { + action-client: insertHTMLAsLastChild; + insertHTMLAsLastChild-kssSelector: parentnode('#parent-root % div.related'); + insertHTMLAsLastChild-html: '
    selected
    '; +} Modified: kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.pt ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.pt (original) +++ kukit/kss.demo/trunk/kss/demo/browser/selectors/selectors.pt Fri Jul 6 12:56:21 2007 @@ -36,8 +36,6 @@ Click me!
- -
@@ -45,5 +43,21 @@
+ +
+ paretnode can also be used to select siblings or other related nodes +
+ +
+
+
+ Click me! +
+
+ +
From jvloothuis at codespeak.net Fri Jul 6 12:57:36 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Fri, 6 Jul 2007 12:57:36 +0200 (CEST) Subject: [KSS-checkins] r44770 - kukit/kukit.js/trunk/kukit Message-ID: <20070706105736.BC0AC81A4@code0.codespeak.net> Author: jvloothuis Date: Fri Jul 6 12:57:36 2007 New Revision: 44770 Modified: kukit/kukit.js/trunk/kukit/selectorreg.js Log: Added an extra option to the parentnode selector so that it now accepts selectors in the form of selector1 % selector2. This can be used to select surrounding nodes. Modified: kukit/kukit.js/trunk/kukit/selectorreg.js ============================================================================== --- kukit/kukit.js/trunk/kukit/selectorreg.js (original) +++ kukit/kukit.js/trunk/kukit/selectorreg.js Fri Jul 6 12:57:36 2007 @@ -149,28 +149,64 @@ return nodes; }); -// Return a list of all nodes that match the css expression in the parent chain +// Return a list of all nodes that match the css expression in the +// parent chain This selector can also return surrounding nodes by +// passing in an expression with a "%" in it. kukit.selectorTypesGlobalRegistry.register('parentnode', function(expr, node) { - var selectednodes = kukit.dom.cssQuery(expr); - var parentnodes = []; - var parentnode = node.parentNode; - while(parentnode.parentNode) { - parentnodes.push(parentnode); - parentnode = parentnode.parentNode; + var expressions = expr.split('%'); + + ;;; if (expressions.length > 2) { + ;;; throw 'Only one "%" allowed in parentnode selector: "' + expr + '"'; + ;;; } + + function parentnodes(node){ + var nodes = []; + var parentnode = node; + while(parentnode.parentNode) { + nodes.push(parentnode); + parentnode = parentnode.parentNode; + } + return nodes; + } + + function filternode(allowed, node){ + for(var i=0; i Author: jvloothuis Date: Fri Jul 6 14:09:18 2007 New Revision: 44777 Modified: kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.kss kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.pt kukit/kss.demo/trunk/kss/demo/demoview.py Log: Added test for issue #6 where multi select lists where not properly handled Modified: kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.kss ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.kss (original) +++ kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.kss Fri Jul 6 14:09:18 2007 @@ -72,3 +72,14 @@ submitFullFormIntoRequest-kssSubmitForm: 'full2'; } +#single-select:click { + action-client: executeCommand; + executeCommand-name: replaceInnerHTML; + executeCommand-selector: "#target"; + executeCommand-html: currentFormVar(single-select); +} + +#multiple-select:click { + action-server: submitFullForm; + submitFullForm-form: currentFormVar(multiple-select); +} Modified: kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.pt ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.pt (original) +++ kukit/kss.demo/trunk/kss/demo/browser/parameterfunction/forms.pt Fri Jul 6 14:09:18 2007 @@ -98,6 +98,37 @@ type="radio" name="radio-by-name" value="radio-2" checked="checked" /> + +

+ currentFormVar(name) with select field. +

+
+ Click the button. +
+
+ Click me ! + +
+ +

+ currentFormVar(name) with multiple select field. +

+
+ Click the button. +
+
+ Click me ! + +
+

form(full1) with simple field names, named form Modified: kukit/kss.demo/trunk/kss/demo/demoview.py ============================================================================== --- kukit/kss.demo/trunk/kss/demo/demoview.py (original) +++ kukit/kss.demo/trunk/kss/demo/demoview.py Fri Jul 6 14:09:18 2007 @@ -1,4 +1,3 @@ -# -*- coding: ISO-8859-15 -*- # Copyright (c) 2005-2007 # Authors: KSS Project Contributors (see docs/CREDITS.txt) # From jvloothuis at codespeak.net Fri Jul 6 14:09:44 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Fri, 6 Jul 2007 14:09:44 +0200 (CEST) Subject: [KSS-checkins] r44778 - kukit/kukit.js/trunk/kukit Message-ID: <20070706120944.053858137@code0.codespeak.net> Author: jvloothuis Date: Fri Jul 6 14:09:44 2007 New Revision: 44778 Modified: kukit/kukit.js/trunk/kukit/forms.js Log: Added fix for issue #6 where multi select lists where not properly handled Modified: kukit/kukit.js/trunk/kukit/forms.js ============================================================================== --- kukit/kukit.js/trunk/kukit/forms.js (original) +++ kukit/kukit.js/trunk/kukit/forms.js Fri Jul 6 14:09:44 2007 @@ -152,14 +152,28 @@ kukit.fo.fieldUpdateRegistry.doUpdate(element); // Collect the data if (element.selectedIndex != undefined) { - if (element.selectedIndex < 0) { - value=""; - } else { - var option = element.options[element.selectedIndex]; - value = option.value; - if (value == "") - value = option.text; - } + // handle single selects first + if(!element.multiple){ + if (element.selectedIndex < 0) { + value=""; + } else { + var option = element.options[element.selectedIndex]; + value = option.value; + if (value == "") + value = option.text; + } + } + // Now process selects with the multiple option set + else { + var value = []; + for(i=0; i Author: reebalazs Date: Fri Jul 6 19:50:24 2007 New Revision: 44798 Added: kukit/kukit.js/branch/historical/ree-stripout-comments/ - copied from r44797, kukit/kukit.js/branch/ree-stripout-comments/ Removed: kukit/kukit.js/branch/ree-stripout-comments/ Log: Archive this branch From reebalazs at codespeak.net Fri Jul 6 19:58:09 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Fri, 6 Jul 2007 19:58:09 +0200 (CEST) Subject: [KSS-checkins] r44799 - kukit/kukit.js/branch/ree-binding-improvements Message-ID: <20070706175809.5EF62817C@code0.codespeak.net> Author: reebalazs Date: Fri Jul 6 19:58:09 2007 New Revision: 44799 Added: kukit/kukit.js/branch/ree-binding-improvements/ - copied from r44798, kukit/kukit.js/trunk/ Log: Branch off From reebalazs at codespeak.net Fri Jul 6 20:00:38 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Fri, 6 Jul 2007 20:00:38 +0200 (CEST) Subject: [KSS-checkins] r44800 - in kukit/azax/branch: 1.1-performance_improvement historical/1.1-performance_improvement Message-ID: <20070706180038.AAFBC8170@code0.codespeak.net> Author: reebalazs Date: Fri Jul 6 20:00:38 2007 New Revision: 44800 Added: kukit/azax/branch/historical/1.1-performance_improvement/ - copied from r44799, kukit/azax/branch/1.1-performance_improvement/ Removed: kukit/azax/branch/1.1-performance_improvement/ Log: Archive branch From reebalazs at codespeak.net Fri Jul 6 20:00:59 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Fri, 6 Jul 2007 20:00:59 +0200 (CEST) Subject: [KSS-checkins] r44801 - in kukit/azax/branch: 1.1-ree-stripout-comments historical/1.1-ree-stripout-comments Message-ID: <20070706180059.D19098171@code0.codespeak.net> Author: reebalazs Date: Fri Jul 6 20:00:59 2007 New Revision: 44801 Added: kukit/azax/branch/historical/1.1-ree-stripout-comments/ - copied from r44800, kukit/azax/branch/1.1-ree-stripout-comments/ Removed: kukit/azax/branch/1.1-ree-stripout-comments/ Log: Archive branch From reebalazs at codespeak.net Fri Jul 6 20:01:58 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Fri, 6 Jul 2007 20:01:58 +0200 (CEST) Subject: [KSS-checkins] r44803 - kukit/azax/branch/1.1-ree-binding-improvements Message-ID: <20070706180158.3805B8170@code0.codespeak.net> Author: reebalazs Date: Fri Jul 6 20:01:57 2007 New Revision: 44803 Added: kukit/azax/branch/1.1-ree-binding-improvements/ - copied from r44802, kukit/azax/branch/1.1-ree-plugin-dad/ Log: Branch off From reebalazs at codespeak.net Fri Jul 6 20:03:13 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Fri, 6 Jul 2007 20:03:13 +0200 (CEST) Subject: [KSS-checkins] r44805 - kukit/azax/branch/1.1-ree-binding-improvements Message-ID: <20070706180313.AD7A1816E@code0.codespeak.net> Author: reebalazs Date: Fri Jul 6 20:03:13 2007 New Revision: 44805 Modified: kukit/azax/branch/1.1-ree-binding-improvements/ (props changed) kukit/azax/branch/1.1-ree-binding-improvements/EXTERNALS.TXT Log: Set up branch Modified: kukit/azax/branch/1.1-ree-binding-improvements/EXTERNALS.TXT ============================================================================== --- kukit/azax/branch/1.1-ree-binding-improvements/EXTERNALS.TXT (original) +++ kukit/azax/branch/1.1-ree-binding-improvements/EXTERNALS.TXT Fri Jul 6 20:03:13 2007 @@ -5,5 +5,5 @@ # You can update your working dir by: # svn propset svn:externals -F EXTERNALS.TXT . # -kukit http://codespeak.net/svn/kukit/kukit.js/trunk +kukit http://codespeak.net/svn/kukit/kukit.js/branch/ree-binding-improvements configfeature http://codespeak.net/svn/z3/jsonserver/branch/merge/configfeature From reebalazs at codespeak.net Sat Jul 7 00:20:40 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Sat, 7 Jul 2007 00:20:40 +0200 (CEST) Subject: [KSS-checkins] r44814 - in kukit/kukit.js/branch/ree-binding-improvements: kukit tests Message-ID: <20070706222040.759928192@code0.codespeak.net> Author: reebalazs Date: Sat Jul 7 00:20:40 2007 New Revision: 44814 Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js kukit/kukit.js/branch/ree-binding-improvements/tests/test_kssparser.js Log: First parser modifications, to have the event id accept a pprovider Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js ============================================================================== --- kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js (original) +++ kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js Sat Jul 7 00:20:40 2007 @@ -1,7 +1,7 @@ /* * Copyright (c) 2005-2007 * Authors: KSS Project Contributors (see docs/CREDITS.txt) -* Martin Heidegger +* Martin Heidegger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as published @@ -313,6 +313,7 @@ this.digestTxt(cursor, kukit.tk.Fraction, kukit.kssp.Comment); this.txt = ''; var txt = cursor.txt; + if (this.ifToken(cursor, kukit.kssp.String)) { // The previous txt must be all whitespace. if (txt) { @@ -382,7 +383,7 @@ /* * class PropValueInPseudo * -* PropValue in pseudo must ba single word with no spaces around. +* PropValue in pseudo must be single word with no spaces around. */ kukit.kssp.PropValueInPseudo = kukit.tk.mkParser('propvalue', { "{": 'this.emitAndReturn()', @@ -392,11 +393,61 @@ "\r": 'this.emitAndReturn()', "\/\*": 'this.emitAndReturn()', ":": 'this.emitAndReturn()', - "(": 'this.emitAndReturn(new kukit.kssp.MethodArgs(this.src, kukit.kssp.openparent))' + "(": '[new kukit.kssp.openparent(this.src), new kukit.kssp.PropValue(this.src)]', + ")": 'this.emitAndReturn(new kukit.kssp.closeparent(this.src))' }); kukit.kssp.PropValueInPseudo.prototype.multiword_allowed = false; -kukit.kssp.PropValueInPseudo.prototype.process = kukit.kssp.PropValue.prototype.process; -kukit.kssp.PropValueInPseudo.prototype.valueClass = kukit.rd.KssPseudoValue; +kukit.kssp.PropValueInPseudo.prototype.process = function() { + var cursor = {'next': 0}; + this.digestTxt(cursor, kukit.tk.Fraction, kukit.kssp.Comment); + this.txt = ''; + var txt = cursor.txt; + if (this.ifToken(cursor, kukit.kssp.String)) { + // The previous txt must be all whitespace. + if (txt) { + ;;; kukit.E = 'Excess characters before the string in property value'; + this.emitError(kukit.E); + } + // the next one must be a string. + this.expectToken(cursor, kukit.kssp.String); + this.produceTxt(cursor.token.txt); + } else if (this.ifToken(cursor, kukit.kssp.openparent)) { + this.expectToken(cursor, kukit.kssp.openparent); + this.expectToken(cursor, kukit.kssp.PropValue); + this.value = new kukit.rd.KssPseudoValue(txt, cursor.token.value); + this.digestTxt(cursor, kukit.tk.Fraction, kukit.kssp.Comment); + // we have to be at the end and have no text after + if (cursor.txt) { + ;;; kukit.E = 'Excess characters before the closing parenthesis. Only one parameter is allowed.'; + this.emitError(kukit.E); + } + // eat up everything before the closing parent + this.expectToken(cursor, kukit.kssp.closeparent); + } else { + // not a string or method: check if we allowed multiword. + if (! this.multiword_allowed && txt.indexOf(' ') != -1) { + ;;; kukit.E = 'Property value must be one word'; + this.emitError(kukit.E); + } + this.produceTxt(txt); + } + // see what's after + if (cursor.next < this.result.length) { + this.digestTxt(cursor, kukit.tk.Fraction, kukit.kssp.Comment); + // we have to be at the end and have no text after + if (cursor.next < this.result.length || cursor.txt) { + ;;; kukit.E = 'Excess characters after the property value'; + this.emitError(kukit.E); + } + } + this.result = []; +}; + + + + + +//kukit.kssp.PropValueInPseudo.prototype.valueClass = kukit.rd.KssPseudoValue; kukit.kssp.PropValueInPseudo.prototype.produceTxt = function(txt) { // txt parms are returned embedded this.value = new kukit.rd.KssPseudoValue(txt, []); @@ -493,8 +544,10 @@ * embedded parser to parse the selector * kss event selector: (has spaces in it) * selector:name(id) +* selector:name(pprov(id)) * kss method selector: (has no spaces in it) * document:name(id) or behaviour:name(id) +* document:name(pprov(id)) or behaviour:name(pprov(id)) */ kukit.kssp.KssSelector = kukit.tk.mkParser('kssselector', { ":": '[new kukit.kssp.colon(this.src), new kukit.kssp.PropValueInPseudo(this.src)]', @@ -551,10 +604,6 @@ ;;; kukit.E = 'Kss event selector must have a one-word name after the colon'; this.emitError(kukit.E); } - if (pseudotoken.value.args.length > 1) { - ;;; kukit.E = 'Kss pseudo value must not have more then one parameters'; - this.emitError(kukit.E); - } css = this.src.text.substring(this.startpos, commatoken.startpos); //print ('>>' + css + ':' + pseudotoken.value.methodname); // Decide if we have an event or a method selector. @@ -570,8 +619,14 @@ } // create the selector. var id = null; - if (pseudotoken.value.args.length == 1) { - id = pseudotoken.value.args[0]; + var ppid = null; + // XXX I think this could be simplified. + if (pseudotoken.value.arg.isMethod) { + // we have a param provider here. Just store. + ppid = pseudotoken.value.arg; + } else { + // just an id. Express in txt. + id = pseudotoken.value.arg.txt; } var name = pseudotoken.value.methodname; var splitname = name.split('-'); @@ -585,7 +640,7 @@ } // Protect the error for better logging ;;; try { - this.kssSelector = new kukit.rd.KssSelector(isEvent, css, name, namespace, id); + this.kssSelector = new kukit.rd.KssSelector(isEvent, css, name, namespace, id, ppid); ;;; } catch(e) { ;;; if (e.name == 'KssSelectorError') { ;;; // Log the message @@ -631,6 +686,7 @@ ;;; // foolishly, we don't know the position at this point ;;; throw new kukit.err.tk.ParsingError('Undefined event name="' + rule.kss_selector.name + '", namespace="' + rule.kss_selector.namespace + '"'); ;;; } + rule.kss_selector.evalId(); // XXX XXX XXX kukit.engine.rules.push(rule); } }; Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js ============================================================================== --- kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js (original) +++ kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js Sat Jul 7 00:20:40 2007 @@ -41,7 +41,7 @@ /* * class KssSelector */ -kukit.rd.KssSelector = function(isEvent, css, name, namespace, id) { +kukit.rd.KssSelector = function(isEvent, css, name, namespace, id, ppid) { this.isEventSelector = isEvent; this.isMethodSelector = ! isEvent; if (! name) { @@ -67,18 +67,24 @@ this.namespace = namespace; this.classname = null; this.id = id; + this.ppid = ppid; }; kukit.rd.KssSelector.prototype.setIdAndClass = function() { // Sets up id and class on the selector, based on registration info this.classname = kukit.eventsGlobalRegistry.get(this.namespace, this.name).classname; - if (this.id == null) { - // singleton for class - this.id = kukit.rd.makeId(this.namespace, this.classname); - } - // Also set the merge id. The rules with the same merge - // id should be merged on the same node. - this.mergeid = kukit.rd.makeMergeId(this.id, this.namespace, this.name); +}; + +kukit.rd.KssSelector.prototype.evalId = function() { + if (this.ppid == null) { + if (this.id == null && this.ppid == null) { + // singleton for class + this.id = kukit.rd.makeId(this.namespace, this.classname); + } + // Also set the merge id. The rules with the same merge + // id should be merged on the same node. + this.mergeid = kukit.rd.makeMergeId(this.id, this.namespace, this.name); + } }; /* @@ -135,11 +141,14 @@ /* * class KssPseudoValue */ -kukit.rd.KssPseudoValue = function(methodname, args) { +kukit.rd.KssPseudoValue = function(methodname, arg) { // A method parameter in the format // methodname(v1) + // can be also: + // methodname(methodname2(v2)) + // in both cases, arg is KssTextValue, or KssMethodValue this.methodname = methodname; - this.args = args; + this.arg = arg; }; kukit.rd.KssPseudoValue.prototype.isMethod = true; kukit.rd.KssPseudoValue.prototype.check = function() { Modified: kukit/kukit.js/branch/ree-binding-improvements/tests/test_kssparser.js ============================================================================== --- kukit/kukit.js/branch/ree-binding-improvements/tests/test_kssparser.js (original) +++ kukit/kukit.js/branch/ree-binding-improvements/tests/test_kssparser.js Sat Jul 7 00:20:40 2007 @@ -1,8 +1,7 @@ /* -* Copyright (c) 2005-2006 -* Authors: -* Martin Heidegger -* Balazs Ree +* Copyright (c) 2005-2007 +* Authors: KSS Project Contributors (see docs/CREDITS.txt) +* Martin Heidegger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as published @@ -218,7 +217,7 @@ }; this.testPropValueInPseudo = function() { - // Parsing prop values in pseudo (no methods allowed) + // Parsing prop values in pseudo (now methods allowed too) var txt= "b"; var src = new kukit.tk.Cursor(txt); @@ -256,7 +255,8 @@ parser = new kukit.kssp.PropValueInPseudo(src, null, true); this.assertEquals(parser.finished, true); this.assertEquals(parser.value.methodname, 'click'); - this.assertListEquals(parser.value.args, ['x']); + this.assertEquals(parser.value.arg.isMethod, false); + this.assertEquals(parser.value.arg.txt, 'x'); // more then 1 args not ok (but we check it only from kss selector) //txt= "drag(x, y)"; @@ -268,6 +268,25 @@ //this.assertParsingError(kukit.kssp.PropValueInPseudo, src, null, true, // 'Excess characters after the property value', 16); + + // methods ok + txt= "click(kssAttr(x))"; + src = new kukit.tk.Cursor(txt); + parser = new kukit.kssp.PropValueInPseudo(src, null, true); + this.assertEquals(parser.finished, true); + this.assertEquals(parser.value.methodname, 'click'); + this.assertEquals(parser.value.arg.isMethod, true); + this.assertEquals(parser.value.arg.methodname, 'kssAttr'); + this.assertListEquals(parser.value.arg.args, ['x']); + + // no more values in the method + txt= "click(kssAttr(x), aaa)"; + src = new kukit.tk.Cursor(txt); + this.assertParsingError(kukit.kssp.PropValueInPseudo, src, null, true, + 'Excess characters before the closing parenthesis. Only one parameter is allowed.', 000); + + // XXX add more failing cases, maybe? + }; this.testMethodArgs = function() { @@ -397,7 +416,7 @@ txt= "a:drop('hello', bello)"; src = new kukit.tk.Cursor(txt); this.assertParsingError(kukit.kssp.KssSelector, src, null, true, - 'Kss pseudo value must not have more then one parameters', 22); + 'Excess characters before the closing parenthesis. Only one parameter is allowed.', 000); // zero params: not std css but tolerated txt= "a:drop()"; @@ -452,23 +471,24 @@ 'Kss event selector must end with an event qualifier :event or :event(id)', 20); // Spaces in the end - txt= " a:lang(hu, uh) b:click "; + ///txt= " a:lang(hu, uh) b:click "; // XXX not supported + txt= " a:lang(hu-uh) b:click "; src = new kukit.tk.Cursor(txt); parser = new kukit.kssp.KssSelector(src, null, true); this.assertEquals(parser.finished, true); this.assertEquals(parser.kssSelector.isEventSelector, true); - this.assertEquals(parser.kssSelector.css, " a:lang(hu, uh) b"); + this.assertEquals(parser.kssSelector.css, " a:lang(hu-uh) b"); this.assertEquals(parser.kssSelector.name, 'click'); this.assertEquals(parser.kssSelector.namespace, null); this.assertEquals(parser.kssSelector.id, null); // Comment in the end - txt= " a:lang(hu, uh) b:click/*comment here*/"; + txt= " a:lang(hu-uh) b:click/*comment here*/"; src = new kukit.tk.Cursor(txt); parser = new kukit.kssp.KssSelector(src, null, true); this.assertEquals(parser.finished, true); this.assertEquals(parser.kssSelector.isEventSelector, true); - this.assertEquals(parser.kssSelector.css, " a:lang(hu, uh) b"); + this.assertEquals(parser.kssSelector.css, " a:lang(hu-uh) b"); this.assertEquals(parser.kssSelector.name, 'click'); this.assertEquals(parser.kssSelector.namespace, null); this.assertEquals(parser.kssSelector.id, null); @@ -572,6 +592,38 @@ this.assertEquals(parser.kssSelector.namespace, null); this.assertEquals(parser.kssSelector.id, 'hello'); + // Param providers within the event identification + + var txt= "a:drag(kssAttr(hello))"; + var src = new kukit.tk.Cursor(txt); + var parser = new kukit.kssp.KssSelector(src, null, true); + this.assertEquals(parser.finished, true); + this.assertEquals(parser.kssSelector.isEventSelector, true); + this.assertEquals(parser.kssSelector.css, 'a'); + this.assertEquals(parser.kssSelector.name, 'drag'); + this.assertEquals(parser.kssSelector.namespace, null); + this.assertEquals(parser.kssSelector.id, null); + this.assertEquals(parser.kssSelector.ppid.methodname, 'kssAttr'); + this.assertListEquals(parser.kssSelector.ppid.args, ['hello']); + + var txt= "a:drag(kssAttr(hello, true ))"; + var src = new kukit.tk.Cursor(txt); + var parser = new kukit.kssp.KssSelector(src, null, true); + this.assertEquals(parser.finished, true); + this.assertEquals(parser.kssSelector.isEventSelector, true); + this.assertEquals(parser.kssSelector.css, 'a'); + this.assertEquals(parser.kssSelector.name, 'drag'); + this.assertEquals(parser.kssSelector.namespace, null); + this.assertEquals(parser.kssSelector.id, null); + this.assertEquals(parser.kssSelector.ppid.methodname, 'kssAttr'); + this.assertListEquals(parser.kssSelector.ppid.args, ['hello', 'true']); + + var txt= "a:drag(kssAttr(hello), xxx)"; + var src = new kukit.tk.Cursor(txt); + this.assertParsingError(kukit.kssp.KssSelector, src, null, true, + 'Excess characters before the closing parenthesis. Only one parameter is allowed.', 000); + + } this.testEmptyDoc = function() { @@ -651,6 +703,9 @@ +'setStyle-kssSelector: "#button_4";\n' +'setStyle-name: backgroundColor;\n' +'setStyle-value: #FFa0a0;\n' + +'}\n' + +"#button-one:annoyClicker-click(kssAttr(widannoy)) {\n" + +" action-client: alert;\n" +"}\n"; var src = new kukit.tk.Cursor(txt); @@ -659,13 +714,13 @@ var parser = new kukit.kssp.Document(src, null, true); this.assertEquals(parser.finished, true); - this.assertEquals(parser.eventRules.length, 12); + this.assertEquals(parser.eventRules.length, 13); var rule; var action; // rule 0 // #calendar-previous a:click { - // kss-action : kukitresponse/kukitGetPreviousMonth; + // action-server : kukitresponse/kukitGetPreviousMonth; // } rule = parser.eventRules[0]; this.assertDictEquals(rule.parms, {}); @@ -684,7 +739,7 @@ // div#update-area:timeout { // evt-timeout-delay: 2000; // effect: fade; - // kss-action: getCurrentTime; + // action-server: getCurrentTime; // } rule = parser.eventRules[1]; this.assertDictEquals(rule.parms, {'delay': '2000'}); @@ -703,7 +758,7 @@ // rule 2 // #calendar-previous a:click { - // kss-action : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/; + // action-server : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/; // } rule = parser.eventRules[2]; this.assertDictEquals(rule.parms, {}); @@ -720,7 +775,7 @@ // rule 3 // #calendar-previous a:click { - // kss-action : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/; + // action-server : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/; // member: formVar(edit, 'f_member'); // } rule = parser.eventRules[3]; @@ -740,7 +795,7 @@ // rule 4 // #calendar-previous a:dnd-drag(shelve) { - // kss-action : whatever + // action-server : whatever // } rule = parser.eventRules[4]; this.assertDictEquals(rule.parms, {}); @@ -758,7 +813,7 @@ // rule 5 //#button-one:annoyClicker-click(annoyMe) { - // kss-action: clickedButton; + // action-server: clickedButton; // id: nodeAttr(id); //} rule = parser.eventRules[5]; @@ -778,7 +833,7 @@ // rule 6 // document:annoy(annoyMe) { - // kss-action: alert; + // action-client: alert; // message: "You are an idiot! Ha ha ha. (But just keep on trying...)"; //} rule = parser.eventRules[6]; @@ -798,8 +853,7 @@ // rule 7 // document:annoyClicker-annoy(annoyMe) { - // annoy#annoy-me { - // kss-action: alert; + // action-client: alert; // message: "You are an idiot! Ha ha ha. (But just keep on trying...)"; //} rule = parser.eventRules[7]; @@ -887,7 +941,7 @@ 'kssSelector': new kukit.rd.KssMethodValue('htmlid', ['button_2']) }); - // rule 10 + // rule 11 //#button_3:click { // action-client: setStyle; // setStyle-kssSelector: "#button_4"; @@ -913,8 +967,27 @@ 'kssSelector': new kukit.rd.KssTextValue('#button_4') }); + // rule 12 + // #button-one:annoyClicker-click(kssAttr(widannoy)) {\n" + // action-client: alert; + //} + rule = parser.eventRules[12]; + this.assertDictEquals(rule.parms, {}); + this.assertEquals(rule.kss_selector.css, '#button-one'); + this.assertEquals(rule.kss_selector.isEventSelector, true); + this.assertEquals(rule.kss_selector.name, 'click'); + this.assertEquals(rule.kss_selector.namespace, 'annoyClicker'); + this.assertEquals(rule.kss_selector.id, null); + this.assertEquals(rule.kss_selector.ppid.methodname, 'kssAttr'); + this.assertListEquals(rule.kss_selector.ppid.args, ['widannoy']); + action = rule.actions.content['alert']; + this.assertEquals(action.type, 'C'); + this.assertEquals(action.name, 'alert'); + this.assertEquals(action.error, null); + this.assertKssParmEquals(action.parms, { + }); - + }; }; From jvloothuis at codespeak.net Sat Jul 7 00:39:41 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Sat, 7 Jul 2007 00:39:41 +0200 (CEST) Subject: [KSS-checkins] r44815 - in kukit/kukit.js/branch/parentnode-improvements: . kukit Message-ID: <20070706223941.BA9CB818E@code0.codespeak.net> Author: jvloothuis Date: Sat Jul 7 00:39:40 2007 New Revision: 44815 Added: kukit/kukit.js/branch/parentnode-improvements/ - copied from r44767, kukit/kukit.js/trunk/ kukit/kukit.js/branch/parentnode-improvements/kukit/ - copied from r44769, kukit/kukit.js/trunk/kukit/ kukit/kukit.js/branch/parentnode-improvements/kukit/forms.js - copied unchanged from r44778, kukit/kukit.js/trunk/kukit/forms.js kukit/kukit.js/branch/parentnode-improvements/kukit/selectorreg.js - copied unchanged from r44770, kukit/kukit.js/trunk/kukit/selectorreg.js Log: Made a branch before reverting on trunk From jvloothuis at codespeak.net Sat Jul 7 00:41:44 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Sat, 7 Jul 2007 00:41:44 +0200 (CEST) Subject: [KSS-checkins] r44816 - kukit/kukit.js/trunk/kukit Message-ID: <20070706224144.78DF8818E@code0.codespeak.net> Author: jvloothuis Date: Sat Jul 7 00:41:43 2007 New Revision: 44816 Modified: kukit/kukit.js/trunk/kukit/selectorreg.js Log: Reverted extra feature for parentnode selecting surrounding nodes Modified: kukit/kukit.js/trunk/kukit/selectorreg.js ============================================================================== --- kukit/kukit.js/trunk/kukit/selectorreg.js (original) +++ kukit/kukit.js/trunk/kukit/selectorreg.js Sat Jul 7 00:41:43 2007 @@ -149,64 +149,28 @@ return nodes; }); -// Return a list of all nodes that match the css expression in the -// parent chain This selector can also return surrounding nodes by -// passing in an expression with a "%" in it. +// Return a list of all nodes that match the css expression in the parent chain kukit.selectorTypesGlobalRegistry.register('parentnode', function(expr, node) { - var expressions = expr.split('%'); - - ;;; if (expressions.length > 2) { - ;;; throw 'Only one "%" allowed in parentnode selector: "' + expr + '"'; - ;;; } - - function parentnodes(node){ - var nodes = []; - var parentnode = node; - while(parentnode.parentNode) { - nodes.push(parentnode); - parentnode = parentnode.parentNode; - } - return nodes; - } - - function filternode(allowed, node){ - for(var i=0; i Author: reebalazs Date: Sat Jul 7 03:23:34 2007 New Revision: 44818 Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js Log: Implement event binding based on the ids fetched dynamically from the dom Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js ============================================================================== --- kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js (original) +++ kukit/kukit.js/branch/ree-binding-improvements/kukit/kssparser.js Sat Jul 7 03:23:34 2007 @@ -624,6 +624,8 @@ if (pseudotoken.value.arg.isMethod) { // we have a param provider here. Just store. ppid = pseudotoken.value.arg; + // Check its syntax too. + ppid.check(kukit.pprovidersGlobalRegistry); } else { // just an id. Express in txt. id = pseudotoken.value.arg.txt; Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js ============================================================================== --- kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js (original) +++ kukit/kukit.js/branch/ree-binding-improvements/kukit/resourcedata.js Sat Jul 7 03:23:34 2007 @@ -61,6 +61,9 @@ ;;; if (css != 'document' && css != 'behaviour') { ;;; throw new kukit.err.rd.KssSelectorError('KssSpecialSelector "' + name + '" must have one of the allowed names'); ;;; } + ;;; if (ppid) { + ;;; throw new kukit.err.rd.KssSelectorError('KssSpecialSelector "' + name + '" must not stand with an event id acquired by parameter provider (' + ppid.methodname + ')'); + ;;; } ;;; } this.css = css; this.name = name; @@ -87,6 +90,42 @@ } }; +kukit.rd.KssSelector.prototype.getId = function(node) { + // Gives the id depending on a node. + if (this.id) { + // Statically set. + return this.id; + } else { + // Evaluate it. + var id = this.ppid.pprovider.eval(this.ppid.args, node, {}); + // check that the id is not empty or null! + if (! id) { + ;;; var namestr; + ;;; if (this.namespace) { + ;;; namestr = this.namespace + '-' + this.name; + ;;; } else { + ;;; namestr = this.name; + ;;; } + ;;; kukit.E = 'Did not get a valid state id, when evaluated the pprovider "' + this.ppid.methodname + '"'; + ;;; kukit.E += ' in kss selector "' + namestr + '" css="' + this.css + '"'; + throw kukit.E; + } + return id; + } +}; + +kukit.rd.KssSelector.prototype.getMergeId = function(node) { + // Gives the merge id depending on a node. + if (this.mergeid) { + // Statically set. + return this.mergeid; + } else { + // Evaluate it. + var id = this.getId(node); + this.mergeid = kukit.rd.makeMergeId(id, this.namespace, this.name); + } +}; + /* * Kss parameter values. There are two kinds: text and method. * @@ -214,9 +253,11 @@ } }; -kukit.rd.EventRule.prototype.getBinderInfo = function() { +kukit.rd.EventRule.prototype.getBinderInfo = function(node) { + // Figure out what will be the "state id" for the kss event rule. + var id = this.kss_selector.getId(node); // Gets the event instance for the rule. - return kukit.engine.binderInfoRegistry.getOrCreateBinderInfo(this.kss_selector.id, this.kss_selector.classname, + return kukit.engine.binderInfoRegistry.getOrCreateBinderInfo(id, this.kss_selector.classname, this.kss_selector.namespace); }; @@ -234,7 +275,7 @@ kukit.rd.EventRule.prototype.bind = function(node) { // Creation of the binding oper var oper = new kukit.op.Oper(); - var binderinfo = this.getBinderInfo(); + var binderinfo = this.getBinderInfo(node); oper.node = node; oper.eventrule = this; oper.binderinstance = binderinfo.binderinstance; @@ -271,9 +312,6 @@ ;;; if (this.kss_selector.id != other.kss_selector.id) { ;;; throw "Differing kss selector ids in event rule merge"; ;;; } - ;;; if (this.kss_selector.classname != other.kss_selector.classname) { - ;;; throw "Differing kss selector classes in event rule merge"; - ;;; } ;;; } ;;; if (this.kss_selector.name != other.kss_selector.name) { ;;; throw "Differing kss selector names in event rule merge"; @@ -288,7 +326,7 @@ ;;; kukit.logDebug('Merged rule ' + this.mergednr + ' mergeid ' + this.kss_selector.mergeid); }; -kukit.rd.EventRule.prototype.mergeIntoDict = function(dict, key, eventrule) { +kukit.rd.EventRule.prototype.mergeIntoDict = function(dict, key) { // Merge into the given dictionary by given key. // If possible, store the genuine rule first - if not, // clone it and do a merge. Never destroy the genuine @@ -296,7 +334,7 @@ var mergedrule = dict[key]; if (typeof(mergedrule) == 'undefined') { // there was no rule - dict[key] = eventrule; + dict[key] = this; } else { // we have to merge the rule if (! mergedrule.isMerged()) { @@ -304,7 +342,7 @@ mergedrule = mergedrule.cloneForMerge(); dict[key] = mergedrule; } - mergedrule.merge(eventrule); + mergedrule.merge(this); } }; @@ -601,7 +639,7 @@ this.nodes[nodehash] = nodeval; } // Merge into the dict - eventrule.mergeIntoDict(nodeval.val, eventrule.kss_selector.mergeid, eventrule); + eventrule.mergeIntoDict(nodeval.val, eventrule.kss_selector.getMergeId(node)); }; kukit.rd.RuleTable.prototype.bindall = function(phase) { @@ -669,7 +707,8 @@ ;;; throw 'Unknown method rule category "' + category + '"'; ;;; } // Merge into the corresponding category - eventrule.mergeIntoDict(dict, eventrule.kss_selector.mergeid, eventrule); + // mergeid must be set on kss selector already. + eventrule.mergeIntoDict(dict, eventrule.kss_selector.getMergeId()); }; kukit.rd.MethodTable.prototype.getMergedRule = function(category, name, binderinstance) { From jvloothuis at codespeak.net Sat Jul 7 13:31:10 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Sat, 7 Jul 2007 13:31:10 +0200 (CEST) Subject: [KSS-checkins] r44823 - kukit/euro-python-2007 Message-ID: <20070707113110.C8F0C8197@code0.codespeak.net> Author: jvloothuis Date: Sat Jul 7 13:31:09 2007 New Revision: 44823 Modified: kukit/euro-python-2007/demo.kss kukit/euro-python-2007/example-plugin.html kukit/euro-python-2007/goals-of-kss.html kukit/euro-python-2007/kss-presentation.css kukit/euro-python-2007/kss-protocol.html kukit/euro-python-2007/python-integration.html kukit/euro-python-2007/static-demo.html Log: Cleaned up slides further to prepare them for the presentation Modified: kukit/euro-python-2007/demo.kss ============================================================================== --- kukit/euro-python-2007/demo.kss (original) +++ kukit/euro-python-2007/demo.kss Sat Jul 7 13:31:09 2007 @@ -9,3 +9,8 @@ toggleClass-kssSelector: htmlid(kss-source); toggleClass-classname: hidden; } +#show-html:click{ + action-client: toggleClass; + toggleClass-kssSelector: htmlid(html-source); + toggleClass-classname: hidden; +} Modified: kukit/euro-python-2007/example-plugin.html ============================================================================== --- kukit/euro-python-2007/example-plugin.html (original) +++ kukit/euro-python-2007/example-plugin.html Sat Jul 7 13:31:09 2007 @@ -72,18 +72,7 @@

Server communication example - -
-

An example KSS command in show which alters the style - property of a node. Notice how the plugin is registered using - the command registry API.

- -

You can also see that a command is defined using - Javascript. In this example you can see it is pretty straight - forware to get the arguments and the node on which to - operate.

-
Modified: kukit/euro-python-2007/goals-of-kss.html ============================================================================== --- kukit/euro-python-2007/goals-of-kss.html (original) +++ kukit/euro-python-2007/goals-of-kss.html Sat Jul 7 13:31:09 2007 @@ -42,7 +42,7 @@
-

Goals of the Kinetic Style Sheets system

+

Goals of KSS (Kinetic Style Sheets)

@@ -67,8 +68,10 @@ @kssaction def update_content(self): core = self.getCommandSet('core') - selector = ksscore.getCssSelector('div.content') - core.replaceInnerHTML(selector, 'html data') + selector = ksscore.getCssSelector( + 'div.content') + core.replaceInnerHTML(selector, + 'html data')
Modified: kukit/euro-python-2007/static-demo.html ============================================================================== --- kukit/euro-python-2007/static-demo.html (original) +++ kukit/euro-python-2007/static-demo.html Sat Jul 7 13:31:09 2007 @@ -56,15 +56,20 @@ toggleClass-kssSelector: htmlid(photo); toggleClass-value: hidden; } + + +
Look at the HTML
+ Plugin example From gotcha at codespeak.net Sat Jul 7 15:21:25 2007 From: gotcha at codespeak.net (gotcha at codespeak.net) Date: Sat, 7 Jul 2007 15:21:25 +0200 (CEST) Subject: [KSS-checkins] r44824 - kukit/euro-python-2007 Message-ID: <20070707132125.4113081AD@code0.codespeak.net> Author: gotcha Date: Sat Jul 7 15:21:24 2007 New Revision: 44824 Modified: kukit/euro-python-2007/kss-presentation.css Log: some css suggestions, feel free to do sthing else, I'd like orange to show up though Modified: kukit/euro-python-2007/kss-presentation.css ============================================================================== --- kukit/euro-python-2007/kss-presentation.css (original) +++ kukit/euro-python-2007/kss-presentation.css Sat Jul 7 15:21:24 2007 @@ -38,24 +38,21 @@ /* color */ body { -background:#201; +background-color:#201; /*background-color: #ff4916;*/ -color:#fff; +color:#ff4916; font-size: 110%; -} - -h1 { -color:#200; +font-family: "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif; } p, h2, .button, a { -color:#fff; +color:#ff4916; } pre { background:#402; color:#fff; -padding:5px 20px; +padding: 0.25em 2em; border:2px solid #fff; } @@ -92,37 +89,39 @@ margin: auto; } -.content { -height:100%; -float:left; -margin:0; -padding:0; -padding-left:80px; -} - h1 { display:block; -font-family:sans serif; font-size:200%; line-height:28px; -padding:0px 20px 23px; +padding: 0.25em 2em; width:100%; } h2 { -padding:0px 20px; +padding: 0.25em 2em; font-size:100%; } -p, h2, .button, a { -font-family:sans serif; -padding:5px 20px; +div, p, h2, .button, a { +padding: 0.25em 2em; font-size:1em; cursor:pointer; text-decoration:none; display:block; } +.wrapper { +padding:0; +} + +.content { +height:100%; +float:left; +margin:0; +padding:0; +padding-left:80px; +} + pre { font-family:Courier; font-size:1em; @@ -134,4 +133,4 @@ display: none; } -li { padding: 0.8em; } \ No newline at end of file +li { padding: 0.8em; } From reebalazs at codespeak.net Sat Jul 7 23:03:15 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Sat, 7 Jul 2007 23:03:15 +0200 (CEST) Subject: [KSS-checkins] r44834 - kukit/kukit.js/branch/ree-binding-improvements/kukit Message-ID: <20070707210315.F206981C5@code0.codespeak.net> Author: reebalazs Date: Sat Jul 7 23:03:14 2007 New Revision: 44834 Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/dom.js kukit/kukit.js/branch/ree-binding-improvements/kukit/providerreg.js Log: Added kssWid, kssUwid param providers Modified: kukit/kukit.js/branch/ree-binding-improvements/kukit/dom.js ============================================================================== --- kukit/kukit.js/branch/ree-binding-improvements/kukit/dom.js (original) +++ kukit/kukit.js/branch/ree-binding-improvements/kukit/dom.js Sat Jul 7 23:03:14 2007 @@ -271,11 +271,18 @@ XXX at the moment, deletion can be achieved with setting with a value ''. This is consistent with DOM behaviour as we seem to be getting '' for nonexistent values anyway. + + Also added the ksswid namespace, that has the special purpose + to markup widgets. */ kukit.dom.kssAttrNamespace = 'kssattr'; +kukit.dom.kssWidNamespace = 'ksswid'; -kukit.dom.getKssClassAttribute = function(node, attrname) { +kukit.dom.getKssClassAttribute = function(node, attrname, attrnamespace) { + if (! attrnamespace) { + attrnamespace = kukit.dom.kssAttrNamespace; + } // Gets a given kss attribute from the class var klass = kukit.dom.getAttribute(node, 'class'); var result = null; @@ -284,7 +291,7 @@ for (var i=0; i + * (strict XHTML, mimetype text/xhtml only, ie. not in Plone) + * + * or: + * + *
+ * + * Results from pproviders, if called from inside the widget: + * + * kssWid(atfield) yields "XFZ34" + * + * kssUwid(atfield) yields "widatfield-XFZ34" + * + */ + +kukit.pr.KssWidPP = function() {}; +kukit.pr.KssWidPP.prototype = { + /* + ;;; */ + check: function(args) { + if (args.length != 1) { + throw 'kssWid/kssUwid method needs 1 argument (wclass)'; + } + if (args[0].match(/[ -]/)) { + throw 'wclass parameter in kssWid/kssUwid method cannot contain "-" or space.'; + } + }, + /* + */ + eval: function(args, node) { + var argname = args[0]; + return kukit.dom.getRecursiveAttribute(node, argname, true, kukit.dom.getKssAttribute, kukit.dom.kssWidNamespace); + } +}; +kukit.pprovidersGlobalRegistry.register('kssWid', kukit.pr.KssWidPP); + +kukit.pr.KssUwidPP = function() {}; +kukit.pr.KssUwidPP.prototype = { + /* + ;;; */ + check: kukit.pr.KssWidPP.prototype.check, + /* + */ + eval: function(args, node) { + return 'wid' + args[0] + '-' + kukit.pr.KssWidPP.eval(args, node); + } +}; +kukit.pprovidersGlobalRegistry.register('kssUwid', kukit.pr.KssUwidPP); + From jvloothuis at codespeak.net Mon Jul 9 07:59:54 2007 From: jvloothuis at codespeak.net (jvloothuis at codespeak.net) Date: Mon, 9 Jul 2007 07:59:54 +0200 (CEST) Subject: [KSS-checkins] r44851 - in kukit/KSSPylonsWiki/trunk: . ksspylonswiki/public Message-ID: <20070709055954.8C651820E@code0.codespeak.net> Author: jvloothuis Date: Mon Jul 9 07:59:53 2007 New Revision: 44851 Modified: kukit/KSSPylonsWiki/trunk/development.ini kukit/KSSPylonsWiki/trunk/ksspylonswiki/public/quick.css Log: Update to the css to match the colors of the presentation Modified: kukit/KSSPylonsWiki/trunk/development.ini ============================================================================== --- kukit/KSSPylonsWiki/trunk/development.ini (original) +++ kukit/KSSPylonsWiki/trunk/development.ini Mon Jul 9 07:59:53 2007 @@ -37,3 +37,4 @@ # Debug mode will enable the interactive debugging tool, allowing ANYONE to # execute malicious code after an exception is raised. #set debug = false + Modified: kukit/KSSPylonsWiki/trunk/ksspylonswiki/public/quick.css ============================================================