This commit is contained in:
progr76@gmail.com
2019-02-21 17:31:48 +03:00
parent 501ea7c584
commit 572a61a6a6
35 changed files with 4230 additions and 95 deletions

View File

@@ -512,3 +512,13 @@ button.radius
color:saddlebrown;
margin: 0;
}
.olink
{
text-decoration: none;
color: #0f1057;
}
.olink:hover
{
font-weight: bold;
}

View File

@@ -937,6 +937,11 @@ function RetChangeSmart(Item)
return '<DIV style="width: 204px;">' + Name + '<button onclick="ChangeSmart(' + Item.Num + ',' + Item.Value.Smart + ')" class="setsmart" style="height: ' + Height + 'px;min-height: ' + Height + 'px;">Set</button>' + State + '</DIV>';
};
function RetHistoryAccount(Item)
{
return "<a class='olink' target='_blank' href='./history.html#" + Item.Num + "'>" + Item.Num + "</a>";
};
function RetBaseAccount(Item)
{
var Str = "" + Item.Account;
@@ -947,10 +952,10 @@ function RetBaseAccount(Item)
function ViewTransaction(BlockNum)
{
window.Open('/HTML/blockviewer.html#' + BlockNum, 'viewer', 800, 800);
window.Open('./blockviewer.html#' + BlockNum, 'viewer', 800, 800);
};
function DateFromBlock(BlockNum)
function DateFromBlock(BlockNum,bAddEnter)
{
var Str;
if(window.FIRST_TIME_BLOCK)
@@ -959,6 +964,11 @@ function DateFromBlock(BlockNum)
Str = now.toISOString();
Str = Str.substr(0, Str.indexOf("."));
Str = Str.replace("T", " ");
if(bAddEnter)
{
var Arr = Str.split(" ");
Str = Arr[0] + "\n" + Arr[1];
}
}
else
Str = "";

View File

@@ -396,12 +396,15 @@ function GetBlockArrFromBuffer(BufRead,Info)
Block.SeqHash = GetSeqHash(Block.BlockNum, Block.PrevHash, Block.TreeHash);
var PrevHashNum = ReadUint32FromArr(Block.PrevHash, 28);
var PrevAddrNum = ReadUint32FromArr(Block.AddrHash, 28);
if(PrevHashNum !== PrevAddrNum && global.WATCHDOG_DEV)
if(PrevHashNum !== PrevAddrNum && Block.BlockNum > 20000000)
{
var Str = "";
if(Info && Info.Node)
Str = " from " + NodeName(Info.Node);
ToError("Error on block load: " + Block.BlockNum + Str);
if(global.WATCHDOG_DEV)
{
var Str = "";
if(Info && Info.Node)
Str = " from " + NodeName(Info.Node);
ToError("Error on block load: " + Block.BlockNum + Str);
}
return [];
}
CalcHashBlockFromSeqAddr(Block, Block.PrevHash);

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>Block</title>
<link rel="shortcut icon" href="/HTML/PIC/viewer.png" type="image/png">
<link rel="shortcut icon" href="../HTML/PIC/viewer.png" type="image/png">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/buttons.css">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/style.css">
@@ -18,7 +18,7 @@
global.RUN_SERVER=0;
}
</script>
<script type="text/javascript" src="/HTML/JS/coinlib.js"></script>
<script type="text/javascript" src="../HTML/JS/coinlib.js"></script>
<script type="text/javascript" src="../HTML/JS/client.js"></script>
@@ -29,6 +29,11 @@
window.onload=function()
{
if(localStorage["MainServer"] && !localStorage["BIGWALLET"])
{
MainServer=JSON.parse(localStorage["MainServer"]);
}
document.body.className="univers "+localStorage["idSelStyle"];
var i=document.URL.indexOf("#");
if(i>0)

210
Source/HTML/history.html Normal file
View File

@@ -0,0 +1,210 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>History account</title>
<link rel="shortcut icon" href="../HTML/PIC/viewer.png" type="image/png">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/buttons.css">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/style.css">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/wallet.css">
<script>
window.RUN_CLIENT=1;
window.RUN_SERVER=0;
if(typeof global === 'object')
{
global.RUN_CLIENT=1;
global.RUN_SERVER=0;
}
</script>
<script type="text/javascript" src="../HTML/JS/coinlib.js"></script>
<script type="text/javascript" src="../HTML/JS/client.js"></script>
<script>
var AccountID;
var CountViewRows=20;
window.onload=function()
{
if(localStorage["MainServer"] && !localStorage["BIGWALLET"])
{
MainServer=JSON.parse(localStorage["MainServer"]);
}
document.body.className="univers "+localStorage["idSelStyle"];
var i=document.URL.indexOf("#");
if(i>0)
{
AccountID=ParseNum(document.URL.substr(i+1));
document.getElementById("idViewAccountID").value=AccountID;
ViewHistory(1);
}
window.onkeydown = function (e)
{
if(e.keyCode===27)
{
window.close();
}
};
}
var CurPage=0;
var ArrPos=[];
function ViewHistory(bReset,NextPos)
{
var Params={AccountID:AccountID,Count:CountViewRows,GetDescription:1}
if(bReset)
{
CurPage=0;
ArrPos=[];
AccountID=ParseNum(document.getElementById("idViewAccountID").value);
}
else
{
Params.NextPos=NextPos;
}
//console.log(CurPage);
//console.log(JSON.stringify(Params));
document.title="Account: "+AccountID;
GetData("GetHistoryTransactions", Params, function (Data)
{
if(!Data || !Data.result)
return;
MaxBlockNum=Data.MaxBlockNum;
window.FIRST_TIME_BLOCK=Data.FIRST_TIME_BLOCK;
var Item;
var arr=Data.History;
for(var i=0;i<arr.length;i++)
{
Item=arr[i];
Item.Num=Item.Pos;
Item.Currency=Data.Currency;
Item.Value={SumCOIN:Item.SumCOIN,SumCENT:Item.SumCENT};
}
if(Item)
{
ArrPos[CurPage]={First:arr[0].Pos,NextPos:Item.NextPos};
}
//console.log(JSON.stringify(ArrPos));
SetGridData(Data.History,"grid_history","idTotalSumH",1);
});
}
function ViewBegin()
{
CurPage=0;
var Item=ArrPos[CurPage];
if(Item)
{
ViewHistory(0,Item.First);
}
}
function ViewPrev()
{
if(CurPage<=0)
return;
CurPage--;
var Item=ArrPos[CurPage];
if(Item)
{
ViewHistory(0,Item.First);
}
}
function ViewNext()
{
var Item=ArrPos[CurPage];
if(Item && Item.NextPos)
{
CurPage++;
ViewHistory(0,Item.NextPos);
}
}
function SaveValues()
{
}
var MaxBlockNum=0;
function ConfirmationFromBlock(BlockNum)
{
var Length=MaxBlockNum-8-BlockNum;
if(Length>0)
{
if(Length<=100)
return Length;
else
{
return ">"+Math.floor(Length/100)*100;
}
}
else
return "";
}
function GetCorrID(Item,Direct)
{
if(Item.Direct===Direct)
return Item.CorrID;
else
return AccountID;
}
function GetStr(Str)
{
if(Str===undefined)
return "";
return Str;
}
</script>
</head>
<body>
<DIV align='center'>
<DIV id="idTransactionBlock" style="display: block">
<BR>
<DIV class="header_tr" >History of account: <INPUT type="number" id="idViewAccountID" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewHistory(1)"> </DIV>
<BR>
<INPUT type="button" onclick="ViewBegin()" class="btdoitm bt" value="|<-">
<INPUT type="button" onclick="ViewPrev()" class="btdoit bt" value="<< Prev">
<INPUT type="button" onclick="ViewNext()" class="btdoit bt" value="Next >>">
<h5>Last Tx on top</h5>
<table id="grid_history" class="grid">
<tr>
<th id="(RetDirect(Item.Direct))" class="direct">Direct</th>
<th id="GetCorrID(Item,'+')" class="num">From</th>
<th id="GetCorrID(Item,'-')" class="num">To</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))" class="date">Date</th>
<th id="SUM_TO_STRING(Item)" class="sum smallbold">Amount</th>
<th id="CurrencyName(Item.Currency)" class="cur">Cur</th>
<th id="GetStr(Item.Description)" class="desc">Description</th>
<th id="ConfirmationFromBlock(Item.BlockNum)" class="num">Confirm</th>
<th id="(RetOpenBlock(Item.BlockNum,1))" class="num">Block</th>
<th id="Item.TrNum" class="num">Tx</th>
</tr>
</table>
<B><DIV id="idTotalSumH"></DIV></B>
<INPUT type="button" onclick="ViewPrev()" class="btdoit bt" value="<< Prev">
<INPUT type="button" onclick="ViewNext()" class="btdoit bt" value="Next >>">
</DIV>
</DIV>
<DIV id="idStableScroll">
@terafoundation
<!--progr76@gmail.com-->
</DIV>
</body>
</html>

