-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathapp_credentials.html
362 lines (340 loc) · 14.1 KB
/
app_credentials.html
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>环信开发者中心</title>
<!--
<link href="//cdnjscn.b0.upaiyun.com/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="//cdnjscn.b0.upaiyun.com/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" media="screen"/>
-->
<link href="assets/css/bootstrap-2.3.2.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/bootstrap-responsive-2.3.2.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/font-awesome-3.1.0.min.css" rel="stylesheet" type="text/css" media="screen"/>
<!--[if IE 7]>
<link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
<![endif]-->
<!--fonts-->
<!-- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" /> -->
<!--ace styles-->
<link href="assets/css/ace.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/ace-responsive.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/ace-skins.min.css" rel="stylesheet" type="text/css" media="screen"/>
<!--[if lte IE 8]>
<link rel="stylesheet" href="assets/css/ace-ie.min.css" />
<![endif]-->
<link href="assets/css/management.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/manage.css" rel="stylesheet" type="text/css" media="screen"/>
<!--
<script src="//cdnjscn.b0.upaiyun.com/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="//cdnjscn.b0.upaiyun.com/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//cdnjscn.b0.upaiyun.com/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="//cdnjscn.b0.upaiyun.com/libs/json2/20130526/json2.min.js"></script>
-->
<script src="assets/js/jquery-1.7.2.min.js"></script>
<script src="assets/js/jquery.cookie-1.3.js"></script>
<script src="assets/js/bootstrap-2.3.2.min.js"></script>
<script src="assets/js/json2.js"></script>
<script src="assets/js/ace-elements.min.js"></script>
<script src="assets/js/ace.min.js"></script>
<script src="assets/js/jquery.form.js"></script>
<script src="assets/js/management.js"></script>
<script src="assets/js/layer/layer.min.js"></script>
<script tyep="text/javascript">
var appUuid = getQueryString('appUuid');
var Application = $.cookie('Application');
$(function(){
$('#showName').text(Application);
$('#fileAppKey').text(Application);
$('#certificate').hide();//页面加载时隐藏掉推送证书
if (!getToken() || getToken()==''){
logout();
}
getAppCredentials(appUuid);
});
// 上一页数据
function getPrevAppUserList(){
getAppCredentials(appUuid,'forward');
}
// 下一页数据
function getNextAppUserList(){
getAppCredentials(appUuid,'next');
}
function changeform(){
var access_token = $.cookie('access_token');
var orgName = $.cookie('orgName');
//https://api.easemob.com/my-org/my-app/appCredential
//var action1 = baseUrl+'/'+orgName+'/'+appUuid+'/notifiers';
//$('#myForm').attr('action',action1)
var credentialName = $('#name').val();
var passphrase = $('#passphrase').val();
var credentialNameRegx = /^[A-Za-z0-9-_]*$/;
if(!credentialNameRegx.test(credentialName)){
alert('证书名称只能是字母数字横线下划线的组合!');
return ;
}
if(!validateSuffix($('#file').val())){
return ;
}
if(passphrase == ''){
alert('请填写证书密码!');
return ;
}
//var action1 = $('#myForm').attr('action');
//$('#myForm').attr('action',action1+''+access_token)
var ajax_option = {
url:baseUrl + '/' + orgName + '/' + appUuid + '/notifiers',
headers:{
'Accept':'application/json',
'Accept-Encoding':'gzip,deflate',
'Authorization':'Bearer ' + access_token,
},
success:function(data){
layer.close(layerNum);
alert("证书添加成功!");
//clear form
$('#name').val('');
$('#passphrase').val('');
toAppCredentialsPage();
},
error:function(data){
layer.close(layerNum);
alert("证书添加失败!");
}
}
var layerNum = layer.load('正在上传...',3);
$('#myForm').ajaxSubmit(ajax_option);
}
// 文件后缀校验
function validateSuffix(fileName){
var fileExt = fileName.substr(fileName.lastIndexOf(".")).toLowerCase();
var allowExt ='.p12';
if(allowExt != fileExt){
alert("警告!\n该文件类型不允许上传。请上传'.p12'类型的文件,当前文件类型为"+fileExt);
return false;
}
return true;
}
// 应用概述页
function toApppofile(){
window.location.href = 'app_profile.html?appUuid='+appUuid;
}
// 用户管理页
function toAppUsersPage(){
window.location.href = 'app_users.html?appUuid='+appUuid;
}
// 群组页面
function togroupAppAdmin(){
window.location.href = 'app_group.html?appUuid='+appUuid;
}
// 推送证书管理页
function toAppCredentialsPage(){
window.location.href = 'app_credentials.html?appUuid='+appUuid;
}
// 数据统计页面
function toApppofileCounter(){
window.location.href = 'app_profile_counter.html?appUuid='+appUuid;
}
// 应用管理员创建页面
function toCreateAppAdmin(){
window.location.href = 'app_admin_create.html?appUuid='+appUuid;
}
//管理员列表页面
function toAppUserAdmin(){
window.location.href = 'app_users_admin.html?appUuid='+appUuid;
}
//显示制作证书按钮
function DisplayCertificate(){
$('#certificate').show();
document.getElementById("div").style.width=240+"px";
}
//隐藏制作证书按钮
function HiddenCertificate(){
$('#certificate').hide();
document.getElementById("div").style.width=80+"px";
}
</script>
</head>
<body>
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container-fluid"> <a class="brand" href="javascript:void(0);"> <small> <img style="height:45px;" src="assets/images/home_logo.png" alt="管理后台"/> </small> </a>
<div class="lianjie">
<ol>
<li><a href="http://www.easemob.com" target="_blank"><h5>主页</h5></a></li>
<li><a href="http://developer.easemob.com" target="_blank"><h5>文档</h5></a></li>
<li><a href="http://www.easemob.com/faq" target="_blank"><h5>帮助</h5></a></li>
<li><a href="http://www.easemob.com/sdk" target="_blank"><h5>下载SDK</h5></a></li>
</ol>
</div>
<ul class="nav ace-nav pull-right">
<li class="light-blue user-profile"> <a class="user-menu dropdown-toggle" href="javascript:void(0);" data-toggle="dropdown"> <span id="user_info"></span> <i class="icon-caret-down"></i> </a>
<ul id="user_menu" class="pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-closer">
<li class="divider"></li>
<li> <a href="admin_home.html"> <i class="icon-user"></i> 账户 </a> </li>
<li> <a onClick="logout();" href="javascript:void(0);"> <i class="icon-off"></i> 退出 </a> </li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="main-container" class="container-fluid"> <a href="javascript:void(0);" id="menu-toggler"> <span></span> </a>
<div id="sidebar">
<div id="sidebar-shortcuts">
<div style="min-height: 40px;" id="sidebar-shortcuts-large"> </div>
<div style="min-height: 40px;" id="sidebar-shortcuts-mini"> </div>
</div>
<ul class="nav nav-list">
<li class="active"> <a href="app_list.html" target="_self"> <i class="icon-ambulance"></i> <span>我的应用</span> </a></li>
<li> <a href="admin_home.html" target="_self"> <i class="icon-user"></i> <span>个人信息</span> </a></li>
</ul>
<div id="sidebar-collapse"> <i class="icon-double-angle-left"></i> </div>
</div>
<div class="clearfix" id="main-content">
<div id="breadcrumbs">
<ul class="breadcrumb">
<li> <i class="icon-home"></i> 我的应用 <span class="divider"> <i class="icon-angle-right"></i> </span> </li>
<li> <a href="javascript:void(0);" target="_self"> <span id="showName"></span></a></li>
</ul>
</div>
<div class="clearfix" id="page-content">
<div class="row-fluid">
<div class="pagination pagination-left">
<ul>
<li> <a href="javascript:toApppofile()">应用概况</a> </li>
</ul>
<ul>
<li> <a href="javascript:toAppUsersPage()">IM用户</a> </li>
</ul>
<ul>
<li> <a href="javascript:togroupAppAdmin()">群组</a> </li>
</ul>
<ul>
<li> <a href="javascript:toAppCredentialsPage()"><font color="green">推送证书</font></a> </li>
</ul>
<ul>
<li> <a href="javascript:toApppofileCounter()">统计数据</a> </li>
</ul>
<ul>
<li> <a href="javascript:toAppUserAdmin()">App管理员</a> </li>
</ul>
<hr>
</div>
</div>
<div class="row-fluid">
<div class="count">
<div class="left" style="width:800px;height:320px;">
<div class="pagination pagination-left">
<!--<ul>
<li><a href="javascript:void(0);">证书列表</a> </li>
</ul>-->
</div>
<div class="apply">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<thead>
<p style="background-color:white;height:30px;font-size:16px;line-height:30px;overflow:hidden;" width="100%" align="center" >证书列表</p>
<tr>
<th>名称</th>
<th>类型</th>
<th>创建日期</th>
<th>最后修改日期</th>
<th>证书状态</th>
<th>操作</th>
</tr>
</thead>
<tbody bgcolor="#FFFFFF" id="appCredentialBody">
</tbody>
</table>
</div>
<div id="paginau" class="pagination pagination-right">
<span id="pageInfo"></span>
</div>
</div>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="count">
<div class="left" style="width:400px;">
<div class="pagination pagination-left" id="div" onMouseOver="DisplayCertificate();" onMouseOut="HiddenCertificate();">
<ul>
<li><a href="javascript:void(0);">新增证书</a> </li>
</ul>
<ul id="certificate">
<li><a href="http://www.easemob.com/docs/ios/push/certificate/" target="_blank">>> 制作iOS推送证书</a> </li>
</ul>
</div>
<div class="apply">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="80px"><strong>应用名称 :</strong></td>
<td bgcolor="#FFFFFF"><span id="fileAppKey"></span></td>
</tr>
</table>
</div>
<div class="apply">
<form id="myForm" method="POST" enctype="multipart/form-data" action="">
<div class="apply">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="80px"><strong>证书名称<font color='red'> * </font>:</strong></td>
<td bgcolor="#FFFFFF"><input type="text" name="name" id="name" value="" placeholder="请输入证书名称(必填)" /></td>
</tr>
</table>
</div>
<div class="apply">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="80px"><strong>证 书<font color='red'> * </font>:</strong></td>
<td bgcolor="#FFFFFF">
<!-- <input type="file" name="file" id="file" class="btn btn-mini btn-primary" value="浏览…" onchange="validateSuffix(this.value)">-->
<input type="text" readonly="readonly" id="f_file"/>
<input type="button" value="浏览..." class="btn btn-mini btn-primary" onClick="file.click()" />
<input type="file" name="file" id="file" onChange="f_file.value=this.value;validateSuffix(this.value)" style="display:none">
</td>
</tr>
</table>
</div>
<div class="apply">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="80px;"><strong>证书密码<font color='red'> * </font>:</strong></td>
<td bgcolor="#FFFFFF" width="280px;">
<input type="password" name="passphrase" id="passphrase" value="" placeholder="请输入证书密码(必填)" />
</td>
</tr>
</table>
</div>
<div class="apply">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="80px;"><strong>证书类型<font color='red'> * </font>:</strong></td>
<td bgcolor="#FFFFFF">
<input type=radio value="DEVELOPMENT" name="environment" checked="checked"><span class="lbl">开发环境</span>
<input type=radio value="PRODUCTION" name="environment"><span class="lbl">生产环境</span>
</td>
</tr>
</table>
</div>
<input type="hidden" name="provider" id="provider" value="APNS" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="80px;"><strong></strong></td>
<td bgcolor="#FFFFFF"><input type="button" class="btn btn-mini btn-primary" value="上传" onClick="changeform()"/></td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>