Fix: Si toutes les box ont t mise du meme cot on peut a nouveau en remettre de l'autre cot.
Qual: Simplification du code de gestion des boxes.
This commit is contained in:
parent
7ee0aaa41c
commit
13dfe98e34
@ -38,7 +38,8 @@ class box_factures_fourn extends ModeleBoxes {
|
||||
|
||||
var $db;
|
||||
var $param;
|
||||
|
||||
var $textnohtmlencoded=true;
|
||||
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
@ -50,7 +51,7 @@ class box_factures_fourn extends ModeleBoxes {
|
||||
global $langs;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->boxlabel=$langs->trans("BoxLastSupplierBills");
|
||||
$this->boxlabel=$langs->transnoentities("BoxLastSupplierBills");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,7 +66,7 @@ class box_factures_fourn extends ModeleBoxes {
|
||||
$facturestatic=new FactureFournisseur($db);
|
||||
|
||||
$this->info_box_head = array(
|
||||
'text' => $langs->trans("BoxTitleLastSupplierBills",$max),
|
||||
'text' => $langs->transnoentities("BoxTitleLastSupplierBills",$max),
|
||||
);
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
@ -89,7 +90,7 @@ class box_factures_fourn extends ModeleBoxes {
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -124,7 +125,7 @@ class box_factures_fourn extends ModeleBoxes {
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
'text' => $langs->transnoentities("ReadPermissionNotAllowed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class ModeleBoxes
|
||||
|
||||
var $db;
|
||||
var $error='';
|
||||
|
||||
var $textnohtmlencoded=false;
|
||||
|
||||
/*
|
||||
* \brief Constructeur
|
||||
@ -105,123 +105,138 @@ class ModeleBoxes
|
||||
|
||||
$bcx[0] = 'class="box_pair"';
|
||||
$bcx[1] = 'class="box_impair"';
|
||||
|
||||
$var = true;
|
||||
|
||||
// Define nbcol and nblines
|
||||
$nbcol=0;
|
||||
if (isset($contents[0])) $nbcol=sizeof($contents[0])+1;
|
||||
$nblines=sizeof($contents);
|
||||
|
||||
print "\n\n<!-- Box start -->\n";
|
||||
print '<table width="100%" class="noborder"';
|
||||
if (isset($this->box_id)) print ' id="boxobject_'.$this->box_id.'"';
|
||||
print '>';
|
||||
print '<div style="padding-right: 2px; padding-left: 2px; padding-bottom: 4px;" id="boxto_'.$this->box_id.'">'."\n";
|
||||
|
||||
// Affiche titre de la boite
|
||||
print '<tr class="box_titre">';
|
||||
print '<td';
|
||||
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
|
||||
print '>';
|
||||
|
||||
if ($conf->use_ajax)
|
||||
if (! empty($head['text']) || ! empty($head['sublink']))
|
||||
{
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td align="left">';
|
||||
print '<div id="boxto_'.$this->box_id.'_title">'."\n";
|
||||
print '<table width="100%" class="noborder">'."\n";
|
||||
print '<tr class="box_titre">';
|
||||
print '<td';
|
||||
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
|
||||
print '>';
|
||||
if ($conf->use_ajax)
|
||||
{
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td align="left">';
|
||||
}
|
||||
if (! empty($head['text']))
|
||||
{
|
||||
$s=dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX);
|
||||
if ($this->textnohtmlencoded) print htmlentities($s);
|
||||
else print $s;
|
||||
}
|
||||
if (! empty($head['sublink']))
|
||||
{
|
||||
print ' <a href="'.$head['sublink'].'" target="_new">'.img_picto($head['subtext'],$head['subpicto']).'</a>';
|
||||
}
|
||||
if ($conf->use_ajax)
|
||||
{
|
||||
print '</td><td class="nocellnopadd" width="14">';
|
||||
print img_picto($langs->trans("MoveBox",$this->box_id),'uparrow','style="cursor:move;"');
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
}
|
||||
if (isset($head['text'])) print dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX);
|
||||
if (isset($head['sublink']) && $head['sublink'])
|
||||
{
|
||||
print ' <a href="'.$head['sublink'].'" target="_new">'.img_picto($head['subtext'],$head['subpicto']).'</a>';
|
||||
}
|
||||
if ($conf->use_ajax)
|
||||
{
|
||||
print '</td><td class="nocellnopadd" width="14">';
|
||||
print img_picto($langs->trans("Move"),'uparrow','style="cursor:move;"');
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Affiche chaque ligne de la boite
|
||||
for ($i=0, $n=$nblines; $i < $n; $i++)
|
||||
{
|
||||
if (isset($contents[$i]))
|
||||
{
|
||||
$var=!$var;
|
||||
if (sizeof($contents[$i]))
|
||||
{
|
||||
if (isset($contents[$i][-1]['class'])) print '<tr valign="top" class="'.$contents[$i][-1]['class'].'">';
|
||||
else print '<tr valign="top" '.$bcx[$var].'>';
|
||||
}
|
||||
if ($nblines)
|
||||
{
|
||||
print '<table width="100%" class="noborder">'."\n";
|
||||
for ($i=0, $n=$nblines; $i < $n; $i++)
|
||||
{
|
||||
if (isset($contents[$i]))
|
||||
{
|
||||
$var=!$var;
|
||||
if (sizeof($contents[$i]))
|
||||
{
|
||||
if (isset($contents[$i][-1]['class'])) print '<tr valign="top" class="'.$contents[$i][-1]['class'].'">';
|
||||
else print '<tr valign="top" '.$bcx[$var].'>';
|
||||
}
|
||||
|
||||
// Affiche chaque cellule
|
||||
for ($j=0, $m=isset($contents[$i][-1])?sizeof($contents[$i])-1:sizeof($contents[$i]); $j < $m; $j++)
|
||||
{
|
||||
$tdparam="";
|
||||
if (isset($contents[$i][$j]['align'])) $tdparam.=' align="'. $contents[$i][$j]['align'].'"';
|
||||
if (isset($contents[$i][$j]['nowrap'])) $tdparam.=' nowrap="'. $contents[$i][$j]['align'].'"';
|
||||
if (isset($contents[$i][$j]['width'])) $tdparam.=' width="'. $contents[$i][$j]['width'].'"';
|
||||
if (isset($contents[$i][$j]['colspan'])) $tdparam.=' colspan="'. $contents[$i][$j]['colspan'].'"';
|
||||
if (isset($contents[$i][$j]['class'])) $tdparam.=' class="'. $contents[$i][$j]['class'].'"';
|
||||
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
|
||||
// Affiche chaque cellule
|
||||
for ($j=0, $m=isset($contents[$i][-1])?sizeof($contents[$i])-1:sizeof($contents[$i]); $j < $m; $j++)
|
||||
{
|
||||
$tdparam="";
|
||||
if (isset($contents[$i][$j]['align'])) $tdparam.=' align="'. $contents[$i][$j]['align'].'"';
|
||||
if (isset($contents[$i][$j]['nowrap'])) $tdparam.=' nowrap="'. $contents[$i][$j]['align'].'"';
|
||||
if (isset($contents[$i][$j]['width'])) $tdparam.=' width="'. $contents[$i][$j]['width'].'"';
|
||||
if (isset($contents[$i][$j]['colspan'])) $tdparam.=' colspan="'. $contents[$i][$j]['colspan'].'"';
|
||||
if (isset($contents[$i][$j]['class'])) $tdparam.=' class="'. $contents[$i][$j]['class'].'"';
|
||||
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
|
||||
|
||||
if (!$contents[$i][$j]['text']) $contents[$i][$j]['text']="";
|
||||
$texte=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:'';
|
||||
$textewithnotags=eregi_replace('<[^>]+>','',$texte);
|
||||
$texte2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:'';
|
||||
$texte2withnotags=eregi_replace('<[^>]+>','',$texte2);
|
||||
//print "xxx $textewithnotags y";
|
||||
if (!$contents[$i][$j]['text']) $contents[$i][$j]['text']="";
|
||||
$texte=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:'';
|
||||
$textewithnotags=eregi_replace('<[^>]+>','',$texte);
|
||||
$texte2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:'';
|
||||
$texte2withnotags=eregi_replace('<[^>]+>','',$texte2);
|
||||
//print "xxx $textewithnotags y";
|
||||
|
||||
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo']) print '<td width="16">';
|
||||
else print '<td '.$tdparam.'>';
|
||||
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo']) print '<td width="16">';
|
||||
else print '<td '.$tdparam.'>';
|
||||
|
||||
// Picto
|
||||
if (isset($contents[$i][$j]['url'])) {
|
||||
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
|
||||
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
|
||||
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
||||
print '>';
|
||||
}
|
||||
// Picto
|
||||
if (isset($contents[$i][$j]['url'])) {
|
||||
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
|
||||
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
|
||||
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
||||
print '>';
|
||||
}
|
||||
|
||||
// Texte
|
||||
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo'])
|
||||
{
|
||||
$logo=eregi_replace("^object_","",$contents[$i][$j]['logo']);
|
||||
print img_object($langs->trans("Show"),$logo);
|
||||
if (isset($contents[$i][$j]['url'])) print '</a>';
|
||||
print '</td><td '.$tdparam.'>';
|
||||
if (isset($contents[$i][$j]['url']))
|
||||
{
|
||||
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
|
||||
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
|
||||
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
||||
print '>';
|
||||
}
|
||||
}
|
||||
$maxlength=$this->MAXLENGTHBOX;
|
||||
if (isset($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
|
||||
// Texte
|
||||
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo'])
|
||||
{
|
||||
$logo=eregi_replace("^object_","",$contents[$i][$j]['logo']);
|
||||
print img_object($langs->trans("Show"),$logo);
|
||||
if (isset($contents[$i][$j]['url'])) print '</a>';
|
||||
print '</td><td '.$tdparam.'>';
|
||||
if (isset($contents[$i][$j]['url']))
|
||||
{
|
||||
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
|
||||
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
|
||||
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
||||
print '>';
|
||||
}
|
||||
}
|
||||
$maxlength=$this->MAXLENGTHBOX;
|
||||
if (isset($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
|
||||
|
||||
if ($maxlength && strlen($textewithnotags) > $maxlength)
|
||||
{
|
||||
$texte=substr($texte,0,$maxlength)."...";
|
||||
}
|
||||
if ($maxlength && strlen($texte2withnotags) > $maxlength)
|
||||
{
|
||||
$texte2=substr($texte2,0,$maxlength)."...";
|
||||
}
|
||||
print $texte;
|
||||
if (isset($contents[$i][$j]['url'])) print '</a>';
|
||||
print $texte2;
|
||||
print "</td>";
|
||||
}
|
||||
if ($maxlength && strlen($textewithnotags) > $maxlength)
|
||||
{
|
||||
$texte=substr($texte,0,$maxlength)."...";
|
||||
}
|
||||
if ($maxlength && strlen($texte2withnotags) > $maxlength)
|
||||
{
|
||||
$texte2=substr($texte2,0,$maxlength)."...";
|
||||
}
|
||||
print $texte;
|
||||
if (isset($contents[$i][$j]['url'])) print '</a>';
|
||||
print $texte2;
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
if (sizeof($contents[$i])) print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "\n<!-- Box end -->\n\n";
|
||||
if (sizeof($contents[$i])) print "</tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
// If invisible box with no contents
|
||||
if (empty($head['text']) && empty($head['sublink']) && ! $nblines) print "<br><br>\n";
|
||||
|
||||
print "</div>\n";
|
||||
print "<!-- Box end -->\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -550,7 +550,8 @@ if (sizeof($boxarray))
|
||||
print '<td>'."\n";
|
||||
|
||||
// Affichage colonne gauche
|
||||
print '<div id="left" style="width: 50%; padding: 0px; margin: 0px; float: left;">'."\n";
|
||||
print "\n<!-- Box container -->\n";
|
||||
print '<div id="left" style="position: absolute; display: block; width: 50%; padding: 0px; margin: 0px; float: left;">'."\n";
|
||||
$ii=0;
|
||||
foreach ($boxarray as $key => $box)
|
||||
{
|
||||
@ -558,21 +559,31 @@ if (sizeof($boxarray))
|
||||
if (eregi('^A',$box->box_order)) // colonne A
|
||||
{
|
||||
$ii++;
|
||||
print '<div style="padding-right: 2px; padding-left: 2px; padding-bottom: 4px;" id="boxto_'.$box->box_id.'">';
|
||||
//print 'box_id '.$boxarray[$ii]->box_id.' ';
|
||||
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
|
||||
$boxid_left[$key] = $boxarray[$key]->box_id;
|
||||
// Affichage boite key
|
||||
$box->loadBox();
|
||||
$box->showBox();
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
// If no box on left, we show add an invisible empty box
|
||||
if (! $ii)
|
||||
{
|
||||
$box->box_id='A';
|
||||
$box->info_box_head=array();
|
||||
$box->info_box_contents=array();
|
||||
$box->showBox();
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
print "<!-- End box container -->\n";
|
||||
print "\n";
|
||||
|
||||
// Affichage colonne droite
|
||||
print "\n<!-- Box container -->\n";
|
||||
// print '<div id="right" style="position: absolute; display: block; width: 50%; padding: 0px; margin: 0px; float: right;">'."\n";
|
||||
print '<div id="right" style="width: 50%; padding: 0px; margin: 0px; float: right;">'."\n";
|
||||
$ii=0;
|
||||
foreach ($boxarray as $key => $box)
|
||||
@ -580,26 +591,35 @@ if (sizeof($boxarray))
|
||||
if (eregi('^B',$box->box_order)) // colonne B
|
||||
{
|
||||
$ii++;
|
||||
print '<div style="padding-right: 2px; padding-left: 2px; padding-bottom: 4px;" id="boxto_'.$box->box_id.'">';
|
||||
//print 'box_id '.$boxarray[$ii]->box_id.' ';
|
||||
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
|
||||
$boxid_right[$key] = $boxarray[$key]->box_id;
|
||||
// Affichage boite key
|
||||
$box->loadBox();
|
||||
$box->showBox();
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
print "\n";
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
// If no box on left, we show add an invisible empty box
|
||||
if (! $ii)
|
||||
{
|
||||
$box->box_id='B';
|
||||
$box->info_box_head=array();
|
||||
$box->info_box_contents=array();
|
||||
$box->showBox();
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
print "<!-- End box container -->\n";
|
||||
print "\n";
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
if ($conf->use_ajax)
|
||||
{
|
||||
print "\n";
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
function updateOrder(){
|
||||
var left_list = cleanSerialize(Sortable.serialize(\'left\'));
|
||||
|
||||
@ -392,6 +392,7 @@ CanBeModifiedIfKo=Can be modified if not valid
|
||||
AutomaticCode=Automatic code
|
||||
NotManaged=Not managed
|
||||
FeatureDisabled=Feature disabled
|
||||
MoveBox=Move box %s
|
||||
# Week day
|
||||
Monday=Monday
|
||||
Tuesday=Tuesday
|
||||
|
||||
@ -393,6 +393,7 @@ CanBeModifiedIfKo=Peut
|
||||
AutomaticCode=Création automatique du code
|
||||
NotManaged=Non géré
|
||||
FeatureDisabled=Fonction désactivée
|
||||
MoveBox=Déplacer la boite %s
|
||||
# Week day
|
||||
Monday=Lundi
|
||||
Tuesday=Mardi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user