Changeset 228 for trunk/trax/vendor/trax

Show
Ignore:
Timestamp:
07/16/06 09:53:11 (6 years ago)
Author:
john
Message:

fixed some helpers made it so select boxes will get error wrapping if errors

Location:
trunk/trax/vendor/trax
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_controller.php

    r210 r228  
    11711171                $path = substr($layout, 0, strripos($layout, "/")); 
    11721172                $layout = $layouts_base_path."/".$path."/".$file.".".Trax::$views_extension; 
    1173             } else { 
     1173            } elseif(file_exists($this->layouts_path."/".$layout.".".Trax::$views_extension)) { 
    11741174                # Is there a layout for the current controller 
    11751175                $layout = $this->layouts_path."/".$layout.".".Trax::$views_extension; 
    1176             } 
    1177  
     1176            } else { 
     1177                $layout = $layouts_base_path."/".$layout.".".Trax::$views_extension; 
     1178            } 
    11781179            if(file_exists($layout)) { 
    11791180                $layout_file = $layout; 
  • trunk/trax/vendor/trax/action_view/helpers.php

    r201 r228  
    303303    function to_content_tag($tag_name, $options = array()) { 
    304304        return $this->content_tag($tag_name, $this->value(), $options); 
    305     }      
     305    }  
     306     
     307    /** 
     308     *  If this tag has an error, wrap it with a visual indicator 
     309     * 
     310     *  @param string HTML to be wrapped 
     311     *  @param boolean  true=>error, false=>no error 
     312     *  @return string 
     313     */ 
     314    function error_wrapping($html_tag, $has_error) { 
     315        return ($has_error ? '<span class="fieldWithErrors">' . $html_tag . '</span>' : $html_tag); 
     316    }          
    306317 
    307318} 
  • trunk/trax/vendor/trax/action_view/helpers/active_record_helper.php

    r218 r228  
    454454     *  @todo Document this method 
    455455     * 
    456      *  @param string  $html_tag 
    457      *  @param boolean $has_error 
    458      */ 
    459     function error_wrapping($html_tag, $has_error) { 
    460         return ($has_error ? '<span class="fieldWithErrors">' . $html_tag . '</span>' : $html_tag); 
    461     } 
    462  
    463     /** 
    464      *  @todo Document this method 
    465      * 
    466456     *  @uses attribute_name 
    467457     *  @uses object() 
  • trunk/trax/vendor/trax/action_view/helpers/asset_tag_helper.php

    r226 r228  
    4949            array_key_exists('JAVASCRIPT_DEFAULT_SOURCES',$GLOBALS) 
    5050            ? $GLOBALS['JAVASCRIPT_DEFAULT_SOURCES'] 
    51             : array('prototype', 'effects', 'dragdrop', 'controls', 'slider', 'builder');     
     51            : array('prototype', 'effects', 'controls', 'dragdrop');     
    5252    } 
    5353     
  • trunk/trax/vendor/trax/action_view/helpers/form_helper.php

    r201 r228  
    292292        $tag_text .= ">True</option>\n"; 
    293293        $tag_text .= "</select>\n"; 
    294         return $this->error_wrapping($tag_text,$this->object()->errors[$this->attribute_name]);; 
     294        return $this->error_wrapping($tag_text,$this->object()->errors[$this->attribute_name]); 
    295295    } 
    296296     
    297     /** 
    298      *  If this tag has an error, wrap it with a visual indicator 
    299      * 
    300      *  @param string HTML to be wrapped 
    301      *  @param boolean  true=>error, false=>no error 
    302      *  @return string 
    303      */ 
    304     function error_wrapping($html_tag, $has_error) { 
    305         return ($has_error 
    306                 ? '<span class="fieldWithErrors">' . $html_tag . '</span>' 
    307                 : $html_tag); 
    308     }     
    309  
    310297} 
    311298 
  • trunk/trax/vendor/trax/action_view/helpers/form_options_helper.php

    r201 r228  
    202202    function to_select_tag($choices, $options, $html_options) { 
    203203        $html_options = $this->add_default_name_and_id($html_options); 
    204         return $this->content_tag( 
    205              "select", 
    206              $this->add_options( 
    207                        $this->options_for_select($choices, $this->value()), 
    208                        $options, 
    209                        $this->value()), 
    210              $html_options); 
     204        return $this->error_wrapping( 
     205            $this->content_tag( 
     206                 "select", 
     207                 $this->add_options( 
     208                           $this->options_for_select($choices, $this->value()), 
     209                           $options, 
     210                           $this->value()), 
     211                 $html_options), 
     212             $this->object()->errors[$this->attribute_name]); 
    211213    } 
    212214     
     
    224226                                      $html_options) { 
    225227        $html_options = $this->add_default_name_and_id($html_options); 
    226         return $this->content_tag( 
    227           "select", 
    228           $this->add_options( 
    229             $this->options_from_collection_for_select($collection, 
    230                                                       $attribute_value, 
    231                                                       $attribute_text, 
    232                                                       $this->value()), 
    233             $options, 
    234             $this->value()), 
    235          $html_options); 
     228        return $this->error_wrapping( 
     229            $this->content_tag( 
     230                "select", 
     231                $this->add_options( 
     232                    $this->options_from_collection_for_select( 
     233                        $collection, 
     234                        $attribute_value, 
     235                        $attribute_text, 
     236                        $this->value()), 
     237                    $options, 
     238                    $this->value()), 
     239                $html_options), 
     240            $this->object()->errors[$this->attribute_name]); 
    236241    } 
    237242     
     
    247252                                   $options, $html_options) { 
    248253        $html_options = $this->add_default_name_and_id($html_options); 
    249         return $this->content_tag( 
     254        return $this->error_wrapping( 
     255            $this->content_tag( 
    250256                "select", 
    251257                $this->add_options( 
     
    254260                        $options, 
    255261                        $this->value), 
    256                 $html_options); 
     262                $html_options), 
     263            $this->object()->errors[$this->attribute_name]); 
    257264    } 
    258265 
  • trunk/trax/vendor/trax/action_view/helpers/form_tag_helper.php

    r199 r228  
    6464     */ 
    6565    function select_tag($name, $option_tags = null, $options = array()) { 
     66        if(is_array($option_tags)) { 
     67            $option_tags = implode('', $option_tags);     
     68        } 
    6669        return $this->content_tag("select", $option_tags, array_merge(array("name" => $name, "id" => $name), $this->convert_options($options))); 
    6770    } 
  • trunk/trax/vendor/trax/action_view/helpers/url_helper.php

    r223 r228  
    172172            $image_options["border"] = $html_options["border"]; 
    173173            unset($html_options["border"]); 
     174        } else { 
     175            $image_options["border"] = 0;         
    174176        } 
    175177