2009-03-17 Esteban Sanchez <estebans@artica.es>

* include/functions_html.php: Do not add id counter if it's 0 on
        print_select. It's a backwards compatibility workaround until we 
        take a decision on correct HTML elements. Fixed comment styles, please
        do not add comments in the same line.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2009-03-17 11:19:36 +00:00
parent a1546eaf9f
commit 9433df0195
2 changed files with 25 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2009-03-17 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Do not add id counter if it's 0 on
print_select. It's a backwards compatibility workaround until we
take a decision on correct HTML elements. Fixed comment styles, please
do not add comments in the same line.
2009-03-17 Jorge Gonzalez <jorgegonz@svn.gnome.org>
* include/languages/es.po, include/languages/es.mo: Updated Spanish

View File

@ -48,7 +48,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
$idcounter[$name] = 0;
}
$id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.$idcounter[$name]);
$id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : ''));
$attributes = "";
if (!empty ($script)) {
@ -74,7 +74,6 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
if ($nothing_value == $selected) {
$output .= ' selected="selected"';
}
//You should pass a translated string already
$output .= '>'.$nothing.'</option>';
}
@ -86,9 +85,11 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
$output .= '<option value="'.$value.'"';
if (is_array ($selected) && in_array ($value, $selected)) {
$output .= ' selected="selected"';
} elseif (is_numeric ($value) && is_numeric ($selected) && $value == $selected) { //This fixes string ($value) to int ($selected) comparisons
} elseif (is_numeric ($value) && is_numeric ($selected) && $value == $selected) {
//This fixes string ($value) to int ($selected) comparisons
$output .= ' selected="selected"';
} elseif ($value === $selected) { //Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
} elseif ($value === $selected) {
//Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
$output .= ' selected="selected"';
}
if ($label === '') {
@ -191,7 +192,9 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
}
//Attributes specified by function call
$attrs = array ("name" => "unnamed", "value" => "", "id" => "text-".sprintf ('%04d', $idcounter), "size" => "", "maxlength" => "");
$attrs = array ("name" => "unnamed", "value" => "",
"id" => "text-".sprintf ('%04d', $idcounter),
"size" => "", "maxlength" => "");
foreach ($attrs as $attribute => $default) {
if (array_key_exists ($attribute, $attributes)) {