summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/sysconfig.inc.php61
-rw-r--r--templates/page-sysconfig-main.html3
-rw-r--r--templates/sysconfig/custom-filelist.html21
3 files changed, 84 insertions, 1 deletions
diff --git a/modules/sysconfig.inc.php b/modules/sysconfig.inc.php
index 5fc0114c..3be8b16f 100644
--- a/modules/sysconfig.inc.php
+++ b/modules/sysconfig.inc.php
@@ -109,6 +109,9 @@ class Page_SysConfig extends Page
case 'list':
$this->listConfigs();
break;
+ case 'module':
+ $this->listModuleContents();
+ break;
default:
Message::addError('invalid-action', $action);
break;
@@ -146,6 +149,64 @@ class Page_SysConfig extends Page
));
}
+ private function listModuleContents()
+ {
+ // fetch the data
+ $moduleid = Request::post('list', 'MISSING');
+ $row = Database::queryFirst("SELECT title, filepath FROM configtgz_module WHERE moduleid = :moduleid LIMIT 1", array('moduleid' => $moduleid));
+ if ($row == false) {
+ Message::addError('config-invalid', $moduleid);
+ Util::redirect('?do=SysConfig');
+ }
+
+ // find files in that archive
+ $taskStatus = Taskmanager::submit('ListArchive', array(
+ 'file' => $row['filepath']
+ ));
+
+ if (isset($taskStatus['id'])) {
+
+ $status = Taskmanager::waitComplete($taskStatus['id']);
+ Taskmanager::release($taskStatus['id']);
+ if (!isset($status['statusCode'])) {
+ //
+ //$this->tmError();
+ }
+ if ($status['statusCode'] != TASK_FINISHED) {
+ $this->taskError($status);
+ }
+ // Sort files for better display
+ $dirs = array();
+ foreach ($status['data']['entries'] as $file) {
+ if ($file['isdir']) continue;
+ $dirs[dirname($file['name'])][] = $file;
+ }
+ ksort($dirs);
+ $list = array();
+ foreach ($dirs as $dir => $files) {
+ $list[] = array(
+ 'name' => $dir,
+ 'isdir' => true
+ );
+ sort($files);
+ foreach ($files as $file) {
+ $file['size'] = Util::readableFileSize($file['size']);
+ $list[] = $file;
+ }
+ }
+ } else {
+ // task failed, redirect
+ Util::redirect('?do=SysConfig');
+ }
+
+
+ // render the template
+ Render::addDialog('Inhalt von "' . $row['title'] . '"', false, 'sysconfig/custom-filelist', array(
+ 'token' => Session::get('token'),
+ 'files' => $list,
+ ));
+ }
+
private function activateConfig()
{
$configid = Request::post('activate', 'MISSING');
diff --git a/templates/page-sysconfig-main.html b/templates/page-sysconfig-main.html
index b3606113..84f98408 100644
--- a/templates/page-sysconfig-main.html
+++ b/templates/page-sysconfig-main.html
@@ -63,6 +63,7 @@
<tr>
<td>{{module}}</td>
<td>
+ <button class="btn btn-default btn-xs" name="list" value="{{moduleid}}"><span class="glyphicon glyphicon-eye-open"></span> Ansehen</button>
<!-- a class="btn btn-default btn-xs"><span class="glyphicon glyphicon-edit"></span> Bearbeiten</a -->
</td>
<td>
@@ -110,4 +111,4 @@
<div class="modal-footer"><a class="btn btn-primary" data-dismiss="modal">Schließen</a></div>
</div>
</div>
-</div> \ No newline at end of file
+</div>
diff --git a/templates/sysconfig/custom-filelist.html b/templates/sysconfig/custom-filelist.html
new file mode 100644
index 00000000..fc851ff8
--- /dev/null
+++ b/templates/sysconfig/custom-filelist.html
@@ -0,0 +1,21 @@
+<form role="form" method="post" action="?do=SysConfig">
+ <input type="hidden" name="modid" value="{{modid}}">
+ <input type="hidden" name="token" value="{{token}}">
+
+ <table class="table table-bordered table-condensed">
+ {{#files}}
+ <tr>
+ {{#isdir}}
+ <td class="fileEntry isdir" colspan="2">{{name}}</td>
+ {{/isdir}}
+ {{^isdir}}
+ <td class="fileEntry">{{name}}</td>
+ <td>{{size}}</td>
+ {{/isdir}}
+ </tr>
+ {{/files}}
+ </table>
+ <div class="pull-left">
+ <button type="submit" class="btn btn-primary" action="?do=SysConfig">Zurück &laquo;</button>
+ </div>
+</form> \ No newline at end of file