summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2014-05-28 18:18:34 +0200
committerSimon Rettberg2014-05-28 18:18:34 +0200
commite4e79982dd3c447a4ced762a6069db553e246f59 (patch)
treed17f74565ed5347350edeab412a07c77bd80a636
parentWIP (diff)
downloadslx-admin-e4e79982dd3c447a4ced762a6069db553e246f59.tar.gz
slx-admin-e4e79982dd3c447a4ced762a6069db553e246f59.tar.xz
slx-admin-e4e79982dd3c447a4ced762a6069db553e246f59.zip
Fixed some bugs from Sateserver v05
-rw-r--r--apis/update.inc.php58
-rw-r--r--inc/database.inc.php34
-rw-r--r--inc/message.inc.php2
-rw-r--r--inc/property.inc.php57
-rw-r--r--inc/trigger.inc.php4
-rw-r--r--modules/minilinux.inc.php68
-rw-r--r--modules/serversetup.inc.php21
-rw-r--r--modules/sysconfig.inc.php49
-rw-r--r--modules/sysconfig/addconfig.inc.php32
-rw-r--r--modules/sysconfig/addmodule.inc.php23
-rw-r--r--modules/sysconfig/addmodule_ad.inc.php9
-rw-r--r--modules/sysconfig/addmodule_custom.inc.php4
-rw-r--r--modules/vmstore.inc.php7
-rw-r--r--script/taskmanager.js10
-rw-r--r--templates/main-menu.html4
-rw-r--r--templates/minilinux/filelist.html2
-rw-r--r--templates/page-sysconfig-main.html7
-rw-r--r--templates/sysconfig/ad-checkconnection.html2
-rw-r--r--templates/sysconfig/cfg-start.html3
-rw-r--r--updates/v243
20 files changed, 216 insertions, 223 deletions
diff --git a/apis/update.inc.php b/apis/update.inc.php
new file mode 100644
index 00000000..4ec94882
--- /dev/null
+++ b/apis/update.inc.php
@@ -0,0 +1,58 @@
+<?php
+
+$targetVersion = 2;
+
+// #######################
+
+$res = Database::queryFirst("SELECT value FROM property WHERE name = 'webif-version' LIMIT 1", array(), true);
+
+$currentVersion = (int) ($res === false ? 1 : $res['value']);
+
+if ($currentVersion >= $targetVersion)
+ die('Up to date :-)');
+
+$function = 'update_' . $currentVersion;
+
+if (!function_exists($function))
+ die("Don't know how to update from version $currentVersion to $targetVersion :-(");
+
+if (!$function())
+ die("Update from $currentVersion to $targetVersion failed! :-(");
+
+$currentVersion++;
+
+$ret = Database::exec("INSERT INTO property (name, value) VALUES ('webif-version', :version)", array('version' => $currentVersion), true);
+if ($ret === false)
+ die('Writing version information back to DB failed. Next update will probably break.');
+
+if ($currentVersion < $targetVersion) {
+ Header('Location: api.php?do=update&random=' . mt_rand());
+ die("Updated to $currentVersion - press F5 to continue");
+}
+
+die("Updated to $currentVersion");
+
+// #######################
+
+// ##### 2014-05-28
+// Add dateline field to property table
+
+function update_1()
+{
+ $res = Database::simpleQuery("DESCRIBE property", array(), false);
+ $type = false;
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ if ($row['Field'] !== 'dateline') continue;
+ $type = $row['Type'];
+ break;
+ }
+ if ($type === false) {
+ Database::exec("ALTER TABLE `property` ADD `dateline` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `name` , ADD INDEX ( `dateline` )");
+ } else {
+ Database::exec("ALTER TABLE `property` CHANGE `dateline` `dateline` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'");
+ }
+ return true;
+}
+
+
+// ################ \ No newline at end of file
diff --git a/inc/database.inc.php b/inc/database.inc.php
index a646e823..e7a16ba1 100644
--- a/inc/database.inc.php
+++ b/inc/database.inc.php
@@ -6,6 +6,7 @@
*/
class Database
{
+
private static $dbh = false;
private static $statements = array();
@@ -14,7 +15,8 @@ class Database
*/
private static function init()
{
- if (self::$dbh !== false) return;
+ if (self::$dbh !== false)
+ return;
try {
self::$dbh = new PDO(CONFIG_SQL_DSN, CONFIG_SQL_USER, CONFIG_SQL_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
} catch (PDOException $e) {
@@ -26,24 +28,31 @@ class Database
* If you just need the first row of a query you can use this.
* Will return an associative array, or false if no row matches the query
*/
- public static function queryFirst($query, $args = array())
+ public static function queryFirst($query, $args = array(), $ignoreError = false)
{
- $res = self::simpleQuery($query, $args);
- if ($res === false) return false;
+ $res = self::simpleQuery($query, $args, $ignoreError);
+ if ($res === false)
+ return false;
return $res->fetch(PDO::FETCH_ASSOC);
}
+
/**
* Execute the given query and return the number of rows affected.
* Mostly useful for UPDATEs or INSERTs
+ *
+ * @param string $query Query to run
+ * @param array $args Arguments to query
+ * @return int|boolean Number of rows affected, or false on error
*/
- public static function exec($query, $args = array())
+ public static function exec($query, $args = array(), $ignoreError = false)
{
- $res = self::simpleQuery($query, $args);
- if ($res === false) return false;
+ $res = self::simpleQuery($query, $args, $ignoreError);
+ if ($res === false)
+ return false;
return $res->rowCount();
}
-
+
/**
* Get id (promary key) of last row inserted.
*
@@ -61,7 +70,7 @@ class Database
* still being valid. If you need to do something fancy, use Database::prepare
* @return \PDOStatement The query result object
*/
- public static function simpleQuery($query, $args = array())
+ public static function simpleQuery($query, $args = array(), $ignoreError = false)
{
self::init();
try {
@@ -71,11 +80,15 @@ class Database
self::$statements[$query]->closeCursor();
}
if (self::$statements[$query]->execute($args) === false) {
+ if ($ignoreError)
+ return false;
Util::traceError("Database Error: \n" . implode("\n", self::$statements[$query]->errorInfo()));
}
return self::$statements[$query];
} catch (Exception $e) {
- return false;
+ if ($ignoreError)
+ return false;
+ Util::traceError("Database Error: \n" . $e->getMessage());
}
}
@@ -90,4 +103,3 @@ class Database
}
}
-
diff --git a/inc/message.inc.php b/inc/message.inc.php
index 75292e09..b62f234f 100644
--- a/inc/message.inc.php
+++ b/inc/message.inc.php
@@ -93,6 +93,7 @@ class Message
public static function renderList()
{
global $error_text;
+ if (!self::$flushed) Render::openTag('div', array('class' => 'container'));
foreach (self::$list as $item) {
$message = $error_text[$item['id']];
foreach ($item['params'] as $index => $text) {
@@ -101,6 +102,7 @@ class Message
Render::addTemplate('messagebox-' . $item['type'], array('message' => $message));
self::$alreadyDisplayed[] = $item;
}
+ if (!self::$flushed) Render::closeTag('div');
self::$list = array();
self::$flushed = true;
}
diff --git a/inc/property.inc.php b/inc/property.inc.php
index 5c316517..77d2b985 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -6,8 +6,9 @@
*/
class Property
{
+
private static $cache = false;
-
+
/**
* Retrieve value from property store.
*
@@ -18,90 +19,96 @@ class Property
private static function get($key, $default = false)
{
if (self::$cache === false) {
+ if (mt_rand(1, 20) === 10) {
+ Database::exec("DELETE FROM property WHERE dateline <> 0 AND dateline < UNIX_TIMESTAMP()");
+ }
$res = Database::simpleQuery("SELECT name, value FROM property");
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
self::$cache[$row['name']] = $row['value'];
}
}
- if (!isset(self::$cache[$key])) return $default;
+ if (!isset(self::$cache[$key]))
+ return $default;
return self::$cache[$key];
}
-
+
/**
* Set value in property store.
*
* @param string $key key of value to set
* @param type $value the value to store for $key
+ * @param int minage how long to keep this entry around at least, in minutes. 0 for infinite
*/
- private static function set($key, $value)
+ private static function set($key, $value, $minage = 0)
{
- Database::exec("INSERT INTO property (name, value) VALUES (:key, :value)"
- . " ON DUPLICATE KEY UPDATE value = VALUES(value)", array(
- 'key' => $key,
- 'value' => $value
- ));
+ Database::exec("INSERT INTO property (name, value, dateline) VALUES (:key, :value, :dateline)"
+ . " ON DUPLICATE KEY UPDATE value = VALUES(value), dateline = VALUES(dateline)", array(
+ 'key' => $key,
+ 'value' => $value,
+ 'dateline' => time() + ($minage * 60)
+ ));
if (self::$cache !== false) {
self::$cache[$key] = $value;
}
}
-
+
public static function getServerIp()
{
return self::get('server-ip', 'none');
}
-
+
public static function setServerIp($value)
{
self::set('server-ip', $value);
}
-
+
public static function getIPxeIp()
{
- return self::get('ipxe-ip', 'none');
+ return self::get('ipxe-ip', 'not-set');
}
-
+
public static function setIPxeIp($value)
{
self::set('ipxe-ip', $value);
}
-
+
public static function getIPxeTaskId()
{
return self::get('ipxe-task');
}
-
+
public static function setIPxeTaskId($value)
{
self::set('ipxe-task', $value);
}
-
+
public static function getBootMenu()
{
return json_decode(self::get('ipxe-menu'), true);
}
-
+
public static function setBootMenu($value)
{
self::set('ipxe-menu', json_encode($value));
}
-
+
public static function getVersionCheckTaskId()
{
return self::get('versioncheck-task');
}
-
+
public static function setVersionCheckTaskId($value)
{
self::set('versioncheck-task', $value);
}
-
+
public static function getVersionCheckInformation()
{
$data = json_decode(self::get('versioncheck-data'), true);
if (isset($data['time']) && $data['time'] + 120 > time())
return $data;
$task = Taskmanager::submit('DownloadText', array(
- 'url' => CONFIG_REMOTE_ML . '/list.php'
+ 'url' => CONFIG_REMOTE_ML . '/list.php'
));
if (!isset($task['id']))
return false;
@@ -116,17 +123,17 @@ class Property
self::setVersionCheckInformation($data);
return $data;
}
-
+
public static function setVersionCheckInformation($value)
{
self::set('versioncheck-data', json_encode($value));
}
-
+
public static function getVmStoreConfig()
{
return json_decode(self::get('vmstore-config'), true);
}
-
+
public static function setVmStoreConfig($value)
{
self::set('vmstore-config', json_encode($value));
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index 102f7987..b7cc67cc 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -39,7 +39,7 @@ class Trigger
public static function ldadp()
{
- $res = Database::simpleQuery("SELECT moduleid, filepath FROM configtgz_module"
+ $res = Database::simpleQuery("SELECT moduleid, configtgz.filepath FROM configtgz_module"
. " INNER JOIN configtgz_x_module USING (moduleid)"
. " INNER JOIN configtgz USING (configid)"
. " WHERE moduletype = 'AD_AUTH'");
@@ -65,7 +65,7 @@ class Trigger
if (!is_array($vmstore)) return;
$storetype = $vmstore['storetype'];
if ($storetype === 'nfs') $addr = $vmstore['nfsaddr'];
- if ($storetype === 'cifs') $addr = $vmstore['nfsaddr'];
+ if ($storetype === 'cifs') $addr = $vmstore['cifsaddr'];
if ($storetype === 'internal') $addr = 'none';
$this->mountTask = Taskmanager::submit('MountVmStore', array(
'address' => $addr,
diff --git a/modules/minilinux.inc.php b/modules/minilinux.inc.php
index e2d85247..f3fb6dce 100644
--- a/modules/minilinux.inc.php
+++ b/modules/minilinux.inc.php
@@ -37,7 +37,7 @@ class Page_MiniLinux extends Page
foreach ($system['files'] as &$file) {
$file['uid'] = 'dlid' . $count++;
$local = CONFIG_HTTP_DIR . '/' . $system['id'] . '/' . $file['name'];
- if (!file_exists($local) || md5_file($local) !== substr($file['md5'], 0, 32)) {
+ if (!file_exists($local) || filesize($local) !== $file['size'] || md5_file($local) !== substr($file['md5'], 0, 32)) {
$file['changed'] = true;
}
}
@@ -83,70 +83,4 @@ class Page_MiniLinux extends Page
}
}
- private function checkFile(&$files, $name)
- {
- static $someId = 0;
- $remote = CONFIG_REMOTE_ML . "/${name}.md5";
- $localTarget = CONFIG_HTTP_DIR . "/default/${name}";
- $local = "${localTarget}.md5";
- $localLock = "${localTarget}.lck";
-
- // Maybe already in progress?
- if (file_exists($localLock)) {
- $data = explode(' ', file_get_contents($localLock));
- if (count($data) == 2) {
- $pid = (int)$data[0];
- if (posix_kill($pid, 0)) {
- $files[] = array(
- 'file' => $name,
- 'id' => 'id' . $someId++,
- 'pid' => $pid,
- 'progress' => $data[1]
- );
- return true;
- } else {
- unlink($localLock);
- }
- } else {
- unlink($localLock);
- }
- }
-
- // Not in progress, normal display
- if (!file_exists($local) || filemtime($local) + 300 < time()) {
- if (file_exists($localTarget)) {
- $existingMd5 = md5_file($localTarget);
- } else {
- $existingMd5 = '<missing>';
- }
- if (file_put_contents($local, $existingMd5) === false) {
- @unlink($local);
- Message::addWarning('error-write', $local);
- }
- } else {
- $existingMd5 = file_get_contents($local);
- }
- $existingMd5 = strtolower(preg_replace('/[^0-9a-f]/is', '', $existingMd5));
- $remoteMd5 = Util::download($remote, 3, $code);
- $remoteMd5 = strtolower(preg_replace('/[^0-9a-f]/is', '', $remoteMd5));
- if ($code != 200) {
- Message::addError('remote-timeout', $remote, $code);
- return false;
- }
- if ($existingMd5 === $remoteMd5) {
- // Up to date
- $files[] = array(
- 'file' => $name,
- 'id' => 'id' . $someId++,
- );
- return true;
- }
- // New version on server
- $files[] = array(
- 'file' => $name,
- 'id' => 'id' . $someId++,
- 'update' => true
- );
- return true;
- }
}
diff --git a/modules/serversetup.inc.php b/modules/serversetup.inc.php
index 3e98b4ad..73a1a8fc 100644
--- a/modules/serversetup.inc.php
+++ b/modules/serversetup.inc.php
@@ -15,7 +15,7 @@ class Page_ServerSetup extends Page
Message::addError('no-permission');
Util::redirect('?do=Main');
}
-
+
$this->currentMenu = Property::getBootMenu();
$action = Request::post('action');
@@ -30,7 +30,7 @@ class Page_ServerSetup extends Page
$this->getLocalAddresses();
$this->updateLocalAddress();
}
-
+
if ($action === 'ipxe') {
// iPXE stuff changes
$this->updatePxeMenu();
@@ -40,7 +40,7 @@ class Page_ServerSetup extends Page
protected function doRender()
{
Render::setTitle('Serverseitige Konfiguration');
-
+
Render::addTemplate('serversetup/ipaddress', array(
'ips' => $this->taskStatus['data']['addresses'],
'token' => Session::get('token')
@@ -48,12 +48,15 @@ class Page_ServerSetup extends Page
$data = $this->currentMenu;
$data['token'] = Session::get('token');
$data['taskid'] = Property::getIPxeTaskId();
- if ($data['defaultentry'] === 'net') $data['active-net'] = 'checked';
- if ($data['defaultentry'] === 'hdd') $data['active-hdd'] = 'checked';
- if ($data['defaultentry'] === 'custom') $data['active-custom'] = 'checked';
+ 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('serversetup/ipxe', $data);
}
-
+
// -----------------------------------------------------------------------------------------------
private function getLocalAddresses()
@@ -104,10 +107,12 @@ class Page_ServerSetup extends Page
}
Util::redirect();
}
-
+
private function updatePxeMenu()
{
$timeout = Request::post('timeout', 10);
+ if ($timeout === '')
+ $timeout = 10;
if (!is_numeric($timeout)) {
Message::addError('value-invalid', 'timeout', $timeout);
}
diff --git a/modules/sysconfig.inc.php b/modules/sysconfig.inc.php
index 06ceb618..5fc0114c 100644
--- a/modules/sysconfig.inc.php
+++ b/modules/sysconfig.inc.php
@@ -2,6 +2,45 @@
class Page_SysConfig extends Page
{
+
+ /**
+ * Holds all the known configuration modules, with title, description, start class for their wizard, etc.
+ * @var array
+ */
+ protected static $moduleTypes = array();
+
+ /**
+ * Add a known configuration module. Every addmoule_* file should call this
+ * for its module provided.
+ *
+ * @param string $id Internal identifier for the module
+ * @param string $startClass Class to start wizard for creating such a module
+ * @param string $title Title of this module type
+ * @param string $description Description for this module type
+ * @param string $group Title for group this module type belongs to
+ * @param bool $unique Can only one such module be added to a config?
+ * @param int $sortOrder Lower comes first, alphabetical ordering otherwiese
+ */
+ public static function addModule($id, $startClass, $title, $description, $group, $unique, $sortOrder = 0)
+ {
+ self::$moduleTypes[$id] = array(
+ 'startClass' => $startClass,
+ 'title' => $title,
+ 'description' => $description,
+ 'group' => $group,
+ 'unique' => $unique,
+ 'sortOrder' => $sortOrder
+ );
+ }
+
+ /**
+ *
+ * @return array All registered module types
+ */
+ public static function getModuleTypes()
+ {
+ return self::$moduleTypes;
+ }
protected function doPreprocess()
{
@@ -13,6 +52,12 @@ class Page_SysConfig extends Page
}
$action = Request::any('action', 'list');
+
+ // Load all addmodule classes, as they populate the $moduleTypes array
+ require_once 'modules/sysconfig/addmodule.inc.php';
+ foreach (glob('modules/sysconfig/addmodule_*.inc.php') as $file) {
+ require_once $file;
+ }
// Action: "addmodule" (upload new module)
if ($action === 'addmodule') {
@@ -181,10 +226,6 @@ class Page_SysConfig extends Page
{
$step = Request::any('step', 0);
if ($step === 0) $step = 'AddModule_Start';
- require_once 'modules/sysconfig/addmodule.inc.php';
- foreach (glob('modules/sysconfig/addmodule_*.inc.php') as $file) {
- require_once $file;
- }
AddModule_Base::setStep($step);
}
diff --git a/modules/sysconfig/addconfig.inc.php b/modules/sysconfig/addconfig.inc.php
index 6f076a12..96c29fea 100644
--- a/modules/sysconfig/addconfig.inc.php
+++ b/modules/sysconfig/addconfig.inc.php
@@ -8,21 +8,6 @@ abstract class AddConfig_Base
{
/**
- *
- * @var array Known module types
- */
- protected static $types = array(
- 'AD_AUTH' => array(
- 'unique' => true,
- 'group' => 'Authentifizierung'
- ),
- 'custom' => array(
- 'unique' => false,
- 'group' => 'Generisch'
- )
- );
-
- /**
* Holds the instance for the currently executing step
* @var \AddConfig_Base
*/
@@ -123,26 +108,27 @@ class AddConfig_Start extends AddConfig_Base
protected function renderInternal()
{
+ $mods = Page_SysConfig::getModuleTypes();
$res = Database::simpleQuery("SELECT moduleid, title, moduletype, filepath FROM configtgz_module"
. " ORDER BY title ASC");
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if (!isset(self::$types[$row['moduletype']])) {
- self::$types[$row['moduletype']] = array(
+ if (!isset($mods[$row['moduletype']])) {
+ $mods[$row['moduletype']] = array(
'unique' => false,
'group' => 'Undefined moduletype in addconfig.inc.php'
);
}
- if (!isset(self::$types[$row['moduletype']]['modules'])) {
- self::$types[$row['moduletype']]['modules'] = array();
- self::$types[$row['moduletype']]['groupid'] = $row['moduletype'];
+ if (!isset($mods[$row['moduletype']]['modules'])) {
+ $mods[$row['moduletype']]['modules'] = array();
+ $mods[$row['moduletype']]['groupid'] = $row['moduletype'];
}
if (empty($row['filepath']) || !file_exists($row['filepath'])) $row['missing'] = true;
- self::$types[$row['moduletype']]['modules'][] = $row;
+ $mods[$row['moduletype']]['modules'][] = $row;
}
Render::addDialog('Konfiguration zusammenstellen', false, 'sysconfig/cfg-start', array(
'token' => Session::get('token'),
'step' => 'AddConfig_Finish',
- 'groups' => array_values(self::$types)
+ 'groups' => array_values($mods)
));
}
@@ -195,7 +181,7 @@ class AddConfig_Finish extends AddConfig_Base
protected function renderInternal()
{
- if (isset($this->task['statusCode']) && $this->task['statusCode'] === TASK_WAITING) {
+ if (isset($this->task['statusCode']) && ($this->task['statusCode'] === TASK_WAITING || $this->task['statusCode'] === TASK_PROCESSING)) {
$this->task = Taskmanager::waitComplete($this->task['id']);
}
if ($this->task === false) $this->tmError();
diff --git a/modules/sysconfig/addmodule.inc.php b/modules/sysconfig/addmodule.inc.php
index 883c196f..5af43c20 100644
--- a/modules/sysconfig/addmodule.inc.php
+++ b/modules/sysconfig/addmodule.inc.php
@@ -8,27 +8,11 @@ abstract class AddModule_Base
{
/**
- * Holds all the known configuration modules, with title, description, start class for their wizard, etc.
- * @var array
- */
- protected static $moduleTypes = array();
-
- /**
* Holds the instance for the currently executing step
* @var \AddModule_Base
*/
private static $instance = false;
- public static function addModule($id, $startClass, $title, $description, $sortOrder = 0)
- {
- self::$moduleTypes[] = array(
- 'startClass' => $startClass,
- 'title' => $title,
- 'description' => $description,
- 'sortOrder' => $sortOrder
- );
- }
-
/**
*
* @param type $step
@@ -125,12 +109,13 @@ class AddModule_Start extends AddModule_Base
protected function renderInternal()
{
$title = $order = array();
- foreach (AddModule_Base::$moduleTypes as $module) {
+ $mods = Page_SysConfig::getModuleTypes();
+ foreach ($mods as $module) {
$title[] = $module['title'];
$order[] = $module['sortOrder'];
}
- array_multisort($order, SORT_ASC, $title, SORT_ASC, self::$moduleTypes);
- Render::addDialog('Modul hinzufügen', false, 'sysconfig/start', array('modules' => self::$moduleTypes));
+ array_multisort($order, SORT_ASC, $title, SORT_ASC, $mods);
+ Render::addDialog('Modul hinzufügen', false, 'sysconfig/start', array('modules' => array_values($mods)));
}
}
diff --git a/modules/sysconfig/addmodule_ad.inc.php b/modules/sysconfig/addmodule_ad.inc.php
index 459d7f2c..d533a2b8 100644
--- a/modules/sysconfig/addmodule_ad.inc.php
+++ b/modules/sysconfig/addmodule_ad.inc.php
@@ -4,9 +4,10 @@
* Wizard for setting up active directory integration for authentication.
*/
-AddModule_Base::addModule('active_directory', 'AdModule_Start', 'Active Directory Authentifizierung',
+Page_SysConfig::addModule('AD_AUTH', 'AdModule_Start', 'Active Directory Authentifizierung',
'Mit diesem Modul ist die Anmeldung an den Client PCs mit den Benutzerkonten eines Active Directory'
- . ' möglich. Je nach Konfiguration ist auch die Nutzung eines Benutzerverzeichnisses auf dem Client möglich.'
+ . ' möglich. Je nach Konfiguration ist auch die Nutzung eines Benutzerverzeichnisses auf dem Client möglich.',
+ 'Authentifizierung', true
);
class AdModule_Start extends AddModule_Base
@@ -88,8 +89,8 @@ class AdModule_Finish extends AddModule_Base
Request::post('server'),
Request::post('searchbase'),
Request::post('binddn'),
- Request::post('bindpw'),
- Request::post('home')
+ Request::post('bindpw', ''),
+ Request::post('home', '')
);
$config['proxyip'] = Property::getServerIp();
$tgz = Taskmanager::submit('CreateAdConfig', $config);
diff --git a/modules/sysconfig/addmodule_custom.inc.php b/modules/sysconfig/addmodule_custom.inc.php
index 070c1fd4..e5def1ef 100644
--- a/modules/sysconfig/addmodule_custom.inc.php
+++ b/modules/sysconfig/addmodule_custom.inc.php
@@ -6,12 +6,12 @@
* fancy is happening.
*/
-AddModule_Base::addModule('custom', 'CustomModule_UploadForm', 'Erweitertes Modul',
+Page_SysConfig::addModule('custom', 'CustomModule_UploadForm', 'Erweitertes Modul',
'Mit einem Erweiterten Modul ist es möglich, beliebige Dateien zum Grundsystem hinzuzufügen.'
. ' Nutzen Sie dieses Modul, um z.B. spezielle Konfigurationsdateien auf den Client PCs zu'
. ' verwenden, die sich nicht mit einem der anderen Wizards erstellen lässt.'
. ' Das Hinzufügen eines Erweiterten Moduls erfordert in der Regel zumindest grundlegende'
- . ' Systemkenntnisse im Linuxbereich.', 100
+ . ' Systemkenntnisse im Linuxbereich.', 'Generisch', false, 100
);
class CustomModule_UploadForm extends AddModule_Base
diff --git a/modules/vmstore.inc.php b/modules/vmstore.inc.php
index ab06b1af..a8f2ec48 100644
--- a/modules/vmstore.inc.php
+++ b/modules/vmstore.inc.php
@@ -60,13 +60,8 @@ class Page_VmStore extends Page
if ($storetype === 'nfs') $addr = $vmstore['nfsaddr'];
if ($storetype === 'cifs') $addr = $vmstore['nfsaddr'];
if ($storetype === 'internal') $addr = 'none';
- $this->mountTask = Taskmanager::submit('MountVmStore', array(
- 'address' => $addr,
- 'type' => 'images',
- 'username' => $vmstore['cifsuser'],
- 'password' => $vmstore['cifspasswd']
- ));
Property::setVmStoreConfig($vmstore);
+ $this->mountTask = Trigger::mount();
}
} \ No newline at end of file
diff --git a/script/taskmanager.js b/script/taskmanager.js
index a34b3aa4..822d1421 100644
--- a/script/taskmanager.js
+++ b/script/taskmanager.js
@@ -10,7 +10,8 @@ function tmInit()
return;
tmItems.each(function(i, item) {
item = $(item);
- if (item.find('.data-tm-icon').length !== 0) return;
+ if (item.find('.data-tm-icon').length !== 0)
+ return;
if (item.is('[data-tm-progress]')) {
item.append('<div class="data-tm-progress"><div class="progress"><div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div></div></div>');
}
@@ -38,17 +39,16 @@ function tmUpdate()
return;
$.post('api.php?do=taskmanager', {'ids[]': active, token: TOKEN}, function(data, status) {
// POST success
- tmIsRunning = tmResult(data, status)
+ tmIsRunning = tmResult(data, status);
if (tmIsRunning) {
setTimeout(tmUpdate, 1000);
}
}, 'json').fail(function(jqXHR, textStatus, errorThrown) {
// POST failure
console.log("TaskManager Error: " + textStatus + " - " + errorThrown);
- if (++tmErrors < TM_MAX_ERRORS)
+ tmIsRunning = (++tmErrors < TM_MAX_ERRORS);
+ if (tmIsRunning)
setTimeout(tmUpdate, 2000);
- else
- tmIsRunning = false;
});
}
diff --git a/templates/main-menu.html b/templates/main-menu.html
index 24ee2238..a419857c 100644
--- a/templates/main-menu.html
+++ b/templates/main-menu.html
@@ -17,9 +17,9 @@
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Einstellungen<b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Client</li>
- <li><a href="?do=MiniLinux">MiniLinux</a></li>
+ <li><a href="?do=SysConfig">Lokalisierung</a></li>
+ <li><a href="?do=MiniLinux">bwLehrpool Mini-Linux</a></li>
<li><a href="?do=BaseConfig">KonfigurationsVariablen</a></li>
- <li><a href="?do=SysConfig">SystemKonfiguration</a></li>
<li class="divider"></li>
<li class="dropdown-header">Server</li>
<li><a href="?do=ServerSetup">Grundkonfiguration</a></li>
diff --git a/templates/minilinux/filelist.html b/templates/minilinux/filelist.html
index 38b709f6..abb28aad 100644
--- a/templates/minilinux/filelist.html
+++ b/templates/minilinux/filelist.html
@@ -32,7 +32,7 @@ function slxUpdate(uid, id, name)
var msg = "Fehler beim Abruf: ";
$('#' + uid).html(msg + xhr.status + " " + xhr.statusText);
} else {
- setTimeout(tmInit, 50);
+ setTimeout(tmInit, 100);
}
});
}
diff --git a/templates/page-sysconfig-main.html b/templates/page-sysconfig-main.html
index 59cc29fb..b3606113 100644
--- a/templates/page-sysconfig-main.html
+++ b/templates/page-sysconfig-main.html
@@ -37,10 +37,15 @@
Keine Systemkonfigurationen gefunden.
<br>Erstellen Sie eine neue Konfiguration aus den unten aufgeführten Konfigurationsmodulen.
</div>
+ {{^modules}}
+ <div class="alert alert-danger">
+ Bevor Sie eine Systemkonfiguration erstellen können, müssen Sie zunächst ein Konfigurationsmodul erzeugen.
+ </div>
+ {{/modules}}
{{/configs}}
</form>
</div>
- <div class="panel-footer">
+ <div class="panel-footer">
<a class="btn btn-primary" href="?do=SysConfig&amp;action=addconfig">Neue Konfiguration</a>
</div>
</div>
diff --git a/templates/sysconfig/ad-checkconnection.html b/templates/sysconfig/ad-checkconnection.html
index 4455660c..3a2c7a42 100644
--- a/templates/sysconfig/ad-checkconnection.html
+++ b/templates/sysconfig/ad-checkconnection.html
@@ -13,6 +13,7 @@
<input name="searchbase" value="{{searchbase}}" type="hidden">
<input name="binddn" value="{{binddn}}" type="hidden">
<input name="bindpw" value="{{bindpw}}" type="hidden">
+ <input name="home" value="{{home}}" type="hidden">
<button type="submit" class="btn btn-primary">&laquo; Zurück</button>
</form>
</div>
@@ -23,6 +24,7 @@
<input name="searchbase" value="{{searchbase}}" type="hidden">
<input name="binddn" value="{{binddn}}" type="hidden">
<input name="bindpw" value="{{bindpw}}" type="hidden">
+ <input name="home" value="{{home}}" type="hidden">
<button id="nextbutton" type="submit" class="btn btn-primary">Überspringen &raquo;</button>
</form>
</div>
diff --git a/templates/sysconfig/cfg-start.html b/templates/sysconfig/cfg-start.html
index dc8f1d11..7d092337 100644
--- a/templates/sysconfig/cfg-start.html
+++ b/templates/sysconfig/cfg-start.html
@@ -26,6 +26,9 @@
{{/missing}}
</div>
{{/modules}}
+ {{^modules}}
+ <a class="btn btn-primary btn-xs" href="?do=SysConfig&amp;action=addmodule&amp;step={{startClass}}">Neu..</a>
+ {{/modules}}
</div>
</div>
{{/groups}}
diff --git a/updates/v2 b/updates/v2
deleted file mode 100644
index e67a5437..00000000
--- a/updates/v2
+++ /dev/null
@@ -1,43 +0,0 @@
-SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
-SET time_zone = "+00:00";
-
-CREATE TABLE `cat_setting` (
- `catid` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(250) NOT NULL,
- `sortval` smallint(5) unsigned NOT NULL,
- PRIMARY KEY (`catid`),
- KEY `sortval` (`sortval`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
-
-INSERT INTO `cat_setting` (`catid`, `name`, `sortval`) VALUES
-(0, 'Unkategorisiert', 20000),
-(1, 'Inaktivität und Abschaltung', 30),
-(2, 'Internetzugriff', 20),
-(3, 'Zeitsynchronisation', 100),
-(4, 'Grundsystem', 10);
-
-ALTER TABLE `setting` ADD `catid` INT( 10 ) UNSIGNED NOT NULL AFTER `setting` ;
-ALTER TABLE `setting` ADD FOREIGN KEY ( `catid` ) REFERENCES `openslx`.`cat_setting` (`catid`) ON DELETE RESTRICT ON UPDATE CASCADE ;
-
-INSERT INTO `setting` (`setting`, `catid`, `defaultvalue`, `permissions`, `validator`, `description`) VALUES
- ('SLX_LOGOUT_TIMEOUT', 1, '1800', 2, 'regex:/^\\d*$/', 'Zeit /in Sekunden/, die eine Benutzersitzung ohne Aktion sein darf, bevor sie beendet wird.\r\nFeld leer lassen, um die Funktion zu deaktivieren.'),
- ('SLX_REMOTE_LOG_SESSIONS', 0, 'anonymous', 2, 'regex:/^(yes|anonymous|no)$/', 'Legt fest, ob Logins und Logouts der Benutzer an den Satelliten gemeldet werden sollen.\r\n*yes* = Mit Benutzerkennung loggen\r\n*anonymous* = Anonym loggen\r\n*no* = Nicht loggen'),
- ('SLX_SHUTDOWN_SCHEDULE', 1, '22:10 00:00', 2, 'regex:/^(\\s*\\d{1,2}:\\d{1,2})*$/', 'Feste Uhrzeit, zu der sich die Rechner ausschalten, auch wenn noch ein Benutzer aktiv ist.\r\nMehrere Zeitpunkte können durch Leerzeichen getrennt angegeben werden.'),
- ('SLX_SHUTDOWN_TIMEOUT', 1, '1200', 2, 'regex:/^\\d*$/', 'Zeit in Sekunden, nach dem ein Rechner abgeschaltet wird, sofern kein Benutzer angemeldet ist.\r\nFeld leer lassen, um die Funktion zu deaktivieren.');
-
-UPDATE setting SET catid = 0 WHERE setting = 'SLX_ADDONS' LIMIT 1;
-UPDATE setting SET catid = 0 WHERE setting = 'SLX_REMOTE_LOG_SESSIONS' LIMIT 1;
-UPDATE setting SET catid = 1 WHERE setting = 'SLX_LOGOUT_TIMEOUT' LIMIT 1;
-UPDATE setting SET catid = 1 WHERE setting = 'SLX_SHUTDOWN_SCHEDULE' LIMIT 1;
-UPDATE setting SET catid = 1 WHERE setting = 'SLX_SHUTDOWN_TIMEOUT' LIMIT 1;
-UPDATE setting SET catid = 2 WHERE setting = 'SLX_NET_DOMAIN' LIMIT 1;
-UPDATE setting SET catid = 2 WHERE setting = 'SLX_PROXY_BLACKLIST' LIMIT 1;
-UPDATE setting SET catid = 2 WHERE setting = 'SLX_PROXY_IP' LIMIT 1;
-UPDATE setting SET catid = 2 WHERE setting = 'SLX_PROXY_MODE' LIMIT 1;
-UPDATE setting SET catid = 2 WHERE setting = 'SLX_PROXY_PORT' LIMIT 1;
-UPDATE setting SET catid = 2 WHERE setting = 'SLX_PROXY_TYPE' LIMIT 1;
-UPDATE setting SET catid = 3 WHERE setting = 'SLX_BIOS_CLOCK' LIMIT 1;
-UPDATE setting SET catid = 3 WHERE setting = 'SLX_NTP_SERVER' LIMIT 1;
-UPDATE setting SET catid = 4 WHERE setting = 'SLX_ROOT_PASS' LIMIT 1;
-UPDATE setting SET catid = 4 WHERE setting = 'SLX_VM_NFS' LIMIT 1;
-