aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Admin.php31
-rwxr-xr-xview/tpl/admin_plugins.tpl34
2 files changed, 61 insertions, 4 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index 68508fdb0..b4c372f84 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -1364,11 +1364,18 @@ class Admin extends \Zotlabs\Web\Controller {
get_markup_template('generic_modal.tpl'), array(
'$id' => $newRepoModalID,
'$title' => t('Install new repo'),
- '$ok' => t('OK'),
+ '$ok' => t('Install'),
'$cancel' => t('Cancel')
)
);
+ $reponames = $this->listAddonRepos();
+ $addonrepos = [];
+ foreach($reponames as $repo) {
+ $addonrepos[] = array('name' => $repo, 'description' => '');
+ // TODO: Parse repo info to provide more information about repos
+ }
+
$t = get_markup_template('admin_plugins.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
@@ -1383,10 +1390,28 @@ class Admin extends \Zotlabs\Web\Controller {
'$expandform' => false,
'$form' => $admin_plugins_add_repo_form,
'$newRepoModal' => $newRepoModal,
- '$newRepoModalID' => $newRepoModalID
+ '$newRepoModalID' => $newRepoModalID,
+ '$addonrepos' => $addonrepos,
+ '$repoUpdateButton' => t('Update'),
+ '$repoBranchButton' => t('Switch branch'),
+ '$repoRemoveButton' => t('Remove')
));
}
-
+
+ function listAddonRepos() {
+ $addonrepos = [];
+ $addonDir = __DIR__ . '/../../extend/addon/';
+ if ($handle = opendir($addonDir)) {
+ while (false !== ($entry = readdir($handle))) {
+ if ($entry != "." && $entry != "..") {
+ $addonrepos[] = $entry;
+ }
+ }
+ closedir($handle);
+ }
+ return $addonrepos;
+ }
+
static public function plugin_sort($a,$b) {
return(strcmp(strtolower($a[2]['name']),strtolower($b[2]['name'])));
}
diff --git a/view/tpl/admin_plugins.tpl b/view/tpl/admin_plugins.tpl
index 3ba83986f..9e1d05a44 100755
--- a/view/tpl/admin_plugins.tpl
+++ b/view/tpl/admin_plugins.tpl
@@ -14,7 +14,20 @@
<div id="chat-rotator"></div>
</div>
<div class="clear"></div>
- <div id="new-repo-info" class="section-content-wrapper"></div>
+ <div class="section-content-wrapper">
+ <h1>Installed Addon Repositories</h1>
+ {{foreach $addonrepos as $repo}}
+ <div class="section-content-tools-wrapper">
+ <div>
+ <h2>{{$repo.name}}</h2>
+ <div class='desc'>{{$repo.description}}</div>
+ <button class="btn btn-success" onclick="updateAddonRepo('{{$repo.name}}'); return false;">{{$repoUpdateButton}}</button>
+ <button class="btn btn-primary" onclick="switchAddonRepoBranch('{{$repo.name}}'); return false;">{{$repoBranchButton}}</button>
+ <button class="btn btn-danger" onclick="removeAddonRepo('{{$repo.name}}'); return false;">{{$repoRemoveButton}}</button>
+ </div>
+ </div>
+ {{/foreach}}
+ </div>
<div class="section-content-wrapper-np">
{{foreach $plugins as $p}}
<div class="section-content-tools-wrapper" id="pluginslist">
@@ -36,6 +49,9 @@
</div>
{{$newRepoModal}}
<script>
+
+ $("#generic-modal-ok-{{$id}}").click(installAddonRepo());
+
function adminPluginsAddRepo() {
var repoURL = $('#id_repoURL').val();
$('#chat-rotator').spin('tiny');
@@ -58,4 +74,20 @@
},
'json');
}
+
+ function installAddonRepo() {
+ // TODO: Link store/git/sys/reponame to /extend/addon/ and run util/add_addon_repo script
+ }
+ function updateAddonRepo(repoName) {
+ window.console.log('updateAddonRepo; ' + repoName);
+ // TODO: Update an existing repo
+ }
+ function switchAddonRepoBranch(repoName) {
+ window.console.log('switchAddonRepoBranch; ' + repoName);
+ // TODO: Discover the available branches and create an interface to switch between them
+ }
+ function removeAddonRepo(repoName) {
+ window.console.log('removeAddonRepo; ' + repoName);
+ // TODO: Unlink the addons and delete the addon repo
+ }
</script> \ No newline at end of file