diff --git a/doc/images/dolibarr_screenshot1_1280x800.jpg b/doc/images/dolibarr_screenshot1_1280x800.jpg new file mode 100644 index 00000000000..c6d5776d1fc Binary files /dev/null and b/doc/images/dolibarr_screenshot1_1280x800.jpg differ diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index bfd21deee33..8d959a9decb 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -40,6 +40,8 @@ $langcode=GETPOST('langcode','alpha'); $transkey=GETPOST('transkey','alpha'); $transvalue=GETPOST('transvalue','alpha'); +$mode = GETPOST('mode')?GETPOST('mode'):'overwrite'; + $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -124,7 +126,7 @@ $formadmin = new FormAdmin($db); $wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración'; llxHeader('',$langs->trans("Setup"),$wikihelp); -print load_fiche_titre($langs->trans("TranslationSetup"),'','title_setup'); +print load_fiche_titre($langs->trans("Translation"),'','title_setup'); print $langs->trans("TranslationDesc")."
\n"; print "
\n"; @@ -140,16 +142,24 @@ print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("La print '
'; -$param=''; -if ($conf->global->MAIN_FEATURES_LEVEL > 1) +$param='mode='.$mode; + + +print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; + +$head=translation_prepare_head(); + +dol_fiche_head($head, $mode, '', 0, ''); + +if ($mode == 'searchkey') { - print '
'; - print load_fiche_titre($langs->trans("TranslationKeySearch"), '', '')."\n"; + //print '
'; + //print load_fiche_titre($langs->trans("TranslationKeySearch"), '', '')."\n"; - print 'entity) && $debug)?'?debug=1':'').'" method="POST">'; print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -165,7 +175,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 1) print "\n"; print ''."\n"; print ''; - - print ''."\n"; - print ''."\n"; - - // Value - print ''; - - print ''; - - print "\n"; - print "\n"; - $i++; - } } - -print '
'; - print $formadmin->select_language(GETPOST('langcodesearch'),'langcodesearch',0,null,1,0,0,'',1); + print $formadmin->select_language(GETPOST('langcodesearch'),'langcodesearch',0,null,$langs->trans("All"),0,0,'',1); //print ''; print ''; @@ -194,112 +204,116 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 1) print ''; } -print '
'; - -print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n"; - -print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; -print ''; -print ''; - -print ''; -print ''; -print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("NewTranslationStringToShow"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder); -if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder); -print ''; -print "\n"; - - -// Line to add new record -$var=false; -print "\n"; - -print ''."\n"; -print ''; -// Limit to superadmin -if (! empty($conf->multicompany->enabled) && !$user->entity) +if ($mode == 'overwrite') { - print ''; - print '\n"; -print ''; + //print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n"; + + print ''; + print ''; + print ''; + + print '
'; -print $formadmin->select_language(GETPOST('langcode'),'langcode',0,null,1,0,0,'',1); -//print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - print ''; - print ''; -} -else -{ - print ''; - print ''; -} -print ''; -print "
'; + print ''; + print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("NewTranslationStringToShow"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder); + if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder); + print ''; + print "\n"; + + + // Line to add new record + $var=false; + print "\n"; + + print ''."\n"; + print ''; + // Limit to superadmin + if (! empty($conf->multicompany->enabled) && !$user->entity) + { + print ''; + print '\n"; + print ''; + + + // Show constants + $sql = "SELECT"; + $sql.= " rowid"; + $sql.= ", lang"; + $sql.= ", transkey"; + $sql.= ", transvalue"; + $sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans"; + $sql.= " WHERE 1 = 1"; + //$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")"; + //if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug + //else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits + //if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name')); + //$sql.= " ORDER BY entity, name ASC"; + $sql.= $db->order($sortfield, $sortorder); + + dol_syslog("translation::select from table", LOG_DEBUG); + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + $var=false; + + while ($i < $num) + { + $obj = $db->fetch_object($result); + $var=!$var; + + print "\n"; + + print ''; + + print ''."\n"; + print ''."\n"; + + // Value + print ''; + + print ''; + + print "\n"; + print "\n"; + $i++; + } + } + + + print '
'; + print $formadmin->select_language(GETPOST('langcode'),'langcode',0,null,1,0,0,'',1); + //print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + else + { + print ''; + print ''; + } + print ''; + print "
'.$obj->lang.''.$obj->transkey.''; + /*print ''; + print ''; + print ''; + print ''; + */ + print $obj->transvalue; + print ''; + print ''.img_delete().''; + print '
'; - -// Show constants -$sql = "SELECT"; -$sql.= " rowid"; -$sql.= ", lang"; -$sql.= ", transkey"; -$sql.= ", transvalue"; -$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans"; -$sql.= " WHERE 1 = 1"; -//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")"; -//if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug -//else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits -//if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name')); -//$sql.= " ORDER BY entity, name ASC"; -$sql.= $db->order($sortfield, $sortorder); - -dol_syslog("translation::select from table", LOG_DEBUG); -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows($result); - $i = 0; - $var=false; - - while ($i < $num) - { - $obj = $db->fetch_object($result); - $var=!$var; - - print "\n"; - - print '
'.$obj->lang.''.$obj->transkey.''; - /*print ''; - print ''; - print ''; - print ''; - */ - print $obj->transvalue; - print ''; - print ''.img_delete().''; - print '
'; +dol_fiche_end(); print "\n"; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 33393f1ef46..af51b64fa8d 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -51,14 +51,14 @@ class FormAdmin * @param string $htmlname Name of HTML select * @param int $showauto Show 'auto' choice * @param array $filter Array of keys to exclude in list - * @param int $showempty Add empty value + * @param string $showempty 1=Add empty value or string to show * @param int $showwarning Show a warning if language is not complete * @param int $disabled Disable edit of select * @param string $morecss Add more css styles * @param int $showcode Add language code into label * @return string Return HTML select string with list of languages */ - function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=null,$showempty=0,$showwarning=0,$disabled=0,$morecss='',$showcode=0) + function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=null,$showempty='',$showwarning=0,$disabled=0,$morecss='',$showcode=0) { global $langs; @@ -71,7 +71,10 @@ class FormAdmin { $out.= '