Template stuff
parent
b8ff50956c
commit
6108091278
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
* CVM is more free software. It is licensed under the WTFPL, which
|
||||
* allows you to do pretty much anything with it, without having to
|
||||
* ask permission. Commercial use is allowed, and no attribution is
|
||||
* required. We do politely request that you share your modifications
|
||||
* to benefit other developers, but you are under no enforced
|
||||
* obligation to do so :)
|
||||
*
|
||||
* Please read the accompanying LICENSE document for the full WTFPL
|
||||
* licensing text.
|
||||
*/
|
||||
|
||||
if(!isset($_APP)) { die("Unauthorized."); }
|
||||
|
||||
$sTemplates = array();
|
||||
|
||||
try
|
||||
{
|
||||
foreach(Template::CreateFromQuery("SELECT * FROM templates") as $sTemplate)
|
||||
{
|
||||
$sTemplates[] = array(
|
||||
"id" => $sTemplate->sId,
|
||||
"name" => $sTemplate->sName,
|
||||
"filename" => $sTemplate->sTemplateName,
|
||||
"description" => $sTemplate->sDescription,
|
||||
"supported" => $sTemplate->sIsSupported,
|
||||
"outdated" => $sTemplate->sIsOutdated,
|
||||
"available" => $sTemplate->sIsAvailable
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (NotFoundException $e)
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
$sPageContents = NewTemplater::Render("{$sTheme}/admin/template/list", $locale->strings, array(
|
||||
"templates" => $sTemplates
|
||||
));
|
@ -0,0 +1,36 @@
|
||||
<h2>Add templates</h2>
|
||||
|
||||
{%if isempty|templates == true}
|
||||
<p>
|
||||
To add new templates, add the corresponding tar.gz files to /etc/cvm/templates on the master node, and reload this page.
|
||||
New files will be automatically detected, and you will be able to add them as templates from this page.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
All templates will be automatically synchronized to slave nodes.
|
||||
</p>
|
||||
{%else}
|
||||
<form method="post" action="/admin/templates/add" class="pure-form pure-form-aligned">
|
||||
{%foreach template in templates}
|
||||
<section>
|
||||
<div class="pure-controls">
|
||||
<h3>{%?template}</h3>
|
||||
<input type="hidden" name="filename[]" value="{%?template}">
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label>Template name</label>
|
||||
{%input type="text" group="addtemplate" name="name[]"}
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label>Description</label>
|
||||
<textarea name="description[]"></textarea>
|
||||
</div>
|
||||
</section>
|
||||
{%/foreach}
|
||||
<div class="pure-controls">
|
||||
<button type="submit" name="submit" class="pure-button pure-button-primary">Add templates</button>
|
||||
</div>
|
||||
</form>
|
||||
{%/if}
|
@ -0,0 +1,56 @@
|
||||
<h2>Template overview</h2>
|
||||
|
||||
<div class="pure-menu pure-menu-open pure-menu-horizontal submenu">
|
||||
<ul>
|
||||
<li><a href="/admin/templates/add/"><i class="fa fa-fw fa-plus-circle"></i> Add template(s)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<table class="pure-table pure-table-bordered stretch">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Template name</th>
|
||||
<th>Supported</th>
|
||||
<th>Up-to-date</th>
|
||||
<th>Available</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%foreach template in templates}
|
||||
<tr class="clickable" data-url="/admin/template/{%?template[id]}/">
|
||||
<td>
|
||||
<a href="/admin/template/{%?template[id]}/">
|
||||
{%?template[filename]}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/admin/template/{%?template[id]}/">
|
||||
{%?template[name]}
|
||||
</a>
|
||||
</td>
|
||||
<td class="icon">
|
||||
{%if template[supported] == true}
|
||||
<i class="fa fa-check-circle ok"></i>
|
||||
{%else}
|
||||
<i class="fa fa-times-circle not-ok"></i>
|
||||
{%/if}
|
||||
</td>
|
||||
<td class="icon">
|
||||
{%if template[outdated] == true}
|
||||
<i class="fa fa-times-circle not-ok"></i>
|
||||
{%else}
|
||||
<i class="fa fa-check-circle ok"></i>
|
||||
{%/if}
|
||||
</td>
|
||||
<td class="icon">
|
||||
{%if template[available] == true}
|
||||
<i class="fa fa-check-circle ok"></i>
|
||||
{%else}
|
||||
<i class="fa fa-times-circle not-ok"></i>
|
||||
{%/if}
|
||||
</td>
|
||||
</tr>
|
||||
{%/foreach}
|
||||
</tbody>
|
||||
</table>
|
Loading…
Reference in New Issue