Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Div
classfloatRight
Panel
titleOn This Page
Table of Contents
maxlevel2
minlevel2
Warning

This page is NOT documentation of the UI Options API. It is a working document. The UI Options API is currently undergoing revision, and there is no API documentation as yet.

 

This page presents a proposal for a new API for User Interface Options. It lays out what we would like to expect of an integrator.

Use Case: Out-of-the-box, default settings, no customization

Guiding Principles

Setting UIO up out-of-the-box – using default panels, with no customizations – should be simple:

...

Panel
titleOn This Page
Table of Contents
maxlevel2
minlevel2

Guiding Principles

  • A schema exists to define the settings, their defaults, ranges, etc.
  • Any options that might be set should be top-level.
    • Option names should make sense.
  • Integrators should not have to create both a page enhancer and the fat panel individually; If they want the fat panel, the page enhancer would be assumed and should be instantiated on the page automatically.
  • Integrators may want should be able to create a page enhancer without UIO (in the case of a full-page UIO available elsewhere, through a link).

Proposed API

Until schema support is implemented, integrators need a way to say "just give me the settings I saw in the demo."

To create UIO and a page enhancer:The options shown here represent the minimal options that an integrator would have to provide. Other options will also be available.

Basic API

Section
Column

UIO Only

Code Block
javascript
javascript
fluid.uiOptions(container, {
    gradeNames: [<gradenames of desired panels>
]
,
     
pathToTemplates: "my/sites/lib/infusion/templates/",
       
pathToTocTemplate:
 
"my/sites/",
 
//
 
filename
 
would
 
be
<gradenames 
in
of 
a
schema 
separate
for 
option
settings>],
    
siteThemeClassName
pathToTemplates: "
foofer-doodle-theme
my/sites/lib/infusion/templates/"
});

...

Column

Page Enhancer Only

Code Block
javascript
javascript
fluid.
uiOptionsWithDefaultPanels(container, { pathToTemplates: "my/sites/lib/infusion/templates/"
pageEnhancer({
    gradeNames: [<grade names of desired enactors>,
                 <gradenames of schema for settings>],
    pathToTocTemplate: "my/sites/",
//
 
filename
 
would
 
be
 
in a separate option
siteThemeClassName: "foofer-doodle-theme"
});

...

Section
Code Block
javascriptjavascript
Column
width25%
 
Column

UIO + Page Enhancer

Code Block
javascript
javascript
fluid.
uiOptions
uiOptionsPlusPageEnhancer(container, {
    gradeNames: [
"fluid.uiOptions.defaultPanels"]
<gradenames of desired panels>,
    
pathToTemplates: "my/sites/lib/infusion/templates/",
            
pathToTocTemplate: "my/sites/", // filename would be in a separate option
 <grade names of desired enactors>,
        
siteThemeClassName:
 
"foofer-doodle-theme"
 
});
 

To create only a page enhancer:

 
fluid.pageEnhancer({
     
gradeNames:
<gradenames 
[<grade
of 
names
schema for
desired
 settings>],
    
pathToTocTemplate
pathToTemplates: "my/sites/lib/infusion/templates/",
//
 
filename
 
would
 
be
 
in a separate option
pathToTocTemplate: "my/sites/",
    
siteThemeClassName: "foofer-doodle-theme"
});

...

Column
width25%
 

If no grade names are specified, the default state of the components would be no panels, no settings. It's unlikely anyone would ever use it without grade names.

Use Case: 2nd Parties (Infusion-provided "starter-set" of panels and settings)

Add the "starter-set" of panels and settings included in Infusion using the starter grades.

Section
Column

UIO Only

Code Block
javascript
javascript
fluid.
pageEnhancerWithDefaultSetting
uiOptions(container, {
    
pathToTocTemplate
gradeNames: 
"my/sites/", // filename would be in a separate option siteThemeClassName: "foofer-doodle-theme
["fluid.uiOptions.starterSettings"],
    pathToTemplates: "my/sites/lib/infusion/templates/"
});

...

NOTE: The starterSettings grade combines the grades for the starter panels and the starter schema.

Column

Page Enhancer Only

Code Block
javascript
javascript
fluid.pageEnhancer({
    gradeNames: ["fluid.
uiOptions
uiEnhancer.
defaultSettings"
starterSettings],
    pathToTocTemplate: "my/sites/",
// filename would be in a separate option

    siteThemeClassName: "foofer-doodle-theme"
});

Once schemas are being used and one exists for the default collection of preferences:

...

NOTE: The starterSettings grade combines the grades for the starter enactors and the starter schema.

Section
Column
width25%
 
Column

UIO + Page Enhancer

Code Block
javascript
javascript
fluid.
uiOptions
uiOptionsPlusPageEnhancer(container, {
    
pathToSchema
gradeNames: 
"my/sites/lib/infusion/defaultSchema.json"
["fluid.uiOptions.starterSettings"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
// filename would be

in
 
a
 
separate
 
option
 
siteThemeClassName: "foofer-doodle-theme"
});

To create only a page enhancer:

NOTE: The starterSettings grade combines the grades for the starter enactors, panels and schema.

QUESTION: What should we name this/these combined grades?

Column
width25%
 

Use Case: 3rd Parties Adding Panels To The Starter Set

Note: 3rd parties will have to define their own grades for new settings, panels, enactors.

Note: All further examples will only use the "UIO + Page Enhancer" version: fluid.uiOptionsPlusPageEnhancer(). The pattern holds.

Section
Column
width20%
 
Code Block
javascriptjavascript // this *could* be implemented as a grade, and then just specify the grade in the demands block fluid.demands("fluid.pageEnhancer", "my.integration", { defaultSiteSettings: {
Column
Code Block
javascript
javascript

fluid.pageEnhancer({
    pathToSchema: "my/sites/lib/infusion/defaultSchema.json",
    pathToTocTemplate: "my/sites/", // filename should be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});

Use Case: Add new settings

Guiding Principles

Adding panels requires creating components, etc. and therefore requires knowledge of the Framework. For this use case, we expect that integrators understand components, options structures, demands, etc.

Adding panels should be done independent of initializing UIO i.e. through demands blocks only.

  • This should not involve modifying options to the UIO initialization call.
  • Templates for new panels should be able to be located anywhere i.e. not required to be added to wherever the default templates are.

Consider the use case of the WordPress FSS Theme (which adds UIO to a site) and the VideoPlayer WordPress plugin (which wants to add the media panel to UIO). We want independent modules, plugins, portlets, etc. to be able to add panels to UIO without UIO knowing about it, without other modules, plugins, portlets, etc. knowing about it, without multiple plugins conflicting.

Proposed API

/**
 * Define a grade for the schema for your settings
 */
fluid.defaults("my.extra.settingsSchema", {
    schema: {...}
});
/**
 * Define a grade for extra panels
 * and their default settings
 */
fluid.defaults("my.extra.panels", {
    components: {
        foofer: {
            funcName: "my.integration.fooferPanel",
            options: {
         
foofer: 7,
       // if necessary:
                
doodle: true
template: "myFooferPanel.html"
                // why can't panels load their own templates?
            }
,

            // any other configuration as necessary
       
components:
 
{
},
        
foofer
doodle: {
            funcName: "my.integration.
fooferEnactor
doodlePanel",
            options: {
                template: "myDoodlePanel.html"
                // if necessary
            }
            // any other configuration as necessary
        }
    }
});
/**
 * Define a grade for extra enactors
 */
fluid.defaults("my.extra.enactors", {
    components: {
        
doodle
foofer: {
            funcName: "my.integration.
doodleEnactor
fooferEnactor",
            // any other configuration as necessary
        },
     
options
   doodle: {
            funcName: "my.integration.doodleEnactor",
  
//
 
if
 
necessary
        // any other configuration as 
}
necessary
        }
    }
});
/**
 * A grade that combines my enactors, panels and schema.
 */
fluid.
demands
defaults("
fluid
my.extra.
uiOptions
settings", {
    gradeNames: ["my.extra.
integration
enactors",
{
      
defaultSiteSettings:
 
{
         
foofer: 7
 "my.extra.panels",
        
doodle: true
         "my.extra.settingsSchema"]
});
/**
 * Add the enactors, panels and schema
 
components:
*/
fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.starterSettings",
  
foofer:
 
{
             
funcName:
 "my.
integration
extra.
fooferPanel
settings"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: 
options:
"my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});
Column
width20%
 

Alternatively, the extra grades could be added using demands:

Section
Column
width20%
 
Column
Code Block
javascript
javascript
fluid.demands("fluid.uiOptions", ["my.integrations"], {
    gradeNames: ["my.extra.settings"],
});
fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.starterSettings"],
    
template
pathToTemplates: "
myFooferPanel.html" // why can't panels load their own templates?
my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});
Column
width20%
 

Use Case: 3rd Parties Wanting A Subset Of The Starter Set

There are three possible ways to do this:

  1. Cut-and-paste: Copy the code that defines the "starter" grades, rename the grades, delete the parts you don't want, and use these new grades instead of the starter grades (not really recommended).
  2. Empty subcomponents: Use the starter grades and override the excluded subcomponents with fluid.emptySubcomponent
  3. Individual grades: Use the individual settings grades desired instead of the starter set.

The last two of these methods will be shown here, excluding the colour-and-contrast setting and the layout setting.

...

Section
Column
width50%

Empty Subcomponents

Code Block
javascript
javascript
fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.starterSettings"],

    components: {
        //
if necessary
 Override the settings panels
        contrast: {
            
}
type: "fluid.emptySubcomponent"
        },
        
doodle
layoutControls: {
            
funcName
type: "
my
fluid.
integration.doodlePanel",
emptySubcomponent"
        },

        // Override the 
options: {
enactors
        theme: {
            
template
type: "
myDoodlePanel
fluid.
html
emptySubcomponent"
        },
       
// if necessary
 tableOfContentsEnactor: {
            
}
type: "fluid.emptySubcomponent"
        }
    }

    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

Use Case: Remove settings

Guiding Principles

Column
width50%

Individual Grades

Code Block
javascript
javascript
fluid.defaults("my.panelSet", {
    gradeNames: [
        // Specify each of the four desired 
fluid.demands(
panels directly
        "fluid.uiOptions.textSizer",
        "fluid.uiOptions.lineSpacer",
        "fluid.uiOptions.textFont",
     
"my.integration
   "fluid.uiOptions.linksControls",
 
{
       
components:
 
{
       // Specify 
panelIwantToRemove:
each 
{
of the four desired enactors directly
       
type:
 "fluid.
emptySubcomponent
uiEnhancer.textSizer",
        
}
"fluid.uiEnhancer.lineSpacer",
     
}
 
});
  
fluid.demands(
"fluid.uiEnhancer.textFont",
    
"my.integration", {
    "fluid.uiEnhancer.linksControls",
        
        // Use 
components:
the 
{
full schema
       
panelIwantToRemove: {
 "fluid.uiOptions.starterSettingsSchema"
    ]
});
fluid.uiOptionsPlusPageEnhancer(container, {
    
type
gradeNames: ["
fluid
my.
emptySubcomponent
panelSet"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    
}
pathToTocTemplate: "my/sites/",
    
}
siteThemeClassName: "foofer-doodle-theme"
});

Use Case:

...

Guiding Principles

Integrators should be able to translate a single strings bundle that would take care of the entire interface.

  • The strings will all be in a single .js files that places the message bundle in the global namespace.
  • To translate, the integrator either
    • creates a copy of the file and edits the link in the header to reference translated file (preferred), or
    • edits the original file.

Proposed API

...

4th Parties (users of customized UIOs)