SlideShare uma empresa Scribd logo
1 de 11
Baixar para ler offline
KSS Techniques
                                    Plone Symposium East 2008




       Author:       Joel Burton <joel@joelburton.com>
       Copyright:    Copyright 2007 Joel Burton. All rights reserved.
       Covering:     Plone 2.5 or newer
       Notice:       Distribution outside of presentation prohibited.
       Company:      PloneBootcamps: www.plonebootcamps.com



Contents
1   KSS Techniques                                                                                                                                                                2
    1.1 Overview . . . . . . . . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   2
        1.1.1 Who Am I? . . . . . . .         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   2
        1.1.2 Overview . . . . . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   2
        1.1.3 Challenges of JavaScript        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   2
        1.1.4 What is KSS? . . . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   3
    1.2 Client-Side . . . . . . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   3
        1.2.1 Simple Message . . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   3
        1.2.2 KSS . . . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   3
        1.2.3 KSS . . . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   3
        1.2.4 KSS . . . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   3
        1.2.5 KSS . . . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   4
        1.2.6 KSS . . . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   4
        1.2.7 Parameter Provider . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   4
        1.2.8 Parameter Provider . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   4
        1.2.9 Registering KSS . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   4
    1.3 Server-Side . . . . . . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
        1.3.1 Server-Side . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
        1.3.2 Book Order Form . . . .         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
        1.3.3 KSS . . . . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
        1.3.4 Script . . . . . . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   5
        1.3.5 Script . . . . . . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
        1.3.6 Script . . . . . . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
        1.3.7 No Submit KSS . . . . .         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   6
        1.3.8 No Submit KSS . . . . .         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   7
        1.3.9 Report Data . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   7
        1.3.10 Book Report . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   7
        1.3.11 Updating in KSS . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   7
        1.3.12 Updating Script . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   8
        1.3.13 Updating Automatically         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   8
        1.3.14 Updating Script . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   8
    1.4 KSS Cheat Sheet . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   8
        1.4.1 Events: Basic . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   8



                                                                  1
1 KSS TECHNIQUES


         1.4.2    Events: Mouse . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
         1.4.3    Events: Form . . . . . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
         1.4.4    Events: Automatic . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
         1.4.5    Actions: Changing HTML . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
         1.4.6    Actions: Attributes . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
         1.4.7    Actions: CSS Classes . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
         1.4.8    Actions: Form Elements . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
         1.4.9    Actions: Debugging . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
         1.4.10   Parameter Providers: Forms .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
         1.4.11   Parameter Providers: Content        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
         1.4.12   Command Sets: Core . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
         1.4.13   Commands Sets: Zope + Plone         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
         1.4.14   Debugging KSS . . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
         1.4.15   Future of KSS . . . . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
         1.4.16   Thanks! . . . . . . . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11




1 KSS Techniques


1.1     Overview


1.1.1   Who Am I?
   • Plone Trainer / Developer
         – Offers training at http://plonebootcamps.com
         – Definitely not a JavaScript expert!



1.1.2   Overview
   • Why KSS?
   • Client-side convenience
   • Server-side power
   • Quick reference guide



1.1.3   Challenges of JavaScript
   • Another language!
   • Browser incompatibilities persist
   • Even when done correctly ...
         – Do it again in Python




                                                          2
1.2 Client-Side                                                      1 KSS TECHNIQUES


1.1.4   What is KSS?
   • “Kinetic Style Sheets”
          – “Power of JS, syntax of CSS”
          – Allows you to declare behavior
          – Includes AJAX library
   • Very powerful, very cool!



1.2     Client-Side


1.2.1   Simple Message
        <form>                            Show button
          <input type="submit" id="logButton" name="log"
               value="Show Message" />
        </form>

        <fieldset>                        Show message
          <legend>Message:</legend>
          <p id="message"
              tal:condition="exists: request/log">Clicked (non-KSS)</p>
        </fieldset>



1.2.2   KSS
        #logButton:click {
          action-client: alert;
          alert-message: "Clicked!";
        }



1.2.3   KSS
        #logButton:click {               Identifer & event
          action-client: alert;          Client action: alert
          alert-message: "Clicked!";     Parameters for alert
        }



1.2.4   KSS
        #logButton:click {
          action-client: replaceInnerHTML;               Action
          replaceInnerHTML-kssSelector: "#message";      Where
          replaceInnerHTML-html: "Clicked (via KSS)";
        }




                                                3
1.2 Client-Side                                                          1 KSS TECHNIQUES


1.2.5   KSS
        #logButton:click {
          action-client: replaceInnerHTML;                  Action
          replaceInnerHTML-kssSelector: "#message";         Where
          replaceInnerHTML-html: "Clicked (via KSS)";
        }
        <p id="message">Clicked (non-KSS)</p>



