[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant-frontends] branch master updated: remove de
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant-frontends] branch master updated: remove dead code |
Date: |
Sun, 23 Apr 2017 10:14:31 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant-frontends.
The following commit(s) were added to refs/heads/master by this push:
new c981246 remove dead code
c981246 is described below
commit c981246832d91d8b73e2648f1ce9d1e013f3d1e6
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sun Apr 23 10:14:20 2017 +0200
remove dead code
---
talerfrontends/static/tracking-error.js | 54 -----
talerfrontends/static/tracking.css | 12 --
talerfrontends/static/tracking.js | 235 ---------------------
talerfrontends/templates/error.html | 12 --
talerfrontends/templates/tracking.html | 101 ---------
talerfrontends/templates/transaction_conflict.html | 15 --
talerfrontends/templates/transfer_conflict.html | 15 --
7 files changed, 444 deletions(-)
diff --git a/talerfrontends/static/tracking-error.js
b/talerfrontends/static/tracking-error.js
deleted file mode 100644
index 87cf11f..0000000
--- a/talerfrontends/static/tracking-error.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- @licstart The following is the entire license notice for the
- JavaScript code in this page.
-
- Copyright (C) 2015, 2016 INRIA
-
- The JavaScript code in this page is free software: you can
- redistribute it and/or modify it under the terms of the GNU
- Lesser General Public License (GNU LGPL) as published by the Free Software
- Foundation, either version 2.1 of the License, or (at your option)
- any later version. The code is distributed WITHOUT ANY WARRANTY;
- without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU LGPL for more details.
-
- As additional permission under GNU LGPL version 2.1 section 7, you
- may distribute non-source (e.g., minimized or compacted) forms of
- that code without the copy of the GNU LGPL normally required by
- section 4, provided you include this license notice and a URL
- through which recipients can access the Corresponding Source.
-
- @licend The above is the entire license notice
- for the JavaScript code in this page.
-
- @brief Contains functions that regulate the focus to input fields
- and others that request /history to the frontend
- @author Marcello Stanisci
-*/
-
-/**
- * Append anchor needed to save content to disk. Used on
- * errors to save crypto proofs.
- */
-function save_proof(){
- var content = document.querySelectorAll("[name=proof]")[0];
- console.log("Saving blob:", content);
- var blob = new Blob([content.getAttribute("value")], {type:"text/plain"});
- var href = window.URL.createObjectURL(blob);
- var a = document.createElement("a");
- var d = new Date();
- a.download = d.getFullYear()
- + "-" + d.getMonth()
- + "-" + d.getDay()
- + "_" + d.getHours()
- + "-" + d.getMinutes()
- + "-" + d.getSeconds()
- + ".conflict-proof";
- a.href = href;
- var d = new Date();
- a.innerHTML = "Export proof to file";
- var container = document.getElementById("save-file");
- container.appendChild(a);
-}
-
-document.addEventListener("DOMContentLoaded", save_proof);
diff --git a/talerfrontends/static/tracking.css
b/talerfrontends/static/tracking.css
deleted file mode 100644
index dc49a35..0000000
--- a/talerfrontends/static/tracking.css
+++ /dev/null
@@ -1,12 +0,0 @@
-.track-button {
- float: left;
-}
-
-.track-trans {
- font-size: medium;
- white-space: nowrap;
-}
-
-#history, #history th, #history td {
- border: 1px solid black;
-}
diff --git a/talerfrontends/static/tracking.js
b/talerfrontends/static/tracking.js
deleted file mode 100644
index b5945bc..0000000
--- a/talerfrontends/static/tracking.js
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- @licstart The following is the entire license notice for the
- JavaScript code in this page.
-
- Copyright (C) 2015, 2016 INRIA
-
- The JavaScript code in this page is free software: you can
- redistribute it and/or modify it under the terms of the GNU
- Lesser General Public License (GNU LGPL) as published by the Free Software
- Foundation, either version 2.1 of the License, or (at your option)
- any later version. The code is distributed WITHOUT ANY WARRANTY;
- without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU LGPL for more details.
-
- As additional permission under GNU LGPL version 2.1 section 7, you
- may distribute non-source (e.g., minimized or compacted) forms of
- that code without the copy of the GNU LGPL normally required by
- section 4, provided you include this license notice and a URL
- through which recipients can access the Corresponding Source.
-
- @licend The above is the entire license notice
- for the JavaScript code in this page.
-
- @brief Contains functions that regulate the focus to input fields
- and others that request /history to the frontend
- @author Marcello Stanisci
-*/
-"use strict";
-
-// Used when parsing amount objects into strings.
-var FRACTION = 100000000;
-
-/**
- * Attach event handlers where needed
- */
-function init(){
- var inputs = document.querySelectorAll(".track-input");
- for (var i=0; i<inputs.length; i++) {
- inputs[i].onfocus = function(){
-
this.parentNode.parentNode.querySelectorAll(".track-button")[0].removeAttribute("disabled")};
- inputs[i].onblur = function(){
- var button =
this.parentNode.parentNode.querySelectorAll(".track-button")[0];
- var father = this.parentNode;
- setTimeout(function(){
- if (document.activeElement != button
- && document.activeElement.parentNode != father)
- button.setAttribute("disabled", "disabled");
- },
- 100);
- };
- }
-}
-
-/**
- * Paste transaction details into the form
- */
-function paste_transaction(tid, instance){
-
- var form_fields =
document.evaluate('//tbody/tr/th[2]/form//address@hidden"text"]',
- document,
- null,
- XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
- null);
- for (var i = 0; i < form_fields.snapshotLength; i++){
- var node = form_fields.snapshotItem(i);
- switch (node.name){
- case "tid":
- node.value = tid;
- break;
- case "instance":
- node.value = instance;
- node.focus();
- }
- }
-}
-
-/**
- * Paste transfer details into the form
- */
-function paste_transfer(exchange_uri, instance, wtid){
-
- var form_fields =
document.evaluate('//tbody/tr/th[1]/form//address@hidden"text"]',
- document,
- null,
- XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
- null);
- for (var i = 0; i < form_fields.snapshotLength; i++){
- var node = form_fields.snapshotItem(i);
- switch (node.name){
- case "wtid":
- node.value = wtid;
- break;
- case "exchange-uri":
- node.value = exchange_uri;
- break;
- case "instance":
- node.value = instance;
- node.focus();
- }
- }
-}
-
-/**
- * Parse Taler date string
- */
-function get_date(date){
- var split = date.match(/Date\((.*)\)/);
- var seconds;
- if(isNaN(seconds = Number(split[1]))){
- console.error("Malformed date gotten from backend");
- return;
- }
- console.log("Extracting timestamp", split[1]);
- var d = new Date(seconds * 1000);
- return d;
-}
-
-/**
- * Stringify amounts
- */
-function parse_amount(amount){
- var v = amount.value + (amount.fraction/FRACTION);
- return v + " " + amount.currency;
-}
-
-
-/**
- * Issue a /map/out to the frontend, in order to
- * get a plain contract corresponding to the given
- * hashcode. Update the column with the received
- * content.
- */
-function fill_contract_details(summary_column,
- instance_column,
- tid_column,
- entry){
- /* Wait for frontend implementing /map. */
- var req = new XMLHttpRequest();
-
- var on_error = function(){
- var msg = "Not able to talk to frontend.";
- summary_column.textContent = msg;
- instance_column.textContent = msg;
- };
-
- req.open("GET", `/map?h_contract=${entry.h_contract}`);
- req.onerror = on_error;
- req.onload = function(){
- if(req.readyState == 4 && req.status == 200){
- var contract = JSON.parse(req.responseText);
- if(!contract){
- console.log("Got invalid JSON.");
- column.textContent = "Frontend gave invalid contract.";
- return;
- }
- summary_column.textContent = contract.summary;
- instance_column.textContent
- = contract.merchant.instance ? contract.merchant.instance : "default";
- tid_column.innerHTML
- = `<a href="#" onclick='paste_transaction("${entry.transaction_id}",
"${contract.merchant.instance}");'>
- ${entry.transaction_id}
- </a>`;
- }
- else
- on_error();
- };
- req.send();
-}
-
-/**
- * This function gets triggered when the user submits the form
- * used to get a list of transactions
- */
-function submit_history(){
- var table = document.getElementById("history");
-
- /**
- * Remove leftovers.
- */
- var entries = document.getElementsByClassName("history-entry");
- while (0 < entries.length)
- table.removeChild(entries[0]);
-
- var days = document.getElementById("history_form").days.value;
- var req = new XMLHttpRequest();
- var get_column = function(value, ra){
- var column = document.createElement("td");
- column.textContent = value;
- if (ra)
- column.setAttribute("align", "right");
- return column;
- };
- var on_error = function(){
- table.innerHTML = "<p>Could not get transactions list from server</p>"
- };
- req.open("GET", `/history?days=${days}`, true);
- req.onload = function(){
- if(req.readyState == 4 && req.status == 200){
- var history = JSON.parse(req.responseText);
- if(!history)
- console.log("Got invalid JSON");
- if(0 == history.length){
- table.innerHTML = "<p>No transaction was that young!</p>";
- }
- for (var i=0; i<history.length; i++){
- var entry = history[i];
- var tr = document.createElement("tr");
- tr.className = "history-entry";
- // * tr.appendChild(get_column(entry.transaction_id));
- var async_tid_column = get_column("");
- tr.appendChild(async_tid_column);
- var date = get_date(entry.timestamp);
- tr.appendChild(get_column(date.toDateString()
- + " " + date.toLocaleTimeString()));
- var async_summary_column = get_column("");
- var async_instance_column = get_column("");
- tr.appendChild(async_summary_column);
- tr.appendChild(async_instance_column);
- fill_contract_details(async_summary_column,
- async_instance_column,
- async_tid_column,
- entry);
- tr.appendChild(get_column(parse_amount(entry.total_amount), true))
- table.appendChild(tr);
- }
- table.style.visibility = "";
- }
- else{
- on_error();
- }
- };
- req.send();
-}
-
-document.addEventListener("DOMContentLoaded", init);
diff --git a/talerfrontends/templates/error.html
b/talerfrontends/templates/error.html
deleted file mode 100644
index e2a551d..0000000
--- a/talerfrontends/templates/error.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{% extends "templates/base.html" %}
-
-{% block scripts %}
-<script src="/static-common/tracking.js"
type="application/javascript"></script>
-<link rel="stylesheet" type="text/css" href="/static-common/tracking.css">
-{% endblock %}
-
-{% block main %}
-Error type: {{ error }}
-<br>
-details: {{ details }}
-{% endblock %}
diff --git a/talerfrontends/templates/tracking.html
b/talerfrontends/templates/tracking.html
deleted file mode 100644
index 5fb331f..0000000
--- a/talerfrontends/templates/tracking.html
+++ /dev/null
@@ -1,101 +0,0 @@
-{% extends "templates/base.html" %}
-
-{% block scripts %}
-<script src="/static-common/tracking.js"
type="application/javascript"></script>
-<link rel="stylesheet" type="text/css" href="/static-common/tracking.css">
-{% endblock %}
-
-{% block main %}
-<div>
- <table>
- <tbody>
- <tr>
- <th>Wire transfers</th>
- <th>Transactions</th>
- </tr>
- <tr>
- <th>
- <form action="/track/transfer" method="GET" class="track-form">
- <div>
- <input class="track-input" type="text" name="wtid"
placeholder="Wire transfer id"/><br>
- <input class="track-input" type="text" name="exchange-uri"
placeholder="exchange URI"/><br>
- <input class="track-input" type="text" name="instance"
placeholder="Instance"/><br>
- </div>
- <div>
- <input type="submit" value="Track!" class="track-button"
disabled="disabled"/>
- </div>
- </form>
- </th>
- <th>
- <form action="/track/transaction" method="GET" class="track-form">
- <div>
- <input class="track-input" type="text" name="tid"
placeholder="Transaction id"/><br>
- <input class="track-input" type="text" name="instance"
placeholder="Instance"/><br>
- </div>
- <div>
- <input type="submit" value="Track!" class="track-button"
disabled="disabled"/>
- </div>
- </form>
- </th>
- </tr>
- </tbody>
- </table>
- <div id="result">
- </div>
-</div>
-{% if transaction %}
- <p>Records for transaction: {{ original.transaction }}{% if
original.instance %},
- for merchant instance {{ original.instance }}{% endif %}
- </p>
- {% for e in tracks %}
- <ol class="track-trans">
- <li>
- <ul>
- <li>
- WTID: <a href="#" onclick='paste_transfer("{{ e["exchange"] }}", "{{
original.instance }}", "{{ e["wtid"] }}");'>{{ e["wtid"] }}</a>
- </li>
- <li>date: {{ e["date"] }}</li>
- <li>amount: {{ e["amount"] }}</li>
- <li>operated by {{ e["exchange"] }}</li>
- </ul>
- </li>
- </ol>
- {% endfor %}
-{% elif transfer %}
- <p>Records for WTID: {{ original.wtid }}:</p>
- <ol>
- <li>
- {% for e in tracks["deposits"] %}
- <ul>
- <li>
- Transaction: <a href="#" onclick='paste_transaction("{{
e["transaction_id"] }}", "{{ original.instance }}");'>{{ e["transaction_id"]
}}</a>
- </li>
- <li>amount: {{ e["deposit_value"]}}</li>
- </ul>
- {% endfor %}
- </li>
- </ol>
- <p>Total: {{ tracks["total"] }}</p>
-{% else %}
- <p>{{ msg }}</p>
-{% endif %}
-<form id="history_form" action="/history" method="GET">
- Get transactions up to
- <select name="days">
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="7">7</option>
- <option value="0">∞</option>
- </select>
- days back: <input type="button" onclick="submit_history();" value="Get!">
- <br>
- <small>Works only if JavaScript enabled</small>
-</form>
-<br/>
-<table id="history" style="visibility: hidden;">
- <tr>
- <th>Order ID</th>
- </tr>
-</table>
-
-{% endblock %}
diff --git a/talerfrontends/templates/transaction_conflict.html
b/talerfrontends/templates/transaction_conflict.html
deleted file mode 100644
index 339afc3..0000000
--- a/talerfrontends/templates/transaction_conflict.html
+++ /dev/null
@@ -1,15 +0,0 @@
-{% extends "templates/base.html" %}
-
-{% block scripts %}
-<script src="/static-common/tracking-error.js"
type="application/javascript"></script>
-{% endblock %}
-
-{% block main %}
-<meta name="proof" value="{{ details }}">
-
-<p>Conflict: in the attempt to track transaction {{ transaction_id }},
-the exchange claims that coin {{ details.coin_pub }} was transferred by WTID:
-{{ details.transaction_tracking_claim.wtid }}, whereas in previous tracks of
-transaction {{ transaction_id }} that same coin was unknown to the exchange.
-<div id="save-file"></div>
-{% endblock %}
diff --git a/talerfrontends/templates/transfer_conflict.html
b/talerfrontends/templates/transfer_conflict.html
deleted file mode 100644
index 47795d6..0000000
--- a/talerfrontends/templates/transfer_conflict.html
+++ /dev/null
@@ -1,15 +0,0 @@
-{% extends "templates/base.html" %}
-
-{% block scripts %}
-<script src="/static-common/tracking-error.js"
type="application/javascript"></script>
-{% endblock %}
-
-{% block main %}
-<meta name="proof" value="{{ details }}">
-
-<p>Conflict in deposited coin {{ details.coin_pub }}: the exchange
-wire transferred an amount that differs from the amount we deposited.</p>
-<p>Deposited amount:
-{{ expected_amount }} for transaction {{ transaction_id }}</p>
-<p>Wire transferred amount by the exchange: {{ transferred_amount }}</p>
-{% endblock %}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant-frontends] branch master updated: remove dead code,
gnunet <=