Return to Jive Software

Currently Being Moderated

Example Plugin

VERSION 9  Click to view document history

Created on: Jul 18, 2007 4:58 PM by andrew - Last Modified:  Feb 3, 2009 1:53 PM by Vinh

A kind of smorgasbord, this plugin includes several simple examples designed to show how plugins and macros work.

 

What's Included

 

What the Samples Do

 

The samples here include:

 

  • An macro that displays the name of the user currently logged in.

    To test: Create a wiki document, add
    to the document, then publish the document.

  • A "Hello World" tab in the admin console.

    To test: Display the admin console, then click the Hello World tab. You'll get a new "Hello World" page.

  • An "Example Test" menu in the user bar. 

    To test: Display the Clearspace UI, click the Example Test menu, then click the Example command. You'll get a new page displaying results from actions included in this plugin.

  • An "Example Plugin" link in the community Actions box.

    To test: Display the Clearspace UI, navigate to a sub-community, then click the link. You'll get a new page displaying results from actions included in this plugin.

  • An "EchoService" web service that returns text submitted to it.

    To test: Write a web service client that calls the echo operation with some string. The service returns that string, prepended with the name of the user who sent it.

 

Java Source

 

 

  • ExamplePlugin.java

 

  • HelloWorldAction.java

 

  • IncludedPageAction.java

 

  • SimpleAction.java

 

  • AuthorsNameMacro.java

 

  • EchoService.java

 

Resources

 

 

  • examples.css

 

  • example.ftl

 

  • helloword.ftl

 

  • included-page.ftl

 

Building and Deploying the Code

 

The Ant build.xml file at the root of the plugin includes a build.plugins target you can use to compile the code and package it into a JAR file. There's also a deploy.plugins target that copies the JAR into the <jiveHome>/plugins directory that accompanies your Clearspace distribution. Paths into your test Clearspace distribution assume that this plugin project is in the standalone Clearspace distribution at: <root>/plugins/plugins/helloworld. Be sure to update the targets if you're testing another way, such as with the Clearspace WAR distribution.

 

Be sure to read the notes below about dependencies. The JAR files you'll need are included as part of Clearspace.

 

If you'd rather deploy the plugin manually, you can do that in one of two ways:

 

  • Just copy the plugin JAR file into the <jiveHome>/plugins directory. Your running Clearspace instance will deploy it automatically.

  • Open the admin console and navigate to System > Settings > Plugins, then browse for your plugin JAR file.

 

Dependencies

 

In addition to requiring Java 1.5, this code requires a few of the libraries you'll find in the WEB-INF/lib directory of your Clearspace installation, listed below.

 

  • clearspace-<version>.jar

  • webwork.jar

  • xwork.jar

  • rife-continuations.jar

  • xfire-jsr181.jar

 

Clearspace 2 Plugin Files

 

Clearspace 1.X Plugin Files Attached Below

Attachments:
Average User Rating
(2 ratings)
Thom Hickey Thom Hickey  says:

Hi Andrew,

 

Look like this is 1.4.0 only? The Macro.java file is not included in the 1.3.0 distribution and it seems to be required to compile this plugin.

 

Cheers!

Satish Salguti Satish Salguti  says:

Hi Andrew,

I have downloaded the plugin and am reading the source. I have one question. In the plugin.xml we have the jspa extension for helloworld url and no extension for the other two URLs. So when do we need to add an extension and when should we not?

andrew andrew  says in response to Satish Salguti:

hmm.. Perhaps the 1.4 versions was uploaded instead, I will look at getting the 1.3 version up. In the mean time you can download 1.4 beta here: http://dev.jivesoftware.com/downloads/index.jsp

 

The final version of 1.4 will be out at the end of next week.

Satish Salguti Satish Salguti  says:

Andrew,

I understand you have the plugin_i18n.properties in your plugin. That works great. But if I have 2 plugins with the plugin_i18n.propertites each containing the properties for that plugin, only one is getting loaded. The other one is not.I tried putting that file in a package and that does not get loaded either.

andrew andrew  says in response to Thom Hickey:

Try the 1.3 version attached.

James Schopp James Schopp  says:

The admin component DOES add a new tab to the admin panel, but I do not see any of the submenus appearing (ie. the 2nd level menus, and items on the left do NOT appear). I would like to have several submenus - how can I get this?

 

thanks,

james

nickva nickva  says:

In order to get this working for my version of Jive SBS (3.0.3) I had to make the following changes:

  • In struts.xml - change all namespace="something" to namespace="", EXCEPT for the one with package="community-admin-default" (leave this as namespace="/admin")
  • In plugin.xml - make sure all ${x.ID} looks like ${x.ID?c}, the ?c interprets it as a character string first, preventing a number like 1006 from rendering as 1,006
  • In plugin.xml - change all instances of community=${container.ID?c} to community=${community.ID?c}

 

I think this was all I had to change.

Download Plugin for

Plugin Info

  • example
  • by andrew
  • Compatible with 1.x, 2.5.x
  • Last updated: 6/1/2008

Bookmarked By (1)

More Like This

  • Retrieving data ...

More by andrew