1.2.6   KSS
        #logButton:click {
          evt-click-preventdefault: True;        Don’t do normal thing

            action-client: replaceInnerHTML;
            replaceInnerHTML-kssSelector: "#message";
            replaceInnerHTML-html: "Clicked (via KSS)";
        }



1.2.7   Parameter Provider
        #logButton:click {
          evt-click-preventdefault: True;        Don’t do normal thing

            action-client: replaceInnerHTML;
            replaceInnerHTML-kssSelector: currentFormVar(’note’);
            replaceInnerHTML-html: "Clicked (via KSS)";
        }



1.2.8   Parameter Provider
        #logButton:click {
          evt-click-preventdefault: True;        Don’t do normal thing

            action-client: replaceInnerHTML;
            replaceInnerHTML-kssSelector: currentFormVar(’note’);
            replaceInnerHTML-html: "Clicked (via KSS)";
        }
        <input type="text" name="note" />



1.2.9   Registering KSS
   • Add your KSS file name to portal_kss
            – Just like portal_css
            – Put into debug mode to avoid cache problems




                                                  4
1.3 Server-Side                                                        1 KSS TECHNIQUES


1.3     Server-Side


1.3.1   Server-Side
   • Call server-side scripts via AJAX

            – Get results without page refresh
                ∗ Can show results
                ∗ Log them
                ∗ Do side-actions, etc.



1.3.2   Book Order Form
        <form action="order_form">

            <input type="text" id="numcopies" name="numcopies"
                tal:attributes="value numCopies" />

            copies of <b>Mega Plone Development</b> at $19.99 =

            <span id="total" tal:content="cost">[cost]</span>

            <input type="submit" id="updateButton" value="Update" />

        </form>



1.3.3   KSS
        #updateButton:click {
          evt-click-preventdefault: True;            Skip regular

            action-server: kssOrderCalculate;        Call script
            kssOrderCalculate-qty:
                currentFormVar(’numcopies’);         Pass #
        }



1.3.4   Script
   • orderCalculate.py (PythonScript):

              qty = int(qty)
              return qty * 19.99




                                                 5
1.3 Server-Side                                                        1 KSS TECHNIQUES


1.3.5   Script
   • kssOrderCalculate.py (PythonScript):

            from kss.core.ttwapi import (
                startKSSCommands,
                getKSSCommandSet,
                renderKSSCommands )

            startKSSCommands(context, context.REQUEST)
            core = getKSSCommandSet(’core’)

            answer = str(context.orderCalculate(qty))

            core.replaceInnerHTML(’#total’, answer)

            return renderKSSCommands()



1.3.6   Script
   • kssOrderCalculate.py (PythonScript):

            from kss.core.ttwapi import (                boilerplate
                startKSSCommands,
                getKSSCommandSet,
                renderKSSCommands )

            startKSSCommands(context, context.REQUEST) boilerplate
            core = getKSSCommandSet(’core’)

            answer = str(context.orderCalculate(qty))    get answer

            core.replaceInnerHTML(’#total’, answer)      replace

            return renderKSSCommands()                   boilerplate



1.3.7   No Submit KSS
        #updateButton:load {
          action-client: deleteNode;
        }

        #numcopies:change {
          action-server: kssOrderCalculate;
          kssOrderCalculate-qty: currentFormVar(’numcopies’);
        }




                                             6
1.3 Server-Side                                                       1 KSS TECHNIQUES


1.3.8    No Submit KSS
         #updateButton:load {                Get rid of button
           action-client: deleteNode;
         }

         #numcopies:change {               Update on change
           action-server: kssOrderCalculate;
           kssOrderCalculate-qty: currentFormVar(’numcopies’);
         }



1.3.9    Report Data
         def getSalesData(self):

             qty = random.randint(1,20)
             total = qty * 19.99

             return [{
                 ’id’:’mpd’,
                 ’title’:’Mega Plone Development’,
                 ’qty’: qty,
                 ’total’: total
             }]



1.3.10       Book Report
         <tr tal:repeat="book books">
           <td class="title"
               tal:attributes="id string:${book/id}-title"
               tal:content="book/title"></td>
           <td class="qty"
               tal:attributes="id string:${book/id}-qty"
               tal:content="book/qty"></td>
           <td class="cost"
               tal:attributes="id string:${book/id}-cost"
               tal:content="book/total"></td>
         </tr>



1.3.11       Updating in KSS
         #salesUpdate:click {
           evt-click-preventdefault: True;      Skip regular

             action-server: kssUpdateBook;      Call script
             kssUpdateBook-bookid: "mpd";       Pass book to update
         }




                                                7
1.4 KSS Cheat Sheet                                                     1 KSS TECHNIQUES


