diff options
Diffstat (limited to 'view')
-rw-r--r-- | view/tpl/admin_plugins.tpl | 167 | ||||
-rw-r--r-- | view/tpl/admin_plugins_addrepo.tpl | 9 |
2 files changed, 3 insertions, 173 deletions
diff --git a/view/tpl/admin_plugins.tpl b/view/tpl/admin_plugins.tpl index f231da2ad..659f87430 100644 --- a/view/tpl/admin_plugins.tpl +++ b/view/tpl/admin_plugins.tpl @@ -1,45 +1,8 @@ <div class="generic-content-wrapper"> <div class="section-title-wrapper"> - {{if $allowManageRepos}} - <div class="float-end"> - <button class="btn btn-success btn-sm" onclick="openClose('form');">{{$managerepos}}</button> - </div> - {{/if}} <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}}> - - <div class="clear"></div> - <div class="section-title-wrapper" style="margin-top: 20px;"> - <h2>{{$installedtitle}}</h2> - <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%;"> - <span class="float-start">{{$repo.name}}</span><span id="update-message-{{$repo.name}}" style="margin-left: 20px;"></span> - </td> - <td style="width: 15%;"> - <button class="btn btn-sm btn-primary float-end" style="margin-left: 10px; margin-right: 10px;" onclick="updateAddonRepo('{{$repo.name}}'); return false;"><i class='bi fa-download'></i> {{$repoUpdateButton}}</button> - </td> - <td style="width: 15%;"> - <button class="btn btn-sm btn-danger float-end" style="margin-left: 10px; margin-right: 0px;" onclick="removeAddonRepo('{{$repo.name}}'); return false;"><i class='bi bi-trash'></i> {{$repoRemoveButton}}</button> - </td> - <div class="clear"></div> - </td></tr> - {{/foreach}} - </table> - </div> - <div class="clear"></div> - <div class="section-title-wrapper"> - <h2>{{$addnewrepotitle}}</h2> - <div class="clear"></div> - </div> - {{$form}} - </div> <div class="clear"></div> <div id="chat-rotator" class="spinner-wrapper"> <div class="spinner s"></div> @@ -47,9 +10,9 @@ <div class="clear"></div> <div class="section-content-wrapper-np"> {{foreach $plugins as $p}} - <div class="section-content-tools-wrapper" id="pluginslist"> + <div class="section-content-tools-wrapper" id="pluginslist"> <div class="contact-info plugin {{$p.1}}"> - {{if ! $p.2.disabled}} + {{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='bi {{if $p.1==on}}bi-check-square{{else}}bi-square{{/if}} admin-icons'></i></a> {{else}} <i class='bi fa-stop admin-icons'></i> @@ -61,130 +24,6 @@ </div> </div> {{/foreach}} - + </div> </div> -{{$newRepoModal}} -<script> - - // TODO: Implement a simple interface controller that reconfigures the modal dialog - // for each action in a more organized way - - function adminPluginsAddRepo() { - $("#generic-modal-ok-{{$newRepoModalID}}").removeClass('btn-success'); - $("#generic-modal-ok-{{$newRepoModalID}}").addClass('btn-primary'); - var repoURL = $('#id_repoURL').val(); - var repoName = $('#id_repoName').val(); - $('#chat-rotator').show(); - $.post( - "/admin/addons/addrepo", {repoURL: repoURL, repoName: repoName}, - function(response) { - $('#chat-rotator').hide(); - if (response.success) { - 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%'); - $("#generic-modal-ok-{{$newRepoModalID}}").off('click'); - $("#generic-modal-ok-{{$newRepoModalID}}").click(function () { - installAddonRepo(); - }); - $('#generic-modal-{{$newRepoModalID}}').modal(); - } else { - window.console.log('Error adding repo :' + response['message']); - } - return false; - }, - 'json'); - } - - function installAddonRepo() { - var repoURL = $('#id_repoURL').val(); - var repoName = $('#id_repoName').val(); - $.post( - "/admin/addons/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'); - $("#generic-modal-ok-{{$newRepoModalID}}").removeClass('btn-primary'); - $("#generic-modal-ok-{{$newRepoModalID}}").addClass('btn-success'); - $("#generic-modal-ok-{{$newRepoModalID}}").off('click'); - $("#generic-modal-ok-{{$newRepoModalID}}").click(function () { - $('#generic-modal-{{$newRepoModalID}}').modal('hide'); - if(confirm('Repo installed. Click OK to refresh page.')) { - location.reload(); - } - }); - $('#generic-modal-{{$newRepoModalID}}').modal(); - - } else { - window.console.log('Error installing repo :' + response['message']); - alert('Error installing addon repo!'); - } - return false; - }, - 'json'); - } - function updateAddonRepo(repoName) { - if(confirm('Are you sure you want to update the addon repo ' + repoName + '?')) { - $.post( - "/admin/addons/updaterepo", {repoName: repoName}, - function(response) { - if (response.success) { - window.console.log('Addon repo '+repoName+' successfully updated :' + response['message']); - //alert('Addon repo updated.'); - $('#update-message-' + repoName).css('background-color', 'yellow'); - $('#update-message-' + repoName).html('Repo updated!'); - setTimeout(function () { - $('#update-message-' + repoName).html(''); - }, 60000); - } else { - window.console.log('Error updating repo :' + response['message']); - //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); - } - return false; - }, - 'json'); - } - } - function switchAddonRepoBranch(repoName) { - window.console.log('switchAddonRepoBranch: ' + repoName); - // TODO: Discover the available branches and create an interface to switch between them - } - - function removeAddonRepo(repoName) { - // TODO: Unlink the addons - if(confirm('Are you sure you want to remove the addon repo ' + repoName + '?')) { - $.post( - "/admin/addons/removerepo", {repoName: repoName}, - function(response) { - if (response.success) { - window.console.log('Addon repo '+repoName+' successfully removed :' + response['message']); - if(confirm('Repo deleted. Click OK to refresh page.')) { - location.reload(); - } - } else { - window.console.log('Error removing repo :' + response['message']); - alert('Error removing addon repo!'); - } - return false; - }, - 'json'); - } - } - -</script> diff --git a/view/tpl/admin_plugins_addrepo.tpl b/view/tpl/admin_plugins_addrepo.tpl deleted file mode 100644 index e0e271d5a..000000000 --- a/view/tpl/admin_plugins_addrepo.tpl +++ /dev/null @@ -1,9 +0,0 @@ -<form id="add-plugin-repo-form" action="{{$post}}" method="post" > - - <p class="descriptive-text">{{$desc}}</p> - {{include file="field_input.tpl" field=$repoURL}} - {{include file="field_input.tpl" field=$repoName}} - <div class="btn-group float-end"> - <button id="add-plugin-repo-submit" class="btn btn-primary" type="submit" name="submit" onclick="adminPluginsAddRepo(); return false;">{{$submit}}</button> - </div> -</form> |