Changeset 233 for trunk

Show
Ignore:
Timestamp:
07/28/06 05:18:21 (6 years ago)
Author:
john
Message:

helper fixes

Location:
trunk/trax/vendor/trax/action_view
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_view/helpers.php

    r228 r233  
    292292        $html = "<$name "; 
    293293        $html .= $this->tag_options($options); 
     294        if($options['strip_slashes']) { 
     295            $content = stripslashes($content);     
     296        } 
    294297        $html .= ">$content</$name>"; 
    295298        return $html."\n"; 
     
    313316     */ 
    314317    function error_wrapping($html_tag, $has_error) { 
    315         return ($has_error ? '<span class="fieldWithErrors">' . $html_tag . '</span>' : $html_tag); 
     318        return ($has_error ? '<span class="fieldWithErrors">' . eregi_replace("[\n\r]", '', $html_tag) . '</span>' : $html_tag); 
    316319    }          
    317320 
  • trunk/trax/vendor/trax/action_view/helpers/form_helper.php

    r228 r233  
    269269 
    270270        $options = $this->add_default_name_and_id($options); 
    271         return $this->error_wrapping($this->tag("input", $options) . $this->tag("input", array("name" => $options["name"], "type" => "hidden", "value" => $unchecked_value)),$this->object()->errors[$this->attribute_name]); 
     271        return $this->error_wrapping($this->tag("input", array("name" => $options["name"], "type" => "hidden", "value" => $unchecked_value)) . $this->tag("input", $options),$this->object()->errors[$this->attribute_name]); 
    272272    } 
    273273 
  • trunk/trax/vendor/trax/action_view/helpers/form_options_helper.php

    r228 r233  
    110110        if(is_array($choices)) { 
    111111            foreach($choices as $choice_value => $choice_text) { 
    112                 if(!empty($choice_value)) { 
     112                if(!empty($choice_value) || is_numeric($choice_value)) { 
    113113                    $is_selected = ($choice_value == $selected) 
    114114                        ? true : false;    
     
    119119                if($is_selected) { 
    120120                    $options[] = "<option value=\"" 
    121               . htmlspecialchars($choice_value) 
    122               . "\" selected=\"selected\">" 
    123               . htmlspecialchars($choice_text)."</option>"; 
     121                    . htmlspecialchars($choice_value) 
     122                    . "\" selected=\"selected\">" 
     123                    . htmlspecialchars($choice_text)."</option>"; 
    124124                } else { 
    125125                    $options[] = "<option value=\"" 
    126               . htmlspecialchars($choice_value) 
    127               . "\">" 
    128               . htmlspecialchars($choice_text)."</option>"; 
     126                    . htmlspecialchars($choice_value) 
     127                    . "\">" 
     128                    . htmlspecialchars($choice_text)."</option>"; 
    129129                }                         
    130130            }     
     
    202202    function to_select_tag($choices, $options, $html_options) { 
    203203        $html_options = $this->add_default_name_and_id($html_options); 
     204        $value = $this->value(); 
    204205        return $this->error_wrapping( 
    205206            $this->content_tag( 
    206207                 "select", 
    207208                 $this->add_options( 
    208                            $this->options_for_select($choices, $this->value()), 
     209                           $this->options_for_select($choices, $value), 
    209210                           $options, 
    210                            $this->value()), 
     211                           $value), 
    211212                 $html_options), 
    212213             $this->object()->errors[$this->attribute_name]); 
     
    226227                                      $html_options) { 
    227228        $html_options = $this->add_default_name_and_id($html_options); 
     229        $value = $this->value(); 
    228230        return $this->error_wrapping( 
    229231            $this->content_tag( 
     
    234236                        $attribute_value, 
    235237                        $attribute_text, 
    236                         $this->value()), 
     238                        $value), 
    237239                    $options, 
    238                     $this->value()), 
     240                    $value), 
    239241                $html_options), 
    240242            $this->object()->errors[$this->attribute_name]); 
     
    252254                                   $options, $html_options) { 
    253255        $html_options = $this->add_default_name_and_id($html_options); 
     256        $value = $this->value(); 
    254257        return $this->error_wrapping( 
    255258            $this->content_tag( 
    256259                "select", 
    257260                $this->add_options( 
    258                         $this->country_options_for_select($this->value(), 
     261                        $this->country_options_for_select($value, 
    259262                                                          $priority_countries), 
    260263                        $options, 
    261                         $this->value), 
     264                        $value), 
    262265                $html_options), 
    263266            $this->object()->errors[$this->attribute_name]); 
     
    270273     *  @param string[] 
    271274     *  @param string 
    272      *  @todo <b>FIXME:</b> Why the third argument?  It's overwritten! 
    273275     *  @uses value() 
    274276     */ 
     
    278280            $option_tags = "<option value=\"\"></option>\n" . $option_tags; 
    279281        }  
    280         $value = $this->value(); 
    281282        if(empty($value) && array_key_exists('prompt', $options)) { 
    282283            $text = $options['prompt'] ? $options['prompt'] : "Please select";