Customize user preferences
With these API calls you can customize several user preferences.
Introduction
- Units
- Language
- Note color
- UI customization
For these settings PROOFSCOPE uses the CLOUDFLOW preferences.
Structure of Preferences
- System preferences (system)
- User preferences (user)
User preferences inherit from the system preferences. For example, if a preference key language is defined on system level, it is inherited on user preference level if it is not present there. The idea behind it is that a CLOUDFLOW system defines the defaults and that the users can override these defaults. User preferences are bound to the email address of the users.
You can assign further preferences per application. To bind a preference to an application an identifier is used, called the application key (for example com.nixps.proofscope). You can leave the application key empty, in which case it not specified for an application.
This document describes how to use the API to change the preferences for a specified user. If you want to retrieve or save your own preferences, you need to use other calls.
Preferences API
api.preferences.save_for_realm(
preferences, // the preference value to set
'user', // the realm to use, here 'user'
user_email, // the email for the user
'', // the application key, empty means 'not application
// specific'
preference_key // the key of the preference (see examples)
);
You can get all of the preferences of a user with get_for_realm API call:
api.preferences.get_for_realm(
'user', // the realm to use, here 'user'
user_email, // the email for the user
'', // the application key, here empty
'' // the key of the preference, empty returns everything
);
The
user_email parameter should be the same as the one used for
creating the view URL. Here's an overview of preference keys used in PROOFSCOPE:
(Preferences) Key | Application Key | Description |
---|---|---|
units.length | ‘’ | The unit for lengths |
units.small_length | ‘’ | The unit for small lengths |
units.ruling | ‘’ | The unit for rulings |
language | ‘’ | The language in the UI |
noteColor | com.nixps.proofscope | The color of the PROOFSCOPE notes |
hideSidebar | com.nixps.proofscope | Hide/show the sidebar when opening PROOFSCOPE |
defaultPanel | com.nixps.proofscope | The default side panel to show when opening PROOFSCOPE |
Setting the units
- length: used for showing distances, for example measure tool.
- small_length: used for showing small distances.
- ruling: used by the measure halftones tool.
- accuracy: digits after the decimal.
- unit: the unit to use (see units table).
Units table:
Unit | Unit name | Usage |
---|---|---|
pt | points | length, small_length |
in | inches | length, small_length |
mm | millimeters | length, small_length |
cm | centimeters | length, small_length |
m | meters | length, small_length |
dpmm | dots per millimeter | ruling |
dpi | dots per inch | ruling |
lpmm | lines per millimeter | ruling |
lpi | lines per inch | ruling |
api.preferences.save_for_realm(
{accuracy: 3, unit: 'in'},
'user',
'john@domain.com',
'',
'units.length')
This
will set the length unit to inches with 3 digits after the decimal. api.preferences.save_for_realm(
{accuracy: 5, unit: 'in'},
'user', 'john@domain.com',
'',
'units.small_length')
api.preferences.save_for_realm(
{accuracy: 0, unit: ‘dpi'},
'user',
'john@domain.com',
'',
'units.ruling')
Setting the language
The language preference contains the ISO code of the language to use in the PROOFSCOPE UI.
api.preferences.save_for_realm(
'en',
'user',
'john@domain.com',
'',
'language')
Setting the note color
A user can have a specific note color. There are several predefined note colors:
- yellow
- green
- blue
- purple
- orange
- pink
You can also specify an HTML note color, for example #FF0000 for red.
api.preferences.save_for_realm(
'green',
'user',
'john@domain.com',
'com.nixps.proofscope', // Make sure to specify this application-key
'noteColor')
Show/hide the side bar
You can control the visibility of the side bar when opening PROOFSCOPE. To do this, you can
set a boolean flag called hideSidebar
to true or
false.
api.preferences.save_for_realm(
false,
'user',
'john@domain.com',
'com.nixps.proofscope', // Make sure to specify this application-key
'hideSidebar')
Set the default side panel
You can set the default side panel that the user will see when opening PROOFSCOPE. You can set
the preference key defaultPanel
to thumbnails, notes or separations.
Here is an example that will set the default side panel to the separations panel:
api.preferences.save_for_realm(
'separations',
'user',
'john@domain.com',
'com.nixps.proofscope', // Make sure to specify this application-key
'defaultPanel')