// Bind and Events dependencies
var Bind = require("github/jillix/bind")
  , Events = require("github/jillix/events")
  ;

/**
 *  This module creates the UI part for user actions in a DMS
 *  application.
 *
 * */
module.exports = function init (config) {

    // get the module
    var self = this;

    // call Events
    Events.call(self, config);

    // run binds
    if (config.binds) {
        for (var i = 0; i < config.binds.length; ++i) {
            Bind.call(self, config.binds[i]);
        }
    }

    // module cache
    self.cache = {
        // { "selector": jQueryObjectsMatchedBySelector  }
        selectors: {}
    };

    /**
     *
     *  updateActionControls
     *
     *  Arguments
     *    @options: an object containing the following fields:
     *      - TODO
     *
     *    @callback: the callback function
     *
     * */
    self.updateActionControls = function (options, callback) {

        // call the server operation
        self.link("getUserControls", {data: options}, function (err, responseObject) {

            // handle error
            if (err) {
                return callback (err, null);
            }

            // get selectors
            var selectors = Object.keys(responseObject);

            // each selector
            for (var i = 0; i < selectors.length; ++i) {

                // get the current selector
                var cSelector = selectors[i]
                  , $jQueryObject = self.cache.selectors[cSelector]
                  ;

                // the jquery object was taken from cache
                if (!$jQueryObject) {
                    $jQueryObject = self.cache.selectors[cSelector] = $(cSelector, self.dom);
                }

                // show it
                if (responseObject[cSelector]) {
                    $jQueryObject.show()
                // hide it
                } else {
                    $jQueryObject.hide()
                }
            }

            // callback
            callback (null, responseObject);
        });
    };

    /**
     *  user-actions#runAction
     *
     *  This function calls the server operation which validates the
     *  rights of this user to run the action.
     *
     *  Arguments
     *    @options: object
     *    @callback: the callback function
     *
     * */
    self.runAction = function (options, callback) {

    };

    // ready
    self.emit("ready", config);
};

@@ -912,24 +912,143 @@
 allback) %7B%0A%0A
+        // conversions and defaults%0A        options = Object(options);%0A        callback = callback %7C%7C function () %7B%7D;%0A%0A
         // c
@@ -2487,24 +2487,222 @@
 allback) %7B%0A%0A
+        // conversions and defaults%0A        options = Object(options);%0A        callback = callback %7C%7C function () %7B%7D;%0A%0A        // call the server operation%0A        self.link(%22runAction%22, callback);%0A
     %7D;%0A%0A    

Call runAction server operation.