'Inject the JS to instantiate the client-side widget controller
@param dashboard_id: the dashboard DOM node ID
@param options: JSON-serializable dict with script options'

@staticmethod
def inject_script(dashboard_id, options=None):

    s3 = current.response.s3
    scripts = s3.scripts
    appname = current.request.application
    if s3.debug:
        script = ('/%s/static/scripts/S3/s3.ui.dashboard.js' % appname)
        if (script not in scripts):
            scripts.append(script)
    else:
        script = ('/%s/static/scripts/S3/s3.ui.dashboard.min.js' % appname)
        if (script not in scripts):
            scripts.append(script)
    if (not options):
        options = {}
    script = ('$("#%(dashboard_id)s").dashboardController(%(options)s)' % {'dashboard_id': dashboard_id, 'options': json.dumps(options)})
    s3.jquery_ready.append(script)
