Page Auto List widget using the calendar date instead of publishing dat

Hello all,

I’m not sure how often people use the page auto list widget for upcoming events with calendar pages but right now the page auto list only lists pages based on their publishing date.

How about another option that access the calendar date and lists pages based on what the calendar date is, would anyone else be interested in this?

Can this be accomplished building a custom widget?


That is a great question!  I am going to discuss this with the team and see if it can be accomplished by building a custom widget. 


Yes, please!

This is a great question! And a good candidate for a custom widget using the  AutoWidgetContentFinder velocity method. YOu can see two examples of this in use in these blog posts:… 

For your purposes, Andrew, you could create a custom widget that would allow you to enter the folder path as a variable name into the $query variable that holds the JCR query to the database. 

There are additional parameters that can be added to that JCR query such as:

"order by rx:sys_contentpostdate desc"

or filtering by date:
rx:sys_contentpostdate > ‘2015-01-01 00:00:00’ 
rx:sys_contentpostdate > '2015-12-31 23:59:59’

You can use the date field type in the widget builder to make date selection easy. 

The JCR query options can be set using variables for folderpath and year  from your custom widget fields and then combined into the following for example:

"select rx:sys_contentid, rx:sys_folderid from rx:percPage where (jcr:path like ‘/$folderLocation/%’ OR jcr:path like ‘/$folderLocation2/%’) AND rx:sys_contentpostdate > ‘$yearStart’ AND rx:sys_contentpostdate < ‘$yearEnd’ order by rx:sys_contentpostdate desc"

Once you have you query properly formed we can set the rest of our AWCF params:

#set($params=$rx.string.stringToMap(null)) ##
#set($dummy=$params.put(‘max_results’, $maxResults )) ##
#set($dummy=$params.put(‘query’, $query)) ##
#set($finderName=“Java/global/percussion/widgetcontentfinder/perc_AutoWidgetContentFinder”) ##

Notice we can add an additional  maxResults  variable as a field in our custom widget as well. 

Then we pass the parameters into the AutoWidgetContentFinder method:

#set($relresults= $rx.pageutils.widgetContents($sys.assemblyItem, $perc.widget, $finderName, $params))##

The method returns a list of objects into the variable  $relresults that we can then iterate on using a velocity  forloop. To start with let’s output the raw data to see what we’re working with:

#foreach($result in $relresults)##





You’ll see the assembly object with a list of key-value pairs of properties. The calendar event properties you’re looking for here are names:

You can use the velocity set statement to get values from the objects and them generate your HTML with them. For example:

#set($eventStart = $result.node.getProperty(‘rx:page_start_date’).getString())##
#set($eventEnd = $result.node.getProperty(‘rx:page_end_date’).getString())##
#set($calendars= $result.node.getProperty(‘rx:page_calendar’).getValues())##

Andrew, I hope that information helps along in your development on this widget. I wrote a bit more than I anticipated so you can expect i’ll be writing this up as a blog post soon to share with other community users as well. 

Additionally, here’s a link to Apache’s velocity user guide for reference on working with loops and variables and such: