I know enough about YUI, JavaScript, and Moodle to be dangerous. So sorry if this seems like an obvious question.
I have in the PHP file something like:
$PAGE->requires->js(new moodle_url('/mod/mediasite/js/util.js'), true);
In the util.js file it self I have:
YUI().use("console","node","node-base", function(Y)
{
function set_value(e, args) {
var name = args[0],
id = args[1],
resourcetype = args[2],
siteid = args[3];
opener.document.getElementById('id_name').value = name;
opener.document.getElementById('id_resourceid').value = id;
opener.document.getElementById('id_resourcetype').value = resourcetype;
opener.document.getElementById('id_siteid').value = siteid;
window.close();
}
function get_details(e, args) {
}
});
I then reference the 'set_value' function like:
$action = new component_action('click', 'set_value', array($escapedname, $result->Id, $resourcetype, $siteid));
But it doesn't seem that the 'set_value' function is getting called or it cannot be found. If I jump out of PHP and put this function in a <script> block right on the page the function gets called just fine. What am I missing for the scope of a function in a YUI 'use' statement?