Customize user preferences

With these API calls you can customize several user preferences.

Introduction

You can customize the following PROOFSCOPE settings for a user:
  • Units
  • Language
  • Note color
  • UI customization

For these settings PROOFSCOPE uses the CLOUDFLOW preferences.

Structure of Preferences

The CLOUDFLOW preferences are divided in two realms:
  • 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

You can change a CLOUDFLOW preference with the save_for_realm API call:
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

PROOFSCOPE uses three unit types:
  • length: used for showing distances, for example measure tool.
  • small_length: used for showing small distances.
  • ruling: used by the measure halftones tool.
A unit has two fields:
  • 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
You can set the length of the unit with this API call:
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.
In the following example the small_length unit is set to inches, with five digits after the decimal:
api.preferences.save_for_realm(
  {accuracy: 5, unit: 'in'}, 
  'user', 'john@domain.com', 
  '', 
  'units.small_length')
In the following example the unit for the ruling is set to DPI:
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.

In the following example the language is set to English:
api.preferences.save_for_realm(
  'en', 
  'user', 
  'john@domain.com', 
  '', 
  'language')
Note: The ISO 639 two digits language codes are used to select a language (in this example, en for English)

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.

In the following example the note color is set to green:
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.

Here is an example that will hide the side bar when opening PROOFSCOPE:
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')