Fix: more flexibility

This commit is contained in:
Regis Houssin
2009-07-29 16:19:15 +00:00
parent 6b7d3ad0c1
commit 6a3534c32a
3 changed files with 23 additions and 26 deletions

View File

@@ -1888,37 +1888,23 @@ function print_titre($titre)
* \param pictoisfullpath 1=Icon name is a full absolute url of image
*/
function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0)
{
print fiche_titre($titre, $mesg, $picto, $pictoisfullpath);
}
/**
* \brief Affichage d'un titre d'une fiche, aligne a gauche
* \param titre Le titre a afficher
* \param mesg Message suplementaire a afficher a droite
* \param picto Icon to use before title (should be a 32x32 transparent png file)
* \param pictoisfullpath 1=Icon name is a full absolute url of image
*/
function fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0)
{
global $conf;
if ($picto == 'setup') $picto='title.png';
if (empty($conf->browser->firefox) && $picto=='title.png') $picto='title.gif';
$title = "\n";
$title.= '<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
if ($picto && $titre) $title.= '<td class="nobordernopadding" width="40" align="left" valign="middle">'.img_picto('',$picto, '', $pictoisfullpath).'</td>';
$title.= '<td class="nobordernopadding" valign="middle">';
$title.= '<div class="titre">'.$titre.'</div>';
$title.= '</td>';
print "\n";
print '<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
if ($picto && $titre) print '<td class="nobordernopadding" width="40" align="left" valign="middle">'.img_picto('',$picto, '', $pictoisfullpath).'</td>';
print '<td class="nobordernopadding" valign="middle">';
print '<div class="titre">'.$titre.'</div>';
print '</td>';
if (strlen($mesg))
{
$title.= '<td class="nobordernopadding" align="right" valign="middle"><b>'.$mesg.'</b></td>';
print '<td class="nobordernopadding" align="right" valign="middle"><b>'.$mesg.'</b></td>';
}
$title.= '</tr></table>'."\n";
return $title;
print '</tr></table>'."\n";
}
/**

View File

@@ -19,7 +19,16 @@
* $Source$
*}
<!-- BEGIN SMARTY TEMPLATE -->
{$title}
<table width="100%" border="0" class="notopnoleftnoright">
<tr>
<td class="nobordernopadding" width="40" align="left" valign="middle">
{$title_picto}
</td>
<td class="notopnoleftnoright" valign="middle">
<div class="titre">{$title_text}</div>
</td>
</tr>
</table>
<form id="evolForm" action="fiche.php" method="post">
<input type="hidden" name="action" value="add">

View File

@@ -384,7 +384,7 @@ class ProductLivre extends Product
*/
function assign_smarty_values(&$smarty, $action='')
{
global $langs;
global $conf,$langs;
if ($action =='edit' or $action == 'create')
{
@@ -403,8 +403,10 @@ class ProductLivre extends Product
$smarty->assign('class_focus_ref', 'focus');
}
$title = fiche_titre($langs->trans('NewBook'));
$smarty->assign('title', $title);
$picto='title.png';
if (empty($conf->browser->firefox)) $picto='title.gif';
$smarty->assign('title_picto', img_picto('',$picto));
$smarty->assign('title_text', $langs->trans('NewBook'));
$smarty->assign('user', $this->user->prenom.' '.$this->user->nom);