Todo: using div instead of tables

This commit is contained in:
Regis Houssin 2011-04-16 08:05:01 +00:00
parent edf0e95424
commit f9b14626e3
4 changed files with 150 additions and 22 deletions

View File

@ -1425,11 +1425,13 @@ if ($id > 0 || ! empty($ref))
}
// TODO test using div instead of tables
//print '<div class="table">';
//print '<div class="table" id="tablelines">';
print '<table id="tablelines" class="noborder" width="100%">';
// Show object lines
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);
//print '<table id="tablelines" class="noborder" width="100%">';
/*
* Form to add new line
@ -1463,8 +1465,8 @@ if ($id > 0 || ! empty($ref))
}
// TODO test using div instead of tables
//print '</div>';
print '</table>';
//print '</div>';
print '</div>';
print "\n";

View File

@ -1466,16 +1466,17 @@ class CommonObject
// TODO test using div instead of tables
/*
print '<div class="table" id="tablelines">';
print '<div class="thead">';
print '<div class="tr">';
print '<div class="td desc">'.$langs->trans('Description').'</div>';
print '<div class="td firstcol">'.$langs->trans('Description').'</div>';
print '<div class="td">'.$langs->trans('VAT').'</div>';
print '<div class="td">'.$langs->trans('PriceUHT').'</div>';
print '<div class="td">'.$langs->trans('Qty').'</div>';
print '<div class="td">'.$langs->trans('ReductionShort').'</div>';
print '<div class="td">'.$langs->trans('TotalHTShort').'</div>';
print '<div class="td ten">&nbsp;</div>';
print '<div class="td ten">&nbsp;</div>';
print '<div class="td endcol">&nbsp;</div>';
print '<div class="td endcol">&nbsp;</div>';
print '<div class="td end">&nbsp;</div>';
print '</div></div>';
*/
@ -1495,7 +1496,9 @@ class CommonObject
$num = count($this->lines);
$var = true;
$i = 0;
//print '<div class="tbody">';
foreach ($this->lines as $line)
{
$var=!$var;
@ -1511,6 +1514,8 @@ class CommonObject
$i++;
}
//print '</div></div>';
}
/**
@ -1561,6 +1566,7 @@ class CommonObject
// Use global variables + $seller and $buyer
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_view.tpl.php');
//include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductlinediv_view.tpl.php');
}
else
{

View File

@ -0,0 +1,106 @@
<?php
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
?>
<!-- BEGIN PHP TEMPLATE predefinedproductline_view.tpl.php -->
<div class="tr pair" <?php echo 'id="row-'.$line->id.'"'; ?>>
<div class="td firstcol">
<a name="<?php echo $line->id; ?>"></a>
<?php
echo $html->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
// Show range
print_date_range($line->date_start, $line->date_end);
// Add description in form
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print ($line->description && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
}
?>
</div>
<div class="td"><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></div>
<div class="td"><?php echo price($line->subprice); ?></div>
<div class="td">
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
else echo '&nbsp;'; ?>
</div>
<div class="td">
<?php if (!empty($line->remise_percent) && $line->special_code != 3) {
echo dol_print_reduction($line->remise_percent,$langs);
} else {
echo '&nbsp;';
} ?>
</div>
<div class="td">
<?php if ($line->special_code == 3) {
echo $langs->trans('Option');
} else {
echo price($line->total_ht);
} ?>
</div>
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?>
<div class="td endcol">
<?php if (($line->info_bits & 2) == 2) { ?>
<?php } else { ?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#'.$line->id; ?>">
<?php echo img_edit(); ?>
</a>
<?php } ?>
</div>
<div class="td endcol">
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=ask_deleteline&amp;lineid='.$line->id; ?>">
<?php echo img_delete(); ?>
</a>
</div>
<?php if ($num > 1) { ?>
<div class="td end tdlineupdown">
<?php if ($i > 0) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
<?php echo img_up(); ?>
</a>
<?php } ?>
<?php if ($i < $num-1) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>">
<?php echo img_down(); ?>
</a>
<?php } ?>
</div>
<?php } else { ?>
<div class="td endcol tdlineupdown">&nbsp;</div>
<?php } ?>
<?php } else { ?>
<div class="td endcol">&nbsp;</div>
<div class="td endcol">&nbsp;</div>
<div class="td end">&nbsp;</div>
<?php } ?>
</div>
<!-- END PHP TEMPLATE predefinedproductline_view.tpl.php -->

View File

@ -1868,12 +1868,12 @@ A.none, A.none:active, A.none:visited, A.none:hover {
/* Test using div instead of tables */
/* ============================================================================== */
div.table {
display:table;
div.tablelines {
display: table;
/* Joindre les bords des cellules */
border-collapse:collapse;
border-collapse: collapse;
/* Forcer le tableau à prendre la largeur écran */
width:100%;
width: 100%;
}
div.thead {
height: 24px;
@ -1884,30 +1884,44 @@ div.thead {
font-family: <?php print $fontlist ?>;
/* border-bottom: 1px solid #FDFFFF; */
white-space: nowrap;
display:table-row-group;
display: table-row-group;
}
div.tfoot {
display:table-row-group;
display: table-row-group;
}
div.tbody {
display:table-row-group;
display: table-row-group;
}
div.tr {
display:table-row;
display: table-row;
}
div.td {
display:table-cell;
display: table-cell;
text-align: right;
padding:5px;
width:auto;
padding: 5px;
width: 10%;
}
div.td.desc {
div.td.firstcol {
text-align: left;
width: 70%;
width: 65%;
}
div.td.ten {
width: 10px;
div.td.endcol {
width: 5px;
}
div.end {
width:auto;
width: auto;
}
div.dragClass {
color: #002255;
}
div.showDragHandle {
cursor: move;
}
div.tdlineupdown {
background-image: url(<?php echo DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/grip.png' ?>);
background-repeat: no-repeat;
background-position: center center;
cursor: move;
white-space: nowrap;
}