]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame_incremental - settings/plugins.php
Add start of Notes functionality
[irc/unrealircd/unrealircd-webpanel.git] / settings / plugins.php
... / ...
CommitLineData
1<?php
2
3require_once "../inc/common.php";
4require_once "../inc/header.php";
5
6
7?>
8
9<h2>Active Plugins <a class="btn btn-sm btn-primary" href="add-plugin.php">Add New</a></h2>
10<br>
11Your installed plugins:
12<br>
13<table class="container-xxl table table-sm table-responsive caption-top table-striped">
14 <thead class="table-primary">
15 <form method="post">
16 <th scope="col"><input type="checkbox" label='selectall' onClick="toggle_tkl(this)" /></th>
17 <th scope="col">Plugin Name</th>
18 <th scope="col">Version</th>
19 <th scope="col">Description</th>
20 <th scope="col">Author</th>
21 <th scope="col">Contact</th>
22 <th scope="col">Uninstall</th>
23
24 </thead>
25 <tbody>
26 <?php
27 foreach(Plugins::$list as $plugin)
28 {
29 echo "<tr>";
30 echo "<th scope=\"col\"><input type=\"checkbox\" label='selectall' onClick=\"toggle_tkl(this)\" /></th>";
31 echo "<td scope=\"col\" onClick=\"create_plugin_info_modal('".$plugin->handle."')\">".$plugin->name."</td>";
32 echo "<td scope=\"col\"><code>".$plugin->version."</code></td>";
33 echo "<td scope=\"col\">".$plugin->description."</td>";
34 echo "<td scope=\"col\">".$plugin->author."</td>";
35 echo "<td scope=\"col\"><a href='mailto:$plugin->email'>".$plugin->email."</a></td>";
36 echo "<td width=\"110\" scope=\"col\"><div id=\"".$plugin->handle."install\" class='text-center btn-sm btn-danger btn-install-plugin'>Uninstall</div></td>";
37 echo "</tr>";
38 }
39 ?>
40 </tbody>
41</table>
42
43<script>
44const ibtns = document.querySelectorAll(".btn-install-plugin");
45 ibtns.forEach((ib) => {
46 ib.addEventListener('click', (e) => {
47 console.log(ib.id);
48 if (ib.innerHTML !== "Install" && ib.innerHTML !== "Uninstall") // some point between, don't do anything
49 {}
50 else if (ib.innerHTML == "Install") // install button pressed!
51 {
52 let req = requestInstall(ib.id.slice(0,-7))
53 if (req == true)
54 {
55 ib.classList.replace("btn-primary", "btn-secondary");
56 ib.innerHTML = "Installing...";
57 }
58 else
59 {
60 let uhoh = new bsModal("Error", "Could not install: "+req, "", null, false, true);
61 }
62 }
63 else if (ib.innerHTML == "Uninstall")
64 {
65 let req = requestInstall(ib.id.slice(0,-7), true); // true = uninstall
66 if (req == true)
67 {
68 ib.classList.replace("btn-outline-danger", "btn-secondary");
69 ib.innerHTML = "Uninstalling...";
70 }
71 else
72 {
73 let uhoh = new bsModal("Error", "Could not uninstall: "+req, "", null, false, true);
74 }
75 }
76 });
77 })
78 const installed = document.querySelectorAll(".installed");
79 installed.forEach((el) => {
80 let btn = document.getElementById(el.id + 'install');
81 btn.classList.replace("btn-primary", "btn-outline-danger");
82 btn.innerHTML = "Uninstall";
83 });
84</script>
85
86<?php
87require_once "../inc/footer.php";