forked from TezosRio/taps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.cfm
executable file
·164 lines (137 loc) · 6.86 KB
/
status.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<cfif not isUserLoggedIn()>
<cflocation url="index.cfm">
</cfif>
<cfscript>
setLocale("English (us)");
</cfscript>
<cfset statusValue="">
<cfset updateResult="">
<cfif isDefined("form.statusValue")>
<cfset statusValue="#form.statusValue#">
<cfelse>
<cfset statusValue="">
</cfif>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="cache-control" content="no-cache">
<!-- CSS Bootstrap-->
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<!-- CSS Page-->
<link rel="stylesheet" type="text/css" href="css/estilo.css">
<script src="js/jquery-3.2.1.min.js"></script>
<script language="javascript">
function validate()
{
var selectedOption = document.getElementById('idStatus').value;
if (selectedOption == '0')
{
if (confirm('Do you really want to turn OFF?'))
return true;
}
else if (selectedOption == '1')
{
if (confirm('Configure taps to SIMULATION mode?'))
return true;
}
else if (selectedOption == '2')
{
if (confirm('This will turn taps ON and do real rewards payments. Are you sure?'))
return true;
}
return false;
}
</script>
<style>
a, a:active, a:focus, a:hover, input, input:focus { outline: none; !important; }
.nooutline, .nooutline:focus { outline: none; !important; }
</style>
</head>
<body>
<section class="box-content-rewards">
<div style="width:550px;">
<cfoutput>
<h1 class="title-baker">
Status
</h1>
<br>
<!--- Get settings from configuration --->
<cfinvoke component="components.database" method="getSettings" returnVariable="settings">
<cfif #settings.recordCount# GT 0>
<!--- If under the "native" mode, check if TAPS has a native wallet configured --->
<cfif #settings.funds_origin# EQ "native">
<cfif #len(settings.wallet_hash)# EQ 0>
<!--- Force update os STATUS with mode "OFF", until a wallet is created --->
<cfset statusValue="0">
</cfif>
</cfif>
<cfif #statusValue# EQ "">
<cfinvoke component="components.database" method="getStatusValue" description="#settings.mode#" returnVariable="statusValue">
<cfelse>
<!--- Save the new status mode --->
<cfinvoke component="components.database" method="setStatusMode" bakerId="#application.bakerId#" statusValue="#statusValue#" returnVariable="updateResult">
</cfif>
<div style="text-align: justify;text-justify: inter-word;">
TAPS starts in <span style="font-weight:bold;">Simulation</span> mode, which means it will fetch information from Tezos network
in a frequent basis, but it will NOT make real rewards payments to delegators.
If mode is set to <span style="font-weight:bold;">Off</span>, it will not fetch data at all.
When TAPS is set to <span style="font-weight:bold;">On</span>, it will fetch data in a frequent basis an when it detects
a cycle change, it will make REAL rewards payments to delegators, according to their shares,
based on information obtained from the Tezos blockchain.<br><br>
</div>
<br>
<cfform name="form" action="status.cfm" method="post">
<table id="idRangeTable">
<tr style="outline:none; !important;">
<td align="right">
<label><span class="text-input-taps" id="idSpanBlack" style="color:black;" onClick="document.getElementById('idStatus').value='#application.mode_no#';">Off</span></label>
</td>
<td style="outline:none; !important;"><input type="range" id="idStatus" name="statusValue" min="0" max="2" value="#statusValue#" step="1" style="width:300px;outline: none; !important;" class="nooutline"></td>
<td align="left">
<label> <span class="text-input-taps" id="idSpanRed" style="color:red;" onClick="document.getElementById('idStatus').value='#application.mode_yes#';">On</span></label>
</td>
<td>
<button type="button" class="botao-taps" onClick="if (validate()) { document.form.submit(); }">SAVE</button>
</td>
</tr>
<tr>
<td align="left" colspan="3">
<label><span class="text-input-taps" id="idSpanGreen" style="color:green;" onClick="document.getElementById('idStatus').value='#application.mode_try#';">Simulation</span></label>
</td>
</tr>
</table>
</cfform>
<br><br>
<cfif #updateResult# EQ "true">
<cfif #settings.funds_origin# EQ "native" and #len(settings.wallet_hash)# EQ 0>
<script language="javascript">
alert('In native wallet mode, TAPS requires a native wallet to be configured first! Please go to menu option WALLET and create your wallet.');
$("##idRangeTable").find("input,button,textarea,select,range,span").attr("disabled", "disabled");
$("##idRangeTable").find("input,button,textarea,select,range,span").attr("readonly", "readonly");
$("##idRangeTable").find("input,button,textarea,select,range,span").css('color', 'grey');
$("##idRangeTable").find("input,button,textarea,select,range,span").removeAttr('onClick');
</script>
<cfelse>
<script language="javascript">alert('Status updated successfully');</script>
</cfif>
<cfelseif #updateResult# EQ "false">
<script language="javascript">alert('Could not update status, please try again');</script>
</cfif>
<cfelse>
There is no configuration saved on settings.<br>
Please go to SETUP first.<br>
</cfif>
</cfoutput>
</div>
</section>
</body>
</html>