From f0a1b7984f7a3659e557fd9aab43afa379ac097f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 May 2015 08:59:25 +0200 Subject: [PATCH] More complete test pages --- htdocs/public/test/test_arrays.php | 241 +++++++++++++++++------------ htdocs/public/test/test_forms.php | 64 +++++--- 2 files changed, 188 insertions(+), 117 deletions(-) diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 5ff161f0b1a..dcf966eb475 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -1,18 +1,18 @@ - - - - - - -Test page - - - - - - -" /> - - - - - --- - - + ?> + + + + + + + Test page + + + + + + + " /> + + + + + + + + - + -
+
- This page is a sample of page using tables. It is designed to make test with
-- css (edit page to change to test another css)
-- jmobile (add parameter dol_use_jmobile=1 to enable view with jmobile)
+- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
+- jmobile (add parameter dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)
+- no javascript / usage for bind people (add parameter nojs=1 to force disable javascript)
- dataTables
- tablednd
@@ -111,51 +114,53 @@ This page is a sample of page using tables. It is designed to make test with
-


Example 1 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this for tables that are edited forms

+


Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines or for long result tables
+ use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; +include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +$productspecimen=new Product($db); +$productspecimen->initAsSpecimen(); + +$sortfield='aaa'; +$sortorder='ASC'; +$tasksarray=array(1,2,3); // To force having several lines +$tagidfortablednd='tablelines3'; +if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + +$nav=''; +$nav.='
'; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.=''; +if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; +if ($filter) $nav.=''; +if ($filtert) $nav.=''; +if ($socid) $nav.=''; +if ($showbirthday) $nav.=''; +if ($pid) $nav.=''; +if ($type) $nav.=''; +if ($usergroup) $nav.=''; +$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); +$nav.=' '; +$nav.='
'; + +print_barre_liste('Title of my list', 3, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 5000, '', 0, $nav); + ?> -
-
-
line3
-
dfsdf
-
ffdsfsd
-
aaaa
-
-
-
line4
-
dfsdf
-
-
bbbb
-
-
-
line5
-
dfsdf
-
-
bbbb
-
- - -
+ + +trans('title1'),0,$_SERVER["PHP_SELF"],'aaa','','','align="left"',$sortfield,$sortorder); ?> +trans('title2'),0,$_SERVER["PHP_SELF"],'bbb','','','align="right"',$sortfield,$sortorder); ?> +trans('title3'),0,$_SERVER["PHP_SELF"],'ccc','','','align="center"',$sortfield,$sortorder); ?> + + + +
getNomUrl(1); ?>b1c1
a2b2c2
+
-


Example 2 : Table using tags: table/thead/tbody/tr/td + dataTable => Use this for long result tables
+


Example 2 : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for short result tables
@@ -238,91 +243,129 @@ $('xxxth').replaceWith( - - - - trans('zzz'),1,$_SERVER["PHP_SELF"],'','','','align="center" class="tagtd"',$sortfield,$sortorder); ?> + + + + trans('Column C'),1,$_SERVER["PHP_SELF"],'','','','align="center" class="tagtd"',$sortfield,$sortorder); + ?> - + - + - + - + - + - + - + - + - + - + - + - +
snake
Column A
line1 dfsdf xxx xxx
line2 dfsdf xxx xxx
line3 dfsdf xxx xxx
line4 dfsdf xxx xxx
line5 dfsdf xxx xxx
line6 dfsdf xxx xxx
line7 dfsdf xxx xxx
line8 dfsdf xxx xxx
line9 dfsdf xxx xxx
line10 dfsdf xxx xxx
line11 dfsdf xxx xxx
line12 dfsdf xxx xxx

-


Example 3 : Standard table => Use this if you need the drag and drop for lines
+


Example 3 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)

+ use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; ?> - - - - -
title1title2
a1b1
a2b2
-
+
+
+
Title A
+
title B
+
title C
+
title D
+
+
+
line4
+
dfsdf
+
+
bbbb
+
+
+
line5
+
dfsdf
+
+
bbbb
+
+
+
line6
+
jghjgh
+
5
+
lll
+
+ + +
+ + - \ No newline at end of file + diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index deb3e2fe0c4..c0c81882fe2 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -6,23 +6,21 @@ define('REQUIRE_JQUERY_MULTISELECT','select2'); require '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') -{ - print "Page available only frome remote address 127.0.0.1"; - exit; +if ($dolibarr_main_prod) { + accessforbidden(); } - llxHeader(); ?>

This page is a sample of page using Dolibarr HTML widget methods. It is designed to make test with
-- css (edit page to change to test another css)
-- jmobile (add parameter dol_use_jmobile=1 to enable view with jmobile)
-
+- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
+- jmobile (add parameter dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)
+- no javascript / usage for bind people (add parameter nojs=1 to force disable javascript)

+

'."\n"; print "Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)
\n"; $form->select_date(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0); +/*print '

'."\n"; + +print "Test 4c: a select with ajax refresh
\n"; +//$array=array(0=>'',1=>'Search into xxx',2=>'Search into yyy',3=>'Search into zzz'); +$array=array(); +$selected=-1; +print $form->selectArrayAjax(DOL_URL_ROOT.'/core/ajax/selecsearchbox.php', 'testselectc', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1); +*/ + print '

'."\n"; -// Test4: a multiselect -print "Test 4: a multiselect
\n"; +// Test4: a select +print "Test 4a: a select
\n"; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3 ith a very long text. aze eazeae e ae aeae a e a ea ea ea e a e aea e ae aeaeaeaze.'); +$selected=3; +print $form->selectarray('testselecta', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1); +print '

'; +print "Test 4b: a select
\n"; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); +$selected=3; +print $form->selectarray('testselectb', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1); +print '

'."\n"; +print "Test 4c: Select array with no js forced
\n"; +$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); +print $form->selectarray('selectarray',$array); + +print '

'."\n"; + +// Test4d: form->select_thirdparty +print "Test 4d: Select thirdparty
\n"; +print $form->select_thirdparty(0,'thirdpartytest'); + +print '

'."\n"; + +// Test4e: form->select_product +print "Test 4e: Select product (using ajax)
\n"; +$form->select_produits(0,'producttest'); + +print '

'."\n"; + +// Test5: a multiselect +print "Test 5: a multiselect
\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); -print '

'."\n"; - -// Test5: a select -print "Test 5: a select
\n"; -$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); -$selected=3; -print $form->selectarray('testselect', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"'); - llxFooter(); $db->close();