PrintBasket Plugin

Name Print Basket Plugin
Version 1.0.0
Vendor SGCIB
Author(s)
  • Florent GERBOD
  • Kedar LEE
  • François FEY
Contact
Price free
License Open Source (LGPL)
Download JAR printBasket-1.0.0.jar
Source Control  

Description

This plugin add a printing basket which allows you to make a selection of pages and to print them at one time



Features

  • Click on "Add" in order to add the current page in the basket
  • Click on "View Basket" in order to view/hide the basket content
  • Click on  in order to add all first children of a page
  • Click on  in order to delete a page
  • Click on  in order to print all pages listed in the basket

Downloading & Installing

  • Download from above the plugin jar.
  • Install the plugin through Confluence's plugin upload feature.

Known Problems

This plugin is designed for default theme of Confluence. If you use another theme it may be needed of making some modifications to your theme (for example in LeftNav Theme it doesn't work).

1. The first thing to do is to disabling the web-item. In order to do that you can add && $item.key != "PrintBasket" where system.space.actions items are listed :

For example in LeftNav Theme it's in navlinks.vm file :

navlinks.vm
...
#foreach ($item in $action.webInterfaceManager.getDisplayableItems("system.space.actions", $action.remoteUser, $helper))
  #if ($item.key != "browse-space" && $item.key != "PrintBasket")
    #set ($itemRenderedUrl = $item.link.getDisplayableUrl($req, $helper))
    #set ($itemLabel = $item.label.getDisplayableLabel($req, $helper))
    #if ($item.icon)
      #set ($icon = $item.icon)
      <li><a href="$itemRenderedUrl"><img src="$icon.url.getDisplayableUrl($req, $helper)" height="$icon.height" width="$icon.width" border="0" align="absmiddle" title="$itemLabel">&nbsp;$itemLabel</a></li>
    #else
      <li><a href="$itemRenderedUrl">$itemLabel</a></li>
    #end
  #end
#end
...

2. Next you have to add the code below where you want that  the basket appears :

<script language="JavaScript" src="$req.contextPath/includes/js/ajax.js" ></script>
<script language="JavaScript" src="$req.contextPath/download/resources/com.sgcib.confluence.macros.PrintBasket:PrintBasket/printbasket.js" ></script>

<img src="$req.contextPath/images/icons/cart_16.gif"  width="16" height="16" border="0" align="absmiddle"> Basket Print (<span id='nbPageBasketPrint'>0</span>)

<div id="basketPrintWindow">
</div>

<script language="JavaScript">loadBasket();</script>

Take a look at windowsBasket.vm file (in the jar) if you want to see how it works for the default theme.

3. Finally add the line below where you want to have the link to add the current page in the basket :

<a href="#" onClick="javascript:addBasket($helper.getPage().getId());">Add</a>

Screenshots

Developer information

Web item

The link in system.space.actions section menu is added by a web-item as below.

<web-item key="PrintBasket" name="Print Basket" section="system.space.actions" weight="40">
  <label key=""/>
  <link linkId="printBasket"><![CDATA["></a>#parse ("/vm/windowBasket.vm")<a href="]]></link>
</web-item>

This web-item is used to include html code in the page. It's not very clean but I don't know if there is a better way.

It's this method which doesn't work in some themes. That's why, in these kind of themes, you have to disable the web-item and include html code directly in the vmd files.

Package action "printBasketActions"

<xwork name="printBasketActions" key="printBasketActions">
  <package name="printmode" extends="default" namespace="/basketPrint">
    <default-interceptor-ref name="defaultStack" />

    <action name="printmode" class="com.sgcib.confluence.macros.PrintBasket.BasketPrintAction" method="doDefault">
      <result name="input" type="velocity">/vm/printmodeBasket.vm</result>
      <result name="error" type="velocity">/vm/printmodeBasket.vm</result>
      <result name="success" type="velocity">/vm/printmodeBasket.vm</result>
    </action>
    <action name="generateBasketPrint" class="com.sgcib.confluence.macros.PrintBasket.BasketPrintAction" method="doDefault">
      <result name="input" type="velocity">/vm/basketPrint.vm</result>
      <result name="error" type="velocity">/vm/basketPrint.vm</result>
      <result name="success" type="velocity">/vm/basketPrint.vm</result>
     </action>
  </package>
</xwork>

This package contains 2 actions :

  • printmode : generate page including all pages which are in the basket  (printmodeBasket.vm)
  • generateBasketPrint : generate list of page in the basket (basketPrint.vm)

Class Java

please see [javadoc|http://]

Bugs

Please report bugs in comments.

Labels

plugin plugin Delete
confluence22 confluence22 Delete
non-repository non-repository Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 19, 2006

    Jean-Pierre Loustau says:

    The License Model is not declared, I suggest LGPL.

    The License Model is not declared, I suggest LGPL.

    1. Dec 19, 2006

      David Peterson [CustomWare] says:

      Or BSD, depending on your philosophy.

      Or BSD, depending on your philosophy.

      1. Dec 19, 2006

        Guy Fraser says:

        BSD license is definately the preferred one. Alternatively ASL.

        BSD license is definately the preferred one. Alternatively ASL.

  2. Dec 19, 2006

    Jean-Pierre Loustau says:

    It's just for free usage and developments => not for proprietary and commerci...

    It's just for free usage and developments => not for proprietary and commercial (re) selling

    1. Dec 20, 2006

      Guy Fraser says:

      You have to explicitly state a specific license before we can use this plugin. S...

      You have to explicitly state a specific license before we can use this plugin. So if it is 100% free and open source and people can do whatever they want with it then it should be released under a BSD license. If no license is specificed, we have to assume it is commercial regardless of what anyone says. Only an authentic open source license denotes that the plugin is really open source.

      1. Dec 20, 2006

        Guy Fraser says:

        And before more people start arguing with me as to why a license is not needed (...

        And before more people start arguing with me as to why a license is not needed (which any legal team will tell you without hesitation it is), here is an even more compelling reason for you to release it under an OSS license (BSD or ASL recommended): You've not limited your liability and more importantly the liability of your company. If a company installs this plugin and it leads to loss of business, they can sue you because you have not explicitly limited your liability.

  3. Dec 20, 2006

    Eric Bardoux says:

    If you add a news to the basket, and then try to view the basket, it will end wi...

    If you add a news to the basket, and then try to view the basket, it will end with an exception

    1. Dec 21, 2006

      Florent Gerbod says:

      fixed! thank's for your debugging!

      fixed! thank's for your debugging!

  4. Dec 20, 2006

    Jonathan Nolen says:

    Neat plugin, guys! You should be sure to add it to the [Plugin Repository ...

    Neat plugin, guys! You should be sure to add it to the [Plugin Repository], too.

  5. Aug 08, 2007

    Jim Hazen says:

    I get the following errors with Confluence 2.5.5 and the default theme for any c...

    I get the following errors with Confluence 2.5.5 and the default theme for any content page viewed. The content page fails to render.

    2007-08-08 13:24:27,168 ERROR [http-10.10.13.93-8081-Processor4] [confluence.setup.velocity.ApplyDecoratorDirective] render org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getUrl' in  class com.atlassian.confluence.plugin.descriptor.web.model.ConfluenceWebIcon threw exception class java.lang.NullPointerException : null
     -- url: /display/~testUser/Home | userName: testUser | action: viewpage | page: 17484
    org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getUrl' in  class com.atlassian.confluence.plugin.descriptor.web.model.ConfluenceWebIcon threw exception class java.lang.NullPointerException : null
            at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:188)
            at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:226)
            at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:207)
    ...
    caused by:
    java.lang.NullPointerException
            at com.atlassian.confluence.plugin.descriptor.web.model.ConfluenceWebIcon.getUrl(ConfluenceWebIcon.java:20)
            at sun.reflect.GeneratedMethodAccessor240.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:154)
    

    Any ideas?

  6. Apr 09, 2008

    Keith Brophy says:

    Was the license for this plugin decided upon? Also - is the source available? ...

    Was the license for this plugin decided upon?

    Also - is the source available?

    Thanks,

    Keith 

  7. May 20, 2008

    Helene says:

    This plugin would be fantastic for us to use...but when I install it, Confluence...

    This plugin would be fantastic for us to use...but when I install it, Confluence stops working.  I can access the Dashboard, but any space I enter give me more or less a blank page:
     
    I am not using the left Nav theme.  Is there something that I need to do after I install the plugin and enable it?  Or has it just not been updated to work with 2.7?

  8. Oct 08

    James Cap says:

    Has anyone got some code to make it work on Confluence 2.9.1? I get the followin...

    Has anyone got some code to make it work on Confluence 2.9.1? I get the following when I install the plugin; default theme: