Skip to content

Commit

Permalink
hide morelog button if there are no more log entries - bugfix for oc-…
Browse files Browse the repository at this point in the history
…1398
  • Loading branch information
Georg Ehrke committed Aug 4, 2012
1 parent d7e77f6 commit 1bccc80
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions settings/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
$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;
}
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){
Expand Down
2 changes: 1 addition & 1 deletion settings/ajax/getlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
$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));
3 changes: 3 additions & 0 deletions settings/js/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
});
},
Expand Down
3 changes: 3 additions & 0 deletions settings/templates/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@
</tr>
<?php endforeach;?>
</table>
<?php if($_['entriesremain']): ?>
<input id='moreLog' type='button' value='<?php echo $l->t('More');?>...'></input>
<?php endif; ?>

</fieldset>


Expand Down

0 comments on commit 1bccc80

Please sign in to comment.