Commit 6ab0c9f9 authored by Robert Lyon's avatar Robert Lyon
Browse files

Allowing file browser to stay open when changing dirs (bug 1240415)



Problems here is there are 2 file pickers on the same form so we can't
use the normal js success callback to update form so we have to go the
non js way - but if we have browse=1 in the url the form won't save.

Patch looks to see if folder is set in url and if so then we
are in a browse mode.

Also adjusted the template to allow for the adding of the 'select
a file' button (in hidden state) to the page when entering the
subdirectories. this will mean the hidden button will be added to a few
places where it is not need (eg selecting an image gallery
blockinstance) but as it is hidden by default no one will see it.

A better fix would be to get multiple filechooser elements working in one form
but this isn't likely to happen at the moment.

Change-Id: Iddbd677a81d216f71cdeae86a02ed107261c04b5
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent c390faf5
......@@ -10,8 +10,8 @@
<input type="hidden" name="{$prefix}_changefolder" id="{$prefix}_changefolder" value="" />
<input type="hidden" name="{$prefix}_foldername" id="{$prefix}_foldername" value="{$foldername}" />
{if $config.select && !$browse}
<div id="{$prefix}_open_upload_browse_container">
{if $config.select}
<div id="{$prefix}_open_upload_browse_container"{if $browse} class="hidden"{/if}>
<input type="submit" class="buttondk" id="{$prefix}_open_upload_browse" name="browse" value="{if $config.selectone}{str tag=selectafile section=artefact.file}{else}{str tag=addafile section=artefact.file}{/if}" />{if $config.browsehelp}{contextualhelp plugintype=$config.plugintype pluginname=$config.pluginname section=$config.browsehelp}{/if}
</div>
{/if}
......
......@@ -83,9 +83,9 @@ else {
'public' => get_string('publicskinaccess', 'skin'),
);
}
$folder = param_integer('folder', 0);
$browse = (int) param_variable('browse', 0);
// because the page has two artefact choosers in the form
// we need to handle how the browse works differently from normal
$folder = param_integer('folder', null);
$highlight = null;
if ($file = param_integer('file', 0)) {
$highlight = array($file);
......@@ -148,13 +148,13 @@ if (!$designsiteskin) {
'body_background_image' => array(
'type' => 'filebrowser',
'title' => get_string('bodybgimage', 'skin'),
'folder' => $folder,
'folder' => ((isset($folder)) ? $folder : 0),
'highlight' => $highlight,
'browse' => $browse,
'browse' => ((isset($folder)) ? 1 : 0),
'filters' => array(
'artefacttype' => array('image', 'profileicon'),
),
'page' => get_config('wwwroot') . 'skin/design.php?id=' . $id . '&browse=' . $browse . '&fs=skinbg',
'page' => get_config('wwwroot') . 'skin/design.php?id=' . $id . '&fs=skinbg',
'config' => array(
'upload' => false,
'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'),
......@@ -222,13 +222,13 @@ if (!$designsiteskin) {
'view_background_image' => array(
'type' => 'filebrowser',
'title' => get_string('viewbgimage', 'skin'),
'folder' => $folder,
'folder' => ((isset($folder)) ? $folder : 0),
'highlight' => $highlight,
'browse' => $browse,
'browse' => ((isset($folder)) ? 1 : 0),
'filters' => array(
'artefacttype' => array('image', 'profileicon'),
),
'page' => get_config('wwwroot') . 'skin/design.php?id=' . $id . '&browse=' . $browse . '&fs=viewbg',
'page' => get_config('wwwroot') . 'skin/design.php?id=' . $id . '&fs=viewbg',
'config' => array(
'upload' => false,
'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'),
......
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