Commit a1a1ae59 authored by Robert Lyon's avatar Robert Lyon
Browse files

fixing problem in embedded media when first adding to block to page



Similar to bug 1235305 where the included js files were not being
loaded in time - so have created a similar fix by making sure js is
loaded on config form loading.

Change-Id: I1a477f0f7c274ce3c2dec36a6849042dc768e8c6
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent f1db0886
...@@ -80,6 +80,13 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype { ...@@ -80,6 +80,13 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
return true; return true;
} }
public static function get_instance_config_javascript() {
$result = self::get_js_source(true);
if (!empty($result)) {
return $result;
}
}
public static function instance_config_form($instance) { public static function instance_config_form($instance) {
$configdata = $instance->get('configdata'); $configdata = $instance->get('configdata');
safe_require('artefact', 'file'); safe_require('artefact', 'file');
...@@ -448,11 +455,16 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype { ...@@ -448,11 +455,16 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
. ($wmp ? '&download=1' : ''); . ($wmp ? '&download=1' : '');
} }
private static function get_js_source() { private static function get_js_source($asarray = false) {
if (defined('BLOCKTYPE_INTERNALMEDIA_JS_INCLUDED')) { if (defined('BLOCKTYPE_INTERNALMEDIA_JS_INCLUDED')) {
return ''; return '';
} }
define('BLOCKTYPE_INTERNALMEDIA_JS_INCLUDED', true); define('BLOCKTYPE_INTERNALMEDIA_JS_INCLUDED', true);
if ($asarray) {
return array(get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer-3.2.6.js',
get_config('wwwroot') . 'artefact/file/blocktype/internalmedia/swfobject.js',
);
}
return '<script src="'.get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer-3.2.6.js"></script> return '<script src="'.get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer-3.2.6.js"></script>
<script src="' . get_config('wwwroot') . 'artefact/file/blocktype/internalmedia/swfobject.js" type="text/javascript"></script>'; <script src="' . get_config('wwwroot') . 'artefact/file/blocktype/internalmedia/swfobject.js" type="text/javascript"></script>';
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment