Plugin Gadgets - Integration manual v1.3.0, v1.4.0, v1.5.0


  1. Installation
  2. Gadget library
    1. Example
    2. UWA gadgets
    3. I-frame containing a custom gadget
  3. End of integration

Installation

  • Stop the server
  • Download jars from plugin and add them (ametys-plugin-gadgets-1.3.0.jar and ametys- plugin-gadgets-resources-1 .3.0.jar) to your application's WEB-INF/lib directory. Ametys

  • plugin requires a number of external libraries to function. Download the zip file containing these libraries, and extract the files into your application's WEB-INF/lib directory. Ametys

  • The plugin gadget also depends on the javax.el package. Depending on your application server, it may or may not be included by default (if you use Tomcat, it should be).

Gadget library

You need to define your own library of gadgets that will be available to your visitors and contributors.

This library is defined in your application's WEB-INF/param/gadgets.xml file.

Gadgets are grouped by category.

The i18n keys contained in this file must be translated in the file WEB-INF\i18n\application .xml.

For each gadget you need to supply theurl Open Social or UWA definition, or theurl HTML of your own gadget, or theurl of a feed. RSS

  • for a UWA gadgetadd the attribute type="UWA"

    <gadget url="http://widget.pagesjaunes.fr/uwa/index.html" type="UWA"/>
    
  • for your own gadget iframe, add the attribute type="HTML" :

    <gadget url="http://localhost:8080/samplecontainer/iframe.html" type="HTML"/>
    
  • for a feed rss, add the attribute type="RSS" :

    <gadget url="http://www.nytimes.com/services/xml/rss/nyt/GlobalBusiness.xml" type="RSS"/>
    

Example

Here is an example of a library containing three categories

<library>
    <group>
        <label i18n="true">application:GADGETS_GROUP_OFFICE_TOOLS</label>
        <gadget url="http://www.google.com/ig/modules/dictionary.xml"/>
        <gadget url="http://bbs.cnnas.com/igoogle/datetimemulti.xml"/>
        <gadget url="http://www.labpixies.com/campaigns/converter/converter.xml"/>
        <gadget url="http://www.netvibes.com/modules/multipleFeeds/multipleFeeds.php?provider=ft_india" type="UWA"/>
    </group>
 
    <group>
        <label i18n="true">application:GADGETS_GROUP_GAMES</label>
        <gadget url="http://www.google.com/ig/modules/horoscope.xml"/>
        <gadget url="http://hosting.gmodules.com/ig/gadgets/file/102462998830435293579/dradio.xml"/>
        <gadget url="http://throttled.org/googlegadgets/youtubesearch.xml"/>
        <gadget url="http://hosting.gmodules.com/ig/gadgets/file/117375892785445698801/flickr-photos-search.xml"/>
        <gadget url="http://hosting.gmodules.com/ig/gadgets/file/100080069921643878012/facebook.xml"/>
        <gadget url="http://www.labpixies.com/campaigns/trio/trio.xml"/>
        <gadget url="http://www.programme.tv/webmaster/google/tv.xml"/>
    </group>
 
    <group>
        <label i18n="true">application:GADGETS_GROUP_NEWS</label>
        <gadget url="http://bbcnewsgadget.googlecode.com/svn/trunk/Gadget/bbc_igoogle_ukedition12.xml"/>
        <gadget url="http://hosting.gmodules.com/ig/gadgets/file/116551734240963456629/cnn-tech.xml"/>
        <gadget url="http://www.weatheronline.co.uk/rss/igoogle"/>
        <gadget url="http://widget.pagesjaunes.fr/uwa/index.html" type="UWA"/>
        <gadget url="http://localhost:8080/samplecontainer/iframe.html" type="HTML"/>
        <gadget url="http://www.netvibes.com/modules/multipleFeeds/multipleFeeds.php?provider=lefigaro" type="UWA"/>
            <gadget url="http://www.nytimes.com/services/xml/rss/nyt/GlobalBusiness.xml" type="RSS"/>
    </group>
</library>

Warning: if you change the library, the server must be restarted!

 

UWA gadgets

There are 3 ways to define the height of UWA gadgets (in the file WEB-INF/param/gadgets.xml):

  • Dynamically: does not work for all gadgets

    <gadget url="http://www.voyages-sncf.com/design/daily/deals/widget/uwa/expbooking/uwa_expbooking.html" type="UWA" dynamic_height="true"/>
    
  • Fixed: to be used if the width of the gadget is known

    <gadget url="http://www.voyages-sncf.com/design/daily/deals/widget/uwa/expbooking/uwa_expbooking.html" type="UWA" height="270"/>
    
  • Default

    <gadget url="http://www.voyages-sncf.com/design/daily/deals/widget/uwa/expbooking/uwa_expbooking.html" type="UWA"/>
    

     

     

I-frame containing a custom gadget

You can define your own gadget: it consists of an XHTML page, accessible via the http://starting with <?xml version="1.0" encoding="UTF-8"?>

The page must contain a <title> and the <meta> for the gadget description:

  • title: gadget title
  • description: optional description of the gadget
  • thumbnail: used for the library
  • height: preferred height in pixels for displaying the gadget
  • author: the author of the gadget
  • author_email: the author's mail address
  • screenshot: an optional screenshot of the gadget

Example of a gadget in an iframe :

  • HTML gadget page (http://localhost:80/sample/ametys_en.html)

    <?xml version="1.0" encoding="UTF-8"?>
    <html>
       <head>
        <title>Ametys Smart Web CMS</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta content="A simple gadget provided by Anyware Services" name="description"/>
        <meta content="Anyware Services" name="author"/>
        <meta content="250" name="height"/>
        <meta content="support@anyware-services.com" name="author_email"/>
        <meta content="http://localhost:8080/samplecontainer/ametys.jpg" name="screenshot"/>
        <meta content="http://localhost:8080/samplecontainer/ametys.jpg" name="thumbnail"/>
     
        <style>
            body {
              font-size: 11px;
              font-family: Arial,Helvetica,sans-serif;
            }
        h1 {color: #812281;}
        </style>
        </head>
        <body>
            <h1>Ametys Smart Web CMS</h1>
        <img src="ametys.png" style="float:left; margin-right: 10px"/>
            <p>Ametys is an open source project distributed under the Apache open source license.
            The developers and users community has a set of tools allowing them to contribute to the project</p>
            <ul>
               <li>If you have any questions, go and ask the community on <a target="blank" href="http://www.ametys.org/forum">forum</a> (in french)</li>
               <li>The <a target="blank" href="https://wiki.ametys.org">Wiki</a> stores documentations and initiatives related to Ametys</li>
               <li><a target="blank" href="https://issues.ametys.org/secure/Dashboard.jspa">JIRA</a> allows issues and suggestions gathering and tracking</li>
            </ul>
            <p>All this information and other on <a target="blank" href="http://www.ametys.org">www.ametys.org</a>.</p>
        </body>
    </html>
    
  • Render the Gadget by adding it to the container

End of integration

Once everything has been set up, restart the server.

Back to top

Gadgets