Adding a menu to Teamsite to call a workflow.

Posted: 20 May 2009 in Content Center Professional interface, Roles, SitePublisher, Teamsite, UI toolkits, Worfklow models, Workflows

This is a 4 step process.

  1. We need to define a custom operation that points to the workflow, 
  2. We use the operation in the menu so that users can do the invoking.
  3. We make the toolkit so that teamsite accepts our new operation
  4. We grant people the right to use our operation

 Defining a custom operation

In the teamsite/local/config/lib/content_center/customer_src/etc/conf/customer folder, the file userops_custom.xml is the one we want to modify.

<custom-operations>
<operation description="Calls the workflow to create a new intranet site" display-name="New Site (Intranet)" id="acme.newsite.intranet" />
</custom-operations>

The id must be unique throughout the system. The operation itself does not do anything, it is used later to find who’s allowed to use the action before the action is checked from the link.

Modifying the menu

In order to modify a menu, you need to find where to place it. For that, navigate to the application folder teamsite/httpd/webapps/content_center/WEB-INF/conf/ccpro and view the file ui_common.xml

In this example, we want to create a link below the File > New Site menu option. Looking at the link when we hover over it gives us the “iw.livesite.ccpro.create_site” command. Now we know that, we can find the file this menu has been created in with this little script:

command="iw.livesite.ccpro.create_site"
for file in `find teamsite/local/config/lib/content_center/reference/etc/conf/ -name ui*.xml 2>/dev/null`
 do
  echo ${file}
  cat ${file} | grep ${command}
 done

Open the file given as containing the command (and therefore the link using it) and find the command again.
We need to customise our customisation file called ui_custom.xml with the containing element (and all its parent hierarchy to the action list).

<iwov-ui>
    <action-list id="iw.ccpro.filesys.menubar">
        <menu id="iw.ccpro.file.menu">
        </menu>
    </action>
</iwov-ui>

We need to insert a menu item, below the link to create a new site.

<iwov-ui>
    <action-list id="iw.ccpro.filesys.menubar">
        <menu id="iw.ccpro.file.menu">
            <iwov-insert-after id="iw.livesite.ccpro.file_menu.create_site.link">
                 <link id="acme.file.newsite.intranet"
                        label="New Site (Intranet)"
                        description="Creates a new intranet site"
                        url="/iw-cc/command/iw.ccpro.new_job?iw_template_file=intranet_new_site&amp;iw_template_name=intranet_new_site&amp;workflowType.flag=true"
                        target="_blank"
                        operationID="acme.newsite.intranet"/>
            </iwov-insert-after>
        </menu>
    </action>
</iwov-ui>

Making the toolkit

Navigate to teamsite/local/config/lib/content_center/customer_src and issue the following command as root

./make_toolkit.sh

Granting rights

 Now we’ve done all the hard work, All we need to do is give the operation to one of the roles. For example, admin. On the administration tab, select the manage roles and expand the custom operations part for the admin role.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s