1.3.12    Updating Script
         class KSSSalesReport(PloneKSSView):     Simplifies our work
           @kssaction                            By doing boilerplate
           def __call__(self, bookid):

             qty = random.randint(21,40)
             total = qty * 19.99

             core = self.getCommandSet(’core’)
             core.replaceInnerHTML(’#%s-qty’ % bookid, str(qty))
             core.replaceInnerHTML(’#%s-cost’ % bookid, str(total))



1.3.13    Updating Automatically
         #salesUpdate:load {               Get rid of button
           action-client: deleteNode;
         }

         #sales:timeout {               Refresh every 2 secs
           evt-timeout-delay:    2000;
           action-server:        kssUpdateBook;
           kssUpdateBook-bookid: "mpd";
         }



1.3.14    Updating Script
         class KSSSalesReport(PloneKSSView):
           @kssaction
           def __call__(self, bookid):

             qty = random.randint(21,40)
             total = qty * 19.99

             core = self.getCommandSet(’core’)
             core.replaceInnerHTML(’#%s-qty’ % bookid, str(qty))
             core.replaceInnerHTML(’#%s-cost’ % bookid, str(total))




1.4      KSS Cheat Sheet


1.4.1    Events: Basic
   • click

   • dblclick

   • load : Done on page load




                                                 8
1.4 KSS Cheat Sheet                                                         1 KSS TECHNIQUES


         – Useful for hiding stuff when KSS active



1.4.2   Events: Mouse
   • mousedown, mouseup
   • mouseover, mouseout



1.4.3   Events: Form
   • blur : leaving a field
   • focus : entering a field
   • change : field value changes
   • select : trigger when drop-down changes
   • submit : on form submission



1.4.4   Events: Automatic
   • timeout : done automatically after expiration
         – evt-timeout-delay : period in milliseconds
         – evt-timeout-repeat : (default true)



1.4.5   Actions: Changing HTML
   • replaceInnerHTML : Replace all children of the given node with the given content.
         – html: the html to insert
   • insertHTMLAfter : Add HTML after given node.
         – html: the html to insert
   • deleteNode : Delete the node.



1.4.6   Actions: Attributes
   • setAttribute : Sets a given HTML attribute of the node.
         – name: the attribute name.
         – value: the attribute value to set
   • setStyle : Sets a given style element on the node.
         – name: the name of the style element.
         – value: the style element value to set




                                                    9
1.4 KSS Cheat Sheet                                                              1 KSS TECHNIQUES


1.4.7    Actions: CSS Classes
   • addClass : Add a class to the classes of the node.

          – value: the name of the class

   • removeClass : Remove a class from the classes of the node.
          – value: the name of the class

   • toggleClass : Toggle class on node.

          – value: the name of the class



1.4.8    Actions: Form Elements
   • focus : Focus the given node that is a form input.



1.4.9    Actions: Debugging
   • error : Throws an exception, when executed.

   • log : Logs an informational message.

          – message

   • alert : Javascript alert box.

          – message



1.4.10    Parameter Providers: Forms
   • formVar(formname, varname)

          – Produces the value of a given variable within a given form.

   • currentFormVar(varname)

          – Produces the value of a given variable within the current form.



1.4.11    Parameter Providers: Content
   • nodeAttr(attrname)

          – Produces the value of a given html attribute of the selected node.

   • nodeContent()

          – Produces the textual content of the node. Newlines are converted to spaces.




                                                   10
1.4 KSS Cheat Sheet                                            1 KSS TECHNIQUES


1.4.12   Command Sets: Core
   • Commands are things used by scripts

   • core command set are the same as the “actions”

         – setAttribute, addClass, etc.



1.4.13   Commands Sets: Zope + Plone
   • Additional command sets for Zope and Plone specific stuff

         – Refreshing a viewlet
         – Refreshing a portlet
         – ... and more!



1.4.14   Debugging KSS
   • Use Firebug!

         – Turn on portal_javascript debugging
         – Messages come out to Firebug console

   • Try your scripts from URL directly



1.4.15   Future of KSS
   • Other JavaScript libraries

         – For people who want to tinker deeply

   • Possibly non-JS backends?

   • In any event ...

         – ... lots more interactivity!



1.4.16   Thanks!
   • Questions?
   • Handouts at

           http://plonebootcamps.com/resources




                                                  11

Mais conteúdo relacionado

Mais procurados

Cinelerra Video Editing Manual
Cinelerra Video Editing ManualCinelerra Video Editing Manual
Cinelerra Video Editing Manualduquoi
 
Winning noble
Winning nobleWinning noble
Winning noblestryfe10
 
Documentation - LibraryRandom
Documentation - LibraryRandomDocumentation - LibraryRandom
Documentation - LibraryRandomMichel Alves
 
Building a humane CMS for Plone: updated tutorial
Building a humane CMS for Plone: updated tutorialBuilding a humane CMS for Plone: updated tutorial
Building a humane CMS for Plone: updated tutorialVincenzo Barone
 
Symbol from NEM Whitepaper 0.9.6.3
Symbol from NEM Whitepaper 0.9.6.3Symbol from NEM Whitepaper 0.9.6.3
Symbol from NEM Whitepaper 0.9.6.3Alexander Schefer
 
The Eagle The Beautiful Creation of God Ethomology
The Eagle The Beautiful Creation of God EthomologyThe Eagle The Beautiful Creation of God Ethomology
The Eagle The Beautiful Creation of God EthomologySister Lara
 
Cuda toolkit reference manual
Cuda toolkit reference manualCuda toolkit reference manual
Cuda toolkit reference manualPiyush Mittal
 
Concept mapping patient initials, age, gender and admitting d
Concept mapping patient initials, age, gender and admitting dConcept mapping patient initials, age, gender and admitting d
Concept mapping patient initials, age, gender and admitting dARIV4
 
REDI - Resiliency rating
REDI - Resiliency ratingREDI - Resiliency rating
REDI - Resiliency ratingDISSIPATOR
 

Mais procurados (14)

Cinelerra Video Editing Manual
Cinelerra Video Editing ManualCinelerra Video Editing Manual
Cinelerra Video Editing Manual
 
Winning noble
Winning nobleWinning noble
Winning noble
 
Documentation - LibraryRandom
Documentation - LibraryRandomDocumentation - LibraryRandom
Documentation - LibraryRandom
 
Time series
Time seriesTime series
Time series
 
Red hat enterprise_linux-7-system_administrators_guide-en-us
Red hat enterprise_linux-7-system_administrators_guide-en-usRed hat enterprise_linux-7-system_administrators_guide-en-us
Red hat enterprise_linux-7-system_administrators_guide-en-us
 
Building a humane CMS for Plone: updated tutorial
Building a humane CMS for Plone: updated tutorialBuilding a humane CMS for Plone: updated tutorial
Building a humane CMS for Plone: updated tutorial
 
Symbol from NEM Whitepaper 0.9.6.3
Symbol from NEM Whitepaper 0.9.6.3Symbol from NEM Whitepaper 0.9.6.3
Symbol from NEM Whitepaper 0.9.6.3
 
The Eagle The Beautiful Creation of God Ethomology
The Eagle The Beautiful Creation of God EthomologyThe Eagle The Beautiful Creation of God Ethomology
The Eagle The Beautiful Creation of God Ethomology
 
Dsa
DsaDsa
Dsa
 
R Lang
R LangR Lang
R Lang
 
Bash
BashBash
Bash
 
Cuda toolkit reference manual
Cuda toolkit reference manualCuda toolkit reference manual
Cuda toolkit reference manual
 
Concept mapping patient initials, age, gender and admitting d
Concept mapping patient initials, age, gender and admitting dConcept mapping patient initials, age, gender and admitting d
Concept mapping patient initials, age, gender and admitting d
 
REDI - Resiliency rating
REDI - Resiliency ratingREDI - Resiliency rating
REDI - Resiliency rating
 

Destaque

Bfg Ploneconf Oct2008
Bfg Ploneconf Oct2008Bfg Ploneconf Oct2008
Bfg Ploneconf Oct2008Jeffrey Clark
 
DIY Intranet Wiki
DIY Intranet WikiDIY Intranet Wiki
DIY Intranet Wikiguestea9cfd
 
Plone I18n Tutorial - Hanno Schlichting
Plone I18n Tutorial - Hanno SchlichtingPlone I18n Tutorial - Hanno Schlichting
Plone I18n Tutorial - Hanno SchlichtingJeffrey Clark
 
Zpugdc2007 101105081808-phpapp01
Zpugdc2007 101105081808-phpapp01Zpugdc2007 101105081808-phpapp01
Zpugdc2007 101105081808-phpapp01Jeffrey Clark
 

Destaque (9)

Bfg Ploneconf Oct2008
Bfg Ploneconf Oct2008Bfg Ploneconf Oct2008
Bfg Ploneconf Oct2008
 
Kss Extjs
Kss ExtjsKss Extjs
Kss Extjs
 
Top Ten Test
Top Ten TestTop Ten Test
Top Ten Test
 
DIY Intranet Wiki
DIY Intranet WikiDIY Intranet Wiki
DIY Intranet Wiki
 
Plone I18n Tutorial - Hanno Schlichting
Plone I18n Tutorial - Hanno SchlichtingPlone I18n Tutorial - Hanno Schlichting
Plone I18n Tutorial - Hanno Schlichting
 
Simplifying Plone
Simplifying PloneSimplifying Plone
Simplifying Plone
 
Opensourceweblion
OpensourceweblionOpensourceweblion
Opensourceweblion
 
The PSF and You
The PSF and YouThe PSF and You
The PSF and You
 
Zpugdc2007 101105081808-phpapp01
Zpugdc2007 101105081808-phpapp01Zpugdc2007 101105081808-phpapp01
Zpugdc2007 101105081808-phpapp01
 

Semelhante a KSS Techniques - Joel Burton

Motorola air defense mobile 6.1 user guide
Motorola air defense mobile 6.1 user guideMotorola air defense mobile 6.1 user guide
Motorola air defense mobile 6.1 user guideAdvantec Distribution
 
Reverse engineering for_beginners-en
Reverse engineering for_beginners-enReverse engineering for_beginners-en
Reverse engineering for_beginners-enAndri Yabu
 
Creating Scientific Posters
Creating Scientific PostersCreating Scientific Posters
Creating Scientific Postersemphemory
 
Guía de administración de Asterisk
Guía de administración de AsteriskGuía de administración de Asterisk
Guía de administración de AsteriskCef Espinoza
 
Motorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guideMotorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guideAdvantec Distribution
 
Motorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guideMotorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guideAdvantec Distribution
 
Mathematics grade-3-1.1 (4) compressed
Mathematics grade-3-1.1 (4) compressedMathematics grade-3-1.1 (4) compressed
Mathematics grade-3-1.1 (4) compressedBenficious
 
Mathematics grade-3-1.1
Mathematics grade-3-1.1Mathematics grade-3-1.1
Mathematics grade-3-1.1Benficious
 
Ibm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job designIbm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job designdivjeev
 

Semelhante a KSS Techniques - Joel Burton (20)

Networkx 0.99
Networkx 0.99Networkx 0.99
Networkx 0.99
 
Latex2e
Latex2eLatex2e
Latex2e
 
R Ints
R IntsR Ints
R Ints
 
Code Conventions
Code ConventionsCode Conventions
Code Conventions
 
Mi ps
Mi psMi ps
Mi ps
 
LSI_SAS2008_Manual_v100.pdf
LSI_SAS2008_Manual_v100.pdfLSI_SAS2008_Manual_v100.pdf
LSI_SAS2008_Manual_v100.pdf
 
Openstack InstallGuide.pdf
Openstack InstallGuide.pdfOpenstack InstallGuide.pdf
Openstack InstallGuide.pdf
 
Math
MathMath
Math
 
By d ui_styleguide_2012_fp35
By d ui_styleguide_2012_fp35By d ui_styleguide_2012_fp35
By d ui_styleguide_2012_fp35
 
Motorola air defense mobile 6.1 user guide
Motorola air defense mobile 6.1 user guideMotorola air defense mobile 6.1 user guide
Motorola air defense mobile 6.1 user guide
 
Reverse engineering for_beginners-en
Reverse engineering for_beginners-enReverse engineering for_beginners-en
Reverse engineering for_beginners-en
 
Manual doctrine jog
Manual doctrine jogManual doctrine jog
Manual doctrine jog
 
Creating Scientific Posters
Creating Scientific PostersCreating Scientific Posters
Creating Scientific Posters
 
Guía de administración de Asterisk
Guía de administración de AsteriskGuía de administración de Asterisk
Guía de administración de Asterisk
 
Tortoise svn 1.7-en
Tortoise svn 1.7-enTortoise svn 1.7-en
Tortoise svn 1.7-en
 
Motorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guideMotorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guide
 
Motorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guideMotorola ws2000 wireless switch cli reference guide
Motorola ws2000 wireless switch cli reference guide
 
Mathematics grade-3-1.1 (4) compressed
Mathematics grade-3-1.1 (4) compressedMathematics grade-3-1.1 (4) compressed
Mathematics grade-3-1.1 (4) compressed
 
Mathematics grade-3-1.1
Mathematics grade-3-1.1Mathematics grade-3-1.1
Mathematics grade-3-1.1
 
Ibm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job designIbm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job design
 

Mais de Jeffrey Clark

Python memory management_v2
Python memory management_v2Python memory management_v2
Python memory management_v2Jeffrey Clark
 
Jwt with flask slide deck - alan swenson
Jwt with flask   slide deck - alan swensonJwt with flask   slide deck - alan swenson
Jwt with flask slide deck - alan swensonJeffrey Clark
 
Genericmeetupslides 110607190400-phpapp02
Genericmeetupslides 110607190400-phpapp02Genericmeetupslides 110607190400-phpapp02
Genericmeetupslides 110607190400-phpapp02Jeffrey Clark
 
Pyramiddcpythonfeb2013 131006105131-phpapp02
Pyramiddcpythonfeb2013 131006105131-phpapp02Pyramiddcpythonfeb2013 131006105131-phpapp02
Pyramiddcpythonfeb2013 131006105131-phpapp02Jeffrey Clark
 
Zpugdc deformpresentation-100709203803-phpapp01
Zpugdc deformpresentation-100709203803-phpapp01Zpugdc deformpresentation-100709203803-phpapp01
Zpugdc deformpresentation-100709203803-phpapp01Jeffrey Clark
 
Zpugdccherry 101105081729-phpapp01
Zpugdccherry 101105081729-phpapp01Zpugdccherry 101105081729-phpapp01
Zpugdccherry 101105081729-phpapp01Jeffrey Clark
 
Using Grok to Walk Like a Duck - Brandon Craig Rhodes
Using Grok to Walk Like a Duck - Brandon Craig RhodesUsing Grok to Walk Like a Duck - Brandon Craig Rhodes
Using Grok to Walk Like a Duck - Brandon Craig RhodesJeffrey Clark
 
What Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike RobinsonWhat Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike RobinsonJeffrey Clark
 
What Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike RobinsonWhat Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike RobinsonJeffrey Clark
 
Real World Intranets - Joel Burton
Real World Intranets - Joel BurtonReal World Intranets - Joel Burton
Real World Intranets - Joel BurtonJeffrey Clark
 
State Of Zope 3 - Stephan Richter
State Of Zope 3 - Stephan RichterState Of Zope 3 - Stephan Richter
State Of Zope 3 - Stephan RichterJeffrey Clark
 

Mais de Jeffrey Clark (16)

Python memory management_v2
Python memory management_v2Python memory management_v2
Python memory management_v2
 
Python meetup
Python meetupPython meetup
Python meetup
 
Jwt with flask slide deck - alan swenson
Jwt with flask   slide deck - alan swensonJwt with flask   slide deck - alan swenson
Jwt with flask slide deck - alan swenson
 
Genericmeetupslides 110607190400-phpapp02
Genericmeetupslides 110607190400-phpapp02Genericmeetupslides 110607190400-phpapp02
Genericmeetupslides 110607190400-phpapp02
 
Pyramiddcpythonfeb2013 131006105131-phpapp02
Pyramiddcpythonfeb2013 131006105131-phpapp02Pyramiddcpythonfeb2013 131006105131-phpapp02
Pyramiddcpythonfeb2013 131006105131-phpapp02
 
Dc python meetup
Dc python meetupDc python meetup
Dc python meetup
 
Zpugdc deformpresentation-100709203803-phpapp01
Zpugdc deformpresentation-100709203803-phpapp01Zpugdc deformpresentation-100709203803-phpapp01
Zpugdc deformpresentation-100709203803-phpapp01
 
Zpugdccherry 101105081729-phpapp01
Zpugdccherry 101105081729-phpapp01Zpugdccherry 101105081729-phpapp01
Zpugdccherry 101105081729-phpapp01
 
Tornado
TornadoTornado
Tornado
 
Science To Bfg
Science To BfgScience To Bfg
Science To Bfg
 
Using Grok to Walk Like a Duck - Brandon Craig Rhodes
Using Grok to Walk Like a Duck - Brandon Craig RhodesUsing Grok to Walk Like a Duck - Brandon Craig Rhodes
Using Grok to Walk Like a Duck - Brandon Craig Rhodes
 
What Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike RobinsonWhat Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike Robinson
 
What Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike RobinsonWhat Makes A Great Dev Team - Mike Robinson
What Makes A Great Dev Team - Mike Robinson
 
Real World Intranets - Joel Burton
Real World Intranets - Joel BurtonReal World Intranets - Joel Burton
Real World Intranets - Joel Burton
 
State Of Zope 3 - Stephan Richter
State Of Zope 3 - Stephan RichterState Of Zope 3 - Stephan Richter
State Of Zope 3 - Stephan Richter
 
Zenoss: Buildout
Zenoss: BuildoutZenoss: Buildout
Zenoss: Buildout
 

Último

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 

Último (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 

KSS Techniques - Joel Burton

  • 1. KSS Techniques Plone Symposium East 2008 Author: Joel Burton <joel@joelburton.com> Copyright: Copyright 2007 Joel Burton. All rights reserved. Covering: Plone 2.5 or newer Notice: Distribution outside of presentation prohibited. Company: PloneBootcamps: www.plonebootcamps.com Contents 1 KSS Techniques 2 1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.1 Who Am I? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.3 Challenges of JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.4 What is KSS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 Client-Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.1 Simple Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.2 KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.3 KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.4 KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.5 KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.6 KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.7 Parameter Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.8 Parameter Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.9 Registering KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3 Server-Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3.1 Server-Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3.2 Book Order Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3.3 KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3.4 Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3.5 Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3.6 Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3.7 No Submit KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3.8 No Submit KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.9 Report Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.10 Book Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.11 Updating in KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3.12 Updating Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3.13 Updating Automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3.14 Updating Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4 KSS Cheat Sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.1 Events: Basic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1
  • 2. 1 KSS TECHNIQUES 1.4.2 Events: Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.3 Events: Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.4 Events: Automatic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.5 Actions: Changing HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.6 Actions: Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4.7 Actions: CSS Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.8 Actions: Form Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.9 Actions: Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.10 Parameter Providers: Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.11 Parameter Providers: Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.12 Command Sets: Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4.13 Commands Sets: Zope + Plone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4.14 Debugging KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4.15 Future of KSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4.16 Thanks! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1 KSS Techniques 1.1 Overview 1.1.1 Who Am I? • Plone Trainer / Developer – Offers training at http://plonebootcamps.com – Definitely not a JavaScript expert! 1.1.2 Overview • Why KSS? • Client-side convenience • Server-side power • Quick reference guide 1.1.3 Challenges of JavaScript • Another language! • Browser incompatibilities persist • Even when done correctly ... – Do it again in Python 2
  • 3. 1.2 Client-Side 1 KSS TECHNIQUES 1.1.4 What is KSS? • “Kinetic Style Sheets” – “Power of JS, syntax of CSS” – Allows you to declare behavior – Includes AJAX library • Very powerful, very cool! 1.2 Client-Side 1.2.1 Simple Message <form> Show button <input type="submit" id="logButton" name="log" value="Show Message" /> </form> <fieldset> Show message <legend>Message:</legend> <p id="message" tal:condition="exists: request/log">Clicked (non-KSS)</p> </fieldset> 1.2.2 KSS #logButton:click { action-client: alert; alert-message: "Clicked!"; } 1.2.3 KSS #logButton:click { Identifer & event action-client: alert; Client action: alert alert-message: "Clicked!"; Parameters for alert } 1.2.4 KSS #logButton:click { action-client: replaceInnerHTML; Action replaceInnerHTML-kssSelector: "#message"; Where replaceInnerHTML-html: "Clicked (via KSS)"; } 3
  • 4. 1.2 Client-Side 1 KSS TECHNIQUES 1.2.5 KSS #logButton:click { action-client: replaceInnerHTML; Action replaceInnerHTML-kssSelector: "#message"; Where replaceInnerHTML-html: "Clicked (via KSS)"; } <p id="message">Clicked (non-KSS)</p> 1.2.6 KSS #logButton:click { evt-click-preventdefault: True; Don’t do normal thing action-client: replaceInnerHTML; replaceInnerHTML-kssSelector: "#message"; replaceInnerHTML-html: "Clicked (via KSS)"; } 1.2.7 Parameter Provider #logButton:click { evt-click-preventdefault: True; Don’t do normal thing action-client: replaceInnerHTML; replaceInnerHTML-kssSelector: currentFormVar(’note’); replaceInnerHTML-html: "Clicked (via KSS)"; } 1.2.8 Parameter Provider #logButton:click { evt-click-preventdefault: True; Don’t do normal thing action-client: replaceInnerHTML; replaceInnerHTML-kssSelector: currentFormVar(’note’); replaceInnerHTML-html: "Clicked (via KSS)"; } <input type="text" name="note" /> 1.2.9 Registering KSS • Add your KSS file name to portal_kss – Just like portal_css – Put into debug mode to avoid cache problems 4
  • 5. 1.3 Server-Side 1 KSS TECHNIQUES 1.3 Server-Side 1.3.1 Server-Side • Call server-side scripts via AJAX – Get results without page refresh ∗ Can show results ∗ Log them ∗ Do side-actions, etc. 1.3.2 Book Order Form <form action="order_form"> <input type="text" id="numcopies" name="numcopies" tal:attributes="value numCopies" /> copies of <b>Mega Plone Development</b> at $19.99 = <span id="total" tal:content="cost">[cost]</span> <input type="submit" id="updateButton" value="Update" /> </form> 1.3.3 KSS #updateButton:click { evt-click-preventdefault: True; Skip regular action-server: kssOrderCalculate; Call script kssOrderCalculate-qty: currentFormVar(’numcopies’); Pass # } 1.3.4 Script • orderCalculate.py (PythonScript): qty = int(qty) return qty * 19.99 5
  • 6. 1.3 Server-Side 1 KSS TECHNIQUES 1.3.5 Script • kssOrderCalculate.py (PythonScript): from kss.core.ttwapi import ( startKSSCommands, getKSSCommandSet, renderKSSCommands ) startKSSCommands(context, context.REQUEST) core = getKSSCommandSet(’core’) answer = str(context.orderCalculate(qty)) core.replaceInnerHTML(’#total’, answer) return renderKSSCommands() 1.3.6 Script • kssOrderCalculate.py (PythonScript): from kss.core.ttwapi import ( boilerplate startKSSCommands, getKSSCommandSet, renderKSSCommands ) startKSSCommands(context, context.REQUEST) boilerplate core = getKSSCommandSet(’core’) answer = str(context.orderCalculate(qty)) get answer core.replaceInnerHTML(’#total’, answer) replace return renderKSSCommands() boilerplate 1.3.7 No Submit KSS #updateButton:load { action-client: deleteNode; } #numcopies:change { action-server: kssOrderCalculate; kssOrderCalculate-qty: currentFormVar(’numcopies’); } 6
  • 7. 1.3 Server-Side 1 KSS TECHNIQUES 1.3.8 No Submit KSS #updateButton:load { Get rid of button action-client: deleteNode; } #numcopies:change { Update on change action-server: kssOrderCalculate; kssOrderCalculate-qty: currentFormVar(’numcopies’); } 1.3.9 Report Data def getSalesData(self): qty = random.randint(1,20) total = qty * 19.99 return [{ ’id’:’mpd’, ’title’:’Mega Plone Development’, ’qty’: qty, ’total’: total }] 1.3.10 Book Report <tr tal:repeat="book books"> <td class="title" tal:attributes="id string:${book/id}-title" tal:content="book/title"></td> <td class="qty" tal:attributes="id string:${book/id}-qty" tal:content="book/qty"></td> <td class="cost" tal:attributes="id string:${book/id}-cost" tal:content="book/total"></td> </tr> 1.3.11 Updating in KSS #salesUpdate:click { evt-click-preventdefault: True; Skip regular action-server: kssUpdateBook; Call script kssUpdateBook-bookid: "mpd"; Pass book to update } 7
  • 8. 1.4 KSS Cheat Sheet 1 KSS TECHNIQUES 1.3.12 Updating Script class KSSSalesReport(PloneKSSView): Simplifies our work @kssaction By doing boilerplate def __call__(self, bookid): qty = random.randint(21,40) total = qty * 19.99 core = self.getCommandSet(’core’) core.replaceInnerHTML(’#%s-qty’ % bookid, str(qty)) core.replaceInnerHTML(’#%s-cost’ % bookid, str(total)) 1.3.13 Updating Automatically #salesUpdate:load { Get rid of button action-client: deleteNode; } #sales:timeout { Refresh every 2 secs evt-timeout-delay: 2000; action-server: kssUpdateBook; kssUpdateBook-bookid: "mpd"; } 1.3.14 Updating Script class KSSSalesReport(PloneKSSView): @kssaction def __call__(self, bookid): qty = random.randint(21,40) total = qty * 19.99 core = self.getCommandSet(’core’) core.replaceInnerHTML(’#%s-qty’ % bookid, str(qty)) core.replaceInnerHTML(’#%s-cost’ % bookid, str(total)) 1.4 KSS Cheat Sheet 1.4.1 Events: Basic • click • dblclick • load : Done on page load 8
  • 9. 1.4 KSS Cheat Sheet 1 KSS TECHNIQUES – Useful for hiding stuff when KSS active 1.4.2 Events: Mouse • mousedown, mouseup • mouseover, mouseout 1.4.3 Events: Form • blur : leaving a field • focus : entering a field • change : field value changes • select : trigger when drop-down changes • submit : on form submission 1.4.4 Events: Automatic • timeout : done automatically after expiration – evt-timeout-delay : period in milliseconds – evt-timeout-repeat : (default true) 1.4.5 Actions: Changing HTML • replaceInnerHTML : Replace all children of the given node with the given content. – html: the html to insert • insertHTMLAfter : Add HTML after given node. – html: the html to insert • deleteNode : Delete the node. 1.4.6 Actions: Attributes • setAttribute : Sets a given HTML attribute of the node. – name: the attribute name. – value: the attribute value to set • setStyle : Sets a given style element on the node. – name: the name of the style element. – value: the style element value to set 9
  • 10. 1.4 KSS Cheat Sheet 1 KSS TECHNIQUES 1.4.7 Actions: CSS Classes • addClass : Add a class to the classes of the node. – value: the name of the class • removeClass : Remove a class from the classes of the node. – value: the name of the class • toggleClass : Toggle class on node. – value: the name of the class 1.4.8 Actions: Form Elements • focus : Focus the given node that is a form input. 1.4.9 Actions: Debugging • error : Throws an exception, when executed. • log : Logs an informational message. – message • alert : Javascript alert box. – message 1.4.10 Parameter Providers: Forms • formVar(formname, varname) – Produces the value of a given variable within a given form. • currentFormVar(varname) – Produces the value of a given variable within the current form. 1.4.11 Parameter Providers: Content • nodeAttr(attrname) – Produces the value of a given html attribute of the selected node. • nodeContent() – Produces the textual content of the node. Newlines are converted to spaces. 10
  • 11. 1.4 KSS Cheat Sheet 1 KSS TECHNIQUES 1.4.12 Command Sets: Core • Commands are things used by scripts • core command set are the same as the “actions” – setAttribute, addClass, etc. 1.4.13 Commands Sets: Zope + Plone • Additional command sets for Zope and Plone specific stuff – Refreshing a viewlet – Refreshing a portlet – ... and more! 1.4.14 Debugging KSS • Use Firebug! – Turn on portal_javascript debugging – Messages come out to Firebug console • Try your scripts from URL directly 1.4.15 Future of KSS • Other JavaScript libraries – For people who want to tinker deeply • Possibly non-JS backends? • In any event ... – ... lots more interactivity! 1.4.16 Thanks! • Questions? • Handouts at http://plonebootcamps.com/resources 11