- 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 != ''} {if $LSview_actions != ''}
<ul class='LSview-actions'> <ul class='LSview-actions'>
{foreach from=$LSview_actions item=item} {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> <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} {/foreach}
</ul> </ul>
{/if} {/if}

View file

@ -17,7 +17,9 @@
{if $LSview_actions != ''} {if $LSview_actions != ''}
<ul class='LSview-actions'> <ul class='LSview-actions'>
{foreach from=$LSview_actions item=item} {foreach from=$LSview_actions item=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 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} {/foreach}
</ul> </ul>
{/if} {/if}

View file

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