blob: 508b5a25304fe219dbf2b569385c32e6114ab690 [file] [log] [blame]
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05001<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8" />
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <% include ../partials/head %>
7 <% include ../partials/header %>
8 <script type="text/javascript" src="/javascripts/admportal.js" async></script>
9 <title>SDN-C AdminPortal</title>
10<script class="init">
11 $(document).ready(function() {
12 $('#phs_server_credentials').DataTable( {
13 "order": [[ 0, "asc" ]]
14 } );
15} );
16</script>
17
18</head>
19<body>
20
21<div class="well well-sm">
22<h3>PHS Server Credentials</h3>
23</div>
24
25<% if ( typeof result != 'undefined' ) {
26 if (result.code.length > 0) {
27 if ( result.code == 'success' ) { %>
28 <div class='alert alert-success' role='alert'>
29 <%
30 for ( x in result.msg ){ %>
31 <div><%= result.msg[x] %></div>
32 <% } %>
33 </div>
34 <% } else { %>
35 <div class='alert alert-danger' role='danger'>
36 <%
37 for ( x in result.msg ){ %>
38 <div><%= result.msg[x] %></div>
39 <% } %>
40 </div>
41 <% } %>
42 <% } %>
43<% } %>
44
45<% if( typeof privilege != 'undefined'){
46 var priv = privilege.privilege;
47} else {
48 var priv = 'A';
49} %>
50
51
52<div class="container-fluid">
53
54 <% if(priv == 'A'){ %>
55 <div class="actions" style="padding:15px 0px;">
56 <button class="btn btn-primary" data-toggle="modal" data-target="#add_phs_credentials">
57 Add PHS Credentials
58 </button>
59 </div>
60 <% } %>
61
62 <table id="phs_server_credentials" class="table table-hover table-condensed">
63 <thead>
64 <tr>
65 <th>*Device Vendor Name</th>
66 <th>*Customer Name</th>
67 <th>*IP Addresses</th>
68 <th>PHS Username</th>
69 <th>PHS Password</th>
70 <% if(priv == 'A'){ %>
71 <th>Action</th>
72 <% } %>
73 </tr>
74 </thead>
75 <tbody>
76 <% rows.forEach( function(row) { %>
77 <tr>
78 <td><%= row.device_vendor_name %></td>
79 <td><%= row.customer_name %></td>
80 <td><%= row.ip_addresses %></td>
81 <td><%= row.phs_username %></td>
82 <td>*****</td>
83 <% if(priv == 'A') { %>
84 <td>
85 <button type="button" class="btn btn-default btn-xs"
86 onclick="updatePhsCredentials('<%=row.device_vendor_name %>','<%= row.customer_name %>','<%= row.ip_addresses %>','<%= row.phs_username %>','<%= row.phs_password %>');">Update</button>
87 <button type="button" class="btn btn-default btn-xs"
88 onclick="deletePhsCredentials('<%= row.device_vendor_name %>', '<%= row.customer_name %>', '<%= row.ip_addresses %>' );">Delete</button>
89 </td>
90 <% } %>
91
92 </tr>
93 <% }); %>
94 </tbody>
95 </table>
96
97</div>
98
99<% include ../partials/phs_credentials %>
100<footer>
101 <% include ../partials/footer %>
102</footer>
103
104<script type="text/javascript">
105function submitPhsCredentials(form)
106{
107 var errorMsg='';
108 var device_vendor_name = '';
109 var customer_name = '';
110 var ip_addresses = '';
111 var phs_username = '';
112 var phs_password = '';
113 var confirm_phs_password = '';
114
115 if ( form.name == 'addForm' )
116 {
117 device_vendor_name = form.nf_device_vendor_name;
118 customer_name = form.nf_customer_name;
119 ip_addresses = form.nf_ip_addresses;
120 phs_username = form.nf_phs_username;
121 phs_password = form.nf_phs_password;
122 confirm_phs_password = form.nf_confirm_phs_password;
123
124 if ( (device_vendor_name.value == null) || (device_vendor_name.value == "") || isblank(device_vendor_name.value) )
125 {
126 errorMsg += 'Device Vendor Name is required.<br>';
127 }
128 if ( (customer_name.value == null) || (customer_name.value == "") || isblank(customer_name.value) )
129 {
130 errorMsg += 'Customer Name is required.<br>';
131 }
132 if ( (ip_addresses.value == null) || (ip_addresses.value == "") || isblank(ip_addresses.value) ){
133 errorMsg += 'IP Addresses is required.<br>';
134 }
135 if( errorMsg.length > 0 ) {
136 bootbox.alert(errorMsg);
137 return;
138 }
139
140 if ( phs_password.value != confirm_phs_password.value )
141 {
142 bootbox.alert('Passwords do not match.');
143 return;
144 }
145 }
146 else
147 {
148 device_vendor_name = form.uf_device_vendor_name;
149 customer_name = form.uf_customer_name;
150 ip_addresses = form.uf_ip_addresses;
151 phs_username = form.uf_phs_username;
152 phs_password = form.uf_phs_password;
153 confirm_phs_password = form.uf_confirm_phs_password;
154
155 if ( phs_password.value != confirm_phs_password.value )
156 {
157 bootbox.alert('Passwords do not match.');
158 return;
159 }
160 }
161 form.submit();
162}
163
164function updatePhsCredentials(device_vendor_name,customer_name,ip_addresses,phs_username,phs_password) {
165
166 document.getElementById('uf_device_vendor_name').value=device_vendor_name;
167 document.getElementById('uf_customer_name').value=customer_name;
168 document.getElementById('uf_ip_addresses').value=ip_addresses;
169 document.getElementById('uf_phs_username').value=phs_username;
170 document.getElementById('uf_phs_password').value=phs_password;
171
172 $('#update_phs_credentials').modal('show');
173}
174
175function deletePhsCredentials(device_vendor_name, customer_name, ip_addresses) {
176
177 bootbox.confirm({
178 message: "Are you sure you want to delete PHS Credentials " + device_vendor_name + "|" + customer_name + "|" + ip_addresses,
179 callback: function(result) {
180 if ( result )
181 {
182 location.assign("/ucpe/deletePhsCredentials?device_vendor_name=" + device_vendor_name
183 + "&customer_name=" + customer_name + "&ip_addresses=" + ip_addresses);
184 }
185 return;
186 },
187 buttons: {
188 cancel: {
189 label: "Cancel"
190 },
191 confirm: {
192 label: "Yes"
193 }
194 }
195 });
196}
197
198</script>
199
200</body>
201</html>
202