Introduction to KSS

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Introduction to KSS - Presentation Transcript

      • KSS, Ajax with style
        • Vitaliy Podoba, Developer
        • © Quintagroup, 2008
    1. Table of contents
      • What is it about?
      • Why KSS?
      • KSS. Quick Overview
      • Short KSS Reference
      • Advantages
      • Drawbacks
    2. What is it about?
      • KSS is an Ajax framework that allows UI development without writing any Javascript
      • AJAX? http://www.adaptivepath.com/ideas/essays/archives/000385.php
      • First Ajaxes: Google Suggest Yahoo News
      • KSS – Kinetic Style Sheets
    3. The traditional model vs Ajax model
    4. Why KSS?
      • Preserve from writing Javascript
      • Overcome browser incompatibilities
      • Avoid code duplication
      • Thin browser client
      • No Javascript on the page
      • Provide server side for Zope and Plone
    5. No Javascript on the page
      • <a href=&quot;#&quot;
      • onclick=&quot;javascript:clicked();&quot;>
      • Link</a>
    6. Quick Overview
      • Power of Javascript, syntax of CSS
      • KSS Environment
      • KSS Architecture
      • Kinetic Style Sheets Syntax
      • Server Side
      • Tying it all together
    7. KSS Environment
      • Browser compatibility Firefox Internet Explorer Opera Konqueror Safari Mozilla
      • Supported server platforms Zope 2.10, 2.11 Zope 3 Grok Plone 3.0 Pylons Django
    8. Architecture
    9. KSS Syntax
      • #kss-spinner:spinneron {
      • action-client: setStyle;
      • setStyle-name: display;
      • setStyle-value: block;
      • }
      • #kss-spinner:spinneroff {
      • action-client: setStyle;
      • setStyle-name: display;
      • setStyle-value: none;
      • }
    10. KSS Syntax
      • a:click {
      • action-client: alert;
      • alert-message: &quot;Clicked&quot;;
      • }
    11. KSS Syntax
      • a:click { css selector : event
      • action-client: alert; client action 'alert'
      • alert-message: &quot;Clicked&quot;; parameter for 'alert'
      • }
    12. KSS Syntax
      • a:click {
      • evt-click-preventdefault: true; parameter for event
      • action-client: alert;
      • alert-message: &quot;Clicked&quot;;
      • }
    13. KSS Syntax
      • a:click {
      • evt-click-preventdefault: true;
      • action-client: alert;
      • alert-message: &quot;Clicked&quot;;
      • action-server: add; call server action
      • add-url: nodeAttr('href'); parameter for 'add'
      • }
    14. Server Side
      • kss.core
      • plone.app.kss
    15. Server Side : Template
      • <a href=&quot;some/url&quot; class=&quot;replaceHTML&quot;>Update content</a>
      • <div id=&quot;kss-container&quot;>
      • I need to be updated!
      • </div>
    16. Server Side: KSS
      • a.replaceHTML:click {
      • evt-click-preventdefault: True;
      • action-server: response ;
      • }
    17. Server Side : Script
      • # response.py script
      • # import Through-The-Web(TTW) API
      • from kss.core.ttwapi import startKSSCommands, getKSSCommandSet, renderKSSCommands
      • # start a view for commands
      • startKSSCommands(context, context.REQUEST)
      • # add a command
      • core = getKSSCommandSet('core')
      • core.replaceInnerHTML('#kss-container', '<h1>We did it!</h1>')
      • # render the commands
      • return renderKSSCommands()
    18. Server Side : Response
      • <?xml version=&quot;1.0&quot; ?>
      • <kukit xmlns=&quot;http://www.kukit.org/commands/1.1&quot; xmlns:tal=&quot;http://xml.zope.org/namespaces/tal&quot; xmlns:metal=&quot;http://xml.zope.org/namespaces/metal&quot;>
      • <commands>
      • <command selector=&quot;#kss-container&quot; name=&quot;replaceInnerHTML&quot; selectorType=&quot;&quot;>
      • <param name=&quot;html&quot;><h1>We did it!</h1></param>
      • </command>
      • </commands>
      • </kukit>
    19. Server Side: Browser View
      • from kss.core import KSSView, kssaction
      • class DemoView(KSSView): @kssaction def response(self): core = self.getCommandSet('core') core.replaceInnerHTML('#kss-container',
      • '<h1>We did it!</h1>')
      • demoview.py
    20. Server Side: Browser View
      • <browser:page for=&quot;plone.app.kss.interfaces.IPortalObject&quot; class=&quot;.demoview.DemoView&quot; attribute=&quot;response&quot; name=&quot;response&quot; permission=&quot;zope2.View&quot; />
    21. Server Side: KSS Action
      • a.replaceHTML:click {
      • evt-click-preventdefault: True;
      • action-server: response ;
      • }
    22. Server Side: KSS Action
      • a.replaceHTML:click {
      • evt-click-preventdefault: True;
      • action-server: response ;
      • action-error: alert;
      • alert-message: &quot;Error on server&quot;;
      • }
    23. Tying it all together
      • Write kss source file
      • Register kss source file with portal_kss
      • Write server side
      • Extend kss with your own plugins: client actions command actions parameter providers event types selector types
    24. Short KSS Reference
      • Events
      • Actions
      • Parameter Providers
      • Command Sets
    25. Basic Events
      • click
      • dblclick
      • load
      • focus
      • blur
    26. Mouse Events
      • mousedown
      • mouseup
      • mouseover
      • mouseout
    27. Form Events
      • change
      • select
      • submit
    28. Automatic Events
      • timeout evt-timeout-delay evt-timeout-repeat
    29. Changing HTML Actions
      • replaceInnerHTML
      • insertHTMLAfter
      • deleteNode
    30. Changing Attributes Actions
      • setAttribute
      • setKssAttribute
    31. Form Actions
      • focus
    32. Debugging Actions
      • error
      • log
      • alert
    33. Parameter Providers
      • formVar(formname, varname)
      • currentFormVar(varname)
      • nodeAttr(attrname)
      • nodeContent()
    34. Command Sets
      • core
      • zope
      • plone
      • plone-legacy
      • effects
      • dad...
    35. Advantages
      • See 'Why KSS?' section
      • Work can be easily divided between different specialists
    36. Drawbacks
      • Writing javascript plugins
      • Too many rules can freeze page loading
    37. Links
      • KSS Site http://kssproject.org
      • AJAX http://www.adaptivepath.com/publications/essays/archives/000385.php
      • kss.core repository http://codespeak.net/svn/kukit/kss.core/trunk
      • plone.app.kss repository https://svn.plone.org/svn/plone/plone.app.kss/trunk

    + QuintagroupQuintagroup, 2 years ago

    custom

    1769 views, 1 favs, 3 embeds more stats

    What is it about? Why KSS? KSS: Quick Overview, Sho more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1769
      • 1761 on SlideShare
      • 8 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 28
    Most viewed embeds
    • 4 views on http://plug.org.ua
    • 3 views on http://www.plug.org.ua
    • 1 views on http://talk.quintagroup.com

    more

    All embeds
    • 4 views on http://plug.org.ua
    • 3 views on http://www.plug.org.ua
    • 1 views on http://talk.quintagroup.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories