Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
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.

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 should be able to create a page enhancer without UIO (in the case of a full-page UIO available elsewhere, through a link).

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

+ Page Enhancer

Only

Code Block
javascript
javascript

fluid.uiOptions(container, {
    gradeNames: [<gradenames of desired panels>],,
             pathToTemplates: "my/sites/lib/infusion/templates/",   <gradenames of pathToTocTemplate: "my/sites/"schema for settings>],
    siteThemeClassNamepathToTemplates: "foofer-doodle-thememy/sites/lib/infusion/templates/"
});
Column

Page Enhancer Only

Code Block
javascript
javascript

fluid.pageEnhancer({
    gradeNames: [<grade names forof desired enactors>,
                 <gradenames of schema for settings>],
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

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.

Basic API with schema support

Section
Column

UIO + Page Enhancer

Section
Column
width25%
 
Column

UIO + Page Enhancer

Code Block
javascript
javascript

fluid.uiOptionsuiOptionsPlusPageEnhancer(container, {
    schemagradeNames: [<gradenames <pathof todesired schemapanels>,
including filename>,           pathToTemplates: "my/sites/      <grade names of desired enactors>,
                 <gradenames of schema for settings>],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});
Page Enhancer Onlycode {code:javascript} fluid.pageEnhancer({ schema: <path to schema, including filename>, pathToTocTemplate: "my/sites/" 
Column
width
25%
javascriptjavascript

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.uiOptions(container, {
    gradeNames: ["fluid.uiOptions.starterSettings"],
    siteThemeClassNamepathToTemplates: "foofer-doodle-thememy/sites/lib/infusion/templates/"
});

Use Case: 2nd Parties (Infusion-provided panels and settings)

Add the provided panels and settings using the default grades.

Section
Column

UIO + Page Enhancer (no schema)

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

Column

Page Enhancer Only

Code Block
javascript
javascript

fluid.uiOptionspageEnhancer(container, {
    gradeNames: ["fluid.uiOptionsuiEnhancer.defaultPanels"starterSettings],
  
 pathToTemplates: "my/sites/lib/infusion/templates/",     pathToTocTemplate: "my/sites/",
    // TocTemplate
filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});
Column
Page Enhancer Only (no schema)

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

UIO + Page Enhancer (with schema)

Page Enhancer Only (with schema)

Section
Column
width25%
 
Column

UIO + Page Enhancer

Code Block
javascript
javascript

fluid.pageEnhanceruiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.defaultSettingsstarterSettings"],
    pathToTocTemplatepathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
TocTemplate filename would be in a separate option
    siteThemeClassName siteThemeClassName: "foofer-doodle-theme"
});
Section
Column
Code Block
javascriptjavascript

fluid.uiOptions(container, {
    schema: "my/sites/lib/infusion/defaultSchema.json",
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    // TocTemplate filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});
Column
Code Block
javascriptjavascript

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

Use Case: 3rd Parties (adding or removing panels)

3rd parties will have to define their own grades.

Adding panels to the set of included panels (no schema)

Section
Column
width50%

UIO

Code Block
javascriptjavascript

/**
 * Define a grade for extra panels
 * and their default settings
 */
fluid.defaults("my.extra.panels", {
    defaultSiteSettings: {

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%
 
Column
Code Block
javascript
javascript
/**
 * 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: {
                // if necessary:
                template: "myFooferPanel.html"
               foofer: 7,// why can't panels load their own templates?
 doodle: true     },     components:}
{         foofer: {  // any other configuration as necessary
     funcName: "my.integration.fooferPanel",   },
        doodle: {
      options: {     funcName: "my.integration.doodlePanel",
          // if necessaryoptions: {
                template: "myFooferPanelmyDoodlePanel.html"
                // if whynecessary
can't panels load their own templates?       }
     }       // any },other configuration as necessary
     doodle: {
            funcName: "my.integration.doodlePanel",
   }
    }
});
/**
 * Define a grade for extra enactors
 */
fluid.defaults("my.extra.enactors", {
    components: {
     options: {  foofer: {
             templatefuncName: "myDoodlePanelmy.integration.htmlfooferEnactor",
            // any other configuration // ifas necessary
        },
   }         }doodle: {
    } }); fluid.uiOptions(container, {     gradeNamesfuncName: ["fluidmy.uiOptionsintegration.defaultPanelsdoodleEnactor",
"my.extra.panels"],     pathToTemplates: "my/sites/lib/infusion/templates/",     pathToTocTemplate: "my/sites/", any other configuration as  //necessary
TocTemplate filename would be in a separate option }
   siteThemeClassName: "foofer-doodle-theme" }
});

Alternatively, the extra grade could be added using demands:

Code Block
javascriptjavascript

fluid.demands("fluid.uiOptions", ["my.integrations"]/**
 * A grade that combines my enactors, panels and schema.
 */
fluid.defaults("my.extra.settings", {
    gradeNames: ["my.extra.panelsenactors"],
});
fluid.uiOptions(container, {,
                gradeNames: ["fluidmy.uiOptionsextra.defaultPanelspanels"],
    pathToTemplates: "my/sites/lib/infusion/templates/",       pathToTocTemplate: "my/sites/",     // TocTemplate filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});
Column

Page Enhancer

Code Block
javascriptjavascript

/**
 * Define a grade for extra enactors
 * and their default settings
 */
fluid.defaults("my.extra.settingsSchema"]
});
/**
 * Add the enactors, panels and schema
 */
fluid.uiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluid.uiOptions.starterSettings",
                 "my.extra.settings"],
{     defaultSiteSettingspathToTemplates: {"my/sites/lib/infusion/templates/",
        fooferpathToTocTemplate: 7"my/sites/",
        doodle: true
    },
    components: siteThemeClassName: "foofer-doodle-theme"
});
Column
width20%
 

Alternatively, the extra grades could be added using demands:

Section
Column
width20%
 
Column

...

width50%

UIO

...


// The grade definition would be the same as above

fluid.uiOptions(container, {
    // XXX: Would custom schema include 'default' panels?
    schema: "my/sites/mySchema.json"
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    // TocTemplate filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});

...

Page Enhancer

...


// The grade definition would be the same as above

fluid.pageEnhancer({
    // XXX: Would custom schema include 'default' panels?
    schema: "my/sites/mySchema.json"
    pathToTocTemplate: "my/sites/",
    // TocTemplate filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});

Using a subset of defaults

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:

...


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

...

width50%

Access to the default panels would be made easy through a "flavour" of uiOptions (similar to flavours of Reorderer):

...


fluid.uiOptionsWithDefaultPanels(container, {
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

...

which would be equivalent to

...


fluid.uiOptions(container, {
    gradeNames: ["fluid.uiOptions.defaultPanels"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

To create only a page enhancer:

...


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

...

width50%

Access to the default setting would be made easy through a "flavour" of enhancer (similar to flavours of Reorderer):

...


fluid.pageEnhancerWithDefaultSetting({
    pathToTocTemplate: "my/sites/", // filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});

...

which would be equivalent to

...


fluid.pageEnhancer({
    gradeNames: ["fluid.uiEnhancer.defaultSettings"],
    pathToTocTemplate: "my/sites/", // filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});

Once schemas are being used

To create UIO and a page enhancer using out-of-the-box schema for default panels:

...


fluid.uiOptions(container, {
    pathToSchema: "my/sites/lib/infusion/defaultSchema.json",
    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 using out-of-the-box schema for default settings:

...


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/remove settings, configure a fresh UIO (3rd parties)

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 through grades, either at invocation time or by adding a grade through a demands block.
  • 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

Add panels to UIO

...


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

To add the grade to UIO, use one of the following:

Section
Column
width50%
Code Block
javascript
javascript
fluid.demands("fluid.uiOptions", ["my.integrations"], {
        foofer: {
   gradeNames: ["my.extra.settings"],
});
fluid.uiOptionsPlusPageEnhancer(container, {
        funcNamegradeNames: ["myfluid.integrationuiOptions.fooferEnactorstarterSettings"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
      optionspathToTocTemplate: {"my/sites/",
                // if necessary
            }
        },
        doodle: {
            funcName: "my.integration.doodleEnactor",
            options: {
                // if necessary
            }
        }
    }
});
fluid.pageEnhancer({
    gradeNames: ["fluid.uiOptions.defaultSettings", "my.extra.settings"],
    pathToTocTemplate: "my/sites/",
    // TocTemplate filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});

Alternatively, the extra grade could be added using demands:

Code Block
javascriptjavascript

fluid.demands("fluid.pageEnhancer", ["my.integrations"], {
    gradeNames: ["my.extra.settings"],
});
fluid.pageEnhancer({
    gradeNames: ["fluid.uiOptions.defaultSettings"],
    pathToTocTemplate: "my/sites/",
    // TocTemplate filename would be in a separate option
    siteThemeClassName: "foofer-doodle-theme"
});

Adding panels to the set of included panels (with schema)

...

Code Block
javascriptjavascript

// Add the grade to UIOptions as part of creation
fluid.uiOptionssiteThemeClassName: "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.defaultPanels", "my.extra.panels"],
    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: "my/sites/", // filename would be in a separate option"fluid.uiOptions.starterSettings"],

    components: {
     siteThemeClassName: "foofer-doodle-theme" });
Column
Code Block
javascriptjavascript
 // AddOverride the grade to UIOptions through demands
fluid.demands("fluid.uiOptions", "my.integration", {settings panels
        gradeNamescontrast: ["my.extra.panels"]
});
// create UIO
fluid.uiOptions(container, { {
            gradeNamestype: ["fluid.uiOptions.defaultPanels"],emptySubcomponent"
      pathToTemplates: "my/sites/lib/infusion/templates/",  },
        pathToTocTemplatelayoutControls: "my/sites/", // filename would be in a separate option{
            siteThemeClassNametype: "foofer-doodle-themefluid.emptySubcomponent"
}); 

Add settings to UIE

Code Block
Section
javascriptjavascript
 
//
 
Define
 
a
 
grade
 
for
 
the
 
extra
},
enactors

and
 
their
 
default
 
settings
 
fluid.defaults("my.extra.settings",
 
{
   // Override 
defaultSiteSettings:
the 
{
enactors
        
foofer
theme: {
 
7,
         
doodle:
 
true
 type: "fluid.emptySubcomponent"
  
},
     
components:
 
{
},
        
foofer
tableOfContentsEnactor: {
            
funcName
type: "
my.integration.fooferEnactor",
fluid.emptySubcomponent"
        }
 
options:
 
{
  }

    pathToTemplates: "my/sites/lib/infusion/templates/",
    pathToTocTemplate: 
"my/sites/",
if
  
necessary
  siteThemeClassName: "foofer-doodle-theme"
});
Column
width50%

Individual Grades

Code Block
javascript
javascript
fluid.defaults("my.panelSet", {
    gradeNames: [
}
        // 
},
Specify each of the four desired 
doodle: {
panels directly
        
funcName: "my.integration.doodleEnactor
"fluid.uiOptions.textSizer",
        "fluid.uiOptions.lineSpacer",
   
options:
 
{
    "fluid.uiOptions.textFont",
        "fluid.uiOptions.linksControls",
   
//
 
if
 
necessary
   
        // 
}
Specify each of the four desired enactors directly
 
}
     
}
 
});

To add the grade to UIE, use one of the following:

Column
Code Block
javascriptjavascript

// Add the grade to UIEnhancer as part of creation
fluid.pageEnhancer({ "fluid.uiEnhancer.textSizer",
        "fluid.uiEnhancer.lineSpacer",
       gradeNames: ["fluid.uiEnhancer.defaultSettingstextFont",
  "my.extra.settings"],      "fluid.uiEnhancer.linksControls",
      pathToTocTemplate: "my/sites/", 
   siteThemeClassName: "foofer-doodle-theme"
});
Column
Code Block
javascriptjavascript

// add grade to UIEnhancer through demands
fluid.demands("fluid.uiEnhancer", "my.integrations" {     // Use the full schema
        "fluid.uiOptions.starterSettingsSchema"
    gradeNames:["my.extra.settings"]

});
// create UIEnhancer
fluid.pageEnhanceruiOptionsPlusPageEnhancer(container, {
    gradeNames: ["fluidmy.uiEnhancer.defaultSettingspanelSet"],
    pathToTocTemplatepathToTemplates: "my/sites/lib/infusion/templates/",
    siteThemeClassName: "foofer-doodle-theme"
});

Once schemas are being used

Use Case: Users of customized UIO (4th parties)

Guiding Principles

Proposed API

Use Case: Localization

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

...

pathToTocTemplate: "my/sites/",
    siteThemeClassName: "foofer-doodle-theme"
});

Use Case: 4th Parties (users of customized UIOs)