'Widget method for this form element.
Renders a SELECT MULTIPLE with all available options.
This widget uses s3.inline_component.js to facilitate
manipulation of the entries.
@param field: the Field for this form element
@param value: the current value for this field
@param attributes: keyword attributes for this widget
@ToDo: Add ability to add new options to the list
@ToDo: Wrap S3MultiSelectWidget (or at least bring options up to date)
@ToDo: support Multiple=False'

def __call__(self, field, value, **attributes):

    opts = self.options
    if (opts.readonly is True):
        return self.represent(value)
    if (value is None):
        value = field.default
    if isinstance(value, basestring):
        data = json.loads(value)
    else:
        data = value
        value = json.dumps(value, separators=SEPARATORS)
    if (data is None):
        raise SyntaxError('No    resource    structure    information')
    T = current.T
    jquery_ready = current.response.s3.jquery_ready
    script = opts.get('script', None)
    if (script and (script not in jquery_ready)):
        jquery_ready.append(script)
    options = self._options(data)
    formname = self._formname()
    fieldname = data['field']
    field_name = ('%s-%s' % (formname, fieldname))
    if (not options):
        widget = T('No    options    currently    available')
    else:
        translate = opts.get('translate', None)
        if (translate is None):
            s3db = current.s3db
            if hasattr(s3db, fieldname):
                reusable_field = s3db.get(fieldname)
                if reusable_field:
                    represent = reusable_field.attr.represent
                    if hasattr(represent, 'translate'):
                        translate = represent.translate
        _opts = []
        vals = []
        oappend = _opts.append
        for _id in options:
            option = options[_id]
            v = option['name']
            if translate:
                v = T(v)
            oappend(OPTION(v, _value=_id, _disabled=(not option['editable'])))
            if option['selected']:
                vals.append(_id)
        widget = SELECT(value=vals, _id=field_name, _name=field_name, _multiple=True, _class='inline-multiselect-widget', _size=5, *_opts)
        opt_filter = opts.get('filter', False)
        header = opts.get('header', False)
        selectedList = opts.get('selectedList', 3)
        noneSelectedText = 'Select'
        if (header is True):
            header = ('checkAllText:\'%s\',uncheckAllText:"%s"' % (T('Check    all'), T('Uncheck    all')))
        elif (header is False):
            header = 'header:false'
        else:
            header = ('header:"%s"' % self.header)
        script = ("$('#%s').multiselect({selectedText:'%s',%s,height:300,minWidth:0,selectedList:%s,noneSelectedText:'%s'})" % (field_name, T('#    selected'), header, selectedList, T(noneSelectedText)))
        if opt_filter:
            script = ('%s.multiselectfilter()' % script)
        if (script not in jquery_ready):
            jquery_ready.append(script)
    real_input = ('%s_%s' % (self.resource.tablename, field_name))
    default = dict(_type='text', _value=value, requires=(lambda v: (v, None)))
    attr = StringWidget._attributes(field, default, **attributes)
    attr['_class'] = (attr['_class'] + '    hide')
    attr['_id'] = real_input
    output = DIV(INPUT(**attr), widget, _id=self._formname(separator='-'), _field=real_input, _class='inline-multiselect    inline-component', _name=('%s_widget' % field_name))
    columns = opts.get('columns')
    if columns:
        output.add_class(('small-%s    columns' % columns))
    return output
