- LSview : Bugs dans l'utilisation du cache des recherches [#1745]

This commit is contained in:
Benjamin Renard 2008-12-15 12:44:04 +00:00
parent 78b227d489
commit 87d71e2359
3 changed files with 29 additions and 7 deletions

View file

@ -3,7 +3,9 @@
{if $LSview_actions != ''}
<ul class='LSview-actions'>
{foreach from=$LSview_actions item=item}
{if is_array($item)}
<li class='LSview-actions'><a href='{$item.url}' class='LSview-actions' ><img src='{$LS_IMAGES_DIR}/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a></li>
{/if}
{/foreach}
</ul>
{/if}

View file

@ -17,7 +17,9 @@
{if $LSview_actions != ''}
<ul class='LSview-actions'>
{foreach from=$LSview_actions item=item}
{if is_array($item)}
<li class='LSview-actions'><a href='{$item.url}' class='LSview-actions'><img src='{$LS_IMAGES_DIR}/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a></li>
{/if}
{/foreach}
</ul>
{/if}

View file

@ -304,18 +304,35 @@ if($LSsession -> startLSsession()) {
// On affiche à partir du cache
$searchData=$_SESSION['LSsession']['LSsearch'][$hash];
LSdebug('Recherche : From cache');
if(!isset($searchData['LSview_actions']['create'])) {
LSdebug('Recherche : Check Create()');
if ($GLOBALS['LSsession'] -> canCreate($LSobject)) {
$searchData['LSview_actions']['create'] = array (
'label' => _('Nouveau'),
'url' => 'create.php?LSobject='.$LSobject,
'action' => 'create'
);
}
else {
$searchData['LSview_actions']['create'] = false;
}
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
}
}
else { // Load
LSdebug('Recherche : Load');
if ($GLOBALS['LSsession'] -> canCreate($LSobject)) {
$LSview_actions[] = array (
$LSview_actions['create'] = array (
'label' => _('Nouveau'),
'url' => 'create.php?LSobject='.$LSobject,
'action' => 'create'
);
$canCopy=true;
}
$LSview_actions[] = array (
else {
$LSview_actions['create'] = false;
}
$LSview_actions['refresh'] = array (
'label' => _('Rafraîchir'),
'url' => 'view.php?LSobject='.$LSobject.'&amp;refresh',
'action' => 'refresh'
@ -348,7 +365,7 @@ if($LSsession -> startLSsession()) {
if ($orderby) {
$sort=true;
}
}
} // Fin Load
if ((!isset($searchData['objectList'][0]['actions']))&&(!empty($searchData['objectList']))) {
LSdebug('Load actions');
@ -413,10 +430,11 @@ if($LSsession -> startLSsession()) {
if (!uasort($searchData['objectList'],'sortBy')) {
LSdebug('Erreur durant le trie.');
}
}
} // Fin Order by
$GLOBALS['Smarty']->assign('LSobject_list_orderby',$orderby);
$GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense);
// Mise en cache
if ($GLOBALS['LSsession'] -> cacheSearch()) {
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
}
@ -434,7 +452,7 @@ if($LSsession -> startLSsession()) {
}
$searchData['LSobject_list_nbpage']=ceil($searchData['LSobject_list_nbresult'] / NB_LSOBJECT_LIST);
$GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']);
}
} // Fin Pagination
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css');