Skip to content

Commit 0eeb826

Browse files
committed
Fixed image widget not displaying file selected using fileselect
1 parent b4942e9 commit 0eeb826

4 files changed

Lines changed: 6 additions & 8 deletions

File tree

inc/files/files.ctrl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@
146146
memorize_param( 'action', 'string', '', $action );
147147
}
148148

149-
if( ! empty( $action ) && substr( $fm_mode, 0, 5 ) != 'link_' )
150-
{ // The only modes which can tolerate simultaneous actions at this time are link_* modes (item, user...)
149+
if( ! empty( $action ) && substr( $fm_mode, 0, 5 ) != 'link_' && $fm_mode != 'file_select' )
150+
{ // The only modes which can tolerate simultaneous actions at this time are link_* modes (item, user...) and file_select
151151
$fm_mode = '';
152152
}
153153

inc/files/views/_file_list.inc.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
$link_action = 'set_field';
340340
$link_attribs['target'] = '_parent';
341341
$link_attribs['class'] = 'action_icon select_file btn btn-primary btn-xs';
342-
$link_attribs['onclick'] = 'return window.parent.file_select_add( select_field_name, \''.$sfile_root.'\', \''.$sfile_path.'\' );';
342+
$link_attribs['onclick'] = 'return window.parent.file_select_add( \''.$field_name.'\', \''.$sfile_root.'\', \''.$sfile_path.'\' );';
343343
echo action_icon( T_('Select file'), 'link',
344344
regenerate_url( 'fm_selected', 'action=file_select&fm_selected[]='.rawurlencode($lFile->get_rdfp_rel_path()).'&'.url_crumb('file') ),
345345
' '.T_('Select'), NULL, 5, $link_attribs );
@@ -581,7 +581,7 @@
581581
$link_action = 'set_field';
582582
$link_attribs['target'] = '_parent';
583583
$link_attribs['class'] = 'action_icon select_file btn btn-primary btn-xs';
584-
$link_attribs['onclick'] = 'return window.parent.file_select_add( select_field_name, \''.$sfile_root.'\', \''.'$file_path$'.'\' );';
584+
$link_attribs['onclick'] = 'return window.parent.file_select_add( \''.$field_name.'\', \''.$sfile_root.'\', \''.'$file_path$'.'\' );';
585585
$icon_to_select_files = action_icon( T_('Select file'), 'link',
586586
regenerate_url( 'fm_selected', 'action=file_select&fm_selected[]='.'$file_path$'.'&'.url_crumb('file') ),
587587
' '.T_('Select'), NULL, 5, $link_attribs ).' ';
@@ -760,8 +760,6 @@
760760
?>
761761
<script type="text/javascript">
762762
<!--
763-
var select_field_name = '<?php echo $field_name;?>';
764-
765763
function js_act_on_selected()
766764
{
767765
// There may be an easier selector than below but couldn't make sense of it :(

inc/widgets/widgets/_coll_logo.widget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ function display( $params )
214214
$File = & $FileCache->get_by_ID( $file_ID, false );
215215
}
216216

217-
if( ( $check_file == 'check' || $check_file === '1' ) && ! $File && ! file_exists( $image_path.$this->disp_params['logo_file'] ) )
217+
if( ( $check_file == 'check' || $check_file === '1' ) && ( empty( $File ) || ! file_exists( $File->get_full_path() ) ) && ! file_exists( $image_path.$this->disp_params['logo_file'] ) )
218218
{ // Logo file doesn't exist, Exit here because widget setting requires this:
219219
return true;
220220
}

inc/widgets/widgets/_image.widget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function display( $params )
207207
break;
208208
}
209209

210-
if( $this->disp_params['check_file'] && ! file_exists( $image_path.$this->disp_params['image_file'] ) )
210+
if( $this->disp_params['check_file'] && ( empty( $File ) || ! file_exists( $File->get_full_path() ) ) && ! file_exists( $image_path.$this->disp_params['image_file'] ) )
211211
{ // Logo file doesn't exist, Exit here because of widget setting requires this
212212
return true;
213213
}

0 commit comments

Comments
 (0)