wallet: allow to show the last month txs

This commit is contained in:
Tanguy Pruvot 2016-03-01 14:55:01 +01:00
parent b04eefc91f
commit 2f64283027
2 changed files with 16 additions and 10 deletions

View file

@ -2,6 +2,7 @@
$id = getiparam('id');
$maxrows = arraySafeVal($_REQUEST,'rows',15);
$since = arraySafeVal($_REQUEST,'since',time()-(7*24*3600));
$coin = getdbo('db_coins', $id);
if (!$coin) {
$this->goback();
@ -47,7 +48,7 @@ echo '<br><div id="main_results"></div>';
echo '<br><div id="main_actions" style="margin-top: 8px;">';
// todo: use router createUrl
$url = '/site/coin?id='.$coin->id.'&rows='.($maxrows*2);
$url = '/site/coin?id='.$coin->id.'&since='.(time()-31*24*3600).'&rows='.($maxrows*2);
$moreurl = CHtml::link('Click here to show more transactions...', $url);
echo "{$moreurl}<br/>";
@ -82,7 +83,6 @@ echo <<<END
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
</div>
@ -101,7 +101,7 @@ var main_timeout;
function main_refresh()
{
var url = "/site/coin_results?id={$id}&rows={$maxrows}";
var url = "/site/coin_results?id={$id}&rows={$maxrows}&since={$since}";
clearTimeout(main_timeout);
$.get(url, '', main_ready).error(main_error);
@ -111,6 +111,10 @@ function main_ready(data)
{
$('#main_results').html(data);
main_timeout = setTimeout(main_refresh, main_delay);
var sumHeight = 0 + $('#sums').height();
if ($('#main_actions').height() < sumHeight) {
$('#main_actions').height(sumHeight);
}
}
function main_error()

View file

@ -22,7 +22,9 @@ $symbol = $coin->symbol;
if (!empty($coin->symbol2)) $symbol = $coin->symbol2;
echo "<br/>";
echo "Earnings $reserved2 BTC, balance (db) $balance $symbol, owed $owed $symbol ($owed_btc BTC), $reserved1 $symbol cleared<br/><br/>";
echo "Earnings $reserved2 BTC, balance (db) $balance $symbol";
if ($owed) echo ", owed $owed $symbol ($owed_btc BTC)";
echo ", $reserved1 $symbol cleared<br/><br/>";
//////////////////////////////////////////////////////////////////////////////////////
@ -149,7 +151,7 @@ $txfee = isset($info['paytxfee'])? $info['paytxfee']: '';
$connections = isset($info['connections'])? $info['connections']: '';
$blocks = isset($info['blocks'])? $info['blocks']: '';
echo '<td>'.$coin->difficulty.'</td>';
echo '<td>'.round_difficulty($coin->difficulty).'</td>';
if(!empty($errors))
echo "<td style='color: red;' title='$errors'>$blocks</td>";
else
@ -177,6 +179,9 @@ echo '<br>';
//////////////////////////////////////////////////////////////////////////////////////
// last week
$list_since = arraySafeVal($_GET,'since',time()-(7*24*3600));
$maxrows = arraySafeVal($_GET,'rows', 15);
$maxrows = min($maxrows, 2500);
@ -200,9 +205,6 @@ tr.ssrow.orphan { color: darkred; }
</thead><tbody>
end;
// last week
$list_since = time()-(7*24*3600);
$account = '';
if ($coin->symbol == 'DCR') $account = '*';
@ -277,7 +279,7 @@ foreach($txs_array as $tx)
echo '<td>'.$tx['amount'].'</td>';
if($block) {
echo '<td>'.$block['height'].'</td><td>'.$block['difficulty'].'</td>';
echo '<td>'.$block['height'].'</td><td>'.round_difficulty($block['difficulty']).'</td>';
} else
echo '<td></td><td></td>';
@ -311,7 +313,7 @@ foreach($txs_array as $tx)
echo '</tr>';
$rows++;
if ($rows > $maxrows) break;
if ($rows >= $maxrows) break;
}
echo '</tbody></table>';