Fix: debut simplification template smarty

This commit is contained in:
Regis Houssin 2009-07-29 15:32:13 +00:00
parent 5fe7b641d1
commit 0f16946a03
3 changed files with 28 additions and 15 deletions

View File

@ -1888,23 +1888,37 @@ 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';
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>';
$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>';
if (strlen($mesg))
{
print '<td class="nobordernopadding" align="right" valign="middle"><b>'.$mesg.'</b></td>';
$title.= '<td class="nobordernopadding" align="right" valign="middle"><b>'.$mesg.'</b></td>';
}
print '</tr></table>'."\n";
$title.= '</tr></table>'."\n";
return $title;
}
/**

View File

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

View File

@ -384,6 +384,8 @@ class ProductLivre extends Product
*/
function assign_smarty_values(&$smarty, $action='')
{
global $langs;
if ($action =='edit' or $action == 'create')
{
$this->GetAvailableFormat();
@ -400,6 +402,9 @@ class ProductLivre extends Product
$smarty->assign('class_normal_ref', 'normal');
$smarty->assign('class_focus_ref', 'focus');
}
$title = fiche_titre($langs->trans('NewBook'));
$smarty->assign('title', $title);
$smarty->assign('user', $this->user->prenom.' '.$this->user->nom);