summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-05-18 18:04:56 +0200
committerSimon Rettberg2016-05-18 18:04:56 +0200
commit2e18b36a287ad9b25619f9e2a073dcedf6d620ee (patch)
tree96d802fdc1c21ee9aa9b4d89a6611db7d8502433
parentModularized baseconfig fetching (api) (diff)
downloadslx-admin-2e18b36a287ad9b25619f9e2a073dcedf6d620ee.tar.gz
slx-admin-2e18b36a287ad9b25619f9e2a073dcedf6d620ee.tar.xz
slx-admin-2e18b36a287ad9b25619f9e2a073dcedf6d620ee.zip
MORE WMORK
-rw-r--r--apis/update.inc.php7
-rw-r--r--config.php.example2
-rw-r--r--inc/dictionary.inc.php7
-rw-r--r--inc/message.inc.php85
-rw-r--r--inc/module.inc.php21
-rw-r--r--inc/property.inc.php6
-rw-r--r--inc/render.inc.php39
-rw-r--r--inc/user.inc.php2
-rw-r--r--index.php2
-rw-r--r--modules-available/backup/page.inc.php1
-rw-r--r--modules-available/baseconfig/config.json3
-rw-r--r--modules-available/baseconfig/templates/_page.html2
-rw-r--r--modules-available/baseconfig_partitions_cdn/config.json4
-rw-r--r--modules-available/baseconfig_partitions_cdn/page.inc.php133
-rw-r--r--modules-available/baseconfig_partitions_cdn/templates/_page.html74
-rw-r--r--modules-available/dozmod/hooks/main-warning.inc.php11
-rw-r--r--modules-available/dozmod/lang/de/messages.json1
-rw-r--r--modules-available/dozmod/lang/en/messages.json1
-rw-r--r--modules-available/js_chart/clientscript.js (renamed from script/chart.min.js)0
-rw-r--r--modules-available/js_chart/config.json1
-rw-r--r--modules-available/js_circles/clientscript.js (renamed from script/circles.min.js)0
-rw-r--r--modules-available/js_circles/config.json1
-rw-r--r--modules-available/main/lang/de/global-tags.json2
-rw-r--r--modules-available/main/lang/de/template-tags.json8
-rw-r--r--modules-available/main/lang/en/global-tags.json2
-rw-r--r--modules-available/main/lang/en/template-tags.json8
-rw-r--r--modules-available/main/page.inc.php44
-rw-r--r--modules-available/main/templates/messagebox-error.html1
-rw-r--r--modules-available/main/templates/messagebox-info.html1
-rw-r--r--modules-available/main/templates/messagebox-success.html1
-rw-r--r--modules-available/main/templates/messagebox-warning.html1
-rw-r--r--modules-available/main/templates/messagebox.html7
-rw-r--r--modules-available/main/templates/page-main.html31
-rw-r--r--modules-available/minilinux/hooks/main-warning.inc.php6
-rw-r--r--modules-available/minilinux/lang/de/messages.json3
-rw-r--r--modules-available/minilinux/lang/en/messages.json3
-rw-r--r--modules-available/serversetup-bwlp/config.json (renamed from modules-available/serversetup/config.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/de/messages.json (renamed from modules-available/serversetup/lang/de/messages.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/de/module.json (renamed from modules-available/serversetup/lang/de/module.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/de/template-tags.json (renamed from modules-available/serversetup/lang/de/template-tags.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/en/messages.json (renamed from modules-available/serversetup/lang/en/messages.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/en/module.json (renamed from modules-available/serversetup/lang/en/module.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/en/template-tags.json (renamed from modules-available/serversetup/lang/en/template-tags.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/pt/messages.json (renamed from modules-available/serversetup/lang/pt/messages.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/pt/module.json (renamed from modules-available/serversetup/lang/pt/module.json)0
-rw-r--r--modules-available/serversetup-bwlp/lang/pt/template-tags.json (renamed from modules-available/serversetup/lang/pt/template-tags.json)0
-rw-r--r--modules-available/serversetup-bwlp/page.inc.php (renamed from modules-available/serversetup/page.inc.php)86
-rw-r--r--modules-available/serversetup-bwlp/templates/ipaddress.html (renamed from modules-available/serversetup/templates/ipaddress.html)7
-rw-r--r--modules-available/serversetup-bwlp/templates/ipxe.html70
-rw-r--r--modules-available/serversetup-bwlp/templates/ipxe_update.html (renamed from modules-available/serversetup/templates/ipxe_update.html)0
-rw-r--r--modules-available/serversetup/templates/ipxe-adv.html149
-rw-r--r--modules-available/serversetup/templates/ipxe-smp.html62
-rw-r--r--modules-available/statistics/config.json2
-rw-r--r--modules-available/statistics/page.inc.php2
-rw-r--r--modules-available/sysconfig/addmodule_branding.inc.php1
-rw-r--r--modules-available/sysconfig/addmodule_custommodule.inc.php1
-rw-r--r--modules-available/sysconfig/clientscript.js21
-rw-r--r--modules-available/sysconfig/hooks/main-warning.inc.php6
-rw-r--r--modules-available/sysconfig/inc/configmodule.inc.php2
-rw-r--r--modules-available/sysconfig/lang/de/messages.json27
-rw-r--r--modules-available/sysconfig/lang/en/messages.json27
-rw-r--r--modules-available/sysconfig/page.inc.php1
-rw-r--r--modules-available/syslog/clientscript.js (renamed from script/bootstrap-tagsinput.min.js)0
-rw-r--r--modules-available/syslog/page.inc.php3
-rw-r--r--modules-available/syslog/style.css (renamed from style/bootstrap-tagsinput.css)0
-rw-r--r--modules-available/systemstatus/config.json3
-rw-r--r--modules-available/systemstatus/page.inc.php4
-rw-r--r--modules-available/translation/page.inc.php3
-rw-r--r--modules-available/vmstore/hooks/main-warning.inc.php10
-rw-r--r--modules-available/vmstore/lang/de/messages.json3
-rw-r--r--modules-available/vmstore/lang/en/messages.json3
-rw-r--r--script/custom.js32
-rw-r--r--script/fileselect.js6
73 files changed, 558 insertions, 494 deletions
diff --git a/apis/update.inc.php b/apis/update.inc.php
index 3ba7f9a0..fb5af7d6 100644
--- a/apis/update.inc.php
+++ b/apis/update.inc.php
@@ -1,5 +1,9 @@
<?php
+//
+// TODO: Modularize
+//
+
$targetVersion = Database::getExpectedSchemaVersion();
function fatal($message)
@@ -323,4 +327,5 @@ function update_11()
return true;
}
-// TODO: Remove setting_distro, setting, cat_setting \ No newline at end of file
+// TODO: Remove setting_distro, setting, cat_setting
+// TODO: Add toggle column to setting_global \ No newline at end of file
diff --git a/config.php.example b/config.php.example
index eece978d..cd05e115 100644
--- a/config.php.example
+++ b/config.php.example
@@ -26,7 +26,7 @@ define('CONFIG_VMSTORE_DIR', '/srv/openslx/nfs');
define('CONFIG_PROXY_CONF', '/opt/openslx/proxy/config');
-// Sort order for menu
+// Sort order for menu - optional, if missing, order will be alphabetically
$MENU_CAT_SORT_ORDER = array('main.content' => 0, 'main.settings' => 1, 'main.status' => 2, 'main.users' => 3);
$MENU_SETTING_SORT_ORDER = array(
'news' => 0, 'sysconfig' => 1, 'baseconfig' => 2, 'locations' => 3, // main.content
diff --git a/inc/dictionary.inc.php b/inc/dictionary.inc.php
index 0dafe9d9..5679c52d 100644
--- a/inc/dictionary.inc.php
+++ b/inc/dictionary.inc.php
@@ -90,12 +90,9 @@ class Dictionary
return self::translateFileModule('main', 'global-tags', $tag);
}
- public static function getMessage($id)
+ public static function getMessage($module, $id)
{
- if (!preg_match('/^(\w+)\.(.+)$/', $id, $out)) {
- return 'Invalid Message ID format: ' . $id;
- }
- $string = self::translateFileModule($out[1], 'messages', $out[2]);
+ $string = self::translateFileModule($module, 'messages', $id);
if ($string === false) {
return "($id) ({{0}}, {{1}}, {{2}}, {{3}})";
}
diff --git a/inc/message.inc.php b/inc/message.inc.php
index 15e89041..9197e4c2 100644
--- a/inc/message.inc.php
+++ b/inc/message.inc.php
@@ -13,7 +13,7 @@ class Message
*/
public static function addError($id)
{
- self::add('error', $id, func_get_args());
+ self::add('danger', $id, func_get_args());
}
public static function addWarning($id)
@@ -40,10 +40,35 @@ class Message
if (strstr($id, '.') === false) {
$id = Page::getModule()->getIdentifier() . '.' . $id;
}
+ if (count($params) > 1 && $params[1] === true) {
+ $params = array_slice($params, 2);
+ $linkModule = true;
+ } else {
+ $params = array_slice($params, 1);
+ $linkModule = false;
+ }
+ switch ($type) {
+ case 'danger':
+ $icon = 'exclamation-sign';
+ break;
+ case 'warning':
+ $icon = 'warning';
+ break;
+ case 'info':
+ $icon = 'info-sign';
+ break;
+ case 'success':
+ $icon = 'ok';
+ break;
+ default:
+ $icon = '';
+ }
self::$list[] = array(
'type' => $type,
+ 'icon' => $icon,
'id' => $id,
- 'params' => array_slice($params, 1)
+ 'params' => $params,
+ 'link' => $linkModule
);
if (self::$flushed) self::renderList();
}
@@ -59,25 +84,36 @@ class Message
if (empty(self::$list))
return;
// Ajax
- if (AJAX) {
- foreach (self::$list as $item) {
- $message = Dictionary::getMessage($item['id']);
- foreach ($item['params'] as $index => $text) {
- $message = str_replace('{{' . $index . '}}', '<b>' . htmlspecialchars($text) . '</b>', $message);
- }
- echo Render::parse('messagebox-' . $item['type'], array('message' => $message), 'main');
- }
- self::$list = array();
- return;
- }
- // Non-Ajax
+ $mangled = array();
foreach (self::$list as $item) {
- $message = Dictionary::getMessage($item['id']);
+ if (!preg_match('/^(\w+)\.(.+)$/', $item['id'], $out)) {
+ $message = 'Invalid Message ID format: ' . $item['id'];
+ } else {
+ $message = Dictionary::getMessage($out[1], $out[2]);
+ }
foreach ($item['params'] as $index => $text) {
$message = str_replace('{{' . $index . '}}', '<b>' . htmlspecialchars($text) . '</b>', $message);
}
- Render::addTemplate('messagebox-' . $item['type'], array('message' => $message), 'main');
- self::$alreadyDisplayed[] = $item;
+ if ($item['link'] && isset($out[1])) {
+ $item['link'] = $out[1];
+ }
+ $mangled[] = array(
+ 'type' => $item['type'],
+ 'icon' => $item['icon'],
+ 'message' => $message,
+ 'link' => $item['link']
+ );
+ }
+ if (AJAX) {
+ foreach ($mangled as $entry) {
+ echo Render::parse('messagebox', $entry, 'main');
+ }
+ } else {
+ // Non-Ajax
+ foreach ($mangled as $entry) {
+ Render::addTemplate('messagebox', $entry, 'main');
+ }
+ self::$alreadyDisplayed = array_merge(self::$alreadyDisplayed, self::$list);
}
self::$list = array();
}
@@ -90,7 +126,11 @@ class Message
{
$return = '';
foreach (self::$list as $item) {
- $message = Dictionary::getMessage($item['id']);
+ if (!preg_match('/^(\w+)\.(.+)$/', $item['id'], $out)) {
+ $message = 'Invalid Message ID format: ' . $item['id'];
+ } else {
+ $message = Dictionary::getMessage($out[1], $out[2]);
+ }
foreach ($item['params'] as $index => $text) {
$message = str_replace('{{' . $index . '}}', $text, $message);
}
@@ -110,7 +150,11 @@ class Message
$messages = is_array($_REQUEST['message']) ? $_REQUEST['message'] : array($_REQUEST['message']);
foreach ($messages as $message) {
$data = explode('|', $message);
- if (count($data) < 2 || !preg_match('/^(error|warning|info|success)$/', $data[0])) continue;
+ if (substr($data[0], -1) === '@') {
+ $data[0] = substr($data[0], 0, -1);
+ array_splice($data, 1, 0, true);
+ }
+ if (count($data) < 2 || !preg_match('/^(danger|warning|info|success)$/', $data[0])) continue;
self::add($data[0], $data[1], array_slice($data, 1));
}
}
@@ -123,6 +167,9 @@ class Message
{
$parts = array();
foreach (array_merge(self::$list, self::$alreadyDisplayed) as $item) {
+ if (isset($item['link']) && $item['link']) {
+ $item['type'] .= '@';
+ }
$str = 'message[]=' . urlencode($item['type'] . '|' .$item['id']);
if (!empty($item['params'])) {
$str .= '|' . urlencode(implode('|', $item['params']));
diff --git a/inc/module.inc.php b/inc/module.inc.php
index 246505b5..13d9c1e4 100644
--- a/inc/module.inc.php
+++ b/inc/module.inc.php
@@ -22,8 +22,9 @@ class Module
/**
* Check whether given module is available, that is, all dependencies are
- * met. If the module is available, it will be activated, so all it's classes
- * are available through the auto-loader.
+ * met. If the module is available, it will be activated, so all its classes
+ * are available through the auto-loader, and any js or css is added to the
+ * final page output.
*
* @param string $moduleId module to check
* @return bool true if module is available and activated
@@ -88,6 +89,20 @@ class Module
return self::$modules;
}
+ /**
+ * @return \Module[] List of modules that have been activated
+ */
+ public static function getActivated()
+ {
+ $ret = array();
+ foreach (self::$modules as $module) {
+ if ($module->activated) {
+ $ret[] = $module;
+ }
+ }
+ return $ret;
+ }
+
public static function init()
{
if (self::$modules !== false)
@@ -97,7 +112,7 @@ class Module
return;
self::$modules = array();
while (($dir = readdir($dh)) !== false) {
- if (empty($dir) || preg_match('/[^a-zA-Z0-9]/', $dir))
+ if (empty($dir) || preg_match('/[^a-zA-Z0-9_]/', $dir))
continue;
if (!is_file('modules/' . $dir . '/config.json'))
continue;
diff --git a/inc/property.inc.php b/inc/property.inc.php
index 13e3c66d..eae5033c 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -185,4 +185,10 @@ class Property
return self::get('password-type', 'password');
}
+
+ public static function getIpxeDefault()
+ {
+ return self::get('default-ipxe');
+ }
+
}
diff --git a/inc/render.inc.php b/inc/render.inc.php
index 5fc5be92..b422d7f9 100644
--- a/inc/render.inc.php
+++ b/inc/render.inc.php
@@ -46,9 +46,8 @@ class Render
public static function output()
{
Header('Content-Type: text/html; charset=utf-8');
- $zip = isset($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false);
- if ($zip)
- ob_start();
+ $modules = Module::getActivated();
+ ob_start('ob_gzhandler');
echo
'<!DOCTYPE html>
<html>
@@ -59,9 +58,16 @@ class Render
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="style/bootstrap.min.css" rel="stylesheet" media="screen">
- <link href="style/bootstrap-tagsinput.css" rel="stylesheet" media="screen">
+ ';
+ // Include any module specific styles
+ foreach ($modules as $module) {
+ $file = $module->getDir() . '/style.css';
+ if (file_exists($file)) {
+ echo '<link href="', $file, '" rel="stylesheet" media="screen">';
+ }
+ }
+ echo '
<link href="style/default.css" rel="stylesheet" media="screen">
-
<script type="text/javascript">
var TOKEN = "' . Session::get('token') . '";
</script>
@@ -80,20 +86,21 @@ class Render
<script src="script/jquery.js"></script>
<script src="script/bootstrap.min.js"></script>
<script src="script/taskmanager.js"></script>
- ',
+ <script src="script/fileselect.js"></script>
+ ';
+ foreach ($modules as $module) {
+ $file = $module->getDir() . '/clientscript.js';
+ if (file_exists($file)) {
+ echo '<script src="', $file, '"></script>';
+ }
+ }
+ echo
self::$footer
,
'</body>
</html>'
;
- if ($zip) {
- Header('Content-Encoding: gzip');
- ob_implicit_flush(false);
- $gzip_contents = ob_get_contents();
- ob_end_clean();
- echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
- echo substr(gzcompress($gzip_contents, 5), 0, -4);
- }
+ ob_end_flush();
}
/**
@@ -127,7 +134,7 @@ class Render
*/
public static function addScriptTop($file)
{
- self::addHeader('<script src="script/' . $file . '.js"></script>');
+ trigger_error('Ignoring addScriptTop for ' . $file . ': Deprecated, use module-specific clientscript.js', E_USER_WARNING);
}
/**
@@ -137,7 +144,7 @@ class Render
*/
public static function addScriptBottom($file)
{
- self::addFooter('<script src="script/' . $file . '.js"></script>');
+ trigger_error('Ignoring addScriptBottom for ' . $file . ': Deprecated, use module-specific clientscript.js', E_USER_WARNING);
}
/**
diff --git a/inc/user.inc.php b/inc/user.inc.php
index d3cdc65a..595f4745 100644
--- a/inc/user.inc.php
+++ b/inc/user.inc.php
@@ -30,7 +30,7 @@ class User
{
if (!self::isLoggedIn())
return false;
- return (self::$user['permissions'] & Permission::get($permission)) != 0;
+ return (self::$user['permissions'] & (Permission::get($permission) | Permission::get('superadmin'))) != 0;
}
public static function load()
diff --git a/index.php b/index.php
index a6cfccf2..d9b7c371 100644
--- a/index.php
+++ b/index.php
@@ -70,7 +70,7 @@ abstract class Page
public static function init()
{
$name = empty($_REQUEST['do']) ? 'Main' : $_REQUEST['do'];
- $name = preg_replace('/[^A-Za-z]/', '', $name);
+ $name = preg_replace('/[^A-Za-z_]/', '', $name);
$name = strtolower($name);
Module::init();
self::$module = Module::get($name);
diff --git a/modules-available/backup/page.inc.php b/modules-available/backup/page.inc.php
index 9d253a1e..3f2388a5 100644
--- a/modules-available/backup/page.inc.php
+++ b/modules-available/backup/page.inc.php
@@ -27,7 +27,6 @@ class Page_Backup extends Page
if ($this->action === 'restore') {
Render::addTemplate('restore', $this->templateData);
} else {
- Render::addScriptBottom('fileselect');
Render::addTemplate('_page');
}
}
diff --git a/modules-available/baseconfig/config.json b/modules-available/baseconfig/config.json
index b72e9c23..9ce17b0d 100644
--- a/modules-available/baseconfig/config.json
+++ b/modules-available/baseconfig/config.json
@@ -1,4 +1,3 @@
{
- "category": "main.settings",
- "enabled": true
+ "category": "main.settings"
}
diff --git a/modules-available/baseconfig/templates/_page.html b/modules-available/baseconfig/templates/_page.html
index e8b85dd3..093cb10f 100644
--- a/modules-available/baseconfig/templates/_page.html
+++ b/modules-available/baseconfig/templates/_page.html
@@ -63,5 +63,5 @@
</div>
<button class="btn btn-primary" type="submit">{{lang_save}}</button>
<button class="btn btn-default" type="reset">{{lang_reset}}</button>
- <a class="btn btn-default" href="api.php?do=getconfig">Download</a>
+ <a class="btn btn-default" href="api.php?do=baseconfig">Download</a>
</form>
diff --git a/modules-available/baseconfig_partitions_cdn/config.json b/modules-available/baseconfig_partitions_cdn/config.json
new file mode 100644
index 00000000..a3036a56
--- /dev/null
+++ b/modules-available/baseconfig_partitions_cdn/config.json
@@ -0,0 +1,4 @@
+{
+ "category": "main.settings",
+ "dependencies": [ "baseconfig" ]
+} \ No newline at end of file
diff --git a/modules-available/baseconfig_partitions_cdn/page.inc.php b/modules-available/baseconfig_partitions_cdn/page.inc.php
new file mode 100644
index 00000000..b6ea869a
--- /dev/null
+++ b/modules-available/baseconfig_partitions_cdn/page.inc.php
@@ -0,0 +1,133 @@
+<?php
+
+class Page_BaseConfig_Partitions_CDN extends Page
+{
+
+ protected function doPreprocess()
+ {
+ User::load();
+
+ $action = Request::post('action');
+
+ if($action == 'new_partition') {
+ $this->addPartition();
+ }
+ if($action == 'reset') {
+ $this->resetConfig();
+ }
+
+ $deletePartition = Request::get('deletePartition');
+ if($deletePartition !== false) { // TODO: CSRF: Actions that change/update/delete anything should be POST
+ $this->deletePartition($deletePartition);
+ }
+
+ $this->updatePartitions();
+ }
+
+ protected function doRender()
+ {
+ if (!User::hasPermission('baseconfig_local')) {
+ Message::addError('main.no-permission');
+ Util::redirect('?do=Main');
+ }
+
+ //loads partition settings
+ $partitions = array();
+ $res = Database::simpleQuery('SELECT id, partition_id, size, mount_point, options FROM setting_partition WHERE user=:user',
+ array( 'user' => User::getId() ));
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $partition = array(
+ 'id' => $row['id'],
+ 'partition_id' => $row['partition_id'],
+ 'size' => $row['size'],
+ 'mount_point' => $row['mount_point'],
+ 'options' => $row['options']
+ );
+ $partitions[] = $partition;
+ }
+
+ Render::addTemplate('_page', array(
+ 'partitions' => $partitions,
+ 'user' => User::getId()
+ ));
+ }
+
+ private function addPartition() {
+ $partId = Request::post('new-partition-id');
+ $partSize = Request::post('new-partition-size');
+ $partMountPoint = Request::post('new-partition-mount-point');
+ $partOptions = Request::post('new-partition-options');
+
+ if(strlen($partId) < 1 || strlen($partSize) < 1){
+ Message::addError('main.empty-field');
+ }else{
+ $data = array(
+ 'partition_id' => $partId,
+ 'size' => $partSize,
+ 'mount_point' => $partMountPoint,
+ 'options' => $partOptions,
+ 'user' => User::getId()
+ );
+ if (Database::exec('INSERT INTO setting_partition SET partition_id = :partition_id, size = :size,
+ mount_point = :mount_point, options = :options, user = :user ', $data) != 1) {
+ Util::traceError('Could not create new partition in DB');
+ }
+ }
+ Util::redirect('?do=BaseConfig');
+ }
+
+ private function deletePartition($id){
+ if(is_numeric($id)){
+ $data = array(
+ 'id' => $id,
+ 'user' => User::getId()
+ );
+ if (Database::exec('DELETE FROM setting_partition WHERE id = :id AND user = :user', $data) != 1) {
+ Util::traceError('Could not delete partition in DB');
+ }
+ }
+ Util::redirect('?do=BaseConfig');
+ }
+
+ private function updatePartitions(){
+ $partitions = array();
+ foreach($_POST as $key => $value){
+ if(substr($key,0,9) == 'partition'){
+ $id = substr($key,10,1);
+ $type = substr($key,12);
+ $partitions[$id][$type] = $value;
+ }
+ }
+
+ foreach($partitions as $key => $data){
+ $data = array(
+ 'id' => $key,
+ 'partition_id' => $data['partition_id'],
+ 'size' => $data['size'],
+ 'mount_point' => $data['mount_point'],
+ 'options' => $data['options'],
+ 'user' => User::getId()
+ );
+ Database::exec('UPDATE setting_partition SET partition_id=:partition_id, size=:size, mount_point=:mount_point,
+ options=:options WHERE id=:id AND user=:user;', $data);
+ }
+ if (!empty($partitions)) {
+ Message::addSuccess('partitions-updated');
+ Util::redirect('?do=BaseConfig');
+ }
+ }
+
+ private function resetConfig(){
+ $data = array(
+ 'user' => User::getId()
+ );
+ //Delete all config values
+ Database::exec('DELETE FROM setting_partition WHERE user = :user', $data);
+ //Create default partition values
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '44', size = '5G', mount_point = '/tmp', user = :user", $data );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '43', size = '20G', mount_point = '/boot', options = 'bootable', user = :user", $data );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '40', size = '20G', mount_point = '/cache/export/dnbd3', user = :user", $data );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '41', size = '5G', mount_point = '/home', user = :user", $data );
+ Database::exec ( "INSERT INTO setting_partition SET partition_id = '82', size = '1G', user = :user", $data );
+ }
+} \ No newline at end of file
diff --git a/modules-available/baseconfig_partitions_cdn/templates/_page.html b/modules-available/baseconfig_partitions_cdn/templates/_page.html
new file mode 100644
index 00000000..ee764e37
--- /dev/null
+++ b/modules-available/baseconfig_partitions_cdn/templates/_page.html
@@ -0,0 +1,74 @@
+<h1>{{lang_partitioningManagement}}</h1>
+
+<form action="?do=BaseConfig_Partitions_CDN" method="post">
+ <input type="hidden" name="token" value="{{token}}">
+ <button class="btn btn-lg btn-primary" type="submit">{{lang_save}}</button>
+ <button class="btn btn-lg btn-primary" type="reset">{{lang_reset}}</button>
+ <a class="btn btn-lg btn-primary" href="#" onclick="saveConfig()">Download</a>
+</form>
+<div>
+<form method="post" action="?do=BaseConfig_Partitions_CDN">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="reset">
+ <button class="btn btn-default" type="submit" onclick="return confirm('{{lang_resetConfirm}}');">{{lang_resetDefault}}</button>
+</form>
+</div>
+
+<!-- Create Partition Window -->
+<form action="?do=BaseConfig_Partitions_CDN" method="post">
+ <div class="modal fade" id="add-partition" tabindex="-1" role="dialog">
+ <div class="modal-dialog">
+
+ <div class="modal-content">
+ <div class="modal-header">{{lang_newPartition}}</div>
+ <div class="modal-body">
+
+ <div class="input-group">
+ <span class="input-group-addon">{{lang_partitionId}}</span>
+ <input name="new-partition-id" class="form-control" type="text">
+ </div>
+ <p class="help-block">{{lang_helpId}}</p>
+ <div class="input-group">
+ <span class="input-group-addon">{{lang_partitionSize}}</span>
+ <input name="new-partition-size" class="form-control" type="text">
+ </div>
+ <p class="help-block">{{lang_helpSize}}</p>
+ <div class="input-group">
+ <span class="input-group-addon">{{lang_partitionMountPoint}}</span>
+ <input name="new-partition-mount-point" class="form-control" type="text">
+ </div>
+ <p class="help-block">{{lang_helpMountPoint}}</p>
+ <div class="input-group">
+ <span class="input-group-addon">{{lang_partitionOptions}}</span>
+ <input name="new-partition-options" class="form-control" type="text">
+ </div>
+ <p class="help-block">{{lang_helpOptions}}</p>
+ <input type="submit" class="btn btn-primary" value="{{lang_create}}">
+ </div>
+ <div class="modal-footer"><a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a></div>
+ </div>
+ </div>
+ </div>
+ <input type="hidden" name="action" value="new_partition">
+ <input type="hidden" name="token" value="{{token}}">
+</form>
+<script type="text/javascript">
+ document.getElementById("cat-extra-6").innerHTML = "<div class='list-group'> <div class='list-group-item' style='background-color:#f5f5f5;color:#428bca;'> " +
+ "{{lang_catPartition}} <span style='display:inline-block; float: right; margin-top: -7px;'> <a class='btn btn-default ' data-toggle='modal' " +
+ "data-target='#add-partition'> <span class='glyphicon glyphicon-plus'></span> </a> </span> </div> {{#partitions}} <div class='list-group-item'> " +
+ "<div class='row'> <div class='col-md-1'> <input name='partition-{{id}}-partition_id' type='text' class='form-control' size='30' value='{{partition_id}}'" +
+ " placeholder='{{lang_partitionId}}' /> </div> <div class='col-md-1'> <input name='partition-{{id}}-size' type='text' class='form-control' size='30' " +
+ "value='{{size}}' placeholder='{{lang_partitionSize}}'/> </div> <div class='col-md-4'> <input name='partition-{{id}}-mount_point' type='text' " +
+ "class='form-control' size='30' value='{{mount_point}}' placeholder='{{lang_partitionMountPoint}}'/> </div> <div class='col-md-4'> <input " +
+ "name='partition-{{id}}-options' type='text' class='form-control' size='30' value='{{options}}' placeholder='{{lang_partitionOptions}}'/> </div> " +
+ "<div class='col-md-2'> <a class='btn btn-danger' href='?do=BaseConfig&deletePartition={{id}}&token={{token}}' ><span class='glyphicon glyphicon-trash'>" +
+ "</span> {{lang_delete}}</a> </div> </div> </div> {{/partitions}} </div> </div>";
+
+ function saveConfig(){
+ if(confirm('{{lang_confirm}}'))
+ window.location = 'api.php?do=baseconfig&user={{user}}&save=true';
+ else
+ window.location = 'api.php?do=baseconfig&user={{user}}';
+ }
+
+</script> \ No newline at end of file
diff --git a/modules-available/dozmod/hooks/main-warning.inc.php b/modules-available/dozmod/hooks/main-warning.inc.php
new file mode 100644
index 00000000..ffa87692
--- /dev/null
+++ b/modules-available/dozmod/hooks/main-warning.inc.php
@@ -0,0 +1,11 @@
+<?php
+
+/*
+ * Show notification in main window if there are images that should be deleted and are waiting for confirmation
+ */
+
+$res = Database::queryFirst("SELECT Count(*) AS cnt FROM sat.imageversion WHERE deletestate = 'SHOULD_DELETE'", array(), true);
+if (isset($res['cnt']) && $res['cnt'] > 0) {
+ Message::addInfo('dozmod.images-pending-delete-exist', true, $res['cnt']);
+}
+unset($res);
diff --git a/modules-available/dozmod/lang/de/messages.json b/modules-available/dozmod/lang/de/messages.json
index d6e39cbf..7944ffae 100644
--- a/modules-available/dozmod/lang/de/messages.json
+++ b/modules-available/dozmod/lang/de/messages.json
@@ -1,4 +1,5 @@
{
"delete-images": "L\u00f6schung: {{0}}",
+ "images-pending-delete-exist": "Zur L\u00f6schung markierte Abbilder: {{0}}",
"mail-config-saved": "Mail-Konfiguration gespeichert"
} \ No newline at end of file
diff --git a/modules-available/dozmod/lang/en/messages.json b/modules-available/dozmod/lang/en/messages.json
index a3c94a56..6651e32e 100644
--- a/modules-available/dozmod/lang/en/messages.json
+++ b/modules-available/dozmod/lang/en/messages.json
@@ -1,4 +1,5 @@
{
"delete-images": "Delete: {{0}}",
+ "images-pending-delete-exist": "Images marked for deletion: {{0}}",
"mail-config-saved": "Mail config saved"
} \ No newline at end of file
diff --git a/script/chart.min.js b/modules-available/js_chart/clientscript.js
index 3a0a2c87..3a0a2c87 100644
--- a/script/chart.min.js
+++ b/modules-available/js_chart/clientscript.js
diff --git a/modules-available/js_chart/config.json b/modules-available/js_chart/config.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/modules-available/js_chart/config.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/script/circles.min.js b/modules-available/js_circles/clientscript.js
index 0fc701eb..0fc701eb 100644
--- a/script/circles.min.js
+++ b/modules-available/js_circles/clientscript.js
diff --git a/modules-available/js_circles/config.json b/modules-available/js_circles/config.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/modules-available/js_circles/config.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/modules-available/main/lang/de/global-tags.json b/modules-available/main/lang/de/global-tags.json
index 39236fd4..a8fa0034 100644
--- a/modules-available/main/lang/de/global-tags.json
+++ b/modules-available/main/lang/de/global-tags.json
@@ -2,8 +2,10 @@
"lang_back": "Zur\u00fcck",
"lang_cancel": "Abbrechen",
"lang_close": "Schlie\u00dfen",
+ "lang_days": "Tag(e)",
"lang_delete": "L\u00f6schen",
"lang_hint": "Hinweis",
+ "lang_hours": "Stunde(n)",
"lang_next": "Weiter",
"lang_save": "Speichern",
"lang_today": "Heute",
diff --git a/modules-available/main/lang/de/template-tags.json b/modules-available/main/lang/de/template-tags.json
index b299cbad..c11843a0 100644
--- a/modules-available/main/lang/de/template-tags.json
+++ b/modules-available/main/lang/de/template-tags.json
@@ -1,6 +1,5 @@
{
- "lang_bootMenuWarning": "Das Bootmen\u00fc ist veraltet oder wurde noch nicht generiert.",
- "lang_configure": "Konfigurieren",
+ "lang_goTo": "Gehe zu",
"lang_intro": "Dies ist die bwLehrpool Konfigurationsoberfl\u00e4che.",
"lang_introGuest": "Dies ist das Administrations-Interface der lokalen bwLehrpool-Installation. Bitte authentifizieren Sie sich, um Einstellungen vorzunehmen.",
"lang_language": "Sprachen",
@@ -8,16 +7,11 @@
"lang_loggedInSuffix": " ",
"lang_login": "Anmelden",
"lang_logout": "Abmelden",
- "lang_minilinuxMissing": "Wichtige Dateien der MiniLinux-Installation fehlen.",
"lang_needsSetup": "Einrichtung unvollst\u00e4ndig",
"lang_noExistingAccount": "Es existiert noch kein Administrator-Zugang f\u00fcr diesen Satelliten-Server.",
- "lang_numerOfImagesMarkedForDeletion": "Zur L\u00f6schung markierte Abbilder",
"lang_register": "Registrieren",
- "lang_systemConfiguration": "Systemkonfiguration",
- "lang_systemConfigurationNotChosen": "Es wurde noch keine Systemkonfiguration ausgew\u00e4hlt.",
"lang_toggleNavigation": "Navigation ein\/ausblenden",
"lang_translations": "\u00dcbersetzungen",
- "lang_vmLocationNotSet": "Es ist noch kein Speicherort f\u00fcr die Virtuellen Maschinen festgelegt.",
"lang_warning": "Warnung",
"lang_warningDebug": "Debugmodus aktiv!",
"lang_welcome": "Willkommen"
diff --git a/modules-available/main/lang/en/global-tags.json b/modules-available/main/lang/en/global-tags.json
index 10581ae2..181f600a 100644
--- a/modules-available/main/lang/en/global-tags.json
+++ b/modules-available/main/lang/en/global-tags.json
@@ -2,8 +2,10 @@
"lang_back": "Back",
"lang_cancel": "Cancel",
"lang_close": "Close",
+ "lang_days": "day(s)",
"lang_delete": "Delete",
"lang_hint": "Hint",
+ "lang_hours": "hour(s)",
"lang_next": "Next",
"lang_save": "Save",
"lang_today": "Today",
diff --git a/modules-available/main/lang/en/template-tags.json b/modules-available/main/lang/en/template-tags.json
index be03e53e..fcb34031 100644
--- a/modules-available/main/lang/en/template-tags.json
+++ b/modules-available/main/lang/en/template-tags.json
@@ -1,6 +1,5 @@
{
- "lang_bootMenuWarning": "The boot menu is outdated or has not been generated.",
- "lang_configure": "Configure",
+ "lang_goTo": "Gehe zu",
"lang_intro": "This is the bwLehrpool configuration interface.",
"lang_introGuest": "This is the administration interface of the local bwLehrpool intallation. Please authenticate yourself to adjust settings.",
"lang_language": "Language",
@@ -8,16 +7,11 @@
"lang_loggedInSuffix": " ",
"lang_login": "Login",
"lang_logout": "Logout",
- "lang_minilinuxMissing": "Important files from the mini Linux installation are missing.",
"lang_needsSetup": "Setup incomplete",
"lang_noExistingAccount": "No account has been created yet. Sign up to become the administrator.",
- "lang_numerOfImagesMarkedForDeletion": "Images marked for deletion",
"lang_register": "Register",
- "lang_systemConfiguration": "System Configuration",
- "lang_systemConfigurationNotChosen": "A system configuration has not been chosen yet.",
"lang_toggleNavigation": "toggle navigation",
"lang_translations": "Translations",
- "lang_vmLocationNotSet": "A location for the virtual machine is not set yet.",
"lang_warning": "Warning",
"lang_warningDebug": "Debug mode active!",
"lang_welcome": "Welcome"
diff --git a/modules-available/main/page.inc.php b/modules-available/main/page.inc.php
index 0a9acd81..bd50a5d1 100644
--- a/modules-available/main/page.inc.php
+++ b/modules-available/main/page.inc.php
@@ -3,24 +3,9 @@
class Page_Main extends Page
{
- private $sysconfig;
- private $minilinux;
- private $vmstore;
- private $ipxe;
- private $delPending;
-
protected function doPreprocess()
{
User::load();
- if (User::isLoggedIn()) {
- $this->sysconfig = !file_exists(CONFIG_HTTP_DIR . '/default/config.tgz');
- $this->minilinux = !file_exists(CONFIG_HTTP_DIR . '/default/kernel') || !file_exists(CONFIG_HTTP_DIR . '/default/initramfs-stage31') || !file_exists(CONFIG_HTTP_DIR . '/default/stage32.sqfs');
- $this->vmstore = !is_array(Property::getVmStoreConfig());
- $this->ipxe = !preg_match('/^\d+\.\d+\.\d+\.\d+$/', Property::getServerIp());
- Property::setNeedsSetup(($this->sysconfig || $this->minilinux || $this->vmstore || $this->ipxe) ? 1 : 0);
- $res = Database::queryFirst("SELECT Count(*) AS cnt FROM sat.imageversion WHERE deletestate = 'SHOULD_DELETE'", array(), true);
- $this->delPending = isset($res['cnt']) ? $res['cnt'] : 0;
- }
}
protected function doRender()
@@ -33,24 +18,21 @@ class Page_Main extends Page
}
// Logged in here
- // Load news
- $lines = array();
- $paginate = new Paginate("SELECT newsid, dateline, title, content FROM news ORDER BY dateline DESC", 10);
- $res = $paginate->exec();
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if(count($lines) >= 3) break;
- $lines[] = $row;
- }
-
Render::addTemplate('page-main', array(
- 'user' => User::getName(),
- 'sysconfig' => $this->sysconfig,
- 'minilinux' => $this->minilinux,
- 'vmstore' => $this->vmstore,
- 'ipxe' => $this->ipxe,
- 'delpending' => $this->delPending,
- 'news' => $lines
+ 'user' => User::getName()
));
+
+ // Warnings
+ $needSetup = false;
+ foreach (glob('modules/*/hooks/main-warning.inc.php') as $file) {
+ preg_match('#^modules/([^/]+)/#', $file, $out);
+ if (!Module::isAvailable($out[1]))
+ continue;
+ include $file;
+ }
+
+ // Update warning state
+ Property::setNeedsSetup($needSetup ? 1 : 0);
}
protected function doAjax()
diff --git a/modules-available/main/templates/messagebox-error.html b/modules-available/main/templates/messagebox-error.html
deleted file mode 100644
index 873716c9..00000000
--- a/modules-available/main/templates/messagebox-error.html
+++ /dev/null
@@ -1 +0,0 @@
-<div class="alert alert-danger"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> {{{message}}}</div>
diff --git a/modules-available/main/templates/messagebox-info.html b/modules-available/main/templates/messagebox-info.html
deleted file mode 100644
index eb9d518a..00000000
--- a/modules-available/main/templates/messagebox-info.html
+++ /dev/null
@@ -1 +0,0 @@
-<div class="alert alert-info"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> {{{message}}}</div>
diff --git a/modules-available/main/templates/messagebox-success.html b/modules-available/main/templates/messagebox-success.html
deleted file mode 100644
index 93674d69..00000000
--- a/modules-available/main/templates/messagebox-success.html
+++ /dev/null
@@ -1 +0,0 @@
-<div class="alert alert-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> {{{message}}}</div>
diff --git a/modules-available/main/templates/messagebox-warning.html b/modules-available/main/templates/messagebox-warning.html
deleted file mode 100644
index b02e2e8a..00000000
--- a/modules-available/main/templates/messagebox-warning.html
+++ /dev/null
@@ -1 +0,0 @@
-<div class="alert alert-warning"><span class="glyphicon glyphicon-warning" aria-hidden="true"></span> {{{message}}}</div>
diff --git a/modules-available/main/templates/messagebox.html b/modules-available/main/templates/messagebox.html
new file mode 100644
index 00000000..45d5d8f6
--- /dev/null
+++ b/modules-available/main/templates/messagebox.html
@@ -0,0 +1,7 @@
+<div class="alert alert-{{type}}">
+ <span class="glyphicon glyphicon-{{icon}}" aria-hidden="true"></span>
+ {{#link}}
+ <a class="pull-right" href="?do={{link}}">{{lang_goTo}} &raquo;</a>
+ {{/link}}
+ {{{message}}}
+</div>
diff --git a/modules-available/main/templates/page-main.html b/modules-available/main/templates/page-main.html
index 39e4e74e..a0b2d3b0 100644
--- a/modules-available/main/templates/page-main.html
+++ b/modules-available/main/templates/page-main.html
@@ -3,34 +3,3 @@
<p>{{lang_intro}}</p>
</div>
-<ul class="list-group">
-{{#vmstore}}
- <li class="list-group-item list-group-item-text">
- {{lang_vmLocationNotSet}}
- <a class="btn btn-sm btn-primary" href="?do=VmStore">{{lang_configure}} &raquo;</a>
- </li>
-{{/vmstore}}
-{{#ipxe}}
- <li class="list-group-item list-group-item-text">
- {{lang_bootMenuWarning}}
- <a class="btn btn-sm btn-primary" href="?do=ServerSetup">{{lang_configure}} &raquo;</a>
- </li>
-{{/ipxe}}
-{{#minilinux}}
- <li class="list-group-item list-group-item-text">
- {{lang_minilinuxMissing}}
- <a class="btn btn-sm btn-primary" href="?do=MiniLinux">MiniLinux &raquo;</a>
- </li>
-{{/minilinux}}
-{{#sysconfig}}
- <li class="list-group-item list-group-item-text">
- {{lang_systemConfigurationNotChosen}}
- <a class="btn btn-sm btn-primary" href="?do=SysConfig">{{lang_systemConfiguration}} &raquo;</a>
- </li>
-{{/sysconfig}}
-{{#delpending}}
- <li class="list-group-item list-group-item-text">
- <a href="?do=DozMod">{{lang_numerOfImagesMarkedForDeletion}}: {{delpending}}</a>
- </li>
-{{/delpending}}
-</ul>
diff --git a/modules-available/minilinux/hooks/main-warning.inc.php b/modules-available/minilinux/hooks/main-warning.inc.php
new file mode 100644
index 00000000..2056bbbf
--- /dev/null
+++ b/modules-available/minilinux/hooks/main-warning.inc.php
@@ -0,0 +1,6 @@
+<?php
+
+if (!file_exists(CONFIG_HTTP_DIR . '/default/kernel') || !file_exists(CONFIG_HTTP_DIR . '/default/initramfs-stage31') || !file_exists(CONFIG_HTTP_DIR . '/default/stage32.sqfs')) {
+ Message::addError('minilinux.please-download-minilinux');
+ $needSetup = true;
+} \ No newline at end of file
diff --git a/modules-available/minilinux/lang/de/messages.json b/modules-available/minilinux/lang/de/messages.json
new file mode 100644
index 00000000..c91772c7
--- /dev/null
+++ b/modules-available/minilinux/lang/de/messages.json
@@ -0,0 +1,3 @@
+{
+ "please-download-minilinux": "Wichtige Dateien der MiniLinux-Installation fehlen."
+} \ No newline at end of file
diff --git a/modules-available/minilinux/lang/en/messages.json b/modules-available/minilinux/lang/en/messages.json
new file mode 100644
index 00000000..8d7fa76d
--- /dev/null
+++ b/modules-available/minilinux/lang/en/messages.json
@@ -0,0 +1,3 @@
+{
+ "please-download-minilinux": "Important files from the mini Linux installation are missing."
+} \ No newline at end of file
diff --git a/modules-available/serversetup/config.json b/modules-available/serversetup-bwlp/config.json
index f2abe27c..f2abe27c 100644
--- a/modules-available/serversetup/config.json
+++ b/modules-available/serversetup-bwlp/config.json
diff --git a/modules-available/serversetup/lang/de/messages.json b/modules-available/serversetup-bwlp/lang/de/messages.json
index cb0b229d..cb0b229d 100644
--- a/modules-available/serversetup/lang/de/messages.json
+++ b/modules-available/serversetup-bwlp/lang/de/messages.json
diff --git a/modules-available/serversetup/lang/de/module.json b/modules-available/serversetup-bwlp/lang/de/module.json
index eb777343..eb777343 100644
--- a/modules-available/serversetup/lang/de/module.json
+++ b/modules-available/serversetup-bwlp/lang/de/module.json
diff --git a/modules-available/serversetup/lang/de/template-tags.json b/modules-available/serversetup-bwlp/lang/de/template-tags.json
index bdbcb1ec..bdbcb1ec 100644
--- a/modules-available/serversetup/lang/de/template-tags.json
+++ b/modules-available/serversetup-bwlp/lang/de/template-tags.json
diff --git a/modules-available/serversetup/lang/en/messages.json b/modules-available/serversetup-bwlp/lang/en/messages.json
index d96be232..d96be232 100644
--- a/modules-available/serversetup/lang/en/messages.json
+++ b/modules-available/serversetup-bwlp/lang/en/messages.json
diff --git a/modules-available/serversetup/lang/en/module.json b/modules-available/serversetup-bwlp/lang/en/module.json
index aeea610c..aeea610c 100644
--- a/modules-available/serversetup/lang/en/module.json
+++ b/modules-available/serversetup-bwlp/lang/en/module.json
diff --git a/modules-available/serversetup/lang/en/template-tags.json b/modules-available/serversetup-bwlp/lang/en/template-tags.json
index af22081a..af22081a 100644
--- a/modules-available/serversetup/lang/en/template-tags.json
+++ b/modules-available/serversetup-bwlp/lang/en/template-tags.json
diff --git a/modules-available/serversetup/lang/pt/messages.json b/modules-available/serversetup-bwlp/lang/pt/messages.json
index 65745768..65745768 100644
--- a/modules-available/serversetup/lang/pt/messages.json
+++ b/modules-available/serversetup-bwlp/lang/pt/messages.json
diff --git a/modules-available/serversetup/lang/pt/module.json b/modules-available/serversetup-bwlp/lang/pt/module.json
index aeea610c..aeea610c 100644
--- a/modules-available/serversetup/lang/pt/module.json
+++ b/modules-available/serversetup-bwlp/lang/pt/module.json
diff --git a/modules-available/serversetup/lang/pt/template-tags.json b/modules-available/serversetup-bwlp/lang/pt/template-tags.json
index 3120c58c..3120c58c 100644
--- a/modules-available/serversetup/lang/pt/template-tags.json
+++ b/modules-available/serversetup-bwlp/lang/pt/template-tags.json
diff --git a/modules-available/serversetup/page.inc.php b/modules-available/serversetup-bwlp/page.inc.php
index c48ccd3d..9a040178 100644
--- a/modules-available/serversetup/page.inc.php
+++ b/modules-available/serversetup-bwlp/page.inc.php
@@ -3,10 +3,10 @@
class Page_ServerSetup extends Page
{
- private $mountIpxeTask;
private $taskStatus;
private $currentAddress;
private $currentMenu;
+ private $hasIpSet = false;
protected function doPreprocess()
{
@@ -19,14 +19,6 @@ class Page_ServerSetup extends Page
$this->currentMenu = Property::getBootMenu();
- if(Request::get('download') !== false){
- $this->downloadIpxe(Request::get('download'));
- }
-
- if(Request::get('defaultIpxe') !== false){
- $this->defaultIpxe(Request::get('defaultIpxe'));
- }
-
$action = Request::post('action');
if ($action === false) {
@@ -44,48 +36,30 @@ class Page_ServerSetup extends Page
// iPXE stuff changes
$this->updatePxeMenu();
}
-
- if($action === 'save-script') {
- // Save new iPXE script
- $this->updateIpxeScript();
- }
-
- if($action === 'default-script') {
- // Restore iPXE script to default
- $this->defaultIpxe();
- }
}
protected function doRender()
{
- Render::setTitle(Dictionary::translate('lang_serverConfiguration'));
$taskid = Request::any('taskid');
if ($taskid !== false && Taskmanager::isTask($taskid)) {
Render::addTemplate('ipxe_update', array('taskid' => $taskid));
}
- if (Request::get('advanced', 'false', 'string') === 'false') {
- Render::addTemplate('ipxe-smp');
- } else {
- Render::addTemplate('ipaddress', array(
- 'ips' => $this->taskStatus['data']['addresses']
- ));
- $data = $this->currentMenu;
- if (!isset($data['defaultentry']))
- $data['defaultentry'] = 'net';
- if ($data['defaultentry'] === 'net')
- $data['active-net'] = 'checked';
- if ($data['defaultentry'] === 'hdd')
- $data['active-hdd'] = 'checked';
- if ($data['defaultentry'] === 'custom')
- $data['active-custom'] = 'checked';
- //There is no $this->username and no pxe.embed, why do we need this?
- //Page won't load with lines below uncommented
- //$data['username'] = $this->username;
- //$data['script'] = file_get_contents("/opt/taskmanager/data/pxe.embed");
- Render::addTemplate('ipxe-adv', $data);
- }
+ Render::addTemplate('ipaddress', array(
+ 'ips' => $this->taskStatus['data']['addresses'],
+ 'chooseHintClass' => $this->hasIpSet ? '' : 'alert alert-danger'
+ ));
+ $data = $this->currentMenu;
+ if (!isset($data['defaultentry']))
+ $data['defaultentry'] = 'net';
+ if ($data['defaultentry'] === 'net')
+ $data['active-net'] = 'checked';
+ if ($data['defaultentry'] === 'hdd')
+ $data['active-hdd'] = 'checked';
+ if ($data['defaultentry'] === 'custom')
+ $data['active-custom'] = 'checked';
+ Render::addTemplate('ipxe', $data);
}
// -----------------------------------------------------------------------------------------------
@@ -112,6 +86,7 @@ class Page_ServerSetup extends Page
}
if ($this->currentAddress === $item['ip']) {
$item['default'] = true;
+ $this->hasIpSet = true;
}
$sortIp[] = $item['ip'];
}
@@ -162,33 +137,4 @@ class Page_ServerSetup extends Page
Util::redirect('?do=ServerSetup&taskid=' . $id);
}
- private function downloadIpxe($ipxe){
- $file = '/opt/taskmanager/data/ipxe/src/bin/ipxe.' . $ipxe;
- if (file_exists($file)) {
- header('Content-Description: File Transfer');
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename='.basename($file));
- header('Expires: 0');
- header('Cache-Control: must-revalidate');
- header('Pragma: public');
- header('Content-Length: ' . filesize($file));
- ob_clean();
- flush();
- readfile($file);
- exit();
- }
- }
-
- private function updateIpxeScript(){
- $newScript = Request::post('custom-script');
- file_put_contents("/opt/taskmanager/data/pxe.embed",$newScript);
- Util::redirect('?do=ServerSetup');
- }
-
- private function defaultIpxe(){
- $default = file_get_contents("/opt/taskmanager/data/pxe_default.embed");
- $default = str_replace("{{ip}}", "http://" . Property::getServerIp(), $default);
- file_put_contents("/opt/taskmanager/data/pxe.embed",$default);
- Util::redirect('?do=ServerSetup');
- }
}
diff --git a/modules-available/serversetup/templates/ipaddress.html b/modules-available/serversetup-bwlp/templates/ipaddress.html
index e4c1fba9..0b3b2ed7 100644
--- a/modules-available/serversetup/templates/ipaddress.html
+++ b/modules-available/serversetup-bwlp/templates/ipaddress.html
@@ -1,12 +1,11 @@
-<a class="btn btn-default" href="?do=Serversetup&amp;advanced=false" role="button"><strong>{{lang_ipxeSmp}}</strong></a></br></br>
<div class="panel panel-default">
<div class="panel-heading">
{{lang_bootAddress}}
</div>
<div class="panel-body">
- <p>
+ <div class="{{chooseHintClass}}">
{{lang_chooseIP}}
- </p>
+ </div>
<form method="post" action="?do=ServerSetup">
<input type="hidden" name="action" value="ip">
<input type="hidden" name="token" value="{{token}}">
@@ -32,4 +31,4 @@
</p>
</form>
</div>
-</div>
+</div> \ No newline at end of file
diff --git a/modules-available/serversetup-bwlp/templates/ipxe.html b/modules-available/serversetup-bwlp/templates/ipxe.html
new file mode 100644
index 00000000..4539624b
--- /dev/null
+++ b/modules-available/serversetup-bwlp/templates/ipxe.html
@@ -0,0 +1,70 @@
+<form method="post" action="?do=ServerSetup">
+ <input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;">
+ <input type="password" name="password_fake" id="password_fake" value="" style="display:none;">
+ <input type="hidden" name="action" value="ipxe">
+ <input type="hidden" name="token" value="{{token}}">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_bootMenu}}
+ </div>
+ <div class="panel-body">
+ <p>
+ {{lang_bootInfo}}
+ </p>
+ <br>
+
+ <div class="form-group">
+ <strong>{{lang_bootBehavior}}</strong>
+ <div><label class="radio-inline"><input type="radio" name="defaultentry" value="net" {{active-net}}> bwLehrpool</label></div>
+ <div><label class="radio-inline"><input type="radio" name="defaultentry" value="hdd" {{active-hdd}}> {{lang_localHDD}}</label></div>
+ <div><label class="radio-inline"><input type="radio" name="defaultentry" value="custom" {{active-custom}}> {{lang_customEntry}} (&quot;custom&quot;)</label></div>
+ </div>
+
+ <div class="form-group">
+ <strong>{{lang_menuDisplayTime}}</strong>
+ <div class="input-group form-narrow">
+ <input type="text" class="form-control" name="timeout" value="{{timeout}}" pattern="\d+">
+ <span class="input-group-addon">{{lang_seconds}}</span>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <strong>{{lang_masterPassword}}</strong>
+ <div class="form-narrow">
+ <input type="{{password_type}}" class="form-control" name="masterpassword" value="{{masterpasswordclear}}">
+ </div>
+ <i>{{lang_masterPasswordHelp}}</i>
+ </div>
+
+ <div class="form-group">
+ <strong>{{lang_menuCustom}}</strong> <a class="btn btn-default btn-xs" data-toggle="modal" data-target="#help-custom"><span class="glyphicon glyphicon-question-sign"></span></a>
+ <textarea class="form-control" name="custom" rows="8">{{custom}}</textarea>
+ </div>
+ </div>
+
+ <div class="panel-footer">
+ <button class="btn btn-primary" name="action" value="ipxe">{{lang_bootMenuCreate}}</button>
+ </div>
+ </div>
+</form>
+
+<div class="modal fade" id="help-custom" tabindex="-1" role="dialog">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">{{lang_menuCustom}}</div>
+ <div class="modal-body">
+ {{lang_menuCustomHint1}}
+ <br>{{lang_example}}:
+ <pre>LABEL custom
+ MENU LABEL ^My Boot Entry
+ KERNEL http://1.2.3.4/kernel
+ INITRD http://1.2.3.4/initramfs-stage31
+ APPEND custom=option
+ IPAPPEND 3</pre>
+ {{lang_menuCustomHint2}} LABEL <strong>custom</strong>
+ {{lang_menuCustomHint3}}
+ </div>
+ <div class="modal-footer"><a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a></div>
+ </div>
+ </div>
+</div>
diff --git a/modules-available/serversetup/templates/ipxe_update.html b/modules-available/serversetup-bwlp/templates/ipxe_update.html
index 9c598667..9c598667 100644
--- a/modules-available/serversetup/templates/ipxe_update.html
+++ b/modules-available/serversetup-bwlp/templates/ipxe_update.html
diff --git a/modules-available/serversetup/templates/ipxe-adv.html b/modules-available/serversetup/templates/ipxe-adv.html
deleted file mode 100644
index 00e9fd3a..00000000
--- a/modules-available/serversetup/templates/ipxe-adv.html
+++ /dev/null
@@ -1,149 +0,0 @@
-<div class="panel panel-default">
- <div class="panel-heading">
- {{lang_mountIpxe}}
- </div>
- <div class="panel-body">
- <p>{{lang_ipxeInfo}}</p>
- <label for="ext">{{lang_extension}}:</label>
- <select name="ext" class="form-control">
- <option value="kkpxe">.kkpxe</option>
- <option value="usb">.usb</option>
- <option value="iso">.iso</option>
- </select>
- <br>
- <form method="post" action="?do=ServerSetup" style="display:inline;">
- <input type="hidden" name="action" value="save-script">
- <input type="hidden" name="token" value="{{token}}">
-
- <label for="custom-script">{{lang_customScript}}</label>
- <textarea class="form-control" name="custom-script" rows="9" style="resize:none">{{script}}</textarea>
- <br>
- <input class="btn btn-default btn-sm" type="submit" value="{{lang_saveScript}}" />
- </form>
- <form method="post" action="?do=ServerSetup" style="display:inline;">
- <input type="hidden" name="action" value="default-script">
- <input type="hidden" name="token" value="{{token}}">
- <input class="btn btn-default btn-sm" type="submit" value="{{lang_restoreDefault}}" />
- </form>
- </div>
- <div class="panel-footer">
- <button id="mount-button" onclick="mountIpxe();" class="btn btn-primary" type="button" data-toggle="modal" data-target="#ipxe-modal" data-backdrop="static"> {{lang_compile}}
- </button>
- </div>
-</div>
-
-<form method="post" action="?do=ServerSetup">
- <input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;">
- <input type="password" name="password_fake" id="password_fake" value="" style="display:none;">
- <input type="hidden" name="action" value="ipxe">
- <input type="hidden" name="token" value="{{token}}">
- <div class="panel panel-default">
- <div class="panel-heading">
- {{lang_bootMenu}}
- </div>
- <div class="panel-body">
- <p>
- {{lang_bootInfo}}
- </p>
- <br>
-
- <div class="form-group">
- <strong>{{lang_bootBehavior}}</strong>
- <div><label class="radio-inline"><input type="radio" name="defaultentry" value="net" {{active-net}}> bwLehrpool</label></div>
- <div><label class="radio-inline"><input type="radio" name="defaultentry" value="hdd" {{active-hdd}}> {{lang_localHDD}}</label></div>
- <div><label class="radio-inline"><input type="radio" name="defaultentry" value="custom" {{active-custom}}> {{lang_customEntry}} (&quot;custom&quot;)</label></div>
- </div>
-
- <div class="form-group">
- <strong>{{lang_menuDisplayTime}}</strong>
- <div class="input-group form-narrow">
- <input type="text" class="form-control" name="timeout" value="{{timeout}}" pattern="\d+">
- <span class="input-group-addon">{{lang_seconds}}</span>
- </div>
- </div>
-
- <div class="form-group">
- <strong>{{lang_masterPassword}}</strong>
- <div class="form-narrow">
- <input type="{{password_type}}" class="form-control" name="masterpassword" value="{{masterpasswordclear}}">
- </div>
- <i>{{lang_masterPasswordHelp}}</i>
- </div>
-
- <div class="form-group">
- <strong>{{lang_menuCustom}}</strong> <a class="btn btn-default btn-xs" data-toggle="modal" data-target="#help-custom"><span class="glyphicon glyphicon-question-sign"></span></a>
- <textarea class="form-control" name="custom" rows="8">{{custom}}</textarea>
- </div>
- </div>
-
- <div class="panel-footer">
- <button class="btn btn-primary" name="action" value="ipxe">{{lang_bootMenuCreate}}</button>
- </div>
- </div>
-</form>
-
-<div class="modal fade" id="help-custom" tabindex="-1" role="dialog">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">{{lang_menuCustom}}</div>
- <div class="modal-body">
- {{lang_menuCustomHint1}}
- <br>{{lang_example}}:
- <pre>LABEL custom
- MENU LABEL ^My Boot Entry
- KERNEL http://1.2.3.4/kernel
- INITRD http://1.2.3.4/initramfs-stage31
- APPEND custom=option
- IPAPPEND 3</pre>
- {{lang_menuCustomHint2}} LABEL <strong>custom</strong>
- {{lang_menuCustomHint3}}
- </div>
- <div class="modal-footer"><a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a></div>
- </div>
- </div>
-</div>
-
-<div class="modal fade" id="ipxe-modal" tabindex="-1" role="dialog" aria-labelledby="ipxe-modal-label" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
- <h4 class="modal-title" id="ipxe-modal-label">{{lang_compilingIpxe}}</h4>
- </div>
- <div class="modal-body" id="ipxe-modal-body">
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
- <button id="download-btn" type="button" class="btn btn-primary" disabled="disabled" onclick="downloadIpxe()">{{lang_download}}</button>
- </div>
- </div>
- </div>
-</div>
-
-<script>
- function mountIpxe() {
- document.getElementById('ipxe-modal-body').innerHTML = "<div class='alert alert-info' role='alert'>{{lang_ipxeWarning}}</div>"
- + "{{lang_loading}} <img src='fonts/loader.gif'/>";
- $("#download-btn").prop("disabled",true);
- var xmlhttp = new XMLHttpRequest();
- var extension = $("select[name=ext]").val();
- xmlhttp.open("GET","?do=ServerSetup&async=true&submitTask=true&extension=" + extension,true);
- xmlhttp.onreadystatechange= function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- var initResponse = xmlhttp.responseText;
- if(initResponse != "success")
- document.getElementById('ipxe-modal-body').innerHTML = initResponse;
- else {
- document.getElementById('ipxe-modal-body').innerHTML = "{{lang_success}}: ipxe." + extension;
- $("#download-btn").prop("disabled",false);
- }
- }
- }
- xmlhttp.send();
- }
-
- function downloadIpxe() {
- window.location = "?do=ServerSetup&download=" + $("select[name=ext]").val();
- }
-</script>
diff --git a/modules-available/serversetup/templates/ipxe-smp.html b/modules-available/serversetup/templates/ipxe-smp.html
deleted file mode 100644
index d126710c..00000000
--- a/modules-available/serversetup/templates/ipxe-smp.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<a class="btn btn-default" href="?do=Serversetup&amp;advanced=true" role="button"><strong>{{lang_ipxeAdv}}</strong></a></br></br>
-<div class="panel panel-default">
- <div class="panel-heading">
- {{lang_mountIpxe}}
- </div>
- <div class="panel-body">
- <p>{{lang_ipxeSmpInfo}}</p>
- <button id="mount-button" onclick="mountIpxe('iso');" class="btn btn-primary" type="button" data-toggle="modal" data-target="#ipxe-modal" data-backdrop="static"> {{lang_compileIso}}
- </button>
- <button id="mount-button" onclick="mountIpxe('usb');" class="btn btn-primary" type="button" data-toggle="modal" data-target="#ipxe-modal" data-backdrop="static"> {{lang_compileUsb}}
- </button>
- <br>
- </div>
-</div>
-
-
-<div class="modal fade" id="ipxe-modal" tabindex="-1" role="dialog" aria-labelledby="ipxe-modal-label" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
- <h4 class="modal-title" id="ipxe-modal-label">{{lang_compilingIpxe}}</h4>
- </div>
- <div class="modal-body" id="ipxe-modal-body">
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
- <button id="download-btn" type="button" class="btn btn-primary" disabled="disabled" onclick="downloadIpxe()">{{lang_download}}</button>
- </div>
- </div>
- </div>
-</div>
-
-<script>
- function mountIpxe(extension) {
- document.getElementById('ipxe-modal-body').innerHTML = "<div class='alert alert-info' role='alert'>{{lang_ipxeWarning}}</div>"
- + "{{lang_loading}} <img src='fonts/loader.gif'/>";
- $("#download-btn").prop("disabled",true);
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open("GET","?do=ServerSetup&async=true&submitTask=true&extension=" + extension,true);
- xmlhttp.onreadystatechange= function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- var initResponse = xmlhttp.responseText;
- if(initResponse != "success")
- document.getElementById('ipxe-modal-body').innerHTML = initResponse;
- else {
- document.getElementById('ipxe-modal-body').innerHTML = "{{lang_success}}: ipxe." + extension;
- document.getElementById('download-btn').setAttribute('onclick','downloadIpxe(\''+extension+'\')');
- $("#download-btn").prop("disabled",false);
- }
- }
- }
- xmlhttp.send();
- }
-
- function downloadIpxe(extension) {
- console.log("TESTE");
- console.log(extension);
- window.location = "?do=ServerSetup&download=" + extension;
- }
-</script>
diff --git a/modules-available/statistics/config.json b/modules-available/statistics/config.json
index b0123727..ab71ddbd 100644
--- a/modules-available/statistics/config.json
+++ b/modules-available/statistics/config.json
@@ -1,5 +1,5 @@
{
"category":"main.status",
- "enabled":"true",
+ "dependencies": [ "js_chart" ],
"permission":"0"
}
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php
index f21f0db9..a896b7a6 100644
--- a/modules-available/statistics/page.inc.php
+++ b/modules-available/statistics/page.inc.php
@@ -49,7 +49,6 @@ class Page_Statistics extends Page
$this->showMachineList($filter, $argument);
return;
}
- Render::addScriptBottom('chart.min');
Render::openTag('div', array('class' => 'row'));
$this->showSummary();
$this->showMemory();
@@ -548,7 +547,6 @@ class Page_Statistics extends Page
Render::addTemplate('machine-usage', $spans);
// Any hdds?
if (!empty($hdds['hdds'])) {
- Render::addScriptBottom('chart.min');
Render::addTemplate('machine-hdds', $hdds);
}
// Client log
diff --git a/modules-available/sysconfig/addmodule_branding.inc.php b/modules-available/sysconfig/addmodule_branding.inc.php
index cb5609e6..84602614 100644
--- a/modules-available/sysconfig/addmodule_branding.inc.php
+++ b/modules-available/sysconfig/addmodule_branding.inc.php
@@ -9,7 +9,6 @@ class Branding_Start extends AddModule_Base
protected function renderInternal()
{
- Render::addScriptBottom('fileselect');
Render::addDialog(Dictionary::translate('config-module', 'branding_title'), false, 'branding-start', array(
'step' => 'Branding_ProcessFile',
'edit' => $this->edit ? $this->edit->id() : false
diff --git a/modules-available/sysconfig/addmodule_custommodule.inc.php b/modules-available/sysconfig/addmodule_custommodule.inc.php
index d08cc5fb..3f112c95 100644
--- a/modules-available/sysconfig/addmodule_custommodule.inc.php
+++ b/modules-available/sysconfig/addmodule_custommodule.inc.php
@@ -12,7 +12,6 @@ class CustomModule_Start extends AddModule_Base
protected function renderInternal()
{
Session::set('mod_temp', false);
- Render::addScriptBottom('fileselect');
Render::addDialog(Dictionary::translate('config-module', 'custom_title'), false, 'custom-upload', array(
'step' => 'CustomModule_ProcessUpload',
'edit' => $this->edit ? $this->edit->id() : false
diff --git a/modules-available/sysconfig/clientscript.js b/modules-available/sysconfig/clientscript.js
new file mode 100644
index 00000000..2a133353
--- /dev/null
+++ b/modules-available/sysconfig/clientscript.js
@@ -0,0 +1,21 @@
+
+function forceTable(t)
+{
+ var pwidth = t.parent().innerWidth();
+ var rows = t.find('tr');
+ var row = rows.first();
+ pwidth = Math.round(pwidth);
+ t.width(pwidth);
+ var sum = 0;
+ row.find('td').each(function() {
+ if (!$(this).hasClass('slx-width-ignore'))
+ sum += $(this).outerWidth(true);
+ });
+ var w = Math.round(pwidth - sum);
+ do {
+ rows.find('.slx-dyn-ellipsis').each(function() {
+ $(this).width(w).css('width', w + 'px').css('max-width', w + 'px');
+ });
+ w -= 3;
+ } while (t.width() > pwidth);
+}
diff --git a/modules-available/sysconfig/hooks/main-warning.inc.php b/modules-available/sysconfig/hooks/main-warning.inc.php
new file mode 100644
index 00000000..e5bc592f
--- /dev/null
+++ b/modules-available/sysconfig/hooks/main-warning.inc.php
@@ -0,0 +1,6 @@
+<?php
+
+if (!file_exists(CONFIG_HTTP_DIR . '/default/config.tgz')) {
+ Message::addError('sysconfig.no-noconfig-active', true);
+ $needSetup = true;
+} \ No newline at end of file
diff --git a/modules-available/sysconfig/inc/configmodule.inc.php b/modules-available/sysconfig/inc/configmodule.inc.php
index 7b92ff89..9fc3db21 100644
--- a/modules-available/sysconfig/inc/configmodule.inc.php
+++ b/modules-available/sysconfig/inc/configmodule.inc.php
@@ -118,7 +118,7 @@ abstract class ConfigModule
* Get module instances from module type.
*
* @param int $moduleType module type to get
- * @return array The requested modules from DB, or false on error
+ * @return \ConfigModule[] The requested modules from DB, or false on error
*/
public static function getAll($moduleType = false)
{
diff --git a/modules-available/sysconfig/lang/de/messages.json b/modules-available/sysconfig/lang/de/messages.json
index 7993babd..e6203d3d 100644
--- a/modules-available/sysconfig/lang/de/messages.json
+++ b/modules-available/sysconfig/lang/de/messages.json
@@ -1,20 +1,21 @@
{
+ "config-activated": "Konfiguration {{0}} wurde aktiviert",
+ "config-invalid": "Konfiguration mit ID {{0}} existiert nicht",
"invalid-action": "Ung\u00fcltige Aktion: {{0}}",
+ "missing-file": "Es wurde keine Datei ausgew\u00e4hlt!",
"missing-title": "Kein Titel eingegeben",
- "module-edited": "Modul wurde aktualisiert",
"module-added": "Modul erfolgreich hinzugef\u00fcgt",
- "replacing-config": "Ersetzen von Konfiguration {{0}}",
- "missing-file": "Es wurde keine Datei ausgew\u00e4hlt!",
- "unsuccessful-action": "Nicht erfolgreich",
- "upload-failed": "Upload schlug fehl: {{0}}",
- "remote-timeout": "Konnte Ressource {{0}} nicht herunterladen ({{1}})",
- "no-image": "Unter der angegebenen URL konnte kein SVG-Bild gefunden werden",
- "replacing-module": "Ersetzen von Modul {{0}}",
- "config-invalid": "Konfiguration mit ID {{0}} existiert nicht",
- "config-activated": "Konfiguration {{0}} wurde aktiviert",
- "module-rebuilt": "Modul wurde neu generiert",
+ "module-deleted": "Modul {{0}} wurde gel\u00f6scht",
+ "module-edited": "Modul wurde aktualisiert",
+ "module-in-use": "Modul {{0}} wird noch durch Konfiguration {{1}} verwendet",
"module-rebuild-failed": "Neubau des Moduls fehlgeschlagen",
"module-rebuilding": "Modul wird neu generiert",
- "module-in-use": "Modul {{0}} wird noch durch Konfiguration {{1}} verwendet",
- "module-deleted": "Modul {{0}} wurde gel\u00f6scht"
+ "module-rebuilt": "Modul wurde neu generiert",
+ "no-image": "Unter der angegebenen URL konnte kein SVG-Bild gefunden werden",
+ "no-noconfig-active": "Es wurde noch keine Systemkonfiguration ausgew\u00e4hlt.",
+ "remote-timeout": "Konnte Ressource {{0}} nicht herunterladen ({{1}})",
+ "replacing-config": "Ersetzen von Konfiguration {{0}}",
+ "replacing-module": "Ersetzen von Modul {{0}}",
+ "unsuccessful-action": "Nicht erfolgreich",
+ "upload-failed": "Upload schlug fehl: {{0}}"
} \ No newline at end of file
diff --git a/modules-available/sysconfig/lang/en/messages.json b/modules-available/sysconfig/lang/en/messages.json
index fc3c1160..a4aa8dc1 100644
--- a/modules-available/sysconfig/lang/en/messages.json
+++ b/modules-available/sysconfig/lang/en/messages.json
@@ -1,20 +1,21 @@
{
+ "config-activated": "Configuration {{0}} has been activated",
+ "config-invalid": "Configuration with id {{0}} does not exist",
"invalid-action": "Invalid action: {{0}}",
+ "missing-file": "There was no file selected!",
"missing-title": "No title given",
- "module-edited": "Module has been edited",
"module-added": "Module successfully added",
- "replacing-config": "Replace config {{0}}",
- "missing-file": "There was no file selected!",
- "unsuccessful-action": "Not successful",
- "upload-failed": "Upload failed: {{0}}",
- "remote-timeout": "Could not download resource {{0}} ({{1}})",
- "no-image": "Could not find an SVG-image at the given URL",
- "replacing-module": "Replace module {{0}}",
- "config-invalid": "Configuration with id {{0}} does not exist",
- "config-activated": "Configuration {{0}} has been activated",
- "module-rebuilt": "Module was rebuilt",
+ "module-deleted": "Module {{0}} was deleted",
+ "module-edited": "Module has been edited",
+ "module-in-use": "Module {{0}} is still used by Configuration {{1}}",
"module-rebuild-failed": "Rebuilding module failed",
"module-rebuilding": "Module is rebuilding...",
- "module-in-use": "Module {{0}} is still used by Configuration {{1}}",
- "module-deleted": "Module {{0}} was deleted"
+ "module-rebuilt": "Module was rebuilt",
+ "no-image": "Could not find an SVG-image at the given URL",
+ "no-noconfig-active": "No system configuration created\/selected yet.",
+ "remote-timeout": "Could not download resource {{0}} ({{1}})",
+ "replacing-config": "Replace config {{0}}",
+ "replacing-module": "Replace module {{0}}",
+ "unsuccessful-action": "Not successful",
+ "upload-failed": "Upload failed: {{0}}"
} \ No newline at end of file
diff --git a/modules-available/sysconfig/page.inc.php b/modules-available/sysconfig/page.inc.php
index 3f14a95d..efe34136 100644
--- a/modules-available/sysconfig/page.inc.php
+++ b/modules-available/sysconfig/page.inc.php
@@ -175,7 +175,6 @@ class Page_SysConfig extends Page
'modules' => $modules,
'havemodules' => (count($modules) > 0)
));
- Render::addScriptTop('custom');
Render::addFooter('<script> $(window).load(function (e) {
forceTable($("#modtable"));
forceTable($("#conftable"));
diff --git a/script/bootstrap-tagsinput.min.js b/modules-available/syslog/clientscript.js
index 3d652628..3d652628 100644
--- a/script/bootstrap-tagsinput.min.js
+++ b/modules-available/syslog/clientscript.js
diff --git a/modules-available/syslog/page.inc.php b/modules-available/syslog/page.inc.php
index ea73d1b9..486e0248 100644
--- a/modules-available/syslog/page.inc.php
+++ b/modules-available/syslog/page.inc.php
@@ -15,9 +15,6 @@ class Page_SysLog extends Page
protected function doRender()
{
- Render::setTitle('Client Log');
- Render::addScriptBottom('bootstrap-tagsinput.min');
-
if (isset($_GET['filter'])) {
$filter = $_GET['filter'];
$not = isset($_GET['not']) ? 'NOT' : '';
diff --git a/style/bootstrap-tagsinput.css b/modules-available/syslog/style.css
index 98cfa7f3..98cfa7f3 100644
--- a/style/bootstrap-tagsinput.css
+++ b/modules-available/syslog/style.css
diff --git a/modules-available/systemstatus/config.json b/modules-available/systemstatus/config.json
index 650ab2fe..e78484d8 100644
--- a/modules-available/systemstatus/config.json
+++ b/modules-available/systemstatus/config.json
@@ -1,4 +1,5 @@
{
"category":"main.status",
- "enabled":"true"
+ "enabled":"true",
+ "dependencies": [ "js_circles" ]
}
diff --git a/modules-available/systemstatus/page.inc.php b/modules-available/systemstatus/page.inc.php
index 9f892957..cf80d1cc 100644
--- a/modules-available/systemstatus/page.inc.php
+++ b/modules-available/systemstatus/page.inc.php
@@ -29,8 +29,6 @@ class Page_SystemStatus extends Page
if (is_array($this->rebootTask) && isset($this->rebootTask['id'])) {
$data['rebootTask'] = $this->rebootTask['id'];
}
- Render::addScriptTop('custom');
- Render::addScriptBottom('circles.min');
Render::addTemplate('_page', $data);
}
@@ -184,7 +182,7 @@ class Page_SystemStatus extends Page
'uptime' => '???'
);
if (preg_match('/^(\d+)\D/', $uptime, $out)) {
- $data['uptime'] = floor($out[1] / 86400) . ' ' . Dictionary::translate('lang_days') . ', ' . floor(($out[1] % 86400) / 3600) . ' ' . Dictionary::translate('lang_hours'); // TODO: i18n
+ $data['uptime'] = floor($out[1] / 86400) . ' ' . Dictionary::translate('lang_days') . ', ' . floor(($out[1] % 86400) / 3600) . ' ' . Dictionary::translate('lang_hours');
}
$info = $this->sysInfo();
if (isset($info['MemTotal']) && isset($info['MemFree']) && isset($info['SwapTotal'])) {
diff --git a/modules-available/translation/page.inc.php b/modules-available/translation/page.inc.php
index 1fc3a0fe..5b2d24e1 100644
--- a/modules-available/translation/page.inc.php
+++ b/modules-available/translation/page.inc.php
@@ -721,6 +721,9 @@ class Page_Translation extends Page
$depth--;
}
}
+ // QnD special case for Message::add* using true as second param to add "go to" link.
+ if (preg_match('/^\s*,\s*true\b/i', $str))
+ return $count - 1;
return $count;
}
diff --git a/modules-available/vmstore/hooks/main-warning.inc.php b/modules-available/vmstore/hooks/main-warning.inc.php
new file mode 100644
index 00000000..ca2d1382
--- /dev/null
+++ b/modules-available/vmstore/hooks/main-warning.inc.php
@@ -0,0 +1,10 @@
+<?php
+
+/*
+ * Hook for main page: Show warning if vmstore not configured yet; set "warning" flag if so
+ */
+
+if (!is_array(Property::getVmStoreConfig())) {
+ Message::addError('vmstore.vmstore-not-configured', true); // Always specify module prefix since this is running in main
+ $needSetup = true; // Set $needSetup to true if you want a warning badge to appear in the menu
+}
diff --git a/modules-available/vmstore/lang/de/messages.json b/modules-available/vmstore/lang/de/messages.json
new file mode 100644
index 00000000..993d355d
--- /dev/null
+++ b/modules-available/vmstore/lang/de/messages.json
@@ -0,0 +1,3 @@
+{
+ "vmstore-not-configured": "Es ist noch kein Speicherort f\u00fcr die Virtuellen Maschinen festgelegt."
+} \ No newline at end of file
diff --git a/modules-available/vmstore/lang/en/messages.json b/modules-available/vmstore/lang/en/messages.json
new file mode 100644
index 00000000..9ac360eb
--- /dev/null
+++ b/modules-available/vmstore/lang/en/messages.json
@@ -0,0 +1,3 @@
+{
+ "vmstore-not-configured": "A location for the virtual machine is not set yet."
+} \ No newline at end of file
diff --git a/script/custom.js b/script/custom.js
deleted file mode 100644
index b2c5b2a7..00000000
--- a/script/custom.js
+++ /dev/null
@@ -1,32 +0,0 @@
-function loadContent(elem, source)
-{
- var waitForIt = function() {
- if (typeof $ === 'undefined') {
- setTimeout(waitForIt, 50);
- return;
- }
- $(elem).load(source);
- }
- waitForIt();
-}
-
-function forceTable(t)
-{
- var pwidth = t.parent().innerWidth();
- var rows = t.find('tr');
- var row = rows.first();
- pwidth = Math.round(pwidth);
- t.width(pwidth);
- var sum = 0;
- row.find('td').each(function() {
- if (!$(this).hasClass('slx-width-ignore'))
- sum += $(this).outerWidth(true);
- });
- var w = Math.round(pwidth - sum);
- do {
- rows.find('.slx-dyn-ellipsis').each(function() {
- $(this).width(w).css('width', w + 'px').css('max-width', w + 'px');
- });
- w -= 3;
- } while (t.width() > pwidth);
-} \ No newline at end of file
diff --git a/script/fileselect.js b/script/fileselect.js
index df4ff7b9..13711fd5 100644
--- a/script/fileselect.js
+++ b/script/fileselect.js
@@ -7,17 +7,11 @@ $(document).on('change', '.btn-file :file', function() {
$(document).ready(function() {
$('.btn-file :file').on('fileselect', function(event, numFiles, label) {
-
var input = $(this).parents('.upload-ex').find(':text');
var log = numFiles > 1 ? numFiles + ' files selected' : label;
-
if (input.length) {
input.val(log);
- } else {
- if (log)
- alert(log);
}
-
});
});