2013-12-29 18:35:33 +01:00
< h1 id = "title" > Packages and Provided Plugins< / h1 >
2013-10-08 17:28:46 +02:00
<?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' ])) : ?>
2014-01-28 22:27:39 +01:00
< p class = "alert alert-success" >< strong > <?php echo $_GET [ 'r' ]; ?> </ strong > has been removed.</ p >
2013-10-08 17:28:46 +02:00
<?php endif ; ?>
<?php if ( isset ( $_GET [ 'w' ])) : ?>
2014-05-12 19:26:44 +02:00
< 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 >
2013-10-08 17:28:46 +02:00
<?php endif ; ?>
< div class = "box" >
2013-12-29 18:35:33 +01:00
< h3 class = "title" > Available Plugins< / h3 >
< table class = "table-striped table-bordered table" >
< thead >
< tr >
< th > Name< / th >
< th > Class< / th >
< th > Provided by Package< / th >
< / tr >
< / thead >
< tbody >
<?php foreach ( $plugins as $plugin ) : ?>
< tr >
2014-05-12 19:42:57 +02:00
< td > <?php print $plugin -> name ; ?> </ td >
< td > <?php print $plugin -> class ; ?> </ td >
< td > <?php print $plugin -> source ; ?> </ td >
2013-12-29 18:35:33 +01:00
< / tr >
<?php endforeach ; ?>
< / tbody >
< / table >
< / div >
< div class = "box" >
< h3 class = "title" > Installed Packages< / h3 >
2013-10-08 17:28:46 +02:00
< table class = "table-striped table-bordered table" >
< thead >
< tr >
< th > Title< / th >
< th > Version< / th >
< th width = "1" > < / th >
< / tr >
< / thead >
< tbody >
2013-12-29 18:35:33 +01:00
<?php foreach ( $installedPackages as $package => $version ) : ?>
2013-10-08 17:28:46 +02:00
< tr >
2014-01-28 22:27:39 +01:00
< td > <?php echo $package ; ?> </ td >
< td > <?php echo $version ; ?> </ td >
2013-10-08 17:28:46 +02:00
< td >
<?php if ( ! in_array ( $package , $required ) && $canWrite ) : ?>
2014-01-28 22:27:39 +01:00
< a class = "btn btn-danger btn-small" href = " <?php echo PHPCI_URL ?> plugin/remove?package= <?php echo $package ; ?> " > Remove » </ a >
2013-10-08 17:28:46 +02:00
<?php endif ; ?>
< / td >
< / tr >
<?php endforeach ; ?>
< / tbody >
< / table >
< / div >
< div class = "box" >
2013-12-29 18:35:33 +01:00
< h3 class = "title" > Suggested Packages< / h3 >
2013-10-08 17:28:46 +02:00
< table class = "table-striped table-bordered table" >
< thead >
< tr >
< th > Title< / th >
< th > Description< / th >
< th width = "1" > < / th >
< / tr >
< / thead >
< tbody >
2013-12-29 18:35:33 +01:00
<?php foreach ( $suggestedPackages as $package => $version ) : ?>
<?php if ( in_array ( $package , array_keys ( $installedPackages ))) { continue ; } ?>
2013-10-08 17:28:46 +02:00
< tr >
2014-01-28 22:27:39 +01:00
< td > <?php echo $package ; ?> </ td >
< td > <?php echo $version ; ?> </ td >
2013-10-08 17:28:46 +02:00
< td >
<?php if ( $canWrite ) : ?>
2014-01-28 22:27:39 +01:00
< button data-name = " <?php echo $package ; ?> " class = "install-package btn btn-success btn-small" > Install » </ button >
2013-10-08 17:28:46 +02:00
<?php endif ; ?>
< / td >
< / tr >
<?php endforeach ; ?>
< / tbody >
< / table >
< / div >
< div class = "box" >
2013-12-29 18:35:33 +01:00
< h3 class = "title" > Search Packagist for More Packages< / h3 >
2013-10-08 17:28:46 +02:00
< 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-striped table-bordered table" >
< thead >
< tr >
< th > Title< / th >
< th > Description< / th >
< th width = "1" > < / th >
< / tr >
< / thead >
< tbody id = "search-results" >
< / tbody >
< / table >
< / 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 -->