mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-10-10 02:52:40 +00:00
add code to use bootstrap's custom file input (currently not used)
This commit is contained in:
parent
16e4675d93
commit
07919b0810
|
@ -1350,6 +1350,14 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
function printFileChooserJs() { /* {{{ */
|
function printFileChooserJs() { /* {{{ */
|
||||||
?>
|
?>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
/* do not use bootstrap4 custom form element because it is difficult to localize
|
||||||
|
$(document).on('change', '.custom-file-input',function(){
|
||||||
|
//get the file name
|
||||||
|
var fileName = $(this).val().replace(/\\/g, '/').replace(/.*\//, '');
|
||||||
|
//replace the "Choose a file" label
|
||||||
|
$(this).next('.custom-file-label').html(fileName);
|
||||||
|
})
|
||||||
|
*/
|
||||||
/* Triggered after the file has been selected */
|
/* Triggered after the file has been selected */
|
||||||
$(document).on('change', '.btn-file :file', function() {
|
$(document).on('change', '.btn-file :file', function() {
|
||||||
var input = $(this),
|
var input = $(this),
|
||||||
|
@ -1374,6 +1382,15 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function getFileChooserHtml($varname='userfile', $multiple=false, $accept='') { /* {{{ */
|
function getFileChooserHtml($varname='userfile', $multiple=false, $accept='') { /* {{{ */
|
||||||
$id = preg_replace('/[^A-Za-z]/', '', $varname);
|
$id = preg_replace('/[^A-Za-z]/', '', $varname);
|
||||||
|
/* do not use bootstrap4 custom form element because it is difficult to localize
|
||||||
|
$html = '
|
||||||
|
<div class="custom-file">
|
||||||
|
<input type="file" class="custom-file-input" id="'.$id.'" name="'.$varname.'">
|
||||||
|
<label class="custom-file-label" for="'.$id.'">'.getMLText("browse").'…'.'</label>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
return $html;
|
||||||
|
*/
|
||||||
$html = '
|
$html = '
|
||||||
<div id="'.$id.'-upload-files">
|
<div id="'.$id.'-upload-files">
|
||||||
<div id="'.$id.'-upload-file" class="upload-file">
|
<div id="'.$id.'-upload-file" class="upload-file">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user