Basic configuration - softwareloop/alfresco-inboxes GitHub Wiki

Alfresco-inboxes is an Alfresco plugin that provides an inbox view inside Share, implemented using the new Aikau framework. This page explains how to customise it using the configuration file inboxes.get.config.xml.

What can be configured

You can configure:

  • the number and titles of the inbox groups
  • the number and titles of the inboxes
  • the CMIS query that defines an inbox's content
  • the inbox icons

In practical terms, if you look at the default page:

alfresco-inboxes - inboxes selection - "For my approval highlighted"

  • the two groups "My documents" and "Archives",
  • the 8 inboxes "Drafts", "For my approval", "Overdue", etc,
  • the queries that produce the results that you see on the right side of the page and that are summarised in the counter near the inbox
  • the icons (paper clip, inbox, clock, etc )

... are all the result of configuration and can be changed easily.

Step 1: locate the configuration file

The configuration file is called inboxes.get.config.xml and is located in the source distribution under:

config/alfresco/web-extension/site-webscripts/softwareloop/inboxes/

If you change the file, you'll have to rebuild and reinstall the amp. If the amp is already installed, the config file will be located under: $ALF_HOME/tomcat/webapps/share/WEB-INF/classes/alfresco/web-extension/site-webscripts/softwareloop/inboxes/

You can modify this file directly so you don't have to reinstall the amp or restart Alfresco. However, after each modification, remember to force Alfresco to reload it by visiting http://localhost:8080/share/service/index and clicking on the "Refresh Web Scripts" button.

Step 2: study the XML structure

The XML structure is the following:

  • a root inboxes element contains one or more group elements
  • a group element contains one or more inbox elements
  • an inbox element contains exactly one query element
<inboxes>
  <group id="my-documents">
    <inbox id="drafts" iconClass="foundicon-paper-clip">
      <query><![CDATA[
      SELECT d.*, t.* 
      FROM cmis:document AS d
      JOIN cm:titled AS t on d.cmis:objectId = t.cmis:objectId
      WHERE contains(d, 'PATH:"/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Meeting_x0020_Notes/*"')
      ]]></query>
    </inbox>
    <!-- other inbox definitions -->
  </group>
  <!-- other group definitions -->
</inboxes>

Step 3: define groups and inboxes

Just to familiarise with the xml structure, let's delete the default content and start from scratch with a minimal configuration:

<inboxes>
  <group id="First group">
    <inbox id="An inbox">
      <query></query>
    </inbox>
    <inbox id="Another inbox">
      <query></query>
    </inbox>
  </group>
  <group id="Second group">
    <inbox id="Yet another inbox">
      <query></query>
    </inbox>
  </group>
</inboxes>

Save the file, refresh the web scripts, reload the page. You should now see the new configuration applied:

Two groups of inboxes

The id attribute is used as the group/inbox title. The Translations page explains how to translate the titles in other languages using i18n.

The inbox counter currently displays an "ERR" value, which prompts us to move on to the next configuration step.

Step 4: write the CMIS queries

The content of an inbox is defined by a CMIS query. A CMIS query is similar to an SQL query but its purpose is to retrieve lists of documents and it follows a different syntax.

As an example, let's write a query that retrieves all the documents in the "Meeting Notes" folder under the "swsdp" demo site available on all Alfresco installations:

<query><![CDATA[
SELECT d.*, t.* 
FROM cmis:document AS d
JOIN cm:titled AS t on d.cmis:objectId = t.cmis:objectId
WHERE contains(d, 'PATH:"/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Meeting_x0020_Notes/*"')
]]></query>

Save the inboxes.get.config.xml file, refresh the web scripts and reload the page. You should now see the inbox counter displaying the correct value and the corresponding list of documents on the right side of the page.

Two groups of inboxes with counter and results

Step 5: add the inbox icons

Alfresco-inboxes includes the "general set" of the ZURB Foundation icons. Pick an icon that you like and write down its name (e.g. "idea"). Prepend "foundicon-" to the name (e.g. "foundicon-idea") – this will be the value for the iconClass attribute.

Repeat for all inboxes. This should give you the final inboxes.get.config.xml:

<inboxes>
  <group id="First group">
    <inbox id="An inbox" iconClass="foundicon-idea">
      <query><![CDATA[
      SELECT d.*, t.*
      FROM cmis:document AS d
      JOIN cm:titled AS t on d.cmis:objectId = t.cmis:objectId
      WHERE contains(d, 'PATH:"/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Meeting_x0020_Notes/*"')
      ]]></query>
    </inbox>
    <inbox id="Another inbox" iconClass="foundicon-clock">
      <query><![CDATA[
      SELECT d.*, t.*
      FROM cmis:document AS d
      JOIN cm:titled AS t on d.cmis:objectId = t.cmis:objectId
      WHERE contains(d, 'PATH:"/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Meeting_x0020_Notes/*"')
      ]]></query>
    </inbox>
  </group>
  <group id="Second group">
    <inbox id="Yet another inbox" iconClass="foundicon-phone">
      <query><![CDATA[
      SELECT d.*, t.*
      FROM cmis:document AS d
      JOIN cm:titled AS t on d.cmis:objectId = t.cmis:objectId
      WHERE contains(d, 'PATH:"/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Meeting_x0020_Notes/*"')
      ]]></query>
    </inbox>
  </group>
</inboxes>

Save, refresh the web scripts, reload the page, and... TA-DA! a fully configured set of inboxes:

Inboxes with icon, counter and results

Further readings

More example CMIS queries.

If you're not familiar with CMIS, you can experiment with it using Alfresco's node browser which is available on all installations if you log in as an administrator.

⚠️ **GitHub.com Fallback** ⚠️