Commit 656e16a8 authored by Penny Leach's avatar Penny Leach
Browse files

fixed some TODOs in the internalmedia block

parent 2b584e8e
......@@ -31,4 +31,7 @@ $string['description'] = 'Select files for embedded viewing';
$string['media'] = 'Media';
$string['flashanimation'] = 'Flash animation';
$string['typeremoved'] = 'This block points to a media type that has been disallowed by the administrator';
$string['configdesc'] = 'Configure which file types users can embed into this block. Note that types disabled by the files artefact plugin cannot be enabled. If you disable a filetype that has already been used in a block, it will not be rendered anymore';
?>
......@@ -68,7 +68,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$height = (!empty($configdata['height'])) ? hsc($configdata['height']) : '300';
$extn = $artefact->get('oldextension');
if (!in_array($extn, self::get_allowed_extensions())) {
return 'This has been removed as an allowed type'; // TODO
return get_string('typeremoved', 'blocktype.file/internalmedia');
}
$callbacks = self::get_all_extensions();
$result .= call_static_method('PluginBlocktypeInternalmedia', $callbacks[$extn], $artefact, $instance, $width, $height);
......@@ -133,6 +133,9 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
public static function save_config_options($values) {
$enabledtypes = array();
foreach ($values as $type => $enabled) {
if (!in_array($type, array_keys(self::get_all_extensions()))) {
continue;
}
if (!empty($enabled)) {
$enabledtypes[] = $type;
}
......@@ -146,19 +149,33 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$filetypes = array();
$currenttypes = self::get_allowed_extensions();
if (!$plugindisabled = get_column_sql('SELECT description
FROM {artefact_file_file_types}
WHERE enabled = 0')) {
$plugindisabled = array();
}
foreach (array_keys(self::get_all_extensions()) as $filetype) {
// TODO add checks for types that have been disabled by the file plugin
$filetypes[$filetype] = array(
'type' => 'checkbox',
'title' => get_string($filetype, 'artefact.file'),
'defaultvalue' => in_array($filetype, $currenttypes),
);
if (in_array($filetype, $plugindisabled)) {
$filetypes[$filetype] = array(
'type' => 'checkbox',
'title' => get_string($filetype, 'artefact.file'),
'value' => false,
'disabled' => true,
);
}
else {
$filetypes[$filetype] = array(
'type' => 'checkbox',
'title' => get_string($filetype, 'artefact.file'),
'defaultvalue' => in_array($filetype, $currenttypes),
);
}
}
uasort($filetypes, create_function('$a, $b', 'return $a["title"] > $b["title"];'));
$filetypes = array_merge(
array(
'description' => array(
'value' => 'Some stuff goes here' // TODO
'value' => get_string('configdesc', 'blocktype.file/internalmedia'),
),
),
$filetypes
......@@ -184,7 +201,6 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
'flv' => 'flash_player', // tested
'mov' => 'qt_player', // tested
'wmv' => 'wmp_player', // tested
'mpg' => 'qt_player', // tested
'mpeg' => 'qt_player', // tested
'avi' => 'wmp_player', // tested
'ram' => 'real_player',
......
Markdown is supported
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