From 94bf640ca2382815f0fd54ee54adc823a9675123 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Thu, 25 Feb 2010 21:13:52 +0000 Subject: [PATCH] Lists reset after page reload, nonformatted descriptions for edition, html cleanup. --- includes/ui/ui_lists.inc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 9d7801b0..6d24ed62 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -186,7 +186,7 @@ $opts = array( // default options $found = $value; $edit = $opts['editable'] && $contact_row['editable'] && (@$_POST[$search_box] == $value) - ? $descr : false; + ? $contact_row[1] : false; // get non-formatted description if ($edit) break; // selected field is editable - abandon list construction } @@ -228,7 +228,7 @@ $opts = array( // default options $_POST[$name] = $multi ? $selected_id : $selected_id[0]; - $selector = "\n"; @@ -344,21 +344,27 @@ $opts = array( // default options foreach($items as $value=>$descr) { $sel = ''; if (in_array((string)$value, $selected_id)) { - $sel = 'selected'; + $sel = "selected='selected'"; $found = $value; } if ($first_id === false) { $first_id = $value; - $first_opt = $descr; + $first_opt = "\n"; + } + else { + $selector .= "\n"; } - $selector .= "\n"; } + if ($first_id!==false) { + $sel = ($found===$first_id) || ($found===false && ($spec_option===false)) ? "selected='selected'" : ''; + $selector = sprintf($first_opt, $sel).$selector; + } // Prepend special option. if ($spec_option !== false) { // if special option used - add it $first_id = $spec_id; $first_opt = $spec_option; - $sel = $found===false ? 'selected' : ''; + $sel = $found===false ? "selected='selected'" : ''; $selector = "\n" . $selector; } @@ -367,7 +373,7 @@ $opts = array( // default options $selected_id = array($first_id); } $_POST[$name] = $multi ? $selected_id : $selected_id[0]; - $selector = "\n"; -- 2.30.2