View File

@@ -1330,7 +1330,7 @@
<BR>
<table id="grid_accounts" class="grid">
<tr>
<th id="Item.Num" class="num">ID</th>
<th id="(RetHistoryAccount(Item))" class="num">ID</th>
<th id="SUM_TO_STRING(Item.Value)" class="sum bold">Amount</th>
<th id="CurrencyNameItem(Item)" data-name="Currency" class="cur hint">Cur</th>
<th id="Item.Name" data-name="Account name" class="accname hint">Name</th>
@@ -1428,7 +1428,7 @@
<tr>
<th id="(RetDirect(Item.Direct))" class="direct">Direct</th>
<th id="ConfirmationFromBlock(Item.BlockNum)" class="txt">Confirm</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum)))" class="date">Date</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,0)))" class="date">Date</th>
<th id="SUM_TO_STRING(Item)" class="sum smallbold">Amount</th>
<th id="CurrencyName(Item.Currency)" class="cur">Cur</th>
<th id="Item.Description"class="desc">Description</th>
@@ -1609,7 +1609,7 @@
<table id="grid_accounts_all" class="grid">
<tr>
<th id="Item.Num" class="num">ID</th>
<th id="(RetHistoryAccount(Item))" class="num">ID</th>
<th id="SUM_TO_STRING(Item.Value)" class="sum smallbold">Amount</th>
<th id="CurrencyNameItem(Item)" class="cur">Cur</th>
<th id="Item.Name" class="accname">Name</th>
@@ -1643,7 +1643,7 @@
<tr>
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))" class="num">Num</th>
<th id="(DateFromBlock(Item.BlockNum))" class="date">Date</th>
<th id="(DateFromBlock(Item.BlockNum,1))" class="date">Date</th>
<th id="GetHexFromArr(Item.TreeHash)" class="hash">Data Hash</th>
<th id="GetHexFromArr(Item.PowHash)" class="hash">PowHash</th>
<th id="GetHexFromArr(Item.Hash)" class="hash">Block Hash</th>
@@ -1690,7 +1690,7 @@
<th id="Item.Mode">Mode</th>
<th id="(RetOpenBlock(Item.BlockNum,1))" class="num">Block</th>
<th id="Item.TrNum" class="num">TrNum</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum)))" class="date">Date</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))" class="date">Date</th>
<th id="Item.PrevValue.OperationID" class="num">Prev. Operation</th>
<th id="SUM_TO_STRING(Item.PrevValue)" class="sum">Prev. amount</th>
@@ -1715,7 +1715,7 @@
<tr>
<th id="Item.Num" class="num">Num</th>
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))" class="num">Block</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum)))" class="date">Date</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))" class="date">Date</th>
<th id="GetHexFromArr(Item.Hash)" class="code">Hash</th>
<th id="GetHexFromArr(Item.SumHash)" class="code">SumHash</th>
</tr>

