From b4d6ea7c8c6007705ffbdee90f01dc48169604a4 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 13 Aug 2005 11:31:26 +0000 Subject: [PATCH] added new option in meta HTML code to not sort select lists --- lam/docs/devel/modules-specification.htm | 3 +++ lam/lib/modules.inc | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lam/docs/devel/modules-specification.htm b/lam/docs/devel/modules-specification.htm index 315056dc..0a8e0f39 100644 --- a/lam/docs/devel/modules-specification.htm +++ b/lam/docs/devel/modules-specification.htm @@ -907,6 +907,9 @@ of string. This is the list of pre selected elements, must contain values that are also in options.
  • size: The size of the select field, if set to 1 a dropdown box will be displayed.
  • +
  • noSorting: If set to +true then the entries will not be sorted. Default is false.
    +
  • table: Adds a table. Can be used recursively.
  • diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index ba84de0f..91209a97 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -635,8 +635,10 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex // merge both option arrays and sort them. $options = array_merge ($input[$i][$j]['options'], $input[$i][$j]['options_selected'] ); $options = array_unique($options); - if (get_preg($options[0], 'digit')) sort($options, SORT_NUMERIC); - else sort($options, SORT_STRING); + if (!$input[$i][$j]['noSorting']) { + if (get_preg($options[0], 'digit')) sort($options, SORT_NUMERIC); + else sort($options, SORT_STRING); + } foreach ($options as $option) { if ($option!='') { if (in_array($option, $input[$i][$j]['options_selected'])) echo "\n"; @@ -998,7 +1000,7 @@ class accountContainer { } $return[] = array( 0 => array('kind' => 'text', 'text' => _('Suffix')), - 1 => array('kind' => 'select', 'name' => 'suffix', 'options' => $suffixes, 'options_selected' => array($options_selected)), + 1 => array('kind' => 'select', 'name' => 'suffix', 'options' => $suffixes, 'options_selected' => array($options_selected), 'noSorting' => true), 2 => array ('kind' => 'help', 'value' => 'suffix')); // RDN selection $rdnlist = getRDNAttributes($this->type); @@ -1011,7 +1013,7 @@ class accountContainer { } $return[] = array( 0 => array('kind' => 'text', 'text' => _('RDN identifier')), - 1 => array('kind' => 'select', 'name' => 'rdn', 'options' => $rdnlist, 'options_selected' => $rdnSelected), + 1 => array('kind' => 'select', 'name' => 'rdn', 'options' => $rdnlist, 'options_selected' => $rdnSelected, 'noSorting' => true), 2 => array ('kind' => 'help', 'value' => '301')); // Get list of profiles