Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Extra Placeholders addon add functionality to Confluence 'instructional text' by providing Date, Page and Autocomplete options.

When your template contains Date instructional text field it will present a date picker when activated. Just select the field and start typing:

When your template contains Page instructional text field it will present a page selector when activated. Again, select the field and start typing the title of the page you want to select:

Autocomplete instructional text can provide arbitrary reference data. When addon is first installed it contains sample data:

Confluence administrators can define there own reference data using addon configuration page.

In its simplest form the data is just a list of strings:

Another option is to have javascript provide reference data:

'Confluence Pages' datasource is similar to 'Page' instructional text described above, and is used here as a demo. It's full definition is as follows:

Code Block
languagejs
{
    getUrl: function(val) {
        if (val) {
            return AJS.contextPath() + '/rest/prototype/1/search';
        } else {
            return null;
        }
    },
    getParams: function(autoCompleteControl, val){
        var params = {
            'max-results': 10,
            search: 'name',
            //label: 'my-page-label',
            type: 'page'
        };
        if (val) {
            params.query = Confluence.unescapeEntities(val);
        }
        return params;
    },
    update: function(autoCompleteControl, linkObj){
        //setLink(linkObj);
        if (linkObj.restObj) {
            var link = AJS.$.extend(linkObj.restObj, {
                title: linkObj.restObj.linkAlias
            });
            linkObj = Confluence.Link.fromREST(link);
        }
        linkObj.insert();
    }
}

The code is mostly self-explanatory: getUrl function returns RESTful service endpoint; getParams provides parameters for a call; update converts results to HTML and appends it to the editor.

Extra Placeholders addon supports integration with other addons that contain reference data. Extra Placeholders distribution (OBR file) comes packaged with two simple free addons:


If you have found a bug please report at the Issue Tracker.