From b12fb53ee2e1597f0246a961dc5ff29f8af04d47 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 19 May 2016 12:07:58 +0200 Subject: work work work work work --- config.php.example | 2 +- inc/dashboard.inc.php | 2 +- inc/dictionary.inc.php | 2 +- modules-available/adduser/config.json | 1 - modules-available/backup/config.json | 3 +- .../backup/lang/pt/template-tags.json | 1 - modules-available/baseconfig/api.inc.php | 30 +++++++++-- modules-available/baseconfig/config.json | 2 +- .../baseconfig/lang/de/template-tags.json | 3 +- .../baseconfig/lang/en/template-tags.json | 1 - .../baseconfig/lang/pt/template-tags.json | 2 - modules-available/baseconfig/page.inc.php | 1 + modules-available/baseconfig/templates/_page.html | 2 +- .../baseconfig/getconfig.inc.php | 17 +++++++ .../baseconfig_partitions_cdn/config.json | 4 +- .../lang/de/messages.json | 3 ++ .../baseconfig_partitions_cdn/lang/de/module.json | 4 ++ .../lang/de/template-tags.json | 18 +++++++ .../lang/en/messages.json | 3 ++ .../baseconfig_partitions_cdn/lang/en/module.json | 4 ++ .../lang/en/template-tags.json | 17 +++++++ .../lang/pt/template-tags.json | 16 ++++++ .../baseconfig_partitions_cdn/page.inc.php | 6 +-- .../baseconfig_partitions_cdn/templates/_page.html | 59 +++++++++++++++------- modules-available/citymanagement/config.json | 2 +- .../citymanagement/lang/pt/template-tags.json | 4 +- modules-available/dozmod/config.json | 3 +- .../dozmod/lang/de/template-tags.json | 2 - .../dozmod/lang/en/template-tags.json | 2 - modules-available/eventlog/config.json | 3 +- modules-available/imgmanagement/config.json | 2 +- modules-available/internetaccess/config.json | 3 +- modules-available/locations/config.json | 3 +- .../locations/lang/de/template-tags.json | 2 - .../locations/lang/en/template-tags.json | 2 - modules-available/main/category-icons.json | 5 +- modules-available/main/config.json | 1 - modules-available/main/lang/de/categories.json | 3 +- modules-available/main/lang/de/global-tags.json | 2 + modules-available/main/lang/en/categories.json | 11 ++-- modules-available/main/lang/en/global-tags.json | 2 + modules-available/main/lang/pt/categories.json | 5 +- modules-available/main/lang/pt/global-tags.json | 11 +++- modules-available/minilinux/config.json | 3 +- modules-available/news/config.json | 3 +- modules-available/news/lang/de/template-tags.json | 2 - modules-available/news/lang/en/template-tags.json | 2 - modules-available/news/lang/pt/template-tags.json | 1 - modules-available/serversetup-bwlp/config.json | 3 +- .../serversetup-bwlp/lang/de/template-tags.json | 1 - .../serversetup-bwlp/lang/en/template-tags.json | 2 - .../serversetup-bwlp/lang/pt/template-tags.json | 1 - modules-available/session/config.json | 1 - .../statistics/lang/de/template-tags.json | 2 - .../statistics/lang/en/template-tags.json | 2 - modules-available/support/config.json | 3 +- modules-available/sysconfig/config.json | 4 +- .../sysconfig/lang/de/template-tags.json | 6 --- .../sysconfig/lang/en/template-tags.json | 6 --- .../sysconfig/lang/pt/template-tags.json | 5 -- modules-available/sysconfignew/config.json | 2 +- modules-available/syslog/config.json | 3 +- modules-available/systemstatus/config.json | 1 - modules-available/translation/config.json | 3 +- .../translation/lang/de/template-tags.json | 9 ---- .../translation/lang/en/template-tags.json | 11 +--- modules-available/usermanagement/config.json | 1 - .../usermanagement/lang/en/template-tags.json | 3 -- .../usermanagement/lang/pt/template-tags.json | 3 -- modules-available/vmstore/config.json | 3 +- .../vmstore/lang/de/template-tags.json | 3 -- .../vmstore/lang/en/template-tags.json | 3 -- modules-available/webinterface/config.json | 3 +- .../webinterface/lang/de/template-tags.json | 1 - .../webinterface/lang/en/template-tags.json | 1 - modules-available/webinterface/page.inc.php | 1 - 76 files changed, 210 insertions(+), 159 deletions(-) create mode 100644 modules-available/baseconfig_partitions_cdn/baseconfig/getconfig.inc.php create mode 100644 modules-available/baseconfig_partitions_cdn/lang/de/messages.json create mode 100644 modules-available/baseconfig_partitions_cdn/lang/de/module.json create mode 100644 modules-available/baseconfig_partitions_cdn/lang/de/template-tags.json create mode 100644 modules-available/baseconfig_partitions_cdn/lang/en/messages.json create mode 100644 modules-available/baseconfig_partitions_cdn/lang/en/module.json create mode 100644 modules-available/baseconfig_partitions_cdn/lang/en/template-tags.json create mode 100644 modules-available/baseconfig_partitions_cdn/lang/pt/template-tags.json diff --git a/config.php.example b/config.php.example index cd05e115..6674ef61 100644 --- a/config.php.example +++ b/config.php.example @@ -27,7 +27,7 @@ define('CONFIG_VMSTORE_DIR', '/srv/openslx/nfs'); define('CONFIG_PROXY_CONF', '/opt/openslx/proxy/config'); // 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_CAT_SORT_ORDER = array('main.content' => 0, 'main.settings-client' => 1, 'main.settings-server' => 2, 'main.status' => 3, 'main.users' => 4); $MENU_SETTING_SORT_ORDER = array( 'news' => 0, 'sysconfig' => 1, 'baseconfig' => 2, 'locations' => 3, // main.content 'serversetup' => 0, 'internetaccess' => 1, 'vmstore' => 2, 'webinterface' => 3, 'backup' => 4, // main.settings diff --git a/inc/dashboard.inc.php b/inc/dashboard.inc.php index 13d713bb..e8c20dee 100644 --- a/inc/dashboard.inc.php +++ b/inc/dashboard.inc.php @@ -63,7 +63,7 @@ class Dashboard if ($category === false) { return ''; } - if (!preg_match('/^(\w+)\.(\w+)$/', $category, $out)) { + if (!preg_match('/^(\w+)\.(.*)$/', $category, $out)) { error_log('Requested category icon for invalid category "' . $category . '"'); return ''; } diff --git a/inc/dictionary.inc.php b/inc/dictionary.inc.php index 5679c52d..f5886bda 100644 --- a/inc/dictionary.inc.php +++ b/inc/dictionary.inc.php @@ -104,7 +104,7 @@ class Dictionary if ($category === false) { return 'No Category'; } - if (!preg_match('/^(\w+)\.(\w+)$/', $category, $out)) { + if (!preg_match('/^(\w+)\.(.*)$/', $category, $out)) { return 'Invalid Category ID format: ' . $category; } $string = self::translateFileModule($out[1], 'categories', $out[2]); diff --git a/modules-available/adduser/config.json b/modules-available/adduser/config.json index 4da67ef8..2c63c085 100644 --- a/modules-available/adduser/config.json +++ b/modules-available/adduser/config.json @@ -1,3 +1,2 @@ { - "enabled":"true" } diff --git a/modules-available/backup/config.json b/modules-available/backup/config.json index 6c189b63..706412d0 100644 --- a/modules-available/backup/config.json +++ b/modules-available/backup/config.json @@ -1,4 +1,3 @@ { - "category":"main.content", - "enabled":"true" + "category":"main.content" } diff --git a/modules-available/backup/lang/pt/template-tags.json b/modules-available/backup/lang/pt/template-tags.json index 79f455a5..4ec1abd1 100644 --- a/modules-available/backup/lang/pt/template-tags.json +++ b/modules-available/backup/lang/pt/template-tags.json @@ -3,7 +3,6 @@ "lang_backupDescription": "Aqui voc\u00ea pode fazer um backup completo da configura\u00e7\u00e3o deste server.", "lang_backupRestore": "Backup e Recupera\u00e7\u00e3o", "lang_download": "Baixar", - "lang_file": "Arquivo", "lang_reboot": "Reinicializar Sistema", "lang_restore": "Carregar", "lang_restoreConfig": "Recuperar Configura\u00e7\u00e3o", diff --git a/modules-available/baseconfig/api.inc.php b/modules-available/baseconfig/api.inc.php index c692a0b2..db890299 100644 --- a/modules-available/baseconfig/api.inc.php +++ b/modules-available/baseconfig/api.inc.php @@ -59,9 +59,33 @@ foreach ($defaults as $setting => $value) { $configVars[$setting] = $value; } -// Finally, output what we gathered -foreach ($configVars as $setting => $value) { - echo $setting, "='", escape($value), "'\n"; +// All done, now output + +if (Request::any('save') === 'true') { + // output AND save to disk: Generate contents + $lines = ''; + foreach ($configVars as $setting => $value) { + $lines .= $setting . "='" . escape($value) . "'\n"; + } + // Save to all the locations + $data = Property::getVersionCheckInformation(); + if (is_array($data) && isset($data['systems'])) { + foreach ($data['systems'] as $system) { + $path = CONFIG_HTTP_DIR . '/' . $system['id'] . '/config'; + if (file_put_contents($path, $lines) > 0) { + echo "# Saved config to $path\n"; + } else { + echo "# Error saving config to $path\n"; + } + } + } + // Output to browser + echo $lines; +} else { + // Only output to client + foreach ($configVars as $setting => $value) { + echo $setting, "='", escape($value), "'\n"; + } } // For quick testing or custom extensions: Include external file that should do nothing diff --git a/modules-available/baseconfig/config.json b/modules-available/baseconfig/config.json index 9ce17b0d..dd2122be 100644 --- a/modules-available/baseconfig/config.json +++ b/modules-available/baseconfig/config.json @@ -1,3 +1,3 @@ { - "category": "main.settings" + "category": "main.settings-client" } diff --git a/modules-available/baseconfig/lang/de/template-tags.json b/modules-available/baseconfig/lang/de/template-tags.json index 1c71e174..34163ca9 100644 --- a/modules-available/baseconfig/lang/de/template-tags.json +++ b/modules-available/baseconfig/lang/de/template-tags.json @@ -1,6 +1,5 @@ { "lang_basicConfiguration": "Basiskonfiguration", "lang_clientRelatedConfig": "Die Optionen auf dieser Seite beziehen sich auf das Verhalten der bwLehrpool-Clients.", - "lang_enableOverride": "\u00dcberschreiben", - "lang_reset": "Zur\u00fccksetzen" + "lang_enableOverride": "\u00dcberschreiben" } \ No newline at end of file diff --git a/modules-available/baseconfig/lang/en/template-tags.json b/modules-available/baseconfig/lang/en/template-tags.json index 84eb01d7..6adfd682 100644 --- a/modules-available/baseconfig/lang/en/template-tags.json +++ b/modules-available/baseconfig/lang/en/template-tags.json @@ -15,7 +15,6 @@ "lang_partitionMountPoint": "Mount Point", "lang_partitionOptions": "Options", "lang_partitionSize": "Size", - "lang_reset": "Reset", "lang_resetConfirm": "Do you really wish to reset the variable to their default values?", "lang_resetDefault": "Reset Default", "lang_userName": "Username", diff --git a/modules-available/baseconfig/lang/pt/template-tags.json b/modules-available/baseconfig/lang/pt/template-tags.json index 79e3e911..28b9cb76 100644 --- a/modules-available/baseconfig/lang/pt/template-tags.json +++ b/modules-available/baseconfig/lang/pt/template-tags.json @@ -4,7 +4,6 @@ "lang_catUser": "Gerenciamente de Usu\u00e1rios", "lang_confirm": "Voc\u00ea deseja salvar configura\u00e7\u00f5es em [ \/srv\/openslx\/www\/boot\/default\/config ] ?", "lang_create": "Criar", - "lang_delete": "Deletar", "lang_helpId": "Id da parti\u00e7\u00e3o", "lang_helpMountPoint": "Precisa ser um diret\u00f3rio: \/exemplo\/diret\u00f3rio\/", "lang_helpOptions": "Atualmente, apenas a op\u00e7\u00e3o 'bootable' est\u00e1 dispon\u00edvel", @@ -15,7 +14,6 @@ "lang_partitionMountPoint": "Mount Point", "lang_partitionOptions": "Op\u00e7\u00f5es", "lang_partitionSize": "Tamanho", - "lang_reset": "Limpar", "lang_resetConfirm": "Voc\u00ea realmente deseja restaurar as vari\u00e1veis para seus valores padr\u00f5es?", "lang_resetDefault": "Restaurar Padr\u00e3o", "lang_userName": "Nome", diff --git a/modules-available/baseconfig/page.inc.php b/modules-available/baseconfig/page.inc.php index 21b5459b..d14c64ac 100644 --- a/modules-available/baseconfig/page.inc.php +++ b/modules-available/baseconfig/page.inc.php @@ -157,6 +157,7 @@ class Page_BaseConfig extends Page unset($setting); array_multisort($sortvals, SORT_ASC, SORT_NUMERIC, $settings); Render::addTemplate('_page', array( + 'userid' => User::getId(), 'override' => $this->targetModule !== false, 'categories' => array_values($settings), 'target_module' => $this->targetModule, diff --git a/modules-available/baseconfig/templates/_page.html b/modules-available/baseconfig/templates/_page.html index 093cb10f..305b3cd9 100644 --- a/modules-available/baseconfig/templates/_page.html +++ b/modules-available/baseconfig/templates/_page.html @@ -63,5 +63,5 @@ - Download + Download diff --git a/modules-available/baseconfig_partitions_cdn/baseconfig/getconfig.inc.php b/modules-available/baseconfig_partitions_cdn/baseconfig/getconfig.inc.php new file mode 100644 index 00000000..6348fe71 --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/baseconfig/getconfig.inc.php @@ -0,0 +1,17 @@ +$_GET['user'])); +while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + $config .= "\n" . $row['partition_id'] . "," . $row['size']; + if(strlen($row['mount_point']) > 0) + $config .= "," . $row['mount_point']; + if(strlen($row['options']) > 0) + $config .= "," . $row['options']; +} +$config .= "\n"; + +// vm list url. doesn't really fit anywhere, seems to be a tie between here and dozmod +$configVars["SLX_PARTITION_TABLE"] = $config; +unset($config); \ No newline at end of file diff --git a/modules-available/baseconfig_partitions_cdn/config.json b/modules-available/baseconfig_partitions_cdn/config.json index a3036a56..a355eef3 100644 --- a/modules-available/baseconfig_partitions_cdn/config.json +++ b/modules-available/baseconfig_partitions_cdn/config.json @@ -1,4 +1,4 @@ { - "category": "main.settings", + "category": "main.settings-client", "dependencies": [ "baseconfig" ] -} \ No newline at end of file +} diff --git a/modules-available/baseconfig_partitions_cdn/lang/de/messages.json b/modules-available/baseconfig_partitions_cdn/lang/de/messages.json new file mode 100644 index 00000000..085214a3 --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/lang/de/messages.json @@ -0,0 +1,3 @@ +{ + "partitions-updated": "Partitionskonfiguration wurde aktualisiert" +} \ No newline at end of file diff --git a/modules-available/baseconfig_partitions_cdn/lang/de/module.json b/modules-available/baseconfig_partitions_cdn/lang/de/module.json new file mode 100644 index 00000000..7a50f349 --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/lang/de/module.json @@ -0,0 +1,4 @@ +{ + "module_name": "Partitionierung", + "page_title": "Partitionierung" +} \ No newline at end of file diff --git a/modules-available/baseconfig_partitions_cdn/lang/de/template-tags.json b/modules-available/baseconfig_partitions_cdn/lang/de/template-tags.json new file mode 100644 index 00000000..91cca0db --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/lang/de/template-tags.json @@ -0,0 +1,18 @@ +{ + "lang_addPartition": "Partition anlegen", + "lang_confirm": "Wollen Sie die Einstellungen unter \/srv\/openslx\/www\/boot\/config speichern?", + "lang_create": "Anlegen", + "lang_explanationText": "Hier k\u00f6nnen Sie bestimmen, welche Partitionen auf dem Client angelegt werden.", + "lang_helpId": "Partitions-ID", + "lang_helpMountPoint": "Muss ein Absolutes Verzeichnis im Zieldateisystem sein, z.B. \/mnt\/shares\/data", + "lang_helpOptions": "Zur Zeit ist hier nur 'bootable' erlaubt.", + "lang_helpSize": "Angabe im Format 10G um eine 10GiB-Partition zu erstellen.", + "lang_newPartition": "Neue Partition", + "lang_partitionId": "ID", + "lang_partitionManagement": "Partitionsverwaltung", + "lang_partitionMountPoint": "Mount point", + "lang_partitionOptions": "Optionen", + "lang_partitionSize": "Gr\u00f6\u00dfe", + "lang_resetConfirm": "Wollen Sie die Einstellungen wirklich auf die Standardwerte zur\u00fccksetzen?", + "lang_resetDefault": "Standardwerte laden" +} \ No newline at end of file diff --git a/modules-available/baseconfig_partitions_cdn/lang/en/messages.json b/modules-available/baseconfig_partitions_cdn/lang/en/messages.json new file mode 100644 index 00000000..55289288 --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/lang/en/messages.json @@ -0,0 +1,3 @@ +{ + "partitions-updated": "Partition configuration has been updated" +} \ No newline at end of file diff --git a/modules-available/baseconfig_partitions_cdn/lang/en/module.json b/modules-available/baseconfig_partitions_cdn/lang/en/module.json new file mode 100644 index 00000000..e3ed7ffa --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/lang/en/module.json @@ -0,0 +1,4 @@ +{ + "module_name": "Partitioning", + "page_title": "Partitioning" +} \ No newline at end of file diff --git a/modules-available/baseconfig_partitions_cdn/lang/en/template-tags.json b/modules-available/baseconfig_partitions_cdn/lang/en/template-tags.json new file mode 100644 index 00000000..819d2273 --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/lang/en/template-tags.json @@ -0,0 +1,17 @@ +{ + "lang_confirm": "Would you like to save the settings on [ \/srv\/openslx\/www\/boot\/config ] ?", + "lang_create": "Create", + "lang_explanationText": "Here you can configure what kind of partitions will be created on the client computers, and where they will be mounted", + "lang_helpId": "Partition Id", + "lang_helpMountPoint": "Must be a directory: \/example\/directory\/", + "lang_helpOptions": "Currently, only option 'bootable' is available", + "lang_helpSize": "Must be in Gigabytes e.g. 15G", + "lang_newPartition": "New Partition", + "lang_partitionId": "Id", + "lang_partitionManagement": "Partition Managment", + "lang_partitionMountPoint": "Mount Point", + "lang_partitionOptions": "Options", + "lang_partitionSize": "Size", + "lang_resetConfirm": "Do you really wish to reset the variable to their default values?", + "lang_resetDefault": "Reset Default" +} \ No newline at end of file diff --git a/modules-available/baseconfig_partitions_cdn/lang/pt/template-tags.json b/modules-available/baseconfig_partitions_cdn/lang/pt/template-tags.json new file mode 100644 index 00000000..a010e18c --- /dev/null +++ b/modules-available/baseconfig_partitions_cdn/lang/pt/template-tags.json @@ -0,0 +1,16 @@ +{ + "lang_confirm": "Voc\u00ea deseja salvar configura\u00e7\u00f5es em [ \/srv\/openslx\/www\/boot\/default\/config ] ?", + "lang_create": "Criar", + "lang_helpId": "Id da parti\u00e7\u00e3o", + "lang_helpMountPoint": "Precisa ser um diret\u00f3rio: \/exemplo\/diret\u00f3rio\/", + "lang_helpOptions": "Atualmente, apenas a op\u00e7\u00e3o 'bootable' est\u00e1 dispon\u00edvel", + "lang_helpSize": "Precisa estar em Gigabytes, por exemplo 15G", + "lang_newPartition": "Nova Parti\u00e7\u00e3o", + "lang_partitionId": "Id", + "lang_partitionManagement": "Gerenciamento de Parti\u00e7\u00f5es", + "lang_partitionMountPoint": "Mount Point", + "lang_partitionOptions": "Op\u00e7\u00f5es", + "lang_partitionSize": "Tamanho", + "lang_resetConfirm": "Voc\u00ea realmente deseja restaurar as vari\u00e1veis para seus valores padr\u00f5es?", + "lang_resetDefault": "Restaurar Padr\u00e3o" +} \ 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 index b6ea869a..a1d1445f 100644 --- a/modules-available/baseconfig_partitions_cdn/page.inc.php +++ b/modules-available/baseconfig_partitions_cdn/page.inc.php @@ -73,7 +73,7 @@ class Page_BaseConfig_Partitions_CDN extends Page Util::traceError('Could not create new partition in DB'); } } - Util::redirect('?do=BaseConfig'); + Util::redirect('?do=BaseConfig_Partitions_CDN'); } private function deletePartition($id){ @@ -86,7 +86,7 @@ class Page_BaseConfig_Partitions_CDN extends Page Util::traceError('Could not delete partition in DB'); } } - Util::redirect('?do=BaseConfig'); + Util::redirect('?do=BaseConfig_Partitions_CDN'); } private function updatePartitions(){ @@ -113,7 +113,7 @@ class Page_BaseConfig_Partitions_CDN extends Page } if (!empty($partitions)) { Message::addSuccess('partitions-updated'); - Util::redirect('?do=BaseConfig'); + Util::redirect('?do=BaseConfig_Partitions_CDN'); } } diff --git a/modules-available/baseconfig_partitions_cdn/templates/_page.html b/modules-available/baseconfig_partitions_cdn/templates/_page.html index ee764e37..f7331186 100644 --- a/modules-available/baseconfig_partitions_cdn/templates/_page.html +++ b/modules-available/baseconfig_partitions_cdn/templates/_page.html @@ -1,17 +1,53 @@ -

{{lang_partitioningManagement}}

+

{{lang_partitionManagement}}

+ +

{{lang_explanationText}}

+
+ {{#partitions}} +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ {{/partitions}} + +
Download
+
-
- - - -
+
+ + + +
@@ -53,17 +89,6 @@