diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eb2f13c8ac3afb49941ba2ce0fbf99dddc843a53..99a0985f9143ed784bc5d413b7ef877e97819699 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4168,7 +4168,7 @@ class Form // Add code for jquery to use multiselect // Note: Plugin "multiselect" is no more provided by Dolibarr. You must include it and load it into your module to use it. if ((! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ($conf->global->MAIN_USE_JQUERY_MULTISELECT == 'multiselect')) - || (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT'))) + || (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT') == 'multiselect')) { print '<!-- JS CODE FOR multiselect --> <script type="text/javascript"> @@ -4190,15 +4190,16 @@ class Form } // Add code for jquery to use multiple-select - // Note: Plugin "multiselect" is no more provided by Dolibarr. You must include it and load it into your module to use it. if ((! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ($conf->global->MAIN_USE_JQUERY_MULTISELECT == 'multiple-select')) - || (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT'))) + || (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT') == 'multiple-select')) { print '<!-- JS CODE FOR multiple-select --> <script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/multiple-select/jquery.multiple.select.js"></script> <script type="text/javascript"> $(document).ready(function () { - $(\'#'.$htmlname.'\').multipleSelect(); + $(\'#'.$htmlname.'\').multipleSelect({ + filter: true + }); }); </script>'; } diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 51341901e2130fe9eb76ce41ed1f6bd95de0e69d..6725c776cd43c7d694d1466e24f7c2a8aea47114 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -4,10 +4,9 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require '../../main.inc.php'; - -if (!empty($conf->global->MAIN_FEATURES_LEVEL)) +if ($_SERVER['HTTP_HOST'] != 'localhost') { - print "Page available onto dev environment only"; + print "Page available only with url http://localhost/..."; exit; } $usedolheader=0; // 1 = Test inside a dolibarr page, 0 = Use hard coded header @@ -30,16 +29,21 @@ if (empty($usedolheader)) <!-- Includes for JQuery (Ajax library) --> <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/smoothness/jquery-ui-latest.custom.css" /> <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/css/jquery.dataTables.css" /> +<?php if ($_GET["dol_use_jmobile"] == 1) { ?> <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css" /> -<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php?dol_use_jmobile=1&dol_optimize_smallscreen=1" /> +<?php } ?> +<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1)?'?dol_use_jmobile=1&dol_optimize_smallscreen=1':''; ?>" /> <!-- Includes JS for JQuery --> <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-latest.min.js"></script> <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js"></script> <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/js/jquery.dataTables.js"></script> -<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js"></script> +<?php if ($_GET["dol_use_jmobile"] == 1) { ?> +<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js"></script>-- +<?php } ?> </head> -<body style="margin: 4px;"> +<body style="padding: 10px;"> + <div data-role="page"> <?php @@ -54,24 +58,23 @@ else //--------- ?> - -<br> -This page is a sample of page using tables. To make test with<br> -- css (edit page to change)<br> -- jmobile (edit page to enable/disable)<br> +<h1> +This page is a sample of page using tables. It is designed to make test with<br> +- css (edit page to change to test another css)<br> +- jmobile (add parameter dol_use_jmobile=1 to enable view with jmobile)<br> - dataTables<br> - tablednd<br> - +</h1> <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> <div class="tagtable centpercent"> <div class="tagtr"> - <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 100px;"> <!-- If you remove max-width, the jmobile overflow does not work --> + <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> <select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select> </div> - <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 100px;"> <!-- If you remove max-width, the jmobile overflow does not work --> + <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> <select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select> </div> </div> @@ -84,7 +87,7 @@ This page is a sample of page using tables. To make test with<br> <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> <select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select> </div> - <div class="tagtd" style="max-width:100px; overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> + <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> <select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select> </div> </form> @@ -97,7 +100,7 @@ This page is a sample of page using tables. To make test with<br> <td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> <select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select> </td> - <td class="tagtd" style="max-width:100px; overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> + <td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> <select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select> </td> </tr> diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index 126c9723fa7405b6767ad2877fa7e293b8793f27..d8841e4f7cd1863ad7b82f8eddb53987fda058f5 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -1,48 +1,31 @@ <?php -define("NOLOGIN",1); // This means this output page does not require to be logged. +//define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +define('REQUIRE_JQUERY_MULTISELECT','multiple-select'); require '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (empty($conf->global->MAIN_FEATURES_LEVEL)) +if ($_SERVER['HTTP_HOST'] != 'localhost') { - print "Page available onto dev environment only"; + print "Page available only with url http://localhost/..."; exit; } + + +llxHeader(); + ?> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> - -<head> -<meta name="robots" content="noindex,nofollow" /> -<meta name="author" content="Dolibarr Development Team"> -<link rel="shortcut icon" type="image/x-icon" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/img/favicon.ico"/> -<title>Test page</title> -<!-- Includes for JQuery (Ajax library) --> -<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/smoothness/jquery-ui-latest.custom.css" /> -<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/css/jquery.dataTables.css" /> -<!-- <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css" /> --> -<!-- <link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php?dol_use_jmobile=1" /> --> -<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php?dol_use_jmobile=0" /> -<!-- Includes JS for JQuery --> -<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-latest.min.js"></script> -<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js"></script> -<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/js/jquery.dataTables.js"></script> -<!-- <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js"></script> --> -</head> - - - -<body style="margin: 4px;"> -<div data-role="page"> -<br> -This page is a sample of page using html methods.<br> +<h1> +This page is a sample of page using html methods. It is designed to make test with<br> +- css (edit page to change to test another css)<br> +- jmobile (add parameter dol_use_jmobile=1 to enable view with jmobile)<br> <br> +</h1> <!-- Output to test html.form.class.php --> -<?php +<?php $form=new Form($db); // Test1: form->select_date using tzuser date @@ -64,8 +47,14 @@ print '<br><br>'."\n"; print "Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)<br>\n"; $form->select_date(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0); -?> +print '<br><br>'."\n"; + +// Test4: a multiselect +print "Test 4: a multiselect<br>\n"; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); +$arrayselected=array(1,3); +print $form->multiselectarray('testmulti', $array, $arrayselected, '', 0, '', 0, 250); + -</div> -</body> -</html> \ No newline at end of file +llxFooter(); +$db->close();