|
| 1 | +package main |
| 2 | + |
| 3 | +const indexhtml string = `<html> |
| 4 | + <head> |
| 5 | + <title>file name input</title> |
| 6 | + <link type="image/x-icon" href="go.ico" rel="shortcut icon"> |
| 7 | + <style> |
| 8 | +
|
| 9 | + body { flow:vertical; border-spacing:8px; } |
| 10 | +
|
| 11 | + div.list |
| 12 | + { |
| 13 | + background:white white #D5D5D5 #D5D5D5; |
| 14 | + border:1px solid; |
| 15 | + width:*; |
| 16 | + height:*; |
| 17 | + overflow:scroll-indicator; |
| 18 | + } |
| 19 | +
|
| 20 | + </style> |
| 21 | + <script type="text/tiscript"> |
| 22 | + view.minSize = (1000,400); |
| 23 | + var msg = { |
| 24 | + A0001: "请选择配置文件目录和加密文件输出目录", |
| 25 | + A0002: "请选择不同目录", |
| 26 | + A0003: "请设置秘钥长度", |
| 27 | + A0004: "处理完毕,请查看日志", |
| 28 | + A0005: "秘钥长度超过最大阈值2048,请重新输入", |
| 29 | + A0006: "秘钥长度最小为256,请重新输入", |
| 30 | + N0001: "错误提示" |
| 31 | + }; |
| 32 | +
|
| 33 | + $(button.selector1).onClick = function () { |
| 34 | + var fn = view.selectFolder(); |
| 35 | + if( fn ) $(.path1).value = fn; |
| 36 | + }; |
| 37 | +
|
| 38 | + $(button.selector2).onClick = function () { |
| 39 | + var fn = view.selectFolder(); |
| 40 | + if( fn ) $(.path2).value = fn; |
| 41 | + }; |
| 42 | +
|
| 43 | + $(#btn).onClick = function () { |
| 44 | + this.attributes["disabled"]="disabled" |
| 45 | + var path1=$(.path1).value |
| 46 | + var path2=$(.path2).value |
| 47 | + if ( path1=="" || path2=="" ) { |
| 48 | + view.msgbox(#alert,msg.A0001,msg.N0001); |
| 49 | + this.attributes.remove("disabled"); |
| 50 | + return; |
| 51 | + } |
| 52 | + if ( path1==path2 ) { |
| 53 | + view.msgbox(#alert,msg.A0002,msg.N0001); |
| 54 | + this.attributes.remove("disabled"); |
| 55 | + return; |
| 56 | + } |
| 57 | + if ($(form).value.radioGroup==4 && $(form).value.bitwd==""){ |
| 58 | + view.msgbox(#alert,msg.A0003,msg.N0001); |
| 59 | + this.attributes.remove("disabled"); |
| 60 | + return; |
| 61 | + } |
| 62 | + if ($(form).value.radioGroup==4){ |
| 63 | + if ($(form).value.bitwd>2048){ |
| 64 | + view.msgbox(#alert,msg.A0005,msg.N0001); |
| 65 | + this.attributes.remove("disabled"); |
| 66 | + return; |
| 67 | + } |
| 68 | + if ($(form).value.bitwd<256){ |
| 69 | + view.msgbox(#alert,msg.A0006,msg.N0001); |
| 70 | + this.attributes.remove("disabled"); |
| 71 | + return; |
| 72 | + } |
| 73 | + } |
| 74 | +
|
| 75 | + var res=view.getDir($(form).value); |
| 76 | + if (res["cmd"]=="done" ){ |
| 77 | + view.msgbox(#alert,msg.A0004,msg.N0001); |
| 78 | + } |
| 79 | + }; |
| 80 | +
|
| 81 | + $(form).on("change",function() { |
| 82 | + var radioGroupValue =this.value.radioGroup; |
| 83 | + if (radioGroupValue==1 || radioGroupValue==2 || radioGroupValue==3){ |
| 84 | + $(#pass).style["display"]="block"; |
| 85 | + $(#bit).style["display"]="none"; |
| 86 | + }else{ |
| 87 | + $(#pass).style["display"]="none"; |
| 88 | + $(#bit).style["display"]="block"; |
| 89 | + } |
| 90 | + }); |
| 91 | +
|
| 92 | + function enable(){ |
| 93 | + $(#btn).attributes.remove("disabled"); |
| 94 | + } |
| 95 | +
|
| 96 | + </script> |
| 97 | + </head> |
| 98 | +<body> |
| 99 | + <div> |
| 100 | + <form .table> |
| 101 | + <div> |
| 102 | + 配置文件存放目录 |
| 103 | + <input type="text" name="path1" class="path1" size="80" readonly/><button class="selector1">…</button><br/> |
| 104 | + 加密文件输出目录 |
| 105 | + <input type="text" name="path2" class="path2" size="80" readonly/><button class="selector2">…</button><br/> |
| 106 | + 加密算法<br/> |
| 107 | + <input type="radio" name="radioGroup" value="1" checked="checked">AES</input> |
| 108 | + <input type="radio" name="radioGroup" value="2">DES</input> |
| 109 | + <input type="radio" name="radioGroup" value="3">TripleDes</input> |
| 110 | + <input type="radio" name="radioGroup" value="4">RSA</input> |
| 111 | +
|
| 112 | + <input type="button" id="btn" class="selector3" value="加密"/><br/> |
| 113 | + </div> |
| 114 | + <div id="pass" style="display:true">密码<input type="text" name="passwd" class="passwd" size="30"/></div> |
| 115 | + <div id="bit" style="display:none"> |
| 116 | + 秘钥长度<input type="text" name="bitwd" class="bitwd" size="8" filter="0~9" maxlength="4"/> |
| 117 | + <input type="radio" name="rsaMode" value="1" checked="checked">公钥加密私钥解密模式</input> |
| 118 | + <input type="radio" name="rsaMode" value="2">私钥加密公钥解密模式</input> |
| 119 | + </div> |
| 120 | + </form> |
| 121 | + </div> |
| 122 | +
|
| 123 | + <div id="result" class="list"></div> |
| 124 | +
|
| 125 | +</body> |
| 126 | +</html> |
| 127 | +` |
0 commit comments