Commit 6bb9b455 authored by Florian Kaiser's avatar Florian Kaiser
Browse files

add navigation and separate index page

parent 22e5a2da
......@@ -9,17 +9,9 @@
* @copyright Florian Kaiser 2015
*/
/**
* Create your routes in here. The name is the lowercase name of the controller
* without the controller part, the stuff after the hash is the method.
* e.g. page#index -> OCA\StorageUsage\Controller\PageController->index()
*
* The controller class has to be registered in the application.php file since
* it's instantiated in there
*/
return [
'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'page#do_echo', 'url' => '/echo', 'verb' => 'POST'],
['name' => 'page#storageUsage', 'url' => '/show', 'verb' => 'GET'],
]
];
\ No newline at end of file
......@@ -34,10 +34,19 @@ class PageController extends Controller {
/**
* @AdminRequired
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index() {
//return new TemplateResponse('storageusage', 'main', $params);
return $this->storageUsage();
}
/**
* @AdminRequired
* @NoCSRFRequired
*/
public function storageUsage() {
$data = $this->usagedao->getUsage();
$defaultQuota = $this->config->getAppValue('files', 'default_quota', 'none');
......@@ -57,7 +66,7 @@ class PageController extends Controller {
}
$params = [ 'data' => $data ];
return new TemplateResponse('storageusage', 'main', $params); // templates/main.php
return new TemplateResponse('storageusage', 'storageusage', $params);
}
}
\ No newline at end of file
<?php
script('storageusage', 'jquery.tablesorter');
script('storageusage', 'script');
style('storageusage', 'style');
style('storageusage', 'tablesorter');
?>
<div id="app">
......@@ -13,7 +10,7 @@ style('storageusage', 'tablesorter');
<div id="app-content">
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('part.content')); ?>
<?php print_unescaped($this->inc('part.main')); ?>
</div>
</div>
</div>
<div id="storageusage-wrapper">
<p>This app displays a table with information about the current storage usage for all users.</p>
<p>Collecting the information may take a while if you have many users and/or files.</p>
<p>This app should only be enabled for admin users.<p>
</div>
<ul>
<li><a href="<?php p(\OCP\Util::linkToRoute('storageusage.page.storageUsage')); ?>">Table</a></li>
</ul>
\ No newline at end of file
<div id="storageusage-wrapper">
<table id="storageusage">
<thead>
<tr>
<th>User</th>
<th>Objects</th>
<th>Space</th>
<th>Quota</th>
<th>% Used</th>
<tr>
</thead>
<tbody>
<?php $alt=false; ?>
<?php foreach($_['data'] as $row){ ?>
<tr class="<?php if ($alt=!$alt) echo 'alt';?>">
<td><?php p($row['username']); ?></td>
<td><?php p($row['objects']); ?></td>
<td value="<?php p($row['bytes']); ?>"><?php p($this->human_file_size($row['bytes'])); ?></td>
<td value="<?php p($row['quotavalue']); ?>"><?php p($row['quotastring']); ?></td>
<td value="<?php p((int) ($row['bytes'] / $row['quotavalue'])); ?>"><div class="storageusage-progress" storageusage-percent="<?php p((int) ($row['bytes'] / $row['quotavalue'])); ?>"></div></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
\ No newline at end of file
<?php
script('storageusage', 'jquery.tablesorter');
script('storageusage', 'script');
style('storageusage', 'style');
style('storageusage', 'tablesorter');
?>
<div id="app">
<div id="app-navigation">
<?php print_unescaped($this->inc('part.navigation')); ?>
<?php print_unescaped($this->inc('part.settings')); ?>
</div>
<div id="app-content">
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('part.storageusage')); ?>
</div>
</div>
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment