hide morelog button if there are no more log entries - bugfix for oc-1398

This commit is contained in:
Georg Ehrke 2012-08-04 17:38:31 +02:00
parent d7e77f6426
commit 1bccc80996
4 changed files with 10 additions and 1 deletions

View File

@ -18,6 +18,8 @@ $forms=OC_App::getForms('admin');
$htaccessworking=OC_Util::ishtaccessworking();
$entries=OC_Log_Owncloud::getEntries(3);
$entriesremain=(count(OC_Log_Owncloud::getEntries(4)) > 3)?true:false;
function compareEntries($a,$b){
return $b->time - $a->time;
}
@ -25,6 +27,7 @@ usort($entries, 'compareEntries');
$tmpl->assign('loglevel',OC_Config::getValue( "loglevel", 2 ));
$tmpl->assign('entries',$entries);
$tmpl->assign('entriesremain', $entriesremain);
$tmpl->assign('htaccessworking',$htaccessworking);
$tmpl->assign('forms',array());
foreach($forms as $form){

View File

@ -14,4 +14,4 @@ $count=(isset($_GET['count']))?$_GET['count']:50;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
$entries=OC_Log_Owncloud::getEntries($count,$offset);
OC_JSON::success(array("data" => OC_Util::sanitizeHTML($entries)));
OC_JSON::success(array("data" => OC_Util::sanitizeHTML($entries), "remain"=>(count(OC_Log_Owncloud::getEntries(1,$offset + $offset)) != 0)?true:false));

View File

@ -23,6 +23,9 @@ OC.Log={
if(result.status=='success'){
OC.Log.addEntries(result.data);
$('html, body').animate({scrollTop: $(document).height()}, 800);
if(!result.remain){
$('#moreLog').css('display', 'none');
}
}
});
},

View File

@ -52,7 +52,10 @@ if(!$_['htaccessworking']) {
</tr>
<?php endforeach;?>
</table>
<?php if($_['entriesremain']): ?>
<input id='moreLog' type='button' value='<?php echo $l->t('More');?>...'></input>
<?php endif; ?>
</fieldset>