<%!
from kaithem.src.util import url
from kaithem.src import util,directories
import os, yaml
%>
<%include file="/pageheader.html"/>
<h2>Modules Library<sup><a href="/docs#modules">[help]</a></sup></h2>
<title>Modules Library</title>


<h3>Library Modules</h3>
<div class="window paper">
<details class="help"><summary><i class="mdi mdi-help-circle-outline"></i></summary>These modules are available on the server but not currently loaded.</details>
</p>

<hr>
<dl>
<%
libdir = os.path.join(directories.datadir,"modules")
%>

%for i in sorted(util.get_immediate_subdirectories(libdir)):
   <dt><b>${i|h}</b><form method=POST action="/modules/loadlibmodule/${url(i)}">
   <input type="submit" value="Load"></input>
   </form></dt>
   <dd><pre style="white-space: pre-wrap;">${yaml.load(open(os.path.join(libdir,i,"__metadata__.yaml")), Loader=yaml.SafeLoader)['description']|h}</pre></dd>
%endfor
</ul>
</div>
<%include file="/pagefooter.html"/>
