public String getScriptContribution(FacesContext context, UIComponent component) {
StringBuffer result = new StringBuffer();
result.append(".drop = ");
JSFunctionDefinition definition = new JSFunctionDefinition();
definition.addParameter("event");
definition.addParameter("drag");
Map requestOpts = AjaxRendererUtils.buildEventOptions(context, component);
definition.addToBody("var options = ").addToBody(ScriptUtils.toScript(requestOpts)).addToBody(";");
definition.addToBody("options.parameters['" + DROP_TARGET_ID + "'] = '" + component.getClientId(context) + "';");
//TODO nick - remove as legacy
definition.addToBody("Object.extend(options.parameters, drag.getParameters());");
definition.addToBody("var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };");
JSFunction dropFunction = AjaxRendererUtils.buildAjaxFunction(component, context);
dropFunction.addParameter(new JSReference("options"));
definition.addToBody(dropFunction.toScript()).addToBody(";");
definition.appendScript(result);
result.append(";");
return result.toString();
}