Commit 2d855e68 authored by Robert Lyon's avatar Robert Lyon
Browse files

Problems with image gallery and file/folder selection


Bug 123530 and Bug 1236122

When js slideshow was chosen on a page without a slideshow block
(eg a new page) the js code returned by the selection was not loaded
fast enough

- I've altered it so the js is loaded on opening of config block

- Also folder was not staying selected when re-editing the block
due to it being not ArtefactTypeFile - have adjusted the check to
include ArtefactTypeFolder as well

- The switching between My files and Site files was breaking due to
folder artefact chooser not having certain elements on the page that the
js was trying to access. Have made it so js checks for elements before
trying to update them.

Change-Id: I9b8cbe786b0d35109f05a664f04665e9a9967d92
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent f1db0886
......@@ -56,7 +56,10 @@ class PluginBlocktypeGallery extends PluginBlocktype {
}
public static function get_instance_config_javascript() {
return array('js/configform.js');
return array(
'js/configform.js',
'js/slideshow.js',
);
}
public static function render_instance(BlockInstance $instance, $editing=false) {
......
......@@ -801,10 +801,13 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
if ($(self.id+'_ownersubtabs')) {
$(self.id+'_ownersubtabs').innerHTML = data.newsubtabs;
}
if (data.newtabdata.upload) {
removeElementClass(self.id + '_upload_container', 'hidden');
} else {
addElementClass(self.id + '_upload_container', 'hidden');
if ($(self.id + '_upload_container')) {
if (data.newtabdata.upload) {
removeElementClass(self.id + '_upload_container', 'hidden');
}
else {
addElementClass(self.id + '_upload_container', 'hidden');
}
}
self.config.editmeta = data.editmeta;
}
......
......@@ -105,7 +105,8 @@ function pieform_element_filebrowser(Pieform $form, $element) {
if (!empty($value)) {
foreach ($value as $k => $v) {
$file = artefact_instance_from_id($v);
if (!($file instanceof ArtefactTypeFile) || !$USER->can_publish_artefact($file)) {
if ((!($file instanceof ArtefactTypeFile) && !($file instanceof ArtefactTypeFolder))
|| !$USER->can_publish_artefact($file)) {
unset($value[$k]);
}
}
......
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