Clean code. Fix nojs=1

This commit is contained in:
Laurent Destailleur 2021-02-19 15:37:42 +01:00
parent efb32c7d0b
commit e9f9c46cd6
4 changed files with 21 additions and 22 deletions

View File

@ -98,7 +98,7 @@ class Conf
public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url
public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone
public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url
public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url. 0=default, 1=to say we use app from a webview app, 2=to say we use app from a webview app and keep ajax
public $liste_limit;

View File

@ -6480,6 +6480,11 @@ class Form
$out = '';
if ($addjscombo < 0) {
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $addjscombo = 1;
else $addjscombo = 0;
}
// Add code for jquery to use multiselect
if ($addjscombo && $jsbeautify) {
// Enhance with select2

View File

@ -1010,8 +1010,6 @@ if ((!empty($conf->browser->layout) && $conf->browser->layout == 'phone')
{
$conf->dol_optimize_smallscreen = 1;
}
// If we force to use jmobile, then we reenable javascript
if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1;
// Replace themes bugged with jmobile with eldy
if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok')))
{

View File

@ -12,6 +12,7 @@ if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check a
//if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
require '../../main.inc.php';
if ($dolibarr_main_prod) {
@ -86,14 +87,14 @@ if (empty($usedolheader))
<h2>
This page is a sample of page using tables. It is designed to make test with<br>
</h2>
<div class="wordbreak">
- css (add parameter &amp;theme=newtheme to test another theme or edit css of current theme)<br>
- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=4&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=4&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 1000 to enable view with jmobile)<br>
- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 570 to enable with emulated jmobile)<br>
- no javascript / usage for bind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
- tablednd<br>
</h2>
</div>
<?php ?>
<br><hr><br>Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form<br>
@ -134,7 +135,6 @@ This page is a sample of page using tables. It is designed to make test with<br>
</tr>
</table>
<?php ?>
@ -187,31 +187,30 @@ $nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$
$nav .= '</form>';
$limit = 10;
print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 500, '', 0, $nav, '', $limit);
print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 500, '', 0, $nav, '', $limit, 0, 0, 1);
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('This is a select list for a filter A').': ';
$moreforfilter .= $langs->trans('This is a select list for a filter A (no combo forced)').': ';
$cate_arbo = array('field1'=>'value1a into the select list A', 'field2'=>'value2a');
$moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1); // List without js combo
$moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 0); // List with no js combo
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('This is a select list for a filter B').': ';
$moreforfilter .= $langs->trans('This is a select list for a filter B (auto combo)').': ';
$cate_arbo = array('field1'=>'value1b into the select list B', 'field2'=>'value2b');
$moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
$moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', -1); // List with js combo auto
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('This is a select list for a filter C').': ';
$moreforfilter .= $langs->trans('This is a select list for a filter C (combo forced)').': ';
$cate_arbo = array('field1'=>'value1c into the select list C', 'field2'=>'value2c');
$moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
$moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('This is a select list for a filter D').': ';
$moreforfilter .= $langs->trans('This is a select list for a filter D (combo forced)').': ';
$cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2d');
$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
$moreforfilter .= '</div>';
if (!empty($moreforfilter))
@ -248,8 +247,6 @@ if (!empty($moreforfilter))
<!--
<br><hr><br>Example 1b : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for short result tables<br>
<script type="text/javascript">
$(document).ready(function(){
$('#idtableexample2').dataTable( {
@ -293,7 +290,6 @@ $(document).ready(function(){
})
});
</script>
-->
@ -315,13 +311,13 @@ $(document).ready(function(){
<div class="pair tagtr">
<div class="tagtd">line4<input type="hidden" name="cartitem" value="3"></div>
<div class="tagtd">dfsdf</div>
<div class="tagtd"><input name="count" value="4"></div>
<div class="tagtd"><input name="count" value="4" class="maxwidth50"></div>
<div class="tagtd tdlineupdown">bbbb</div>
</div>
<div class="impair tagtr">
<div class="tagtd">line5<input type="hidden" name="cartitemb" value="3"></div>
<div class="tagtd">dfsdf</div>
<div class="tagtd"><input name="countb" value="4"></div>
<div class="tagtd"><input name="countb" value="4" class="maxwidth50"></div>
<div class="tagtd tdlineupdown">bbbb</div>
</div>
<div class="pair tagtr">