pp3/module/Application/view/application/admin/verifiers.phtml (98 lines of code) (raw):
<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
?>
<?= $this->partial('_nav.phtml'); ?>
<h4>New verifier</h4>
<p>
<?= $this->partial('layout/flash.phtml'); ?>
</p>
<p>
<form class="form-inline" method="post" action="">
<div class="form-group">
<label for="search">Search: </label>
<input type="text" class="form-control" name="email" id="search" placeholder="Email" style="width: 300px;" value="">
</div>
<button type="button" id="searchAccount" class="btn btn-primary">Search Account</button>
<table class="table table-striped table-hover" id="addVerifierStatusList" style="margin-top: 1ex; margin-bottom: 1ex">
</table>
</form>
</p>
<h4>Existing verifiers</h4>
<table class="table table-striped table-hover">
<?php
foreach ($this->verifiers as $v) {
printf('
<tr>
<td>%s <%s> (ID: %d, IdP: %s)</td>
<td>
<form action="%s" method="POST">
<button type="submit" class="btn btn-danger" role="button" name="removeVerifierStatusId" value="%d">
Remove verifier status
</button>
</form>
</td>
</tr>',
htmlentities($v->getName(), ENT_HTML5, 'UTF-8'),
htmlentities($v->getEmail(), ENT_HTML5, 'UTF-8'),
$v->getId(),
htmlentities($v->getIdpProviderId(), ENT_HTML5, 'UTF-8'),
$this->url('admin',array('action'=>'verifiers')),
$v->getId()
);
}
?>
</table>
<script>
$(document).ready(function() {
var inputField = $('#search');
var searchButton = $('#searchAccount');
var resultList = $('#addVerifierStatusList');
function updateAddVerifierStatusList() {
var url = BASE_URL;
url += 'admin/search-user-by-email?email=';
url += encodeURIComponent(inputField.val());
$.ajax(url, {dataType: 'json'}).done(function(data) {
resultList.empty();
for(var idx in data) {
var row = data[idx];
if(row['verifier']) {
continue;
}
resultList
.append(
$("<tr></tr>").append(
$('<td></td>')
.text(row['name'] + "<" + row['email'] + "> (ID: " + row['id'] + ", IdP: " + row['idpProviderId'] + ")"),
$('<td></td>')
.append($('<form action="%s" method="POST"></form>')
.attr('action', BASE_URL + "admin/verifiers")
.append($('<button type="submit" class="btn btn-success" role="button" name="addVerifierStatusId">')
.attr('value', row['id'])
.text('Add verifier status')
)
)
)
);
}
});
}
searchButton.click(updateAddVerifierStatusList);
});
</script>