SlideShare a Scribd company logo
1 of 194
Adding Interactivity to
   your Plone Site
    http://bit.ly/plone-interactivity
Me
Me
• Eric Steele
Me
• Eric Steele
 • Programmer @ WebLion
Me
• Eric Steele
 • Programmer @ WebLion
 • Plone Products
Me
• Eric Steele
 • Programmer @ WebLion
 • Plone Products
   • Faculty/Staff Directory
Me
• Eric Steele
 • Programmer @ WebLion
 • Plone Products
   • Faculty/Staff Directory
   • GloWorm
Me
• Eric Steele
 • Programmer @ WebLion
 • Plone Products
   • Faculty/Staff Directory
   • GloWorm
 • Plone 4 release manager
Adding Interactivity to
   your Plone Site
or...
I Suck at JavaScript...
   and So Can You
I Suck at JavaScript...
   and So Can You
          ~
I Suck at JavaScript...
   and So Can You
               ~
 A half-assed guide to interactive
            JavaScript
The Stuff
The Stuff
• The Boring Stuff
  • Resources
The Stuff
• The Boring Stuff   • The Fun Stuff
  • Resources          • KSS
                       • jQuery
Resources
Resources

• JavaScript
• CSS
• KSS
Including JavaScripts
<tal:block metal:fill-slot=quot;javascript_head_slotquot;>
  <script type=quot;text/javascriptquot; src=quot;myscript.jsquot; />
</tal:block>
Including JavaScripts
<tal:block metal:fill-slot=quot;javascript_head_slotquot;>
  <script type=quot;text/javascriptquot; src=quot;myscript.jsquot; />
</tal:block>




• Only need script on one page/template
Including JavaScripts
<tal:block metal:fill-slot=quot;javascript_head_slotquot;>
  <script type=quot;text/javascriptquot; src=quot;myscript.jsquot; />
</tal:block>




• Only need script on one page/template
• Performance isn’t an issue
Resource Registries
Resource Registries
Resource Registries

• Control inclusion, order
Resource Registries

• Control inclusion, order
• Automatic merging, compression
Resource Registries

• Control inclusion, order
• Automatic merging, compression
• Improved cacheability
Generic Setup
                             jsregistry.xml
<?xml version=quot;1.0quot;?>
<object name=quot;portal_javascriptsquot;>

 <javascript cacheable=quot;Truequot; compression=quot;safequot; cookable=quot;Truequot;
enabled=quot;Truequot;
   expression=quot;quot; id=quot;myscripts.jsquot; inline=quot;Falsequot;
   insert-after=quot;dropdown.jsquot;/>

</object>
External Scripts
External Scripts
<javascript ... id=quot;http://ajax.googleapis.com/
ajax/libs/jquery/1.2.6/jquery.min.jsquot; ... />
External Scripts
<javascript ... id=quot;http://ajax.googleapis.com/
ajax/libs/jquery/1.2.6/jquery.min.jsquot; ... />


• New in Plone 3.3
External Scripts
<javascript ... id=quot;http://ajax.googleapis.com/
ajax/libs/jquery/1.2.6/jquery.min.jsquot; ... />


• New in Plone 3.3
• Include JavaScript from external sources
Google AJAX Libraries
Google AJAX Libraries
 http://code.google.com/apis/ajaxlibs/
Google AJAX Libraries
     http://code.google.com/apis/ajaxlibs/

•   jQuery                 •   Dojo

•   jQuery UI              •   SWFObjectNew

•   Prototype              •   Yahoo! User Interface
                               Library (YUI)
•   script.aculo.us

•   MooTools
Browser Resources
•   Zope 3 concept

•
Browser Resources
Browser Resources
  <browser:resource
      name=quot;myscript.jsquot;
      image=quot;myscript.jsquot;
      />
Browser Resources
       <browser:resource
           name=quot;myscript.jsquot;
           image=quot;myscript.jsquot;
           />


http://myplonesite/++resource++myscript.js
Browser Resources
<?xml version=quot;1.0quot;?>
                             jsregistry.xml
<object name=quot;portal_javascriptsquot;>

 <javascript cacheable=quot;Truequot; compression=quot;safequot; cookable=quot;Truequot;
enabled=quot;Truequot;
   expression=quot;quot; id=quot;++resource++myscript.jsquot; inline=quot;Falsequot;
   insert-after=quot;dropdown.jsquot;/>

</object>
Browser Resources
Browser Resources
<browser:resource
    name=quot;myscript.jsquot;
    image=quot;myscript.jsquot;
    for=quot;..interfaces.IMyCustomType”
    />
Browser Resources
<browser:resource
    name=quot;myscript.jsquot;
    image=quot;myscript.jsquot;
    for=quot;..interfaces.IMyCustomType”
    />
<browser:resource
    name=quot;myscript.jsquot;
    image=quot;myscript.jsquot;
    layer=quot;..interfaces.IMySkinLayer”
    />
Browser Resources
Browser Resources
<browser:resourceDirectory
      name=quot;myResourcesquot;
     directory=quot;stuffquot; />
Browser Resources
       <browser:resourceDirectory
             name=quot;myResourcesquot;
            directory=quot;stuffquot; />

http://myplonesite/++resource++myResources/
checkout.png
JavaScript Libraries
A JavaScript library is a library of
pre-written JavaScript controls which
allow for easier development of
JavaScript-based applications, especially
for AJAX and other web-centric
technologies.
    http://en.wikipedia.org/wiki/JavaScript_library
Why?
Why?

• Save time
Why?

• Save time
• Reuse existing code
Why?

• Save time
• Reuse existing code
• You don’t need to be an expert
Why?

• Save time
• Reuse existing code
• You don’t need to be an expert
• Browser “quirks”
KSS
KSS

• “Kinetic Style Sheets”
• JavaScript/AJAX framework
• Declare behaviors using CSS format
• Built into Plone 3.0+
• Also works with Grok, Pylons, Django
KSS Rules

#mykssbutton:click {
  action-client: alert;
  alert-message: ‘Hello World!’;
}
KSS Rules
CSS Selector
    #mykssbutton:click {
      action-client: alert;
      alert-message: ‘Hello World!’;
    }
KSS Rules
Action Type
   #mykssbutton:click {
     action-client: alert;
     alert-message: ‘Hello World!’;
   }
KSS Rules
             Action

#mykssbutton:click {
  action-client: alert;
  alert-message: ‘Hello World!’;
}
KSS Rules
          Action Parameter
#mykssbutton:click {
  action-client: alert;
  alert-message: ‘Hello World!’;
}          name         value
KSS Rules

evt-click-preventdefault: True;
KSS Rules
        #mykssbutton:click {
          evt-click-preventdefault: True;
          action-client: alert;
          alert-message: ‘Hello World!’;
        }
