From 855226d01ab20bdaaa6faeaa62b79a20d3baabfe Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Mon, 9 Feb 2015 14:49:53 +0100 Subject: [PATCH] sort distribution-names in admin_configfiles, it's confusing otherwise; display the default/recommended daemon of every service; fix small c'n'p error (courier is not our recommended default) Signed-off-by: Michael Kaufmann (d00p) --- admin_configfiles.php | 18 ++++++++++++++++-- lib/classes/config/class.ConfigDaemon.php | 9 +++++++++ lib/configfiles/precise.xml | 2 +- lib/configfiles/trusty.xml | 2 +- lib/configfiles/wheezy.xml | 2 +- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/admin_configfiles.php b/admin_configfiles.php index 4e8c0e45..5fbe3bda 100644 --- a/admin_configfiles.php +++ b/admin_configfiles.php @@ -71,7 +71,11 @@ if ($userinfo['change_serversettings'] == '1') { if ($daemon == "") { foreach ($daemons as $di => $dd) { - $daemons_select .= makeoption($dd->title, $di); + $title = $dd->title; + if ($dd->default) { + $title = $title." ".$lng['panel']['default']; + } + $daemons_select .= makeoption($title, $di); } } } else { @@ -83,14 +87,24 @@ if ($userinfo['change_serversettings'] == '1') { // show list of available distro's $distros = glob($config_dir . '*.xml'); + // tmp array + $distributions_select_data = array(); // read in all the distros foreach ($distros as $_distribution) { // get configparser object $dist = new ConfigParser($_distribution); // get distro-info $dist_display = getCompleteDistroName($dist); + // store in tmp array + $distributions_select_data[$dist_display] = str_replace(".xml", "", strtolower(basename($_distribution))); + } + + // sort by distribution name + ksort($distributions_select_data); + + foreach ($distributions_select_data as $dist_display => $dist_index) { // create select-box-option - $distributions_select .= makeoption($dist_display, str_replace(".xml", "", strtolower(basename($_distribution)))); + $distributions_select .= makeoption($dist_display, $dist_index); } } diff --git a/lib/classes/config/class.ConfigDaemon.php b/lib/classes/config/class.ConfigDaemon.php index 8049aa29..aa6e3673 100644 --- a/lib/classes/config/class.ConfigDaemon.php +++ b/lib/classes/config/class.ConfigDaemon.php @@ -66,6 +66,12 @@ class ConfigDaemon { * @var string */ public $title; + + /** + * Whether this is the default daemon of the service-category + * @var boolean + */ + public $default; public function __construct($xml, $xpath) { $this->fullxml = $xml; @@ -75,6 +81,9 @@ class ConfigDaemon { if ($attributes['title'] != '') { $this->title = $this->_parseContent((string)$attributes['title']); } + if (isset($attributes['default'])) { + $this->default = ($attributes['default'] == true); + } } /** diff --git a/lib/configfiles/precise.xml b/lib/configfiles/precise.xml index fa6aa74a..185490d9 100644 --- a/lib/configfiles/precise.xml +++ b/lib/configfiles/precise.xml @@ -954,7 +954,7 @@ iterate_query = SELECT username AS user FROM mail_users WHERE (imap = 1 OR pop3 - + diff --git a/lib/configfiles/trusty.xml b/lib/configfiles/trusty.xml index 443d9307..dcf06260 100644 --- a/lib/configfiles/trusty.xml +++ b/lib/configfiles/trusty.xml @@ -932,7 +932,7 @@ iterate_query = SELECT username AS user FROM mail_users WHERE (imap = 1 OR pop3 - + diff --git a/lib/configfiles/wheezy.xml b/lib/configfiles/wheezy.xml index a9539b9c..7eb9edf4 100644 --- a/lib/configfiles/wheezy.xml +++ b/lib/configfiles/wheezy.xml @@ -3745,7 +3745,7 @@ plugin { - +