The TaskList macro allows authors to generate and track a simple list of tasks. Each line inside the macro body is parsed as a separate task. Each task will display with a graphic button for marking the task complete. When this happens, the userid is also recorded and displayed.
The TaskListMacro applies authorization policies based on the surrounding context. In simpler terms, if you are an author for the piece of content, you can also edit the tasks.
Example:
"open" document - any registered user can complete a task.
"closed" document with three authors (manny, moe, and jack) -- only those users can marke tasks complete.
your personal blog -- only you will be able to complete a task.
group blog -- any of the blog authors will be able to complete a task
discussion post -- only the author of that post can complete the tasks.
build.xml -- Ant build file
plugin.xml -- plugin descriptor required by Clearspace
xwork-plugin.xml -- XWork file that maps actions to action classes
readme.txt -- macro usage instructions
tasklist.iml -- IntelliJ Idea module file.
src
plugin_i18n.properties -- internationalization
com.jivesoftware.clearspace.plugins.tasklist
TaskListMacro.java -- class that renders the macro
TaskListAction.java -- class that processes task list requests and persisting state
resources
task-list-html.ftl -- FreeMarker template for generating task list in HTML
task-list-text.ftl -- FreeMarker template for generating task list in plain text
jive-icon-task-chk-16x16.gif -- image for checked tasks
jive-icon-task-unchk-16x16.gif -- image for unchecked tasks
The Ant build.xml file at the root of the plugin includes a build.plugins target to compile the code and package it into a JAR file. The deploy.plugins target copies the JAR into the <jiveHome>/plugins directory in 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. You will need to update the target paths if you're testing another way, such as with the Clearspace WAR distribution.
In addition to Java 1.5, compilation depends on some libraries included in the Clearspace web application WEB-INF/lib directory:
clearspace-<version>.jar
webwork.jar
xwork.jar
rife-continuations.jar
If you'd rather deploy the plugin manually, you can do that in one of two ways:
Method 1:
Copy the plugin JAR file into the <jiveHome>/plugins directory - a running Clearspace instance will deploy it automatically.
Method 2:
Open the Clearspace Administration console, navigate to System > Settings > Plugins
Browse to locate and upload the plugin JAR file.
If you compile and receive this error, "method removeAllFilterTargets - can not find symbol", then you have compiled the older v1.4 tasklist macro against the newer v1.6 Confluence Jar.
More info from Nick, "In 1.6, we made it easier to get access to the render filter cache from a custom macro, as many custom macros needed the ability to clear the render cache for various events.... the new tasklist.jar and tasklist-src.jar compatible with 1.6. I renamed the previous plugin to tasklist-1.4.jar for those customers that are still stuck on older versions."
1. Build and deploy the code.
2. Open Clearspace and create a new discussion, document, or blog post. Add whatever text you like, but be sure to add the following macro markup:
{tasklist}
Write an example plugin
Document the example plugin
Provide a readme file for the plugin
{tasklist}
3. Preview or publish the discussion, document, or blog post to see the task list generated by the macro.
Note: You can add a custom title to your task list by using the syntax in place of the first macro tag. Also, the spaces between the brackets should be removed, they are inserted here to prevent the macro from rendering the sample text.
I thought I'd come back and answer my own question in case anyone else notices this. You actually can have multiple people complete tasks with this plugin, but only if the list is created inside a Document (not a discussion or blog post). I guess that makes sense actually since multiple people can be allowed to edit a document anyway.
Hey Brad,
Sorry for not getting back to you sooner. The TaskListMacro actually checks if you are an author for the piece of content, and if so, you can edit the tasks. If you create an open document, any registered user can complete a task. On the other hand, if you create a closed document with only 3 authors, only those 3 people can complete a task. If you use the task list macro in your personal blog, only you will be able to complete a task. However, if it is used in a group blog, any of the group blog authors will be able to complete a task. For discussions, only you can edit the tasks in your message.
Hope this helps, even if it is a bit late ![]()
Nick
Tahnsk - Good & useful plug-in.
Minor Point: The padding top & bottom is a bit generous - knocks document formatting out a bit.
Enhancement Suggestion: Record the date that the last was set to complete.
Minor Issue: did not appear to work for me
There's an issue with the PDF printing of a document with the Task List used. The following additional characters are printed out:
var isPreview = false;
if ($('preview-panel')) {
isPreview = true;
}
Tasks Completed: ...............
Seems like this macro does not compile as is with CS 1.6?
Here's the output from ant:
build.plugins:
mkdir Created dir: /d/work/cs-plugins/tasklist-src/classes
javac Compiling 2 source files to /d/work/cs-plugins/tasklist-src/classes
javac /d/work/cs-plugins/tasklist-src/src/com/jivesoftware/clearspace/plugins/tasklist/TaskListAction.java:95: c
not find symbol
javac symbol : method removeAllFilterTargets(com.jivesoftware.community.impl.dao.DocumentBean,java.lang.String)
javac location: class com.jivesoftware.community.impl.DbDocument
javac DbDocument.removeAllFilterTargets(dbDocumentManager.getDocumentBean(document.getID()),
Body");
javac ^
javac /d/work/cs-plugins/tasklist-src/src/com/jivesoftware/clearspace/plugins/tasklist/TaskListAction.java:133:
nnot find symbol
javac symbol : method removeAllFilterTargets(long,java.lang.String)
javac location: class com.jivesoftware.community.impl.DbBlogPost
javac DbBlogPost.removeAllFilterTargets(blogPost.getID(), "Body");
javac ^
javac /d/work/cs-plugins/tasklist-src/src/com/jivesoftware/clearspace/plugins/tasklist/TaskListAction.java:161:
nnot find symbol
javac symbol : method removeAllFilterTargets(long,java.lang.String)
javac location: class com.jivesoftware.community.impl.DbForumMessage
javac DbForumMessage.removeAllFilterTargets(message.getID(), "Body");
javac ^
javac /d/work/cs-plugins/tasklist-src/src/com/jivesoftware/clearspace/plugins/tasklist/TaskListAction.java:229:
nnot find symbol
javac symbol : method removeAllFilterTargets(com.jivesoftware.community.impl.dao.DocumentBean,java.lang.String)
javac location: class com.jivesoftware.community.impl.DbDocument
javac DbDocument.removeAllFilterTargets(dbDocumentManager.getDocumentBean(document.getID()),
Body");
javac ^
javac /d/work/cs-plugins/tasklist-src/src/com/jivesoftware/clearspace/plugins/tasklist/TaskListAction.java:267:
nnot find symbol
javac symbol : method removeAllFilterTargets(long,java.lang.String)
javac location: class com.jivesoftware.community.impl.DbBlogPost
javac DbBlogPost.removeAllFilterTargets(blogPost.getID(), "Body");
javac ^
javac /d/work/cs-plugins/tasklist-src/src/com/jivesoftware/clearspace/plugins/tasklist/TaskListAction.java:295:
nnot find symbol
javac symbol : method removeAllFilterTargets(long,java.lang.String)
javac location: class com.jivesoftware.community.impl.DbForumMessage
javac DbForumMessage.removeAllFilterTargets(message.getID(), "Body");
javac ^
javac 6 errors
BUILD FAILED
/d/work/cs-plugins/tasklist-src/build.xml:50: Compile failed; see the compiler error output for details.
I get the same thing here... not sure where these classes live.
Addendum...I'm trying this with Clearspace 1.6, and I verified that the classpath does indeed include the clearspace/WEB-INF/lib/*.jar and the servlet-api.jar files.
-T
I dug around a bit more and it seems like the removeAllFilterTargets method simply doesn't exist anymore in 1.6... replacement code would be what?
In 1.6, we made it easier to get access to the render filter cache from a custom macro, as many custom macros needed the ability to clear the render cache for various events. I have uploaded the new tasklist.jar and tasklist-src.jar compatible with 1.6. I renamed the previous plugin to tasklist-1.4.jar for those customers that are still stuck on older versions.
Muchas gracias, Nick! ![]()
Another suggestion -- I know folks shy away from "deleting" anything, especially if it isn't their content; however, I would recommend incorporating the info from your comment, and the relevant previous comments, into the body of this page (I mean "document") -- and then remove the comments.
Advantages: the document is more complete and up to date, and new users have less to sift through. You might add a troubleshooting section "If you see errors complainig about removeAllFilterTargets, you have the 1.4 code and you're trying to compile against 1.6".
Cheers,
Tim
P.S. I would remove my comments myself I had the permissions -- because they simply aren't relevant anymore now that you've provided a solution. It's just extra garbage that somebody will have to sift through (they won't know it's irrelevant until they understand the gestalt of the page).
Ha... I'm not used to the Clearspace UI yet, I just noticed that I do have the ability to edit the document... I can't delete comments, but I can at least help by adding the info you gave. ![]()
-Tim
As I dig deeper into this macro, it looks like the "title" parameter does not work. The code appears to simply create an empty HashMap - "title=foo" does not change the rendered title.
It looks like getProperties is part of the BaseMacro and RenderMacro... however when I try to extend those, many other methods are req'd and I still do not get a "title" to render. ![]()
-Tim
After more time with the code, and a pointer on another thread to the EmbedContent macro - I found the small bug in TaskList Macro and fixed it. ![]()
Looks like it is as simple as setting the instance parameter map to the incoming map from the request to render():
public String render(String body, Map<String, String> parameters, MacroContext macroContext) {
this.parameters = parameters;
return executeHtmlTarget(body, macroContext);
}
-Tim
Tim, thanks for finding this issue and denoting the fix. I think this was caused by a change in the framework from 1.4 to 1.6, but the task list macro wasn't updated property.
When I try to "view as PDF" on a tasklist I get the following instead of a nice list of my tasks. Is there a fix for this?
PDF Export of Tasklist
Groceries
var isPreview = false;
if ($('preview-panel')) {
isPreview = true;
}
Tasks Completed: 40%
milk
eggs (completed by Daniel W. McCall )
cheese
steak (completed by Daniel W. McCall )
beer
Click the icons above to mark or unmark a task as complete
Has anyone ported this to 2.5? I noticed that it renders blank now.
Anyone have a link to porting plugins from older versions of clearspace to 2.5?
This is a very cool plugin Nick. I just installed it and am testing it out. One thing I just noticed is that it seems to only allow the creator of the task list to mark the items complete. If another user tries to check off tasks, they get an "Unauthorized" error message. I'm pretty new to Clearspace so it could be something wrong with config on my end, but thought I would mention and see if this was intended behavior or not.
Thanks!
Brad