Dashboard > Fluid > ... > API documents > Layout Customizer API
Layout Customizer API
Added by Anastasia Cheetham, last edited by Anastasia Cheetham on Aug 26, 2008  (view change)
Labels: 


This documentation refers to the trunk version of the Layout Customizer code. For documentation specific to the v0.4 release, please see Layout Customizer API - v0.4.

Overview

The Layout Customizer can be used to provide the ability to change the layout of content modules, for example portlets within a portal environment. It can be used to organize arbitrary pieces of content, or "modules," provided they are laid out in columns. For details about how modules must be laid out for use with the Layout Customizer, see Layout Customizer Integration - Layout and Permissions.

The Layout Customizer is initialised with two data structures describing the initial layout of the modules and any restrictions on their movement. It can be customized by providing any of a number of optional parameters.


Initializing the Layout Customizer

fluid.initLayoutCustomizer(layout, perms, orderChangedCallbackUrl[, options]);

Parameters

Still need help?

Join the fluid-talk mailing list and ask your questions there.

layout

The layout object specifies the IDs of the DOM elements and the relationships between them.

For more information about the layout object, see the Layout Customizer - Layout and Permissions.

perms

The perms object is a two-dimensional array of binary numbers (i.e. 0s and 1s) describing any restrictions on where modules can be moved. If there are no restrictions, pass null for this parameter.

In the array,

  • each row describes the permissions for one module, i.e. the first row describes where the first module can or can't go
  • each column in that row describes the permissions for one of the drop targets, i.e. the first column refers to the first drop target, the second column refers to the second drop target, etc.

For details about drop targets and the perms object, see the Layout Customizer - Layout and Permissions.

orderChangedCallbackUrl

The orderChangedCallbackUrl is the URL that the Layout Customizer should use to communicate changes in the layout to the server. The Layout Customizer will POST the updated layout to the URL, and expects an updated perms object in response. If there are no restrictions on permissions, the perms object should contain all 1s (for details about the structure of the perms object, see the Layout Customizer - Layout and Permissions).

options

The options parameter is an optional collection of name-value pairs that configure the Layout Customizer:

General options

Name Description Values Default
mergePolicy an object describing how user options should be merged in with defaults  
mergePolicy: {
    "selectors.selectables": "selectors.movables",
    "selectors.dropTargets": "selectors.movables",
    keysets: "replace"
}
styles an object containing CSS class names for styling the Reorderer. See below for a discussion of CSS styling of the Reorderer The object may contain any of the keys defined in the default class names (shown to the right). Any class names not provided will revert to the default.
styles: {
    defaultStyle: "orderable-default",
    selected: "orderable-selected",
    dragging: "orderable-dragging",
    mouseDrag: "orderable-dragging",
    hover: "orderable-hover",
    dropMarker: "orderable-drop-marker",
    avatar: "orderable-avatar"
};
keysets an object containing sets of keycodes to use for directional navigation, and for the modifier key used for moving a movable item. The object must be a list of objects containing the following keys:
  modifier : a function that returns true or false, indicating whether or not the required modifier(s) are activated
  up
  down
  right
  left
fluid.defaultKeysets = [{
    modifier : function (evt) {
        return evt.ctrlKey;
    },
    up : fluid.keys.UP,
    down : fluid.keys.DOWN,
    right : fluid.keys.RIGHT,
    left : fluid.keys.LEFT
},
{
    modifier : function (evt) {
        return evt.ctrlKey;
    },
    up : fluid.keys.i,
    down : fluid.keys.m,
    right : fluid.keys.k,
    left : fluid.keys.j
}];
avatarCreator a function that returns a valid DOM node to be used as the dragging avatar   The item being dragged will be cloned
instructionMessageId the ID of the element containing any instructional messages   "message-bundle:"
orderChangedCallback   a function
function () {};

Layout Customizer-specific options

Name Description Values Default
willShowKBDropWarning      
dropWarningId the ID of an element on the page that should be displayed if users attempt to move an item to a location where movement is not permitted   (none)
orderChangedCallbackUrl      

Dependencies

The Layout Customizer dependencies can be met by including the minified Fluid-all.js file in the header of the HTML file:

<script type="text/javascript" src="Fluid-all.js"></script>

Alternatively, the individual file requirements are:

<script type="text/javascript" src="jquery/jquery-1.2.6.js"></script>
<script type="text/javascript" src="jquery/jARIA.js"></script>
<script type="text/javascript" src="jquery/jquery.keyboard-a11y.js"></script>
<script type="text/javascript" src="jquery/ui.core.js"></script>
<script type="text/javascript" src="jquery/ui.draggable.js"></script>
<script type="text/javascript" src="jquery/ui.droppable.js"></script>
<script type="text/javascript" src="json/json2.js"></script>
<script type="text/javascript" src="fluid/Fluid.js"></script>
<script type="text/javascript" src="fluid/DragManager.js"></script>
<script type="text/javascript" src="fluid/Reorderer.js"></script>
<script type="text/javascript" src="fluid/LayourCustomizer.js"></script>
<script type="text/javascript" src="fluid/ModuleLayout.js"></script>

Site running on a free Atlassian Confluence Open Source Project License granted to The FLUID Project. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5 Build:#805 Apr 26, 2007) - Bug/feature request - Contact Administrators