Commit e24f9307 authored by Nigel McNie's avatar Nigel McNie
Browse files
parents 7bcfc62f 2f8b3825
......@@ -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,12 +201,14 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
'flv' => 'flash_player', // tested
'mov' => 'qt_player', // tested
'wmv' => 'wmp_player', // tested
'mpg' => 'qt_player', // tested
'mpeg' => 'qt_player', // tested
'mpg' => 'qt_player', // tested
'avi' => 'wmp_player', // tested
/* commenting out for now
'ram' => 'real_player',
'rm' => 'real_player',
'rpm' => 'real_player',
*/
);
}
......@@ -199,6 +218,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$extn = $artefact->get('oldextension');
if ($extn == 'mp3') {
$height = 0; // one line
$width = 100;
}
$id = 'blocktype_internalmedia_flash_' . time() . $count;
$url = self::get_download_link($artefact, $block);
......@@ -212,7 +232,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
<span class="blocktype_internalmedia_mp3" id="' . $id . '">('
. get_string('flash', 'blocktype.file/internalmedia') . ')</span>
<script type="text/javascript">
var so = new SWFObject(" ' . $playerurl . '","player","400","400","7");
var so = new SWFObject(" ' . $playerurl . '","player","' . $width . '","' . ($height + 20). '","7");
so.addParam("allowfullscreen","false");
so.addVariable("file","' . urlencode($url) . '");
so.addVariable("displayheight"," ' . $height . '");
......
......@@ -137,7 +137,7 @@ $string['zip'] = 'ZIP Archive';
$string['swf'] = 'SWF Flash movie';
$string['flv'] = 'FLV Flash movie';
$string['mov'] = 'MOV Quicktime movie';
$string['mpg'] = 'MPEG Movie';
$string['mpg'] = 'MPG Movie';
$string['ram'] = 'RAM Real Player Movie';
$string['rpm'] = 'RPM Real Player Movie';
$string['rm'] = 'RM Real Player Movie';
......
......@@ -39,7 +39,13 @@ function pieform_element_viewacl(Pieform $form, $element) {
$value = $form->get_value($element);
// Look for the presets and split them into two groups
$presets = array('public', 'loggedin', 'friends');
$presets = array();
if (get_config('allowpublicviews') == '1') {
$presets = array('public', 'loggedin', 'friends');
}
else {
$presets = array('loggedin', 'friends');
}
if ($value) {
foreach ($value as $key => &$item) {
if (is_array($item)) {
......@@ -87,4 +93,28 @@ function pieform_render_viewacl_getvaluebytype($type, $id) {
return "$type: $id";
}
function pieform_element_viewacl_get_value(Pieform $form, $element) {
global $USER;
$values = null;
$global = ($form->get_property('method') == 'get') ? $_GET : $_POST;
if (isset($element['value'])) {
$values = $element['value'];
}
else if (isset($global[$element['name']])) {
$value = $global[$element['name']];
$values = $value;
}
else if (isset($element['defaultvalue'])) {
$values = $element['defaultvalue'];
}
if (get_config('allowpublicviews') != '1') {
foreach ($values as $key => $value) {
if ($value['type'] == 'public') {
unset($values[$key]);
}
}
}
return $values;
}
?>
......@@ -1190,6 +1190,8 @@ function can_view_view($view_id, $user_id=null) {
// check public
if (
get_config('allowpublicviews') == '1'
&&
isset($view_record['access']['public'])
&& (
$view_record['access']['public']['startdate'] == null
......
......@@ -450,16 +450,19 @@ function upgrade_plugin($upgrade) {
}
$db->CompleteTrans();
/* they do themselves already
// we have to do this after committing the current transaction because we call ourselves recursively...
if ($plugintype == 'artefact' && get_config('installed')) {
// only install associated blocktype plugins if we're not in the process of installing
if ($blocktypes = call_static_method($pcname, 'get_block_types')) {
foreach ($blocktypes as $bt) {
$upgrade = check_upgrades('blocktype.' . $pluginname . '/' . $bt);
upgrade_plugin($upgrade);
if ($upgrade = check_upgrades('blocktype.' . $pluginname . '/' . $bt)) {
upgrade_plugin($upgrade);
}
}
}
}
*/
return $status;
......
......@@ -1545,7 +1545,6 @@ a.pieform-calendar-toggle img {
}
table#initials {
width: 550px;
margin-top:10px;
margin-bottom:10px;
border: none;
......
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