These "administrator-settable" properties are defined in your module at /resources/module.xml. When deployed, this file is copied to MODULE_ROOT/module.xml. Note: This module.xml file is not be confused with the identically-named file generated from the module.properties file, described here and deployed to MODULE_ROOT/config/module.xml.
Module properties support various input types:
<module xmlns="http://labkey.org/moduleProperties/xml/">
<properties>
<propertyDescriptor name="TestProp1">
<canSetPerContainer>false</canSetPerContainer>
</propertyDescriptor>
<propertyDescriptor name="TestProp2">
<canSetPerContainer>true</canSetPerContainer>
<defaultValue>DefaultValue</defaultValue>
<editPermissions>
<permission>UPDATE</permission>
</editPermissions>
</propertyDescriptor>
<propertyDescriptor name="TestCheckbox">
<inputType>checkbox</inputType>
</propertyDescriptor>
<propertyDescriptor name="TestSelect">
<inputType>select</inputType>
<options>
<option display="display1" value="value1"/>
<option display="display2" value="value2"/>
</options>
</propertyDescriptor>
<propertyDescriptor name="TestCombo">
<inputType>combo</inputType>
<options>
<option display="comboDisplay1" value="comboValue1"/>
<option display="comboDisplay2" value="comboValue2"/>
</options>
</propertyDescriptor>
</properties>
<clientDependencies>
<dependency path="/simpletest/testfile.js" />
</clientDependencies>
<requiredModuleContext>
<requiredModule name="Core" />
</requiredModuleContext>
</module>
A folder or project administrator can see and set module properties by opening the > Folder > Management > Module Properties tab. This page shows all properties you can view or set.
If the property can have a separate value per folder, there will be a field for the current folder and each parent folder up to the site-level. If you do not have permission to edit the property in the other containers, the value will be shown as read-only. To see more detail about each property, hover over the question mark in the property name bar.
To use the properties in your module code, use the following:
var somePropFoo = LABKEY.moduleContext.myModule.somePropFoo
If you want a defensive check that the module exists, use the following:
var getModuleProperty = function(moduleName, property) {
var ctx = getModuleContext(moduleName);
if (!ctx) {
return null;
}
return ctx[property];
};