212 lines
6.7 KiB
PHTML
212 lines
6.7 KiB
PHTML
<?php if (!$canWrite): ?>
|
|
<p class="alert alert-danger">PHPCI cannot update composer.json for you as it is not writable.</p>
|
|
<?php endif; ?>
|
|
|
|
<?php if (isset($_GET['r'])): ?>
|
|
<p class="alert alert-success"><strong><?php echo $_GET['r']; ?></strong> has been removed.</p>
|
|
<?php endif; ?>
|
|
|
|
<?php if (isset($_GET['w'])): ?>
|
|
<p class="alert alert-success"><strong><?php echo $_GET['w']; ?></strong> has been added to composer.json for you and will be installed next time you run composer update.</p>
|
|
<?php endif; ?>
|
|
|
|
<div class="box box-primary">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Enabled Plugins</h3>
|
|
</div>
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Class</th>
|
|
<th>Provided by Package</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($plugins as $plugin): ?>
|
|
<tr>
|
|
<td><?php print $plugin->name; ?></td>
|
|
<td><?php print $plugin->class; ?></td>
|
|
<td><?php print $plugin->source; ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<div class="box box-primary">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Installed Packages</h3>
|
|
</div>
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Title</th>
|
|
<th>Version</th>
|
|
<th width="1"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($installedPackages as $package => $version): ?>
|
|
<tr>
|
|
<td><?php echo $package; ?></td>
|
|
<td><?php echo $version; ?></td>
|
|
<td>
|
|
<?php if (!in_array($package, $required) && $canWrite): ?>
|
|
<a class="btn btn-danger btn-small" href="<?php echo PHPCI_URL ?>plugin/remove?package=<?php echo $package; ?>">Remove »</a>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-lg-6">
|
|
<div class="box box-primary">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Suggested Packages</h3>
|
|
</div>
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Title</th>
|
|
<th>Description</th>
|
|
<th width="1"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($suggestedPackages as $package => $version): ?>
|
|
<?php if (in_array($package, array_keys($installedPackages))) { continue; } ?>
|
|
<tr>
|
|
<td><?php echo $package; ?></td>
|
|
<td><?php echo $version; ?></td>
|
|
<td>
|
|
<?php if ($canWrite): ?>
|
|
<button data-name="<?php echo $package; ?>" class="install-package btn btn-success btn-small">Install »</button>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="box box-primary">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Search Packagist for More Packages</h3>
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
<div class="input-group">
|
|
<input id="search-query" type="text" class="form-control">
|
|
<span class="input-group-btn">
|
|
<button id="search-button" class="btn btn-success" type="button">Search</button>
|
|
</span>
|
|
</div>
|
|
|
|
<div id="results" style="margin-top: 15px; display: none;">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Title</th>
|
|
<th>Description</th>
|
|
<th width="1"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="search-results">
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
var canWrite = <?php print $canWrite ? 'true' : 'false'; ?>;
|
|
|
|
$('#search-button').on('click', function() {
|
|
|
|
$('#loading').show();
|
|
|
|
$.getJSON('<?php print PHPCI_URL; ?>plugin/packagist-search', {q: $('#search-query').val()}, function(data) {
|
|
$('#loading').hide();
|
|
$('#results').show();
|
|
var results = $('#search-results').empty();
|
|
|
|
for (var i in data.results) {
|
|
var thisRes = data.results[i];
|
|
var thisRow = $('<tr></tr>');
|
|
thisRow.append($('<td></td>').text(thisRes.name));
|
|
thisRow.append($('<td></td>').text(thisRes.description));
|
|
|
|
var inst = $('<button></button>').data('name', thisRes.name).addClass('btn btn-small btn-success').html('Install »');
|
|
|
|
inst.on('click', versionChooser);
|
|
|
|
thisRow.append($('<td></td>').append(inst));
|
|
results.append(thisRow);
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$('.install-package').on('click', versionChooser);
|
|
|
|
|
|
function versionChooser()
|
|
{
|
|
$('#loading').show();
|
|
|
|
var thisName = $(this).data('name');
|
|
|
|
$.getJSON('<?php print PHPCI_URL; ?>plugin/packagist-versions', {p: thisName}, function(data) {
|
|
|
|
var versions = data.package.versions;
|
|
var vkeys = Object.keys(versions).sort().reverse();
|
|
|
|
$('#version-list ul').empty();
|
|
|
|
for (var i in vkeys) {
|
|
var url = '<?php print PHPCI_URL; ?>plugin/install?package=' + thisName + '&version=' + vkeys[i];
|
|
var li = $('<li></li>');
|
|
var a = $('<a></a>').attr('href', url).text(vkeys[i]);
|
|
|
|
li.append(a);
|
|
|
|
$('#version-list ul').append(li);
|
|
}
|
|
|
|
$('#version-list').modal('show');
|
|
$('#loading').hide();
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<div class="modal fade" id="version-list">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
<h4 class="modal-title">Choose a version...</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<ul></ul>
|
|
</div>
|
|
</div><!-- /.modal-content -->
|
|
</div><!-- /.modal-dialog -->
|
|
</div><!-- /.modal -->
|