Hiding reserve key 'input' field

+ adding a new 'input' field to get the base URL of the
receiving-money mint
+ adapting 'detail'  object passed to the wallet
to indicate all the DOM ids from the SEPA form needed
by the wallet to perform the submission
This commit is contained in:
Marcello Stanisci 2015-11-13 14:14:14 +01:00
parent d6a222beca
commit e5d3c21043

View File

@ -31,7 +31,7 @@
</head> </head>
<body id="css-zen-garden" onload="signal_me()"> <body id="css-zen-garden" onload="signal_me()">
<div class="explanation" id="zen-explanation" role="article"> <div class="explanation" id="zen-explanation" role="article">
<h1>Welcome to the Taler "Demo" Mint</h1> <h1>Welcome to the KUDOS bank!</h1>
<p>Through this page, you can wire funds to our demonstrator mint <p>Through this page, you can wire funds to our demonstrator mint
in order to create your reserves from where withdraw your coins. in order to create your reserves from where withdraw your coins.
Once the reserve is created, the withdrawing of coins will be Once the reserve is created, the withdrawing of coins will be
@ -39,22 +39,16 @@
to the user. to the user.
</p> </p>
<p> <p>
By clicking the button "Wire funds", your wallet will be triggered to Enter the deisired amount, and click 'Select mint'. Your wallet
create a new reserve's key which needs to be pasted in the dedicated will make you choose a mint and will automatically submit all the
field. Fill the desired amount to fund into the key's dialog, in order needed data into the bank's system. At the end of the withdrawal,
to make the wallet check when the mint get all the funds for the reserve. the wallet will show you the 'All coins withdrawn' nice message.
</p> </p>
<input id="wire-funds-button" type="button" value="Wire funds" disabled=true
onclick='wire_funds();'></input>
</div> </div>
<form id="reserve-form" name="tform" action="/fake_wire_transfer.php" method="POST" onsubmit="signal_reserve()"> <form id="reserve-form" name="tform" action="/fake_wire_transfer.php" method="POST">
<div class="participation" id="fake-wire"> <input type="text" id="reserve-pk-input" name="reserve_pk" hidden></input>
<br> Amount to withdraw:
Paste your reserve public key here (right-click, "paste"):
<input type="text" id="reserve-pk-input" name="reserve_pk"></input>
<br>
Amount to credit to your reserve:
<select id="reserve-amn-id" name="kudos_amount"> <select id="reserve-amn-id" name="kudos_amount">
<option value="1 KUDOS">1 KUDOS</option> <option value="1 KUDOS">1 KUDOS</option>
<option value="2 KUDOS">2 KUDOS</option> <option value="2 KUDOS">2 KUDOS</option>
@ -62,25 +56,18 @@
<option value="5 KUDOS">5 KUDOS</option> <option value="5 KUDOS">5 KUDOS</option>
<option value="10 KUDOS">10 KUDOS</option> <option value="10 KUDOS">10 KUDOS</option>
<option value="10.50 KUDOS">10.50 KUDOS</option> <option value="10.50 KUDOS">10.50 KUDOS</option>
<option value="1000 KUDOS">1000 KUDOS</option> <option value="1000.3 KUDOS">1000.3 KUDOS</option>
</select> </select>
<br> <input type="text" id="kudos-mint" hidden></input>
<input type="submit" value="Submit"></input> <input id="select-mint"
<br> type="button"
</div> value="Select mint"
onclick="wire_funds()"
disabled></input>
</form> </form>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
/* The wallet should send this signal only when:
- it gets installed
- it gets a 'taler-wire-mfirst' event */
function signal_reserve(){
var reserve_submitted = new Event("reserve-submitted");
document.body.dispatchEvent(reserve_submitted);
};
document.body.addEventListener("taler-wallet-present", document.body.addEventListener("taler-wallet-present",
has_taler_wallet_cb, has_taler_wallet_cb,
false); false);
@ -93,14 +80,14 @@
signal_me, signal_me,
false); false);
function wire_funds(){ function wire_funds(){
var wallet_param = { var wallet_param = {
'currencies' : new Array("KUDOS"), //'currencies' : new Array("KUDOS"), not anymore: must be given by the mint
'form_id' : 'reserve-form',
'input_amount' : 'reserve-amn-id', 'input_amount' : 'reserve-amn-id',
'input_pub' : 'reserve-pk-input', 'input_pub' : 'reserve-pk-input',
'base_url' : window.location.host 'mint_rcv' : 'kudos-mint'
//'base_url' : window.location.host not anymore: must be given by the mint
}; };
var trigger = new CustomEvent("taler-create-reserve", {detail: wallet_param}); var trigger = new CustomEvent("taler-create-reserve", {detail: wallet_param});
document.body.dispatchEvent(trigger); document.body.dispatchEvent(trigger);
@ -113,12 +100,12 @@
}; };
function has_taler_wallet_cb(){ function has_taler_wallet_cb(){
var button = document.getElementById("wire-funds-button"); var button = document.getElementById("select-mint");
button.removeAttribute("disabled"); button.removeAttribute("disabled");
} }
function no_taler_wallet_cb(){ function no_taler_wallet_cb(){
var button = document.getElementById("wire-funds-button"); var button = document.getElementById("select-mint");
button.setAttribute("disabled", "true"); button.setAttribute("disabled", "true");
} }