{if $field.canUpload}
{if $field.limit}
{if $field.limit == 1}
{remarksbox _type=info title="{tr}Attached files limitation{/tr}"}
{tr }The amount of files that can be attached is limited to
1 . The latest file will be preserved.{/tr}
{/remarksbox}
{else}
{remarksbox _type=info title="{tr}Attached files limitation{/tr}"}
{tr _0=$field.limit}The amount of files that can be attached is limited to
%0 . The latest files will be preserved.{/tr}
{/remarksbox}
{/if}
{/if}
{foreach from=$field.files item=info}
{if $prefs.vimeo_upload eq 'y' and $field.options_map.displayMode eq 'vimeo'}
{icon name='vimeo'}
{elseif $field.options_map.displayMode eq 'img'}
{$info.name|escape}
{elseif $field.options_map.displayMode eq 'barelink'}
{$info.name|escape}
{else}
{$info.fileId|sefurl:'file'|iconify:$info.filetype:$info.fileId:2}
{$info.name|escape}
{/if}
{icon name='delete'}
{/foreach}
{if $field.options_map.displayMode eq 'vimeo'}
{wikiplugin _name='vimeo' fromFieldId=$field.fieldId|escape fromItemId=$item.itemId|escape galleryId=$field.galleryId|escape}{/wikiplugin}
{else}
{if $field.options_map.uploadInModal neq 'n'}
{if $field.limit !== 1}{tr}Upload Files{/tr}{else}{tr}Upload File{/tr}{/if}
{else}
{service_inline controller=file action=uploader uploadInModal=0 galleryId=$field.galleryId limit=$field.limit|default:100 type=$field.filter image_max_size_x=$field.image_x image_max_size_y=$field.image_y addDecriptionOnUpload=$data.addDecriptionOnUpload}
{/if}
{/if}
{if $context.canBrowse}
{if $prefs.fgal_elfinder_feature eq 'y'}
{button href='tiki-list_file_gallery.php' _text="{tr}Browse files{/tr}" _onclick=$context.onclick title="{tr}Browse files{/tr}"}
{else}
{tr}Browse Files{/tr}
{/if}
{/if}
{if $prefs.fgal_upload_from_source eq 'y' and $field.canUpload}
{if $prefs.vimeo_upload eq 'y' and $field.options_map.displayMode eq 'vimeo'}
{tr}Link to existing Vimeo URL{/tr}
{else}
{tr}Upload from URL{/tr}
{/if}
{tr}Type or paste the URL and press ENTER{/tr}
{/if}
{else}
{remarksbox type="error" close="n" title="{tr}You do not have permission to upload files to this gallery.{/tr}" }
{/remarksbox}
{/if}
{if $field.canUpload}
{jq}
$('.files-field.uninitialized').removeClass('uninitialized').each(function () {
var $self = $(this);
var $files = $('.current-list', this);
var $warning = $('.alert', this);
var $field = $('.input', this);
var $url = $('.url', this);
var replaceFile = $(this).is('.replace');
function toggleWarning() {
var limit = $self.data('limit');
if (limit) {
if ($files.children().length > limit) {
$warning.show();
$files.children().css('text-decoration', 'line-through');
$files.children().slice(-5).css('text-decoration', '');
} else {
$files.children().css('text-decoration', '');
$warning.hide();
}
}
}
function addFile(fileId, type, name) {
var li = $('