-
Notifications
You must be signed in to change notification settings - Fork 2
/
html.go
127 lines (113 loc) · 4.24 KB
/
html.go
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
package main
const indexhtml string = `<html>
<head>
<title>file name input</title>
<link type="image/x-icon" href="go.ico" rel="shortcut icon">
<style>
body { flow:vertical; border-spacing:8px; }
div.list
{
background:white white #D5D5D5 #D5D5D5;
border:1px solid;
width:*;
height:*;
overflow:scroll-indicator;
}
</style>
<script type="text/tiscript">
view.minSize = (1000,400);
var msg = {
A0001: "请选择配置文件目录和加密文件输出目录",
A0002: "请选择不同目录",
A0003: "请设置秘钥长度",
A0004: "处理完毕,请查看日志",
A0005: "秘钥长度超过最大阈值2048,请重新输入",
A0006: "秘钥长度最小为256,请重新输入",
N0001: "错误提示"
};
$(button.selector1).onClick = function () {
var fn = view.selectFolder();
if( fn ) $(.path1).value = fn;
};
$(button.selector2).onClick = function () {
var fn = view.selectFolder();
if( fn ) $(.path2).value = fn;
};
$(#btn).onClick = function () {
this.attributes["disabled"]="disabled"
var path1=$(.path1).value
var path2=$(.path2).value
if ( path1=="" || path2=="" ) {
view.msgbox(#alert,msg.A0001,msg.N0001);
this.attributes.remove("disabled");
return;
}
if ( path1==path2 ) {
view.msgbox(#alert,msg.A0002,msg.N0001);
this.attributes.remove("disabled");
return;
}
if ($(form).value.radioGroup==4 && $(form).value.bitwd==""){
view.msgbox(#alert,msg.A0003,msg.N0001);
this.attributes.remove("disabled");
return;
}
if ($(form).value.radioGroup==4){
if ($(form).value.bitwd>2048){
view.msgbox(#alert,msg.A0005,msg.N0001);
this.attributes.remove("disabled");
return;
}
if ($(form).value.bitwd<256){
view.msgbox(#alert,msg.A0006,msg.N0001);
this.attributes.remove("disabled");
return;
}
}
var res=view.getDir($(form).value);
if (res["cmd"]=="done" ){
view.msgbox(#alert,msg.A0004,msg.N0001);
}
};
$(form).on("change",function() {
var radioGroupValue =this.value.radioGroup;
if (radioGroupValue==1 || radioGroupValue==2 || radioGroupValue==3){
$(#pass).style["display"]="block";
$(#bit).style["display"]="none";
}else{
$(#pass).style["display"]="none";
$(#bit).style["display"]="block";
}
});
function enable(){
$(#btn).attributes.remove("disabled");
}
</script>
</head>
<body>
<div>
<form .table>
<div>
配置文件存放目录
<input type="text" name="path1" class="path1" size="80" readonly/><button class="selector1">…</button><br/>
加密文件输出目录
<input type="text" name="path2" class="path2" size="80" readonly/><button class="selector2">…</button><br/>
加密算法<br/>
<input type="radio" name="radioGroup" value="1" checked="checked">AES</input>
<input type="radio" name="radioGroup" value="2">DES</input>
<input type="radio" name="radioGroup" value="3">TripleDes</input>
<input type="radio" name="radioGroup" value="4">RSA</input>
<input type="button" id="btn" class="selector3" value="加密"/><br/>
</div>
<div id="pass" style="display:true">密码<input type="text" name="passwd" class="passwd" size="30"/></div>
<div id="bit" style="display:none">
秘钥长度<input type="text" name="bitwd" class="bitwd" size="8" filter="0~9" maxlength="4"/>
<input type="radio" name="rsaMode" value="1" checked="checked">公钥加密私钥解密模式</input>
<input type="radio" name="rsaMode" value="2">私钥加密公钥解密模式</input>
</div>
</form>
</div>
<div id="result" class="list"></div>
</body>
</html>
`