2
0
forked from Wavyzz/dolibarr

Move ajax_autoselect into functions.lib.php

This commit is contained in:
Laurent Destailleur
2018-02-13 15:46:39 +01:00
parent 7743f88e98
commit 8a32ae6935
2 changed files with 19 additions and 18 deletions

View File

@@ -6861,6 +6861,25 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param=''
}
/**
* Make content of an input box selected when we click into input field.
*
* @param string $htmlname Id of html object
* @param string $addlink Add a 'link to' after
*/
function ajax_autoselect($htmlname, $addlink='')
{
global $langs;
$out = '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("#'.$htmlname.'").click(function() { jQuery(this).select(); } );
});
</script>';
if ($addlink) $out.=' <a href="'.$addlink.'" target="_blank">'.$langs->trans("Link").'</a>';
return $out;
}
/**
* Return mime type of a file
*