2016-05-02 01:20:49 +00:00
|
|
|
<div class="generic-content-wrapper">
|
|
|
|
<div class="section-title-wrapper">
|
2017-01-27 02:20:15 +00:00
|
|
|
{{if $allowManageRepos}}
|
2016-05-02 01:20:49 +00:00
|
|
|
<div class="pull-right">
|
2016-05-19 11:09:13 +00:00
|
|
|
<button class="btn btn-success btn-xs" onclick="openClose('form');">{{$managerepos}}</button>
|
2016-05-02 01:20:49 +00:00
|
|
|
</div>
|
2017-01-27 02:20:15 +00:00
|
|
|
{{/if}}
|
2016-05-02 01:20:49 +00:00
|
|
|
<h2 id="title">{{$title}} - {{$page}}</h2>
|
|
|
|
<div class="clear"></div>
|
|
|
|
</div>
|
|
|
|
<div id="form" class="section-content-tools-wrapper"{{if !$expandform}} style="display:none;"{{/if}}>
|
2016-05-19 11:03:42 +00:00
|
|
|
|
|
|
|
<div class="clear"></div>
|
|
|
|
<div class="section-title-wrapper" style="margin-top: 20px;">
|
2016-05-19 11:09:13 +00:00
|
|
|
<h2>{{$installedtitle}}</h2>
|
2016-05-19 11:03:42 +00:00
|
|
|
<div class="clear"></div>
|
|
|
|
</div>
|
|
|
|
<div class="table-responsive section-content-tools-wrapper">
|
|
|
|
<table class="table table-responsive table-striped table-hover">
|
|
|
|
{{foreach $addonrepos as $repo}}
|
|
|
|
<tr>
|
|
|
|
<td style="width: 70%;">
|
2017-01-27 02:20:15 +00:00
|
|
|
<span class="pull-left">{{$repo.name}}</span><span id="update-message-{{$repo.name}}" style="margin-left: 20px;"></span>
|
2016-05-19 11:03:42 +00:00
|
|
|
</td>
|
|
|
|
<td style="width: 15%;">
|
|
|
|
<button class="btn btn-xs btn-primary pull-right" style="margin-left: 10px; margin-right: 10px;" onclick="updateAddonRepo('{{$repo.name}}'); return false;"><i class='fa fa-download'></i> {{$repoUpdateButton}}</button>
|
|
|
|
</td>
|
|
|
|
<td style="width: 15%;">
|
|
|
|
<button class="btn btn-xs btn-danger pull-right" style="margin-left: 10px; margin-right: 0px;" onclick="removeAddonRepo('{{$repo.name}}'); return false;"><i class='fa fa-trash-o'></i> {{$repoRemoveButton}}</button>
|
|
|
|
</td>
|
|
|
|
<div class="clear"></div>
|
|
|
|
</td></tr>
|
|
|
|
{{/foreach}}
|
|
|
|
</table>
|
|
|
|
</div>
|
2016-05-10 01:17:47 +00:00
|
|
|
<div class="clear"></div>
|
2016-05-19 11:03:42 +00:00
|
|
|
<div class="section-title-wrapper">
|
2016-05-19 11:09:13 +00:00
|
|
|
<h2>{{$addnewrepotitle}}</h2>
|
2016-05-19 11:03:42 +00:00
|
|
|
<div class="clear"></div>
|
|
|
|
</div>
|
|
|
|
{{$form}}
|
|
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
|
|
<div id="chat-rotator-wrapper" class="center-block">
|
|
|
|
<div id="chat-rotator"></div>
|
2016-05-08 02:12:12 +00:00
|
|
|
</div>
|
2016-05-19 11:03:42 +00:00
|
|
|
<div class="clear"></div>
|
2016-05-02 01:20:49 +00:00
|
|
|
<div class="section-content-wrapper-np">
|
2016-05-02 02:29:51 +00:00
|
|
|
{{foreach $plugins as $p}}
|
|
|
|
<div class="section-content-tools-wrapper" id="pluginslist">
|
|
|
|
<div class="contact-info plugin {{$p.1}}">
|
|
|
|
{{if ! $p.2.disabled}}
|
|
|
|
<a class='toggleplugin' href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}?a=t&t={{$form_security_token}}' title="{{if $p.1==on}}Disable{{else}}Enable{{/if}}" ><i class='fa {{if $p.1==on}}fa-check-square-o{{else}}fa-square-o{{/if}} admin-icons'></i></a>
|
|
|
|
{{else}}
|
|
|
|
<i class='fa fa-stop admin-icons'></i>
|
|
|
|
{{/if}}
|
|
|
|
<a href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}'><span class='name'>{{$p.2.name}}</span></a> - <span class="version">{{$p.2.version}}</span>{{if $p.2.disabled}} {{$disabled}}{{/if}}
|
|
|
|
{{if $p.2.experimental}} {{$experimental}} {{/if}}{{if $p.2.unsupported}} {{$unsupported}} {{/if}}
|
2012-02-26 12:17:02 +00:00
|
|
|
|
2016-05-02 02:29:51 +00:00
|
|
|
<div class='desc'>{{$p.2.description}}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/foreach}}
|
|
|
|
|
2016-05-02 01:20:49 +00:00
|
|
|
</div>
|
2016-05-03 10:30:46 +00:00
|
|
|
</div>
|
2016-05-07 22:39:19 +00:00
|
|
|
{{$newRepoModal}}
|
2016-05-03 10:30:46 +00:00
|
|
|
<script>
|
2016-05-08 02:12:12 +00:00
|
|
|
|
2016-05-10 10:28:00 +00:00
|
|
|
// TODO: Implement a simple interface controller that reconfigures the modal dialog
|
|
|
|
// for each action in a more organized way
|
|
|
|
|
2016-05-03 10:30:46 +00:00
|
|
|
function adminPluginsAddRepo() {
|
2016-05-10 10:28:00 +00:00
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").removeClass('btn-success');
|
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").addClass('btn-primary');
|
2016-05-03 10:30:46 +00:00
|
|
|
var repoURL = $('#id_repoURL').val();
|
2016-05-08 13:26:06 +00:00
|
|
|
var repoName = $('#id_repoName').val();
|
2016-05-03 10:30:46 +00:00
|
|
|
$('#chat-rotator').spin('tiny');
|
|
|
|
$.post(
|
2016-05-08 13:26:06 +00:00
|
|
|
"/admin/plugins/addrepo", {repoURL: repoURL, repoName: repoName},
|
2016-05-03 10:30:46 +00:00
|
|
|
function(response) {
|
|
|
|
$('#chat-rotator').spin(false);
|
|
|
|
if (response.success) {
|
2016-05-07 22:39:19 +00:00
|
|
|
var modalBody = $('#generic-modal-body-{{$newRepoModalID}}');
|
|
|
|
modalBody.html('<div>'+response.repo.readme+'</div>');
|
|
|
|
modalBody.append('<h2>Repo Info</h2><p>Message: ' + response.message + '</p>');
|
|
|
|
modalBody.append('<h4>Branches</h4><p>'+JSON.stringify(response.repo.branches)+'</p>');
|
|
|
|
modalBody.append('<h4>Remotes</h4><p>'+JSON.stringify(response.repo.remote)+'</p>');
|
|
|
|
$('.modal-dialog').width('80%');
|
2016-05-10 10:28:00 +00:00
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").off('click');
|
2016-05-09 00:30:00 +00:00
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").click(function () {
|
|
|
|
installAddonRepo();
|
|
|
|
});
|
2016-05-07 22:39:19 +00:00
|
|
|
$('#generic-modal-{{$newRepoModalID}}').modal();
|
2016-05-03 10:30:46 +00:00
|
|
|
} else {
|
|
|
|
window.console.log('Error adding repo :' + response['message']);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
'json');
|
|
|
|
}
|
2016-05-08 02:12:12 +00:00
|
|
|
|
|
|
|
function installAddonRepo() {
|
2016-05-09 00:30:00 +00:00
|
|
|
var repoURL = $('#id_repoURL').val();
|
|
|
|
var repoName = $('#id_repoName').val();
|
|
|
|
$.post(
|
|
|
|
"/admin/plugins/installrepo", {repoURL: repoURL, repoName: repoName},
|
|
|
|
function(response) {
|
|
|
|
if (response.success) {
|
|
|
|
$('#generic-modal-title-{{$newRepoModalID}}').html('Addon repo installed');
|
|
|
|
var modalBody = $('#generic-modal-body-{{$newRepoModalID}}');
|
|
|
|
modalBody.html('<h2>Repo Info</h2><p>Message: ' + response.message + '</p>');
|
|
|
|
modalBody.append('<h4>Branches</h4><p>'+JSON.stringify(response.repo.branches)+'</p>');
|
|
|
|
modalBody.append('<h4>Remotes</h4><p>'+JSON.stringify(response.repo.remote)+'</p>');
|
|
|
|
$('.modal-dialog').width('80%');
|
|
|
|
//$("#generic-modal-cancel-{{$newRepoModalID}}").hide();
|
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").html('OK');
|
2016-05-10 10:28:00 +00:00
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").removeClass('btn-primary');
|
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").addClass('btn-success');
|
2016-05-09 00:30:00 +00:00
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").off('click');
|
|
|
|
$("#generic-modal-ok-{{$newRepoModalID}}").click(function () {
|
|
|
|
$('#generic-modal-{{$newRepoModalID}}').modal('hide');
|
2016-05-10 01:59:27 +00:00
|
|
|
if(confirm('Repo installed. Click OK to refresh page.')) {
|
|
|
|
location.reload();
|
|
|
|
}
|
2016-05-09 00:30:00 +00:00
|
|
|
});
|
|
|
|
$('#generic-modal-{{$newRepoModalID}}').modal();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
window.console.log('Error installing repo :' + response['message']);
|
2016-05-10 01:59:27 +00:00
|
|
|
alert('Error installing addon repo!');
|
2016-05-09 00:30:00 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
'json');
|
2016-05-08 02:12:12 +00:00
|
|
|
}
|
|
|
|
function updateAddonRepo(repoName) {
|
2016-05-10 01:17:47 +00:00
|
|
|
if(confirm('Are you sure you want to update the addon repo ' + repoName + '?')) {
|
|
|
|
$.post(
|
|
|
|
"/admin/plugins/updaterepo", {repoName: repoName},
|
|
|
|
function(response) {
|
|
|
|
if (response.success) {
|
2016-05-11 09:53:23 +00:00
|
|
|
window.console.log('Addon repo '+repoName+' successfully updated :' + response['message']);
|
2017-01-27 02:20:15 +00:00
|
|
|
//alert('Addon repo updated.');
|
|
|
|
$('#update-message-' + repoName).css('background-color', 'yellow');
|
|
|
|
$('#update-message-' + repoName).html('Repo updated!');
|
|
|
|
setTimeout(function () {
|
|
|
|
$('#update-message-' + repoName).html('');
|
|
|
|
}, 60000);
|
2016-05-10 01:17:47 +00:00
|
|
|
} else {
|
2016-05-10 01:59:27 +00:00
|
|
|
window.console.log('Error updating repo :' + response['message']);
|
2017-01-27 02:20:15 +00:00
|
|
|
//alert('Error updating addon repo!');
|
|
|
|
$('#update-message-' + repoName).css('background-color', 'red');
|
|
|
|
$('#update-message-' + repoName).html('Error updating repo!');
|
|
|
|
setTimeout(function () {
|
|
|
|
$('#update-message-' + repoName).html('');
|
|
|
|
}, 60000);
|
2016-05-10 01:17:47 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
'json');
|
|
|
|
}
|
2016-05-08 02:12:12 +00:00
|
|
|
}
|
|
|
|
function switchAddonRepoBranch(repoName) {
|
2016-05-09 00:30:00 +00:00
|
|
|
window.console.log('switchAddonRepoBranch: ' + repoName);
|
2016-05-08 02:12:12 +00:00
|
|
|
// TODO: Discover the available branches and create an interface to switch between them
|
|
|
|
}
|
2016-05-10 01:59:27 +00:00
|
|
|
|
2016-05-08 02:12:12 +00:00
|
|
|
function removeAddonRepo(repoName) {
|
2016-05-10 01:17:47 +00:00
|
|
|
// TODO: Unlink the addons
|
2016-05-09 00:30:00 +00:00
|
|
|
if(confirm('Are you sure you want to remove the addon repo ' + repoName + '?')) {
|
|
|
|
$.post(
|
|
|
|
"/admin/plugins/removerepo", {repoName: repoName},
|
|
|
|
function(response) {
|
|
|
|
if (response.success) {
|
2016-05-11 09:53:23 +00:00
|
|
|
window.console.log('Addon repo '+repoName+' successfully removed :' + response['message']);
|
2016-05-10 01:59:27 +00:00
|
|
|
if(confirm('Repo deleted. Click OK to refresh page.')) {
|
|
|
|
location.reload();
|
|
|
|
}
|
2016-05-09 00:30:00 +00:00
|
|
|
} else {
|
2016-05-10 01:59:27 +00:00
|
|
|
window.console.log('Error removing repo :' + response['message']);
|
|
|
|
alert('Error removing addon repo!');
|
2016-05-09 00:30:00 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
'json');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-03 10:30:46 +00:00
|
|
|
</script>
|