<a href=”front-page” id=”mykssbutton”>Click me!
</a>
`
Client Actions
Client Actions
• alert
Client Actions
• alert
• addClass / removeClass / toggleClass
Client Actions
• alert
• addClass / removeClass / toggleClass
• setAttribute
Client Actions
• alert
• addClass / removeClass / toggleClass
• setAttribute
• setStyle
Client Actions
• alert
• addClass / removeClass / toggleClass
• setAttribute
• setStyle
• replaceInnerHTML
Client Actions
• alert
• addClass / removeClass / toggleClass
• setAttribute
• setStyle
• replaceInnerHTML
• log
Parameter Providers
Parameter Providers

• nodeAttr
Parameter Providers

• nodeAttr
• nodeContent
Parameter Providers

• nodeAttr
• nodeContent
• currentFormVar
Parameter Providers

• nodeAttr
• nodeContent
• currentFormVar
• formVar
Tying Them Together
Tying Them Together
<form id=quot;myFormquot;>
 <input name=quot;colorquot; />
 <input type=quot;submitquot; class=quot;submitquot; />
</form>

<div tal:define=quot;color request/form/color|string:nothing;quot;>
  You chose
  <span id=quot;selectedColorquot;
      tal:content=quot;colorquot;>
  </span>.
</div>
Tying Them Together
<form id=quot;myFormquot;>
 <input name=quot;colorquot; />
 <input type=quot;submitquot; class=quot;submitquot; />
</form>

<div tal:define=quot;color request/form/color|string:nothing;quot;>
  You chose
  <span id=quot;selectedColorquot;
      tal:content=quot;colorquot;>
  </span>.
</div>

#myForm .submit:click {
  evt-click-preventdefault: True;
  action-client: replaceInnerHTML;
  replaceInnerHTML-kssSelector: '#selectedColor';
  replaceInnerHTML-html: currentFormVar(color);
}
Tying Them Together
<form id=quot;myFormquot;>
 <input name=quot;colorquot; />
 <input type=quot;submitquot; class=quot;submitquot; />
</form>

<div tal:define=quot;color request/form/color|string:nothing;quot;>
  You chose
  <span id=quot;selectedColorquot;
      tal:content=quot;colorquot;>
  </span>.
</div>

#myForm .submit:click {
  evt-click-preventdefault: True;
  action-client: replaceInnerHTML;
  replaceInnerHTML-kssSelector: '#selectedColor';
  replaceInnerHTML-html: currentFormVar(color);
}
Fallback
Server Actions
Server Actions
#myForm .submit:click {
  evt-click-preventdefault: True;
  action-server: transformColor;
  transformColor-color: currentFormVar(color);
}
Server Actions
#myForm .submit:click {
  evt-click-preventdefault: True;
  action-server: transformColor;
  transformColor-color: currentFormVar(color);
}

transformColor.py
from kss.core.ttwapi import (startKSSCommands,
getKSSCommandSet, renderKSSCommands)
startKSSCommands(context, context.REQUEST)

uColor = color.upper()
core = getKSSCommandSet('core')
core.replaceInnerHTML('#selectedColor', uColor)
return renderKSSCommands()
Server Actions
#myForm .submit:click {
  evt-click-preventdefault: True;
  action-server: transformColor;
  transformColor-color: currentFormVar(color);
}

transformColor.py
from kss.core.ttwapi import (startKSSCommands,
getKSSCommandSet, renderKSSCommands)
startKSSCommands(context, context.REQUEST)

uColor = color.upper()
core = getKSSCommandSet('core')
core.replaceInnerHTML('#selectedColor', uColor)
return renderKSSCommands()
Command Sets
•   Core                 •   Zope

    •   getCssSelector       •   refreshProvider

    •   addClass             •   refreshViewlet

    •   removeClass      •   Plone

                             •   issuePortalMessage

                             •   refreshPortlet
Registering KSS


• portal_kss registry
kssregistry.xml
<?xml version=quot;1.0quot;?>
   <object name=quot;portal_kssquot; meta_type=quot;KSS Registryquot;>
      <kineticstylesheet cacheable=quot;Truequot; compression=quot;safequot;
     cookable=quot;Truequot;
  enabled=quot;1quot; expression=quot;quot; id=quot;mykssrules.kssquot;/>
</object>
Debugging KSS
Debugging KSS

• Firebug
Debugging KSS

• Firebug
• Firebug
Debugging KSS

• Firebug
• Firebug
• Firebug
Debugging KSS

• Firebug
• Firebug
• Firebug
 • Or Firebug Lite (getfirebug.com/lite.html)
Debugging KSS

• KSS fails silently
• Turn on debugging in portal_javascript
• Messages will appear in Firebug console
Debugging KSS
Debugging KSS
• Firekiss
  http://kssproject.org/download/firekiss.xpi/
KSS Plugins
•   kss.plugin.cacheabilty   •   kss.plugin.jsmath

•   kss.plugin.cns           •   kss.plugin.timer

•   kss.plugin.fadeeffect    •   kss.plugin.yuidnd

•   kss.plugin.history
Documentation


• http://kssproject.org/
• http://plone.org/events/regional/plone-
  symposium-2008/skinning-with-plone-3
KSS Recap


• Simple, CSS-style syntax
• JavaScript, without the JavaScript
But here’s the thing...
Plone 4 won’t include
        KSS *




        * probably...
Dude.
WTF?
• It’s huge
• It’s huge
• Lack of adoption
• It’s huge
• Lack of adoption
• Sparse documentation
See http://dev.plone.org/plone/ticket/8809
           for more information.
This asshole
just wasted half
 an hour of my
      life...
Repeat after me...
“KSS is not going away.”
“It’s just becoming an
   add-on Product.”
“I can still use KSS as
   much as I’d like.”
“By including it in my buildout.”




        Buildout
“Or as a product dependency.”




       Product
“Really.”
jQuery
jQuery
jQuery

• DOM-focused
jQuery

• DOM-focused
• Simple syntax
jQuery

• DOM-focused
• Simple syntax
• Extensible
jQuery

• DOM-focused
• Simple syntax
• Extensible
• 19K
jQuery

• DOM-focused
• Simple syntax
• Extensible
• 19K
• Well-documented
Factory
Factory

• jQuery()
• $()
• jq()
Selectors
Selectors

• CSS
Selectors

• CSS
 • Tag name: jq(‘p’)
Selectors

• CSS
 • Tag name: jq(‘p’)
 • Id: jq(‘#itemId’)
Selectors

• CSS
 • Tag name: jq(‘p’)
 • Id: jq(‘#itemId’)
 • Class: jq(‘.someClass’)
Selectors

• CSS
 • Tag name: jq(‘p’)
 • Id: jq(‘#itemId’)
 • Class: jq(‘.someClass’)
• XPath: jq(‘a[title]’)
Pseudo-Selectors
Pseudo-Selectors
• :first and :last
Pseudo-Selectors
• :first and :last
• :not
  jq(‘#portal-column-content p:not(.discreet)’)
Pseudo-Selectors
• :first and :last
• :not
  jq(‘#portal-column-content p:not(.discreet)’)

• :first-child, :nth-child, and :last-child
  jq(‘ul li:nth-child(2)’)
Pseudo-Selectors
• :first and :last
• :not
  jq(‘#portal-column-content p:not(.discreet)’)

• :first-child, :nth-child, and :last-child
  jq(‘ul li:nth-child(2)’)

• :even and :odd
  jq(‘#myTable tr:odd’)
Sets
Sets

• “Implicit iteration”
Sets

• “Implicit iteration”
 • jq(‘#myDiv’).hide()
Sets

• “Implicit iteration”
 • jq(‘#myDiv’).hide()
 • jq(‘.someDivs’).hide()
Chaining
Chaining

• Operations always return a result
Chaining

• Operations always return a result
• So instead of...
  obj.doSomething()
  obj.doSomethingElse(‘blah’)
Chaining

• Operations always return a result
• So instead of...
  obj.doSomething()
  obj.doSomethingElse(‘blah’)

• We can write...
  jq(‘#myElement’).parent().addClass(‘blah’)
Chaining
Chaining

• One one line...
  jq(‘#faq’).find(‘dd’).hide().end().find(‘dt’).click(function(){...});
Chaining

• One one line...
  jq(‘#faq’).find(‘dd’).hide().end().find(‘dt’).click(function(){...});


• Or several...
  jq('#faq')               // Find the element with id ‘faq’
    .find('dd')             // Get all dd elements within
    .hide()               // Hide those elements
    .end()                // Jump back to the ‘faq’ element
    .find('dt')            // Find all dt elements within
    .click(function() {...}); // And assign an click event.
Events
Events
function foo(){
  alert(‘foo’);
}
window.onload = foo;
Events
function foo(){
  alert(‘foo’);
}
window.onload = foo;
function bar(){
  alert(‘bar’);
}
window.onload = bar;
Events
function foo(){
  alert(‘foo’);
}
window.onload = foo;
function bar(){
  alert(‘bar’);
}
window.onload = bar;
Events
Events


jq(document).ready(function) {
  alert(‘bar’);
});
Events
jq(document).ready(function) {
  alert(‘foo’);
});
    jq(document).ready(function) {
      alert(‘bar’);
    });
Events
jq(document).ready(function) {
  alert(‘foo’);
            jq(document).ready(function) {
});           alert(‘baz’);
    jq(document).ready(function) {
            });
      alert(‘bar’);
   });
Events
jq(document).ready(function) {
  alert(‘foo’);
            jq(document).ready(function) {
});           alert(‘baz’);
    jq(document).ready(function) {
            });
      alert(‘bar’);
    jq(document).ready(function) {
   });
       alert(‘blort’);
    });
Events
jq(document).ready(function) {
  alert(‘foo’);
             jq(document).ready(function) {
});            alert(‘baz’);
    jq(document).ready(function) {
               jq(document).ready(function) {
             });
      alert(‘bar’);
                 alert(‘smoo’);
     jq(document).ready(function) {
    });        });
        alert(‘blort’);
     });
Events
jq(document).ready(function) {
  alert(‘foo’);
             jq(document).ready(function) {
});            alert(‘baz’);
    jq(document).ready(function) {
               jq(document).ready(function) {
             });
      alert(‘bar’);
                 alert(‘smoo’);
jq(document).ready(function) {
     jq(document).ready(function) {
    });        });
  alert(‘floob’);
        alert(‘blort’);
}); });
Events
         #mykssbutton:click {
           evt-click-preventdefault: True;
           action-client: alert;
           alert-message: ‘Hello World!’;
         }
<a href=”front-page” id=”mykssbutton”>Click me!
</a>
Events
      jq(document).ready(function) {
        jq(‘#mykssbutton’).click(function(){
          alert(‘Hello World!);
        });
      });

<a href=”front-page” id=”mykssbutton”>Click me!
</a>
Another Example

jq(document).ready(function() {
   jq(‘a[@href$=”.pdf”]’).addclass(‘pdflink’);
});

a.pdflink { background:url(‘pdficon.gif’) no-repeat;
            padding-left:25px;
          }
AJAX Calls
AJAX Calls
#myForm .submit:click {
  evt-click-preventdefault: True;
  action-server: transformColor;
  transformColor-color: currentFormVar(color);
}
AJAX Calls
#myForm .submit:click {
  evt-click-preventdefault: True;
  action-server: transformColor;
  transformColor-color: currentFormVar(color);
}

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

uColor = color.upper()
core = getKSSCommandSet('core')
core.replaceInnerHTML('#selectedColor', uColor)
return renderKSSCommands()
AJAX Calls
jq_transformColor
  return color.upper()




jq(document).ready(function(){
    jq('#myForm').submit(function(){
        var color = jq('input[name=color]').val();
        jq('#selectedColor').load('jq_transformColor?color=' + color);
        return false;
    });
});
jQuery in Plone

• Built into Plone 3.1+
• ‘jq’ instead of ‘$’
• Now use ‘jq’ method instead of ‘cssQuery’
  or ‘registerPloneFunction’
Integrating jQuery
               Plugins
http://plugins.jquery.com/
Integrating jQuery
      Plugins
Integrating jQuery
          Plugins
• If the plugin uses ‘$’:
Integrating jQuery
          Plugins
• If the plugin uses ‘$’:
 • Place it between jquery.js and jquery-
    integration.js
    <javascript ... insert-before=quot;jquery-integration.jsquot;/>
Integrating jQuery
          Plugins
• If the plugin uses ‘$’:
 • Place it between jquery.js and jquery-
    integration.js
    <javascript ... insert-before=quot;jquery-integration.jsquot;/>


  • or wrap it {
    (function($)
       [your code here]
    })(jQuery);
Existing Behaviors
Collapsible Sections
<dl class=”collapsible”>
  <dt class=”collapsibleHeader”>
    A Title
  </dt>
  <dd class=”collapsibleContent”>
    Your hidable content.
  </dd>
</dl>
Collapsible Sections
<dl class=”collapsible”>
  <dt class=”collapsibleHeader”>
    A Title
  </dt>
  <dd class=”collapsibleContent”>
    Your hidable content.
  </dd>
</dl>
Dropdowns
<dl class=”actionMenu” id=”aUniqueId”>
  <dt class=”actionMenuHeader”>
      <a href=”some_destination”>A Title</
      a>
  </dt>
  <dd class=”actionMenuContent”>
      Your content
  </dd>
</dl>
Dropdowns
<dl class=”actionMenu” id=”aUniqueId”>
  <dt class=”actionMenuHeader”>
      <a href=”some_destination”>A Title</
      a>
  </dt>
  <dd class=”actionMenuContent”>
      Your content
  </dd>
</dl>
Sortable Tables
<table class=”listing” id=”someId”>
  <thead>
     <tr>
        <th>Table header</th>
     </tr>
  </thead>
  <tbody>
     <tr>
        <td>Table cell 1</td>
     </tr>
     <tr>
        <td>Table cell 2</td>
     </tr>
  </tbody>
</table>
Sortable Tables
<table class=”listing” id=”someId”>
  <thead>
     <tr>
        <th>Table header</th>
     </tr>
  </thead>
  <tbody>
     <tr>
        <td>Table cell 1</td>
     </tr>
     <tr>
        <td>Table cell 2</td>
     </tr>
  </tbody>
</table>
Sortable Tables

<th class=”nosort”>
  Unsortable Column
</th>
Sortable Tables

<th class=”nosort”>
  Unsortable Column
</th>
Products using jQuery
collective.flowplayer
                Turns code like:
<a class=quot;autoFlowPlayerquot; href=quot;path/to/video-file.flvquot;>
  <img src=quot;path/to/splashscreen.jpgquot; />
</a>
                       into:
Deco
Deco
Others

• Carousel
• Plone Slimbox
• FancyZoomView
• FadingNavigation
jQuery Documentation

http://docs.jquery.com/
http://www.packtpub.com/jQuery/
Other Libraries

• Yahoo User Interface (YUI)
• extjs
• MochiKit
• MooTools
• Dojo
Conclusions
• JavaScript novice? – Use KSS
• JavaScript novice? – Use KSS
• Otherwise, use JQuery
Special thanks to...

•   David Glick
    http://wglick.org/jstalk.html

•   Joel Burton
    http://bit.ly/z1nLH
http://bit.ly/plone-interactivity
Questions?
http://bit.ly/plone-interactivity

More Related Content

What's hot

Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching ResurrectedBen Scofield
 
RSpec User Stories
RSpec User StoriesRSpec User Stories
RSpec User Storiesrahoulb
 
Developing PHP Web Applications with the Raxan Framework
Developing PHP Web Applications with the Raxan FrameworkDeveloping PHP Web Applications with the Raxan Framework
Developing PHP Web Applications with the Raxan FrameworkRaymond Irving
 
Preparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationPreparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationBrian Hogg
 
WWW:::Mechanize YAPC::BR 2008
WWW:::Mechanize YAPC::BR 2008WWW:::Mechanize YAPC::BR 2008
WWW:::Mechanize YAPC::BR 2008mvitor
 
Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1Byrne Reese
 
Web Projects: From Theory To Practice
Web Projects: From Theory To PracticeWeb Projects: From Theory To Practice
Web Projects: From Theory To PracticeSergey Bolshchikov
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Byrne Reese
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshowsblackman
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事Sofish Lin
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFMark Stanton
 
Node.js Authentication and Data Security
Node.js Authentication and Data SecurityNode.js Authentication and Data Security
Node.js Authentication and Data SecurityTim Messerschmidt
 
Brian hogg word camp preparing a plugin for translation
Brian hogg   word camp preparing a plugin for translationBrian hogg   word camp preparing a plugin for translation
Brian hogg word camp preparing a plugin for translationwcto2017
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important PartsSergey Bolshchikov
 

What's hot (20)

HTML 5 & CSS 3
HTML 5 & CSS 3HTML 5 & CSS 3
HTML 5 & CSS 3
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
RSpec User Stories
RSpec User StoriesRSpec User Stories
RSpec User Stories
 
Developing PHP Web Applications with the Raxan Framework
Developing PHP Web Applications with the Raxan FrameworkDeveloping PHP Web Applications with the Raxan Framework
Developing PHP Web Applications with the Raxan Framework
 
Preparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationPreparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for Translation
 
WWW:::Mechanize YAPC::BR 2008
WWW:::Mechanize YAPC::BR 2008WWW:::Mechanize YAPC::BR 2008
WWW:::Mechanize YAPC::BR 2008
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 
Makezine
MakezineMakezine
Makezine
 
Fast by Default
Fast by DefaultFast by Default
Fast by Default
 
Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1
 
Web Projects: From Theory To Practice
Web Projects: From Theory To PracticeWeb Projects: From Theory To Practice
Web Projects: From Theory To Practice
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
 
Node.js Authentication and Data Security
Node.js Authentication and Data SecurityNode.js Authentication and Data Security
Node.js Authentication and Data Security
 
Brian hogg word camp preparing a plugin for translation
Brian hogg   word camp preparing a plugin for translationBrian hogg   word camp preparing a plugin for translation
Brian hogg word camp preparing a plugin for translation
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important Parts
 

Viewers also liked

Plone Interactivity
Plone InteractivityPlone Interactivity
Plone InteractivityEric Steele
 
The State of Plone – Plone Conference 2012
The State of Plone – Plone Conference 2012The State of Plone – Plone Conference 2012
The State of Plone – Plone Conference 2012Eric Steele
 
Plone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from herePlone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from hereEric Steele
 
Continuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using HudsonContinuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using HudsonEric Steele
 
Eric Steele – World Plone Day 2010 – Plone 4 Overview
Eric Steele – World Plone Day 2010 – Plone 4 OverviewEric Steele – World Plone Day 2010 – Plone 4 Overview
Eric Steele – World Plone Day 2010 – Plone 4 OverviewEric Steele
 
A Look at Plone 4
A Look at Plone 4A Look at Plone 4
A Look at Plone 4Eric Steele
 

Viewers also liked (8)

Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
The State of Plone – Plone Conference 2012
The State of Plone – Plone Conference 2012The State of Plone – Plone Conference 2012
The State of Plone – Plone Conference 2012
 
Plone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from herePlone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from here
 
Iterating Plone
Iterating PloneIterating Plone
Iterating Plone
 
Continuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using HudsonContinuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using Hudson
 
Eric Steele – World Plone Day 2010 – Plone 4 Overview
Eric Steele – World Plone Day 2010 – Plone 4 OverviewEric Steele – World Plone Day 2010 – Plone 4 Overview
Eric Steele – World Plone Day 2010 – Plone 4 Overview
 
A Look at Plone 4
A Look at Plone 4A Look at Plone 4
A Look at Plone 4
 
The headless CMS
The headless CMSThe headless CMS
The headless CMS
 

Similar to Plone Interactivity

Ajax On S2 Odp
Ajax On S2 OdpAjax On S2 Odp
Ajax On S2 Odpghessler
 
Basics of Rich Internet Applications
Basics of Rich Internet ApplicationsBasics of Rich Internet Applications
Basics of Rich Internet ApplicationsSubramanyan Murali
 
Solr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsSolr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsWildan Maulana
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NETgoodfriday
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyMark Meeker
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Librariesjeresig
 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applicationsjeff tapper
 
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity PresentationRails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentationrailsconf
 
Building Secure Twitter Apps
Building Secure Twitter AppsBuilding Secure Twitter Apps
Building Secure Twitter AppsDamon Cortesi
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from AustinLisa Adkins
 
Neil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItNeil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItCarsonified Team
 
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]Chris Toohey
 
Mozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basiclittlebtc
 
Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2sleguiza
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing frameworkIndicThreads
 
HTML5 - techMaine Presentation 5/18/09
HTML5 - techMaine Presentation 5/18/09HTML5 - techMaine Presentation 5/18/09
HTML5 - techMaine Presentation 5/18/09pemaquid
 

Similar to Plone Interactivity (20)

Ajax On S2 Odp
Ajax On S2 OdpAjax On S2 Odp
Ajax On S2 Odp
 
Basics of Rich Internet Applications
Basics of Rich Internet ApplicationsBasics of Rich Internet Applications
Basics of Rich Internet Applications
 
Solr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsSolr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJs
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applications
 
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity PresentationRails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
 
Building Secure Twitter Apps
Building Secure Twitter AppsBuilding Secure Twitter Apps
Building Secure Twitter Apps
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from Austin
 
Neil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItNeil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do It
 
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
 
Jsf Ajax
Jsf AjaxJsf Ajax
Jsf Ajax
 
Mozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basic
 
Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
 
HTML5 - techMaine Presentation 5/18/09
HTML5 - techMaine Presentation 5/18/09HTML5 - techMaine Presentation 5/18/09
HTML5 - techMaine Presentation 5/18/09
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
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
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
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
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Plone Interactivity

Editor's Notes

  1. So what kind of stuff are we going to talk about? We&#x2019;ll get the boring stuff out of the way first and then we&#x2019;ll move on to more interesting things like KSS and jQuery. There&#x2019;s a lot to cover, we&#x2019;ll hold questions until the end. And any of these slides that I don&#x2019;t get to, I&#x2019;ll just cut out of Plone 4.
  2. So what kind of stuff are we going to talk about? We&#x2019;ll get the boring stuff out of the way first and then we&#x2019;ll move on to more interesting things like KSS and jQuery. There&#x2019;s a lot to cover, we&#x2019;ll hold questions until the end. And any of these slides that I don&#x2019;t get to, I&#x2019;ll just cut out of Plone 4.
  3. You might use a block of code like this to include a script in your Plone template if you only need it on one page or one template or performance isn&#x2019;t really something you&#x2019;re concerned about.
  4. You might use a block of code like this to include a script in your Plone template if you only need it on one page or one template or performance isn&#x2019;t really something you&#x2019;re concerned about.
  5. Plone, however, provides Resource Registries for keeping track of things like CSS, JavaScript, and KSS.
  6. So what makes resource registries useful? Control which scripts are included on a page and in what order they&#x2019;ll render. It gives you automatic merging and compression of your scripts. And makes JavaScript more cacheable.
  7. So what makes resource registries useful? Control which scripts are included on a page and in what order they&#x2019;ll render. It gives you automatic merging and compression of your scripts. And makes JavaScript more cacheable.
  8. So what makes resource registries useful? Control which scripts are included on a page and in what order they&#x2019;ll render. It gives you automatic merging and compression of your scripts. And makes JavaScript more cacheable.
  9. And its easy for third-party products to add scripts to portal_javascript using Generic Setup. We can control all of the settings from here and even specify where it should wind up in the ordering.
  10. And now, in Plone 3.3, we can use portal_javascript to include JavaScript being hosted on external servers.
  11. And now, in Plone 3.3, we can use portal_javascript to include JavaScript being hosted on external servers.
  12. And now, in Plone 3.3, we can use portal_javascript to include JavaScript being hosted on external servers.
  13. And that&#x2019;s handy because of sites like Google&#x2019;s AJAX libraries API. Google hosts the libraries, you pull them into your site as needed. They&#x2019;ve got a number of the more-popular JavaScript libraries.
  14. And that&#x2019;s handy because of sites like Google&#x2019;s AJAX libraries API. Google hosts the libraries, you pull them into your site as needed. They&#x2019;ve got a number of the more-popular JavaScript libraries.
  15. These can be registered with the resource registries in the same manner as before. This time we&#x2019;ll use that ++resource++ path to point to the file we&#x2019;re after.
  16. We can also register these to be available only for specific content types or browser layers so that they&#x2019;ll only appear in certain portions of a site.
  17. We can also register these to be available only for specific content types or browser layers so that they&#x2019;ll only appear in certain portions of a site.
  18. There&#x2019;s also a resourceDirectory ZCML directive that will allow you to register an entire folder of files, rather than registering each one individually. The url would look like this.
  19. There&#x2019;s also a resourceDirectory ZCML directive that will allow you to register an entire folder of files, rather than registering each one individually. The url would look like this.
  20. So, what are Javascript libraries?
  21. So why might we use one? It&#x2019;s faster. You&#x2019;ve got better things to do with your time. Chances are someone&#x2019;s already done what you want to do, and done it better. It removes the need to know everything there is to know about writing JavaScript. And you can largely ignore browser compatibility issues.
  22. So why might we use one? It&#x2019;s faster. You&#x2019;ve got better things to do with your time. Chances are someone&#x2019;s already done what you want to do, and done it better. It removes the need to know everything there is to know about writing JavaScript. And you can largely ignore browser compatibility issues.
  23. So why might we use one? It&#x2019;s faster. You&#x2019;ve got better things to do with your time. Chances are someone&#x2019;s already done what you want to do, and done it better. It removes the need to know everything there is to know about writing JavaScript. And you can largely ignore browser compatibility issues.
  24. So why might we use one? It&#x2019;s faster. You&#x2019;ve got better things to do with your time. Chances are someone&#x2019;s already done what you want to do, and done it better. It removes the need to know everything there is to know about writing JavaScript. And you can largely ignore browser compatibility issues.
  25. So let&#x2019;s start with Plone&#x2019;s built-in library, KSS.
  26. This is what a typical KSS rule might look like. Note that it looks very much like something we&#x2019;d see in a stylesheet.
  27. One of the things you&#x2019;ll use most when writing KSS rules will be this bit. Essentially, we&#x2019;re telling KSS that we want to ignore the default click event of whatever element the rule applies to.
  28. This means that if our rule applies to this link, we&#x2019;ll ignore the default action &#x2013;&#xA0;actually going to the front-page &#x2013;&#xA0;and instead apply our own actions, which in this case would be popping up a &#x201C;Hello World!&#x201D; alert message.
  29. And that&#x2019;d look something like this.
  30. So in that example, we used the &#x201C;alert&#x201D; client action. There are others we can use too.
  31. So in that example, we used the &#x201C;alert&#x201D; client action. There are others we can use too.
  32. So in that example, we used the &#x201C;alert&#x201D; client action. There are others we can use too.
  33. So in that example, we used the &#x201C;alert&#x201D; client action. There are others we can use too.
  34. So in that example, we used the &#x201C;alert&#x201D; client action. There are others we can use too.
  35. So in that example, we used the &#x201C;alert&#x201D; client action. There are others we can use too.
  36. Parameter providers let us pull data out of the current page so that we can use it in an action. NodeAttr lets you pull out the value of an HTML attribute of the selected element. NodeContent will return the text content of the selected element. currentFormVar and formVar pull values out of form fields.
  37. Parameter providers let us pull data out of the current page so that we can use it in an action. NodeAttr lets you pull out the value of an HTML attribute of the selected element. NodeContent will return the text content of the selected element. currentFormVar and formVar pull values out of form fields.
  38. Parameter providers let us pull data out of the current page so that we can use it in an action. NodeAttr lets you pull out the value of an HTML attribute of the selected element. NodeContent will return the text content of the selected element. currentFormVar and formVar pull values out of form fields.
  39. Parameter providers let us pull data out of the current page so that we can use it in an action. NodeAttr lets you pull out the value of an HTML attribute of the selected element. NodeContent will return the text content of the selected element. currentFormVar and formVar pull values out of form fields.
  40. So let&#x2019;s tie all of these concepts together. I&#x2019;ve created a simple html page with a form that accepts a color name and has a submit button. There&#x2019;s also a div that will tell the user what they&#x2019;ve just typed in. Complex stuff, I know. The KSS is rule says that when the user clicks on the submit button in our form, it&#x2019;ll ignore the default action (which would be to submit the form) and instead replace the content of the page element with the id #selectedColor with the value of the color field. Let&#x2019;s see this in action.
  41. So let&#x2019;s tie all of these concepts together. I&#x2019;ve created a simple html page with a form that accepts a color name and has a submit button. There&#x2019;s also a div that will tell the user what they&#x2019;ve just typed in. Complex stuff, I know. The KSS is rule says that when the user clicks on the submit button in our form, it&#x2019;ll ignore the default action (which would be to submit the form) and instead replace the content of the page element with the id #selectedColor with the value of the color field. Let&#x2019;s see this in action.
  42. So let&#x2019;s tie all of these concepts together. I&#x2019;ve created a simple html page with a form that accepts a color name and has a submit button. There&#x2019;s also a div that will tell the user what they&#x2019;ve just typed in. Complex stuff, I know. The KSS is rule says that when the user clicks on the submit button in our form, it&#x2019;ll ignore the default action (which would be to submit the form) and instead replace the content of the page element with the id #selectedColor with the value of the color field. Let&#x2019;s see this in action.
  43. So what happens if JavaScript is disabled for whatever reason? KSS makes sure that if that&#x2019;s the case, then the click event override we&#x2019;ve created doesn&#x2019;t get registered and the page will fall back to its default functionality. So disabling javascript on this page, reloading and trying again, we get the same result. KSS makes this very easy, with only a minimal amount of planning on my part.
  44. Alright, now let&#x2019;s get into some actual AJAX. Doing things on the client side is fine, but what if we want to do something a bit more involved with the data. So in this example, I&#x2019;m going to switch to using action-server. We&#x2019;ll call a python script I&#x2019;ve created. This could also be a browser view if we were creating this as a filesystem product. The script is expecting a parameter named &#x201C;color&#x201D;, so we&#x2019;ll need to pass that along as well. Looking at the script itself, there&#x2019;s a lot of boilerplate that you don&#x2019;t really need to be concerned about. Just trust that it&#x2019;s there for a reason and move on with your life. The important bits are the remaining three lines. First of all, we&#x2019;ll do a simple bit of Python and change the color name the script has received into uppercase. Next we&#x2019;ll grab the core kss commandset. Core essentially holds all of those action-client methods we could call directly from KSS, and provides them to Python. So in this case, we&#x2019;re going to replace the inner HTML of the element with the selectedColor id with the capitalized color name. Looking at this in action, we see that providing &#x2018;blue&#x2019; displays it in the page in uppercase, all without reloading the page.
  45. Alright, now let&#x2019;s get into some actual AJAX. Doing things on the client side is fine, but what if we want to do something a bit more involved with the data. So in this example, I&#x2019;m going to switch to using action-server. We&#x2019;ll call a python script I&#x2019;ve created. This could also be a browser view if we were creating this as a filesystem product. The script is expecting a parameter named &#x201C;color&#x201D;, so we&#x2019;ll need to pass that along as well. Looking at the script itself, there&#x2019;s a lot of boilerplate that you don&#x2019;t really need to be concerned about. Just trust that it&#x2019;s there for a reason and move on with your life. The important bits are the remaining three lines. First of all, we&#x2019;ll do a simple bit of Python and change the color name the script has received into uppercase. Next we&#x2019;ll grab the core kss commandset. Core essentially holds all of those action-client methods we could call directly from KSS, and provides them to Python. So in this case, we&#x2019;re going to replace the inner HTML of the element with the selectedColor id with the capitalized color name. Looking at this in action, we see that providing &#x2018;blue&#x2019; displays it in the page in uppercase, all without reloading the page.
  46. Alright, now let&#x2019;s get into some actual AJAX. Doing things on the client side is fine, but what if we want to do something a bit more involved with the data. So in this example, I&#x2019;m going to switch to using action-server. We&#x2019;ll call a python script I&#x2019;ve created. This could also be a browser view if we were creating this as a filesystem product. The script is expecting a parameter named &#x201C;color&#x201D;, so we&#x2019;ll need to pass that along as well. Looking at the script itself, there&#x2019;s a lot of boilerplate that you don&#x2019;t really need to be concerned about. Just trust that it&#x2019;s there for a reason and move on with your life. The important bits are the remaining three lines. First of all, we&#x2019;ll do a simple bit of Python and change the color name the script has received into uppercase. Next we&#x2019;ll grab the core kss commandset. Core essentially holds all of those action-client methods we could call directly from KSS, and provides them to Python. So in this case, we&#x2019;re going to replace the inner HTML of the element with the selectedColor id with the capitalized color name. Looking at this in action, we see that providing &#x2018;blue&#x2019; displays it in the page in uppercase, all without reloading the page.
  47. We saw that &#x201C;getCommandSet&#x201D; line... there are 3 different command sets that come with KSS out of the box. I mentioned &#x2018;core&#x2019;, that essentially provides all of the action-client calls available in our KSS rules. The second is the Zope command set, which allows us to redraw providers -- things like viewlet managers and portlet managers -- or to redraw individual viewlets. Third is the Plone command set, which lets us do things like display portal messages or refresh portlets. All of these let us interact with the browser window from Python. So KSS has allowed JavaScript to talk to Python and Python to talk to JavaScript.
  48. So how do we register a kss file? We&#x2019;re going to use one of the resource registries we talked about earlier -- portal_kss.
  49. Typically, that&#x2019;s done from GenericSetup, using an kssregistry.xml file. This looks almost exactly like the JavaScript registration we looked at earlier.
  50. So how do you go about debugging KSS? Firebug. Firebug. Firebug. Or, if you&#x2019;re debugging in something that&#x2019;s not Firefox, try Firebug Lite.
  51. So how do you go about debugging KSS? Firebug. Firebug. Firebug. Or, if you&#x2019;re debugging in something that&#x2019;s not Firefox, try Firebug Lite.
  52. So how do you go about debugging KSS? Firebug. Firebug. Firebug. Or, if you&#x2019;re debugging in something that&#x2019;s not Firefox, try Firebug Lite.
  53. So how do you go about debugging KSS? Firebug. Firebug. Firebug. Or, if you&#x2019;re debugging in something that&#x2019;s not Firefox, try Firebug Lite.
  54. A side-effect of KSS&#x2019;s no-javascript failover is that if there&#x2019;s an error, your page&#x2019;s KSS will fail to load. Which means that it will typically fail silently. So, essentially, all of the KSS functionality on that page will fail to work if there is a syntax error. I spent a day chasing down what turned out to be a missing semicolon in my ruleset. But, if you turn on javascript debugging in portal_javascript, KSS debugging information will appear in Firebug&#x2019;s console window. And there&#x2019;s a lot of it.
  55. And this is what that debugging output will look like. Firebug will show all of the rules being processed, any XMLRPC calls being passed around, and detailed error messages that may crop up.
  56. There&#x2019;s also &#x201C;Firekiss&#x201D;, a Firebug extension from the KSS folks. It&#x2019;ll show your KSS rules and allow you to change debug mode and log level from within Firebug.
  57. There are a number of KSS addons available. kss.plugin.cacheability which enables KSS requests to be cached. kss.plugin.cns provides a number of new client actions. kss.plugin.fadeeffect adds image fading and substitution. kss.plugin.history allows you to modify the browser location in an effort to add backward and forward navigation to a javascript application. kss.plugin.jsmath uses the jsmath library to display complex mathematical functions. kss.plugin.timer displays a timer. kss.plugin.yuidnd integrates the Yahoo User Interface drag-and-drop library.
  58. Quick recap: What is KSS? It uses a simple, css-style syntax. Basically, it&#x2019;s Javascript, without the JavaScript, which for someone like me who hates writing Javascript, is really awesome.
  59. As of Plone 4, we&#x2019;ll probably no longer be shipping with KSS.
  60. Why?
  61. So here&#x2019;s why... It&#x2019;s huge. The relevant scripts check in at over 100 k. It&#x2019;s been slow to catch on, both within and outside of the Plone project. And the documentation is somewhat lacking.
  62. So here&#x2019;s why... It&#x2019;s huge. The relevant scripts check in at over 100 k. It&#x2019;s been slow to catch on, both within and outside of the Plone project. And the documentation is somewhat lacking.
  63. So here&#x2019;s why... It&#x2019;s huge. The relevant scripts check in at over 100 k. It&#x2019;s been slow to catch on, both within and outside of the Plone project. And the documentation is somewhat lacking.
  64. And you can read PLIP #8809 for more information about that decision.
  65. So right now, you&#x2019;re thinking, &#x201C;This asshole just wasted half an hour of my life.&#x201D;
  66. By including it in my buildout.
  67. I really like KSS and relied on it heavily to build GloWorm. I think I made it about 90% of the way through to the final release before I actually had to write a line of JavaScript code myself, KSS handled the large majority of what I wanted to do. The current direction that Plone core development is taking is to make Plone itself ship as a much leaner product. So just because we&#x2019;re not planning to ship with KSS, that doesn&#x2019;t mean that you can&#x2019;t and shouldn&#x2019;t still use it...
  68. So that brings us to jQuery, the JavaScript library with which we&#x2019;ll be replacing KSS functionality in Plone core.
  69. So why use jQuery It&#x2019;s a DOM-focused library, and by that, I mean that it&#x2019;s less of a &#x201C;make JavaScript a real language&#x201D; library, and more of a &#x201C;get stuff done&#x201D; library. It&#x2019;s got a very simple syntax. It&#x2019;s easy to add on to the core functionality and there are lots of plugins available that do so. It&#x2019;s quite small. And there&#x2019;s a large amount of good documentation.
  70. So why use jQuery It&#x2019;s a DOM-focused library, and by that, I mean that it&#x2019;s less of a &#x201C;make JavaScript a real language&#x201D; library, and more of a &#x201C;get stuff done&#x201D; library. It&#x2019;s got a very simple syntax. It&#x2019;s easy to add on to the core functionality and there are lots of plugins available that do so. It&#x2019;s quite small. And there&#x2019;s a large amount of good documentation.
  71. So why use jQuery It&#x2019;s a DOM-focused library, and by that, I mean that it&#x2019;s less of a &#x201C;make JavaScript a real language&#x201D; library, and more of a &#x201C;get stuff done&#x201D; library. It&#x2019;s got a very simple syntax. It&#x2019;s easy to add on to the core functionality and there are lots of plugins available that do so. It&#x2019;s quite small. And there&#x2019;s a large amount of good documentation.
  72. So why use jQuery It&#x2019;s a DOM-focused library, and by that, I mean that it&#x2019;s less of a &#x201C;make JavaScript a real language&#x201D; library, and more of a &#x201C;get stuff done&#x201D; library. It&#x2019;s got a very simple syntax. It&#x2019;s easy to add on to the core functionality and there are lots of plugins available that do so. It&#x2019;s quite small. And there&#x2019;s a large amount of good documentation.
  73. So why use jQuery It&#x2019;s a DOM-focused library, and by that, I mean that it&#x2019;s less of a &#x201C;make JavaScript a real language&#x201D; library, and more of a &#x201C;get stuff done&#x201D; library. It&#x2019;s got a very simple syntax. It&#x2019;s easy to add on to the core functionality and there are lots of plugins available that do so. It&#x2019;s quite small. And there&#x2019;s a large amount of good documentation.
  74. The basis of all jQuery calls is known as the jQuery factory function. Typically shortened as a dollar sign. In Plone, it&#x2019;s aliased as &#x201C;jq&#x201D;. We&#x2019;ll get into that a bit more later, but for now all of my examples will use the &#x201C;jq&#x201D; alias since that&#x2019;s what you can expect to use when writing scripts for Plone.
  75. We can pass all sorts of selectors to the factory function. Most of the time, we&#x2019;ll use a CSS selector, like a tag, id, or class. But can also use XPath statements to select particular elements of the HTML document we&#x2019;re interacting with.
  76. We can pass all sorts of selectors to the factory function. Most of the time, we&#x2019;ll use a CSS selector, like a tag, id, or class. But can also use XPath statements to select particular elements of the HTML document we&#x2019;re interacting with.
  77. We can pass all sorts of selectors to the factory function. Most of the time, we&#x2019;ll use a CSS selector, like a tag, id, or class. But can also use XPath statements to select particular elements of the HTML document we&#x2019;re interacting with.
  78. We can pass all sorts of selectors to the factory function. Most of the time, we&#x2019;ll use a CSS selector, like a tag, id, or class. But can also use XPath statements to select particular elements of the HTML document we&#x2019;re interacting with.
  79. We can pass all sorts of selectors to the factory function. Most of the time, we&#x2019;ll use a CSS selector, like a tag, id, or class. But can also use XPath statements to select particular elements of the HTML document we&#x2019;re interacting with.
  80. jQuery is fully CSS3 compliant, so we get all sorts of new CSS pseudo-selectors. We can select the first or last instance of a selector. We can get content that does not meet certain criteria. We can get the first, last, or nnth element of a group. And also defines some of its own (:even/:odd).
  81. jQuery is fully CSS3 compliant, so we get all sorts of new CSS pseudo-selectors. We can select the first or last instance of a selector. We can get content that does not meet certain criteria. We can get the first, last, or nnth element of a group. And also defines some of its own (:even/:odd).
  82. jQuery is fully CSS3 compliant, so we get all sorts of new CSS pseudo-selectors. We can select the first or last instance of a selector. We can get content that does not meet certain criteria. We can get the first, last, or nnth element of a group. And also defines some of its own (:even/:odd).
  83. jQuery is fully CSS3 compliant, so we get all sorts of new CSS pseudo-selectors. We can select the first or last instance of a selector. We can get content that does not meet certain criteria. We can get the first, last, or nnth element of a group. And also defines some of its own (:even/:odd).
  84. Whether our selector finds one, many, or no page elements, jQuery&#x2019;s &#x201C;Implicit Iteration&#x201D; means that methods assume that the selector&#x2019;s result is a set of elements and will run accordingly. That lets us call methods without worrying about the number of results.
  85. Whether our selector finds one, many, or no page elements, jQuery&#x2019;s &#x201C;Implicit Iteration&#x201D; means that methods assume that the selector&#x2019;s result is a set of elements and will run accordingly. That lets us call methods without worrying about the number of results.
  86. Whether our selector finds one, many, or no page elements, jQuery&#x2019;s &#x201C;Implicit Iteration&#x201D; means that methods assume that the selector&#x2019;s result is a set of elements and will run accordingly. That lets us call methods without worrying about the number of results.
  87. Operations on an element will always return a result. That result could be the same element, another element, or a set of elements. So instead of calling methods on an object over and over. We can chain commands, performing operations on the previous command&#x2019;s result.
  88. Operations on an element will always return a result. That result could be the same element, another element, or a set of elements. So instead of calling methods on an object over and over. We can chain commands, performing operations on the previous command&#x2019;s result.
  89. Operations on an element will always return a result. That result could be the same element, another element, or a set of elements. So instead of calling methods on an object over and over. We can chain commands, performing operations on the previous command&#x2019;s result.
  90. We can chain as much as we like, doing it all on one line, or several. Splitting it across several lines allows us to provide much more in the way of comments.
  91. We can chain as much as we like, doing it all on one line, or several. Splitting it across several lines allows us to provide much more in the way of comments.
  92. Typically, in JavaScript land, we might define a function that would run once the page has finished loading. The problem is that if we do it this way, each new function we add would overwrite the others and prevent them from running.
  93. Typically, in JavaScript land, we might define a function that would run once the page has finished loading. The problem is that if we do it this way, each new function we add would overwrite the others and prevent them from running.
  94. Typically, in JavaScript land, we might define a function that would run once the page has finished loading. The problem is that if we do it this way, each new function we add would overwrite the others and prevent them from running.
  95. Using jQuery, we could rewrite the this function like this, by assigning a new function to jQuery&#x2019;s document ready event. And since jQuery implements an event queue, we can do this as many times as we&#x2019;d like without worrying that registering one will override another.
  96. Using jQuery, we could rewrite the this function like this, by assigning a new function to jQuery&#x2019;s document ready event. And since jQuery implements an event queue, we can do this as many times as we&#x2019;d like without worrying that registering one will override another.
  97. Using jQuery, we could rewrite the this function like this, by assigning a new function to jQuery&#x2019;s document ready event. And since jQuery implements an event queue, we can do this as many times as we&#x2019;d like without worrying that registering one will override another.
  98. Using jQuery, we could rewrite the this function like this, by assigning a new function to jQuery&#x2019;s document ready event. And since jQuery implements an event queue, we can do this as many times as we&#x2019;d like without worrying that registering one will override another.
  99. Using jQuery, we could rewrite the this function like this, by assigning a new function to jQuery&#x2019;s document ready event. And since jQuery implements an event queue, we can do this as many times as we&#x2019;d like without worrying that registering one will override another.
  100. Using jQuery, we could rewrite the this function like this, by assigning a new function to jQuery&#x2019;s document ready event. And since jQuery implements an event queue, we can do this as many times as we&#x2019;d like without worrying that registering one will override another.
  101. If you remember back to that first KSS action we wrote, we created an action that overrode a link with the id &#x201C;mykssbutton&#x201D; and instead popped up a &#x201C;hello world&#x201D; alert box. Let&#x2019;s rewrite that in jQuery....
  102. So it&#x2019;ll look like this... We&#x2019;ll use the document ready event to signal that a new function should be assigned to click event of the element with an id of #mykssbutton. That new function will present an alert window stating &#x201C;Hello World!&#x201D;
  103. Example... create a script that adds a pdf icon to all links on the page pointing to pdfs.
  104. And we can do our AJAX calls too. This was our KSS AJAX script.
  105. And we can do our AJAX calls too. This was our KSS AJAX script.
  106. And this is how it&#x2019;d look in jQuery. Our python script is going to be a lot simpler, now it just returns the data we&#x2019;re after instead of handling the changing of the page content. Then, we&#x2019;ll tell the selectedColor element to load the response from our jq_transformColor script. Our jQuery will override the submit method of the form. We&#x2019;ll grab the value of the color field. The last line is a bit of voodoo... In order to prevent the form from actually submitting, we return a false value. If we returned true, it&#x2019;d go ahead and complete the action.
  107. jQuery core is now included with Plone as of version 3.1. Plone uses jq instead of the dollar sign shortcut to avoid potential conflicts with other javascript libraries. And if you&#x2019;ve been using &#x2018;cssQuery&#x2019; or &#x2018;registerPloneFunction&#x2019;, you should now be using &#x2018;jq&#x2019; instead.
  108. There are over a thousand jQuery plugins available to handle things like animation, layout, forms, and AJAX.
  109. So how might you integrate one of these into Plone? If the plugin uses the &#x2018;$&#x2019; factory alias, you&#x2019;ll need to place it between jquery.js and jquery-integration.js in the portal_javascript registry. Using GenericSetup, that&#x2019;d look something like this -- specifying that the script should be inserted before jquery-integration.js in the ordering. Or you can wrap it in a function like this.
  110. So how might you integrate one of these into Plone? If the plugin uses the &#x2018;$&#x2019; factory alias, you&#x2019;ll need to place it between jquery.js and jquery-integration.js in the portal_javascript registry. Using GenericSetup, that&#x2019;d look something like this -- specifying that the script should be inserted before jquery-integration.js in the ordering. Or you can wrap it in a function like this.
  111. So how might you integrate one of these into Plone? If the plugin uses the &#x2018;$&#x2019; factory alias, you&#x2019;ll need to place it between jquery.js and jquery-integration.js in the portal_javascript registry. Using GenericSetup, that&#x2019;d look something like this -- specifying that the script should be inserted before jquery-integration.js in the ordering. Or you can wrap it in a function like this.
  112. So let&#x2019;s look at some existing behaviors that Plone provides through jQuery...
  113. And there are quite a few Plone products currently making use of jQuery.
  114. collective.flowplayer will turn links to flash videos or mp3s into inline players.
  115. Deco, which will be the content layout and editing tool at some point in Plone&#x2019;s future makes extensive use of jQuery to handle layout and interaction.
  116. jQuery has some excellent documentation available. I highly recommend checking it out.
  117. I&#x2019;m a fan of the &#x201C;Learning jQuery&#x201D; book from Packt.
  118. And I just want to mention a few other libraries that you can use with Plone. They&#x2019;re each focused on different tasks or approaches to writing interactive applications.
  119. If you&#x2019;re not comfortable with JavaScript or are pressed for time, KSS is the way to go. Otherwise, your best bet is to use JQuery.
  120. If you&#x2019;re not comfortable with JavaScript or are pressed for time, KSS is the way to go. Otherwise, your best bet is to use JQuery.
  121. Any questions?