Those attributes are valid for all widgets and can be set in two locations of the page customization tree:
Attributes:
Example 1: The chart should not be displayed.
return [visible: 'false']
Code example 6: Visibility switched off (set in Admin Tool script)
Example 2: The chart should only be displayed if the selected view is service_customer and the engineer has the consultant role.
view = viewService.getById(view_id) // view_id is passed in context
if (!view.getName().equals("service_customer"))
{
return {"visible": false}
}
def role = roleService.getById('consultant');
def engineer = engineerService.getById(engineer_id);
if(!getRolesForEngineer(engineer).contains(role))
{
return {"visible": false}
}
Code example 7: Visibility depending on engineer role (set within Admin Tool script)
localization
Localized values, i.e., "de: {subject:'Thema', yes:'Ja'}, en: {subject:'Subject', yes:'Yes'}".
The localization attribute can provide the localized values for all string attributes used in the widget script.
For example (see example with graphical user interface below), you need values for the attributes title and footer, than you can set three attributes:
attribute: title, value _('titlestring')
attribute footer, value _('footerstring')
attribute localization which provides localized values for both. Value de:{titlestring:'Offene Tickets: ',footerstring:'Anzahl bearbeitbare Tickets'}, en:{titlestring:'Open tickets: ', footerstring:'Number of accessible tickets'}
You can set values for attributes in the Admin Tool script, as shown in the following script for the three strings all, own, and unassigned.
Figure 196: Localizing page customization attributes in an Admin Tool script
Please note that it does not matter if you provide the values for the attributes using a script or by entering the values using the graphical user interface for the Page Customization! You might also use the following way of localizing values (an example of a KPI widget):
Figure 197: Localizing string Page Customization attributes using the graphical user interface