Commit 34678192 authored by Jonny Bradley's avatar Jonny Bradley

[FIX] elFinder: Make sure the filegal_manager and insertion_syntax request...

[FIX] elFinder: Make sure the filegal_manager and insertion_syntax request params get passed through to getWikiSyntax fn. Should solve wishes 4651 and not break things as reported in 4815. (if someone says "The fix is really easy" beware! :)
parent f3d70b9c
......@@ -171,7 +171,14 @@ class Services_File_FinderController
$fileId = $elFinder->realpath($input->hash->text());
$filegallib = TikiLib::lib('filegal');
$info = $filegallib->get_file(str_replace('f_', '', $fileId));
$info['wiki_syntax'] = $filegallib->getWikiSyntax($info['galleryId'], $info);
$params = array();
if ($input->filegals_manager->text()) {
$params['filegals_manager'] = $input->filegals_manager->text();
}
if ($input->insertion_syntax->text()) {
$params['insertion_syntax'] = $input->insertion_syntax->text();
}
$info['wiki_syntax'] = $filegallib->getWikiSyntax($info['galleryId'], $info, $params);
$info['data'] = ''; // binary data makes JSON fall over
return $info;
}
......
......@@ -2391,14 +2391,17 @@ class FileGalLib extends TikiLib
* @return string wiki markup
*/
function getWikiSyntax($galleryId=0, $fileinfo =null)
function getWikiSyntax($galleryId=0, $fileinfo =null, $params = null)
{
if (isset($_REQUEST['insertion_syntax']) && $_REQUEST['insertion_syntax'] == 'file') { // for use in 'Choose or Upload' toolbar item (tikifile)
if (!$params) {
$params = $_REQUEST;
}
if (isset($params['insertion_syntax']) && $params['insertion_syntax'] == 'file') { // for use in 'Choose or Upload' toolbar item (tikifile)
$syntax = '{file type="gallery" fileId="%fileId%" showicon="y"}';
} else if (isset($_REQUEST['filegals_manager'])) { // for use in plugin edit popup
if ($_REQUEST['filegals_manager'] === 'fgal_picker_id') {
} else if (isset($params['filegals_manager'])) { // for use in plugin edit popup
if ($params['filegals_manager'] === 'fgal_picker_id') {
$syntax = '%fileId%'; // for use in plugin edit popup
} else if ($_REQUEST['filegals_manager'] === 'fgal_picker') {
} else if ($params['filegals_manager'] === 'fgal_picker') {
$href = 'tiki-download_file.php?fileId=123&display'; // dummy id as sefurl expects a (/d+) pattern
global $smarty; include_once('tiki-sefurl.php');
$href = filter_out_sefurl($href);
......
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