projectdoc Toolbox

Authors occasionally need to have a look at a page as if they where in the role of a reader. The pretend-being-a user space property supports switching roles. With the use of the Web API Extension and the Bookmarklets Extension switching roles is now really easy!

Parent
Level of Experience
Expected Duration
20 min
Tags
Type
Contents

The projectdoc Toolbox provides additional visuals for writers. For instance, every transclusion renders a box to make it obvious that information is transcluded from another page. There are also additional buttons for editing and - if you are using fragments caching - reloading caches manually.

If a author wants to have the page rendered as if she was a reader, the Pretend Being A property in the user space needs to be set to the value reader. Once set, the fragment of a page shown above renders link this:

The box with the extra widgets is no longer visible.

This short tip explains how the projectdoc Toolbox, the Web API Extension, and the Bookmarklets Extension support users to switch roles quickly using the pretend-being-a user space property.

 

This tip requires

Add-on on the Atlassian MarketplaceVersionLicense
projectdoc Toolbox1.14+commercial
Web API Extension1.2+free
Bookmarklets Extension1.0+free

User Space Properties

Each projectdoc document provides document properties by the use of the Document Properties Marker Macro. If properties are defined on the homepage of a space, these properties become space properties. While space properties may be set in any space, there are some properties whose definition is only allowed in a user's space.

The pretend-being-a space property is such a user space property.

To create a projectdoc homepage in your private space, add the Document Properties Marker Macro.

The properties Name and Doctype is mandatory for projectdoc documents. To turn your homepage into a projectdoc homepage add the Document Properties Marker Macro like this:

Set Doctype to 'homepage' and Name to identify your page.

Using the bookmarklets will add the pretend-being-a property to the table of this page.

Pretend being a ...

The following roles are defined by the projectdoc Toolbox:

  • writer - the tools provide additional information to help users with write permissions navigate the documentation
  • reader - see what users without write permissions see
  • printer - apply hints to render document content for printing it (e.g. to PDF)

To pretend holding a role, you may edit the homepage of your user space and add the pretend-being-a property with a value of the desired role.

But

  1. changing to your homepage,
  2. switching to edit mode,
  3. changing the value,
  4. and then saving the page

is quite cumbersome.

Let's try to apply these changes with a simple REST call!

Web API

The projectdoc Web API provides services to change document properties via REST calls. So instead of running through the manual steps listed above, a user simply needs to call

Sample REST Call with curl
curl -s -n 
  -X PATCH 
  -H "Content-Type: application/json"  
  https://mycorp.com/confluence/rest/projectdoc/1/document.json?id-list=24248332,24248334,24248330,24248336 
  -d '{"property":[{"name":"pretend-being-a","value":"reader","controls":"hide"}]}'

This could be done from a shell using a command line REST client (for example curl) or users may employ the Atlassian REST API Browser.

Well, not convenient enough ...

Bookmarklets

What would be most productive is an entry to the page menu provided by Confluence. But if not everyone needs switching roles, this menu will soon be cluttered. What would be more convenient is the option for each user to compile her own menu according to her specific needs.

Bookmarklets allow to create menus in the browser. These menus are personalized and may be exported from and imported into different environments. Typically browsers also allow to sync them.

So how will it look like to create a pretender bookmarklet? First of all: it is already provided once you install the Bookmarklets Extension. The bookmarklet is called Pretender.

The Bookmarklet Extension provides a Bookmarklet Editor. This is a simple Confluence page with some macros attached.


Simply select the bookmarklet you want to install to your browser and then drag and drop it to your browser's menubar.

Organize your Bookmarklets

Organize all your bookmarklets and projectdoc related links in your browser's toolbar.

Resources

Title Short Description
The online manual for version 1 of the projectdoc Toolbox for Confluence.
Add-on to extend projectdoc with an API to access on the web.
Add-on to extend the Toolkit with Bookmarklets. Allows to execute tools via the browser.
The bookmarklets editor is a simple page that allows teams to create their bookmarklets more easily. It also provides access to some standard bookmarklets provided for the projectdoc Toolbox.
 Bookmarklet that changes the pretended role of a user.
Switch views on documents dependent on the user's role by setting space properties in the user's homepage.
Properties are metadata that can be added to every projectdoc document. If you require a set of metadata for each instance of a document type, you should write your own doctype.
Lists the configuration options at space level.
A switch to control the assumed role of the logged in user. The property is set as a property of the user's private space.
A table containing document properties. Three columns: name, value and meta data (aka controls) to a property.
Information on how to use the fragments cache.
curlCommand line tool and library
for transferring data with URLs.
Atlassian REST API BrowserInteractive API explorer for Atlassian products.