View File

@@ -677,6 +677,7 @@
{
text-align: left;
width: 90px;
font-size: small;
}
td.hash
{
@@ -890,11 +891,10 @@
<table id="grid_accounts" class="grid">
<tr>
<th id="Item.Num" class="num">ID</th>
<th id="(RetHistoryAccount(Item))" class="num">ID</th>
<th id="SUM_TO_STRING(Item.Value)" class="sum bold">Amount</th>
<th id="CurrencyNameItem(Item)" data-name="Currency" class="cur hint">Currency</th>
<th id="Item.Name" data-name="Account name" class="accname hint">Name</th>
<!--<th id="Item.Adviser" data-name="Adviser" class="snum hint">Adv</th>-->
<th id="(RetChangeSmart(Item))" data-name="Smart contract (DApp)" class="smart hint">Smart</th>
</tr>
</table>
@@ -1022,7 +1022,7 @@
<table id="explorer_accounts" class="grid">
<tr>
<th id="Item.Num" class="num">ID</th>
<th id="(RetHistoryAccount(Item))" class="num">ID</th>
<th id="SUM_TO_STRING(Item.Value)" class="sum">Amount</th>
<th id="CurrencyNameItem(Item)" class="cur">Cur</th>
<th id="Item.Name" class="accname">Name</th>
@@ -1049,7 +1049,7 @@
<table id="explorer_blocks" class="grid">
<tr>
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))" class="num">Num</th>
<th id="(DateFromBlock(Item.BlockNum))" class="date">Date</th>
<th id="(DateFromBlock(Item.BlockNum,1))" class="date">Date</th>
<th id="GetHexFromArr(Item.TreeHash)" class="hash">Data Hash</th>
<th id="GetHexFromArr(Item.PowHash)" class="hash">PowHash</th>
<th id="GetHexFromArr(Item.Hash)" class="hash">Block Hash</th>