'Helper function to inject static JS and instantiate
the foodRegistration widget
@param widget_id: the node ID where to instantiate the widget
@param options: dict of widget options (JSON-serializable)'

@staticmethod
def inject_js(widget_id, options):

    T = current.T
    s3 = current.response.s3
    appname = current.request.application
    options['ajaxURL'] = URL(c='dvr', f='case_event', args=['register_food.json'])
    options['selectAllText'] = s3_str(T('Select    All'))
    scripts = s3.scripts
    script = ('/%s/static/themes/DRK/js/food.js' % appname)
    scripts.append(script)
    scripts = s3.jquery_ready
    script = ("$('#%(id)s').foodRegistration(%(options)s)" % {'id': widget_id, 'options': json.dumps(options)})
    if (script not in scripts):
        scripts.append(script)
