[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dolibarr-dev] extrafields label
From: |
Christophe Battarel |
Subject: |
Re: [Dolibarr-dev] extrafields label |
Date: |
Fri, 23 May 2014 14:39:59 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Finally , i have found a way to skirt the problem with some jquery and a
hook; i give you the code below if you face the same problem :
function formObjectOptions($parameters, $object, $action)
{
// translate extrafields labels
print '<script type="text/javascript">
$(document).ready(function() {
$("input[name^=options_").each(function() {
var labelCell = $(this).parent("td").prev("td");
// get the translation with an ajax call
$.get("'.dol_buildpath('/mymodule/',1).'ajax/translate.php", {text:
$(labelCell).text(), langfile: "address@hidden"}, function(data) {
$(labelCell).html(data); }, "html");
});
});
</script>';
...
}
and here is the ajax translate.php program :
<?php
address@hidden("../../main.inc.php"); // For root
directory
if (! $res) address@hidden("../../../main.inc.php"); // For
"custom" directory
$langfile = GETPOST('langfile');
$text = GETPOST('text');
$langs->load($langfile);
print $langs->trans($text);
?>
Le 23/05/2014 14:39, Philippe Grand a écrit :
Le 23/05/2014 14:35, Florian HENRY a écrit :
About that extrafield define and use by extranal module it can be
nice to be able to define them into module descriptor rather than
play with SQL request to create them, but it's another story.
I rather see what you mean ;-)
and agree one hundred times with you
- [Dolibarr-dev] extrafields label, Christophe Battarel, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Florian HENRY, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Christophe Battarel, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Florian HENRY, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Sasa Ostrouska, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Christophe Battarel, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Florian HENRY, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Philippe Grand, 2014/05/23
- Re: [Dolibarr-dev] extrafields label,
Christophe Battarel <=
- Re: [Dolibarr-dev] extrafields label, Doursenaud , Raphaël, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Florian HENRY, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Christophe Battarel, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Doursenaud , Raphaël, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, Destailleur Laurent, 2014/05/24
- Re: [Dolibarr-dev] extrafields label, Sasa Ostrouska, 2014/05/23
- Re: [Dolibarr-dev] extrafields label, charles.fr, 2014/05/23