Look and feel v6

This commit is contained in:
Laurent Destailleur 2017-06-21 11:37:34 +02:00
parent 9ec7929753
commit 4102403482
14 changed files with 35 additions and 31 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -221,9 +221,7 @@ llxHeader("",$langs->trans("Categories"),$helpurl);
if ($user->rights->categorie->creer)
{
/*
* Fiche en mode creation
*/
// Create or add
if ($action == 'create' || $_POST["addcat"] == 'addcat')
{
dol_set_focus('#label');
@ -246,7 +244,7 @@ if ($user->rights->categorie->creer)
// Ref
print '<tr>';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="flat" name="label" size="25" value="'.$label.'">';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="minwidth100" name="label" value="'.$label.'">';
print'</td></tr>';
// Description
@ -263,7 +261,8 @@ if ($user->rights->categorie->creer)
// Parent category
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $form->select_all_categories($type, $catorigin);
print $form->select_all_categories($type, $catorigin, 'parent');
print ajax_combobox('parent');
print '</td></tr>';
$parameters=array();

View File

@ -1360,7 +1360,7 @@ if ($action == 'create')
}
} else {
print '<td>';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty');
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
{

View File

@ -1477,7 +1477,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td>';
} else {
print '<td>';
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty');
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
{

View File

@ -995,7 +995,7 @@ class Form
unset($societetmp);
}
// mode 1
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter;
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype?'&showtype='.$showtype:'');
$out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out.='<style type="text/css">
.ui-autocomplete {
@ -3461,7 +3461,7 @@ class Form
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
}
$output = '<select class="flat" name="'.$htmlname.'">';
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
$outarray=array();
if (is_array($cate_arbo))
{

View File

@ -37,9 +37,9 @@
* @param int $autoselect Automatic selection if just one value
* @param array $ajaxoptions Multiple options array
* Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
* Ex: array('disabled'=>
* Ex: array('show'=>
* Ex: array('update_textarea'=>
* Ex: array('disabled'=> )
* Ex: array('show'=> )
* Ex: array('update_textarea'=> )
* @return string Script
*/
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
@ -181,12 +181,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
});
}
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}
,delay: 500
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
return $("<li>")
.data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
@ -352,8 +352,8 @@ function ajax_dialog($title,$message,$w=350,$h=150)
/**
* Make content of an input box selected when we click into input field.
*
* @param string $htmlname Id of html object
*
* @param string $htmlname Id of html object
* @param string $addlink Add a 'link to' after
*/
function ajax_autoselect($htmlname, $addlink='')
@ -383,7 +383,7 @@ function ajax_autoselect($htmlname, $addlink='')
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
{
global $conf;
if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen)
if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
@ -392,13 +392,13 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
$tmpplugin='select2';
$msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
<script type="text/javascript">
$(document).ready(function () {
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
dir: \'ltr\',
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
minimumInputLength: '.$minLengthToAutocomplete.'
minimumInputLength: '.$minLengthToAutocomplete.'
})';
if ($forcefocus) $msg.= '.select2(\'focus\')';
$msg.= ';'."\n";

View File

@ -6088,13 +6088,13 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
/**
* Set focus onto field with selector
*
* @param string $selector Selector ('#id') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
* @param string $selector Selector ('#id' or 'input[name="ref"]') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
* @return string HTML code to set focus
*/
function dol_set_focus($selector)
{
print "\n".'<!-- Set focus onto a specific field -->'."\n";
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.$selector.'").focus(); });</script>'."\n";
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.dol_escape_js($selector).'").focus(); });</script>'."\n";
}

View File

@ -1045,7 +1045,7 @@ if ($action == 'create')
}
print '<table class="border" width="100%">';
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
print $form->select_company('','socid','','SelectThirdParty',1);
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300');
print '</td></tr>';
print '</table>';

View File

@ -1436,7 +1436,7 @@ if ($action=='create')
}
else
{
print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty');
print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE))
{

View File

@ -1445,7 +1445,7 @@ if ($action == 'create')
}
else
{
print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty');
print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve supplier informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE))
{

View File

@ -865,6 +865,8 @@ else
$modCodeProduct = new $module();
}
dol_set_focus('input[name="ref"]');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
@ -886,7 +888,7 @@ else
print '<tr>';
$tmpcode='';
if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type);
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input id="ref" name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOST('ref')?GETPOST('ref'):$tmpcode).'">';
if ($refalreadyexists)
{
print $langs->trans("RefAlreadyExists");

View File

@ -181,6 +181,8 @@ if ($action == 'create')
{
print load_fiche_titre($langs->trans("NewWarehouse"));
dol_set_focus('input[name="libelle"]');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
@ -477,7 +479,7 @@ else
}
}
//print '<td>'.dol_print_date($objp->datem).'</td>';
print '<tr class="oddeven">';
print "<td>";

View File

@ -37,6 +37,7 @@ $filter=GETPOST('filter','alpha');
$outjson=(GETPOST('outjson','int') ? GETPOST('outjson','int') : 0);
$action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int');
$showtype=GETPOST('showtype','int');
/*
@ -87,9 +88,9 @@ else
$searchkey=(($id && GETPOST($id, 'alpha'))?GETPOST($id, 'alpha'):(($htmlname && GETPOST($htmlname, 'alpha'))?GETPOST($htmlname, 'alpha'):''));
if (! $searchkey) return;
$form = new Form($db);
$arrayresult=$form->select_thirdparty_list(0,$htmlname,$filter,1,0,0,null,$searchkey,$outjson);
$arrayresult=$form->select_thirdparty_list(0, $htmlname, $filter, 1, $showtype, 0, null, $searchkey, $outjson);
$db->close();

View File

@ -1058,7 +1058,7 @@ if ($action == 'create')
print '</td>';
} else {
print '<td colspan="2">';
print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty');
print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
print '</td>';
}
print '</tr>' . "\n";

View File

@ -283,7 +283,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
font-family: <?php print $fontlist ?>;
outline: none;
margin: 0px 0px 0px 0px;
border-bottom: solid 1px rgba(0,0,0,.4);
border-bottom: solid 1px rgba(0,0,0,.2);